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