]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBCommandReturnObject.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBCommandReturnObject.h
1 //===-- SBCommandReturnObject.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_SBCommandReturnObject_h_
11 #define LLDB_SBCommandReturnObject_h_
12
13 // C Includes
14 #include <stdio.h>
15
16 // C++ Includes
17 #include <memory>
18
19 // Other libraries and framework includes
20 // Project includes
21 #include "lldb/API/SBDefines.h"
22
23 namespace lldb {
24
25 class LLDB_API SBCommandReturnObject {
26 public:
27   SBCommandReturnObject();
28
29   SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
30
31   ~SBCommandReturnObject();
32
33   const lldb::SBCommandReturnObject &
34   operator=(const lldb::SBCommandReturnObject &rhs);
35
36   SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
37
38   lldb_private::CommandReturnObject *Release();
39
40   bool IsValid() const;
41
42   const char *GetOutput();
43
44   const char *GetError();
45
46   size_t PutOutput(FILE *fh);
47
48   size_t GetOutputSize();
49
50   size_t GetErrorSize();
51
52   size_t PutError(FILE *fh);
53
54   void Clear();
55
56   lldb::ReturnStatus GetStatus();
57
58   void SetStatus(lldb::ReturnStatus status);
59
60   bool Succeeded();
61
62   bool HasResult();
63
64   void AppendMessage(const char *message);
65
66   void AppendWarning(const char *message);
67
68   bool GetDescription(lldb::SBStream &description);
69
70   // deprecated, these two functions do not take ownership of file handle
71   void SetImmediateOutputFile(FILE *fh);
72
73   void SetImmediateErrorFile(FILE *fh);
74
75   void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
76
77   void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
78
79   void PutCString(const char *string, int len = -1);
80
81   size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
82
83   const char *GetOutput(bool only_if_no_immediate);
84
85   const char *GetError(bool only_if_no_immediate);
86
87   void SetError(lldb::SBError &error,
88                 const char *fallback_error_cstr = nullptr);
89
90   void SetError(const char *error_cstr);
91
92 protected:
93   friend class SBCommandInterpreter;
94   friend class SBOptions;
95
96   lldb_private::CommandReturnObject *operator->() const;
97
98   lldb_private::CommandReturnObject *get() const;
99
100   lldb_private::CommandReturnObject &operator*() const;
101
102   lldb_private::CommandReturnObject &ref() const;
103
104   void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
105
106 private:
107   std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
108 };
109
110 } // namespace lldb
111
112 #endif // LLDB_SBCommandReturnObject_h_