SBCommandReturnObject.h revision 6b1596d81c34c6efb10ed51a3572d6b145b73f5b
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#ifndef SWIG
28    const lldb::SBCommandReturnObject &
29    operator = (const lldb::SBCommandReturnObject &rhs);
30#endif
31
32    ~SBCommandReturnObject ();
33
34    bool
35    IsValid() const;
36
37    const char *
38    GetOutput ();
39
40    const char *
41    GetError ();
42
43    size_t
44    PutOutput (FILE *fh);
45
46    size_t
47    GetOutputSize ();
48
49    size_t
50    GetErrorSize ();
51
52    size_t
53    PutError (FILE *fh);
54
55    void
56    Clear();
57
58    lldb::ReturnStatus
59    GetStatus();
60
61    bool
62    Succeeded ();
63
64    bool
65    HasResult ();
66
67    void
68    AppendMessage (const char *message);
69
70    bool
71    GetDescription (lldb::SBStream &description);
72
73    void
74    SetImmediateOutputFile (FILE *fh);
75
76    void
77    SetImmediateErrorFile (FILE *fh);
78
79    void
80    PutCString(const char* string, int len = -1);
81
82    size_t
83    Printf(const char* format, ...);
84
85protected:
86    friend class SBCommandInterpreter;
87    friend class SBOptions;
88
89
90#ifndef SWIG
91
92    lldb_private::CommandReturnObject *
93    operator->() const;
94
95    lldb_private::CommandReturnObject *
96    get() const;
97
98    lldb_private::CommandReturnObject &
99    operator*() const;
100
101    lldb_private::CommandReturnObject &
102    ref() const;
103
104#endif
105    void
106    SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
107
108 private:
109    std::auto_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
110};
111
112} // namespace lldb
113
114#endif        // LLDB_SBCommandReturnObject_h_
115