SBError.h revision 7826c8894803dc729f29789ebc038956a94d3e7a
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 15namespace lldb { 16 17class SBError { 18public: 19 SBError (); 20 21 SBError (const SBError &rhs); 22 23 ~SBError(); 24 25#ifndef SWIG 26 27 const SBError & 28 operator =(const SBError &rhs); 29 30#endif 31 32 const char * 33 GetCString () const; 34 35 void 36 Clear (); 37 38 bool 39 Fail () const; 40 41 bool 42 Success () const; 43 44 uint32_t 45 GetError () const; 46 47 lldb::ErrorType 48 GetType () const; 49 50 void 51 SetError (uint32_t err, lldb::ErrorType type); 52 53 void 54 SetErrorToErrno (); 55 56 void 57 SetErrorToGenericError (); 58 59 void 60 SetErrorString (const char *err_str); 61 62 int 63 SetErrorStringWithFormat (const char *format, ...); 64 65 bool 66 IsValid () const; 67 68 bool 69 GetDescription (lldb::SBStream &description); 70 71 bool 72 GetDescription (lldb::SBStream &description) const; 73 74protected: 75 friend class SBArguments; 76 friend class SBDebugger; 77 friend class SBCommunication; 78 friend class SBHostOS; 79 friend class SBInputReader; 80 friend class SBProcess; 81 friend class SBTarget; 82 friend class SBValue; 83 84#ifndef SWIG 85 86 lldb_private::Error * 87 get(); 88 89 lldb_private::Error * 90 operator->(); 91 92 const lldb_private::Error & 93 operator*() const; 94 95#endif 96 97 98 void 99 SetError (const lldb_private::Error &lldb_error); 100 101private: 102 std::auto_ptr<lldb_private::Error> m_opaque_ap; 103 104 void 105 CreateIfNeeded (); 106}; 107 108 109} // namespace lldb 110 111#endif // LLDB_SBError_h_ 112