SBError.h revision 98f930f429160f9777f626c3ac6aa609f4e965d2
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 // The following function gets called by Python when a user tries to print 72 // an object of this class. It takes no arguments and returns a 73 // PyObject * representing a char * (and it must be named "__repr__"); 74 75 PyObject * 76 __repr__ (); 77 78protected: 79 friend class SBArguments; 80 friend class SBDebugger; 81 friend class SBCommunication; 82 friend class SBHostOS; 83 friend class SBInputReader; 84 friend class SBProcess; 85 86#ifndef SWIG 87 88 lldb_private::Error * 89 get(); 90 91 lldb_private::Error * 92 operator->(); 93 94 const lldb_private::Error & 95 operator*() const; 96 97#endif 98 99 100 void 101 SetError (const lldb_private::Error &lldb_error); 102 103private: 104 std::auto_ptr<lldb_private::Error> m_opaque_ap; 105 106 void 107 CreateIfNeeded (); 108}; 109 110 111} // namespace lldb 112 113#endif // LLDB_SBError_h_ 114