1 //===-- SBError.h -----------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLDB_SBError_h_ 11 #define LLDB_SBError_h_ 12 13 #include "lldb/API/SBDefines.h" 14 15 namespace lldb { 16 17 class SBError { 18 public: 19 SBError (); 20 21 SBError (const lldb::SBError &rhs); 22 23 ~SBError(); 24 25 const SBError & 26 operator =(const lldb::SBError &rhs); 27 28 const char * 29 GetCString () const; 30 31 void 32 Clear (); 33 34 bool 35 Fail () const; 36 37 bool 38 Success () const; 39 40 uint32_t 41 GetError () const; 42 43 lldb::ErrorType 44 GetType () const; 45 46 void 47 SetError (uint32_t err, lldb::ErrorType type); 48 49 void 50 SetErrorToErrno (); 51 52 void 53 SetErrorToGenericError (); 54 55 void 56 SetErrorString (const char *err_str); 57 58 int 59 SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3))); 60 61 bool 62 IsValid () const; 63 64 bool 65 GetDescription (lldb::SBStream &description); 66 67 protected: 68 69 friend class SBCommandReturnObject; 70 friend class SBData; 71 friend class SBDebugger; 72 friend class SBCommunication; 73 friend class SBHostOS; 74 friend class SBInputReader; 75 friend class SBProcess; 76 friend class SBThread; 77 friend class SBTarget; 78 friend class SBValue; 79 friend class SBWatchpoint; 80 81 lldb_private::Error * 82 get(); 83 84 lldb_private::Error * 85 operator->(); 86 87 const lldb_private::Error & 88 operator*() const; 89 90 lldb_private::Error & 91 ref(); 92 93 void 94 SetError (const lldb_private::Error &lldb_error); 95 96 private: 97 std::unique_ptr<lldb_private::Error> m_opaque_ap; 98 99 void 100 CreateIfNeeded (); 101 }; 102 103 104 } // namespace lldb 105 106 #endif // LLDB_SBError_h_ 107