LLDB API Documentation

SBCommandReturnObject.h
Go to the documentation of this file.
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:
28 
30 
32 
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
71  // ownership of file handle
72  void SetImmediateOutputFile(FILE *fh);
73 
74  void SetImmediateErrorFile(FILE *fh);
75 
76  void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
77 
78  void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
79 
80  void PutCString(const char *string, int len = -1);
81 
82  size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
83 
84  const char *GetOutput(bool only_if_no_immediate);
85 
86  const char *GetError(bool only_if_no_immediate);
87 
88  void SetError(lldb::SBError &error,
89  const char *fallback_error_cstr = nullptr);
90 
91  void SetError(const char *error_cstr);
92 
93 protected:
94  friend class SBCommandInterpreter;
95  friend class SBOptions;
96 
97  lldb_private::CommandReturnObject *operator->() const;
98 
99  lldb_private::CommandReturnObject *get() const;
100 
101  lldb_private::CommandReturnObject &operator*() const;
102 
103  lldb_private::CommandReturnObject &ref() const;
104 
105  void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
106 
107 private:
108  std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
109 };
110 
111 } // namespace lldb
112 
113 #endif // LLDB_SBCommandReturnObject_h_
class LLDB_API SBCommandReturnObject
Definition: SBDefines.h:40