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