LLDB  mainline
SBCommandReturnObject.h
Go to the documentation of this file.
1 //===-- SBCommandReturnObject.h ---------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SBCommandReturnObject_h_
10 #define LLDB_SBCommandReturnObject_h_
11 
12 #include <stdio.h>
13 
14 #include <memory>
15 
16 #include "lldb/API/SBDefines.h"
17 
18 namespace lldb {
19 
21 public:
23 
25 
27 
29  operator=(const lldb::SBCommandReturnObject &rhs);
30 
32 
34 
35  explicit operator bool() const;
36 
37  bool IsValid() const;
38 
39  const char *GetOutput();
40 
41  const char *GetError();
42 
43  size_t PutOutput(FILE *fh);
44 
45  size_t GetOutputSize();
46 
47  size_t GetErrorSize();
48 
49  size_t PutError(FILE *fh);
50 
51  void Clear();
52 
53  lldb::ReturnStatus GetStatus();
54 
55  void SetStatus(lldb::ReturnStatus status);
56 
57  bool Succeeded();
58 
59  bool HasResult();
60 
61  void AppendMessage(const char *message);
62 
63  void AppendWarning(const char *message);
64 
65  bool GetDescription(lldb::SBStream &description);
66 
67  // deprecated, these two functions do not take ownership of file handle
68  void SetImmediateOutputFile(FILE *fh);
69 
70  void SetImmediateErrorFile(FILE *fh);
71 
72  void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
73 
74  void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
75 
76  void PutCString(const char *string, int len = -1);
77 
78  size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
79 
80  const char *GetOutput(bool only_if_no_immediate);
81 
82  const char *GetError(bool only_if_no_immediate);
83 
84  void SetError(lldb::SBError &error,
85  const char *fallback_error_cstr = nullptr);
86 
87  void SetError(const char *error_cstr);
88 
89 protected:
90  friend class SBCommandInterpreter;
91  friend class SBOptions;
92 
93  lldb_private::CommandReturnObject *operator->() const;
94 
96 
98 
100 
101  void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
102 
103 private:
104  std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
105 };
106 
107 } // namespace lldb
108 
109 #endif // LLDB_SBCommandReturnObject_h_
const Scalar operator*(const Scalar &lhs, const Scalar &rhs)
Definition: Scalar.cpp:2161
class LLDB_API SBCommandReturnObject
Definition: SBDefines.h:33
#define LLDB_API
Definition: lldb-defines.h:23
Definition: SBAddress.h:15