SBError.h revision 81a96aa6242f7b559770f5dc62316253cb8cb0d4
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 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 67protected: 68 69 friend class SBData; 70 friend class SBDebugger; 71 friend class SBCommunication; 72 friend class SBHostOS; 73 friend class SBInputReader; 74 friend class SBProcess; 75 friend class SBThread; 76 friend class SBTarget; 77 friend class SBValue; 78 friend class SBWatchpoint; 79 80 lldb_private::Error * 81 get(); 82 83 lldb_private::Error * 84 operator->(); 85 86 const lldb_private::Error & 87 operator*() const; 88 89 lldb_private::Error & 90 ref(); 91 92 void 93 SetError (const lldb_private::Error &lldb_error); 94 95private: 96 STD_UNIQUE_PTR(lldb_private::Error) m_opaque_ap; 97 98 void 99 CreateIfNeeded (); 100}; 101 102 103} // namespace lldb 104 105#endif // LLDB_SBError_h_ 106