]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - scripts/interface/SBCommandReturnObject.i
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / scripts / interface / SBCommandReturnObject.i
1 //===-- SWIG Interface for SBCommandReturnObject ----------------*- 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 namespace lldb {
11
12 %feature("docstring",
13 "Represents a container which holds the result from command execution.
14 It works with SBCommandInterpreter.HandleCommand() to encapsulate the result
15 of command execution.
16
17 See SBCommandInterpreter for example usage of SBCommandReturnObject."
18 ) SBCommandReturnObject;
19 class SBCommandReturnObject
20 {
21 public:
22
23     SBCommandReturnObject ();
24
25     SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
26
27     ~SBCommandReturnObject ();
28
29     bool
30     IsValid() const;
31
32     const char *
33     GetOutput ();
34
35     const char *
36     GetError ();
37
38     size_t
39     GetOutputSize ();
40
41     size_t
42     GetErrorSize ();
43
44     const char *
45     GetOutput (bool only_if_no_immediate);
46     
47     const char *
48     GetError (bool if_no_immediate);
49     
50     size_t
51     PutOutput (FILE *fh);
52     
53     size_t
54     PutError (FILE *fh);
55
56     void
57     Clear();
58
59     void
60     SetStatus (lldb::ReturnStatus status);
61     
62     void
63     SetError (lldb::SBError &error,
64               const char *fallback_error_cstr = NULL);
65     
66     void
67     SetError (const char *error_cstr);
68
69     lldb::ReturnStatus
70     GetStatus();
71
72     bool
73     Succeeded ();
74
75     bool
76     HasResult ();
77
78     void
79     AppendMessage (const char *message);
80
81     void
82     AppendWarning (const char *message);
83
84     bool
85     GetDescription (lldb::SBStream &description);
86     
87
88     // wrapping here so that lldb takes ownership of the 
89     // new FILE* created inside of the swig interface
90     %extend {
91         void SetImmediateOutputFile(FILE *fh) {
92             self->SetImmediateOutputFile(fh, true);
93         }
94         void SetImmediateErrorFile(FILE *fh) {
95             self->SetImmediateErrorFile(fh, true);
96         }
97     }
98
99         void
100         PutCString(const char* string, int len);
101
102     // wrapping the variadic Printf() with a plain Print()
103     // because it is hard to support varargs in SWIG bridgings
104     %extend {
105         void Print (const char* str)
106         {
107             self->Printf("%s", str);
108         }
109     }
110
111 };
112
113 } // namespace lldb