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