SBCommandReturnObject.h revision 26bc105b1882a78de609d46d148ad2b5c4d50656
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#include <stdio.h>
14
15#include "lldb/API/SBDefines.h"
16
17namespace lldb {
18
19class SBCommandReturnObject
20{
21public:
22
23    SBCommandReturnObject ();
24
25    SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
26
27    const lldb::SBCommandReturnObject &
28    operator = (const lldb::SBCommandReturnObject &rhs);
29
30
31    SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
32
33    lldb_private::CommandReturnObject *
34    Release ();
35
36    ~SBCommandReturnObject ();
37
38    bool
39    IsValid() const;
40
41    const char *
42    GetOutput ();
43
44    const char *
45    GetError ();
46
47    size_t
48    PutOutput (FILE *fh);
49
50    size_t
51    GetOutputSize ();
52
53    size_t
54    GetErrorSize ();
55
56    size_t
57    PutError (FILE *fh);
58
59    void
60    Clear();
61
62    lldb::ReturnStatus
63    GetStatus();
64
65    void
66    SetStatus (lldb::ReturnStatus status);
67
68    bool
69    Succeeded ();
70
71    bool
72    HasResult ();
73
74    void
75    AppendMessage (const char *message);
76
77    void
78    AppendWarning (const char *message);
79
80    bool
81    GetDescription (lldb::SBStream &description);
82
83    void
84    SetImmediateOutputFile (FILE *fh);
85
86    void
87    SetImmediateErrorFile (FILE *fh);
88
89    void
90    PutCString(const char* string, int len = -1);
91
92    size_t
93    Printf(const char* format, ...)  __attribute__ ((format (printf, 2, 3)));
94
95    const char *
96    GetOutput (bool only_if_no_immediate);
97
98    const char *
99    GetError (bool only_if_no_immediate);
100
101protected:
102    friend class SBCommandInterpreter;
103    friend class SBOptions;
104
105    lldb_private::CommandReturnObject *
106    operator->() const;
107
108    lldb_private::CommandReturnObject *
109    get() const;
110
111    lldb_private::CommandReturnObject &
112    operator*() const;
113
114    lldb_private::CommandReturnObject &
115    ref() const;
116
117    void
118    SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
119
120 private:
121    std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
122};
123
124} // namespace lldb
125
126#endif        // LLDB_SBCommandReturnObject_h_
127