1 //===-- SWIG Interface for SBCommandReturnObject ----------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
12 "Represents a container which holds the result from command execution.
13 It works with SBCommandInterpreter.HandleCommand() to encapsulate the result
16 See SBCommandInterpreter for example usage of SBCommandReturnObject."
17 ) SBCommandReturnObject;
18 class SBCommandReturnObject
22 SBCommandReturnObject ();
24 SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
26 ~SBCommandReturnObject ();
31 explicit operator bool() const;
46 GetOutput (bool only_if_no_immediate);
49 GetError (bool if_no_immediate);
52 PutOutput (lldb::SBFile file);
55 PutError (lldb::SBFile file);
58 PutOutput (lldb::FileSP BORROWED);
61 PutError (lldb::FileSP BORROWED);
67 SetStatus (lldb::ReturnStatus status);
70 SetError (lldb::SBError &error,
71 const char *fallback_error_cstr = NULL);
74 SetError (const char *error_cstr);
86 AppendMessage (const char *message);
89 AppendWarning (const char *message);
92 GetDescription (lldb::SBStream &description);
94 void SetImmediateOutputFile(lldb::SBFile file);
95 void SetImmediateErrorFile(lldb::SBFile file);
96 void SetImmediateOutputFile(lldb::FileSP BORROWED);
97 void SetImmediateErrorFile(lldb::FileSP BORROWED);
99 STRING_EXTENSION(SBCommandReturnObject)
102 // transfer_ownership does nothing, and is here for compatibility with
103 // old scripts. Ownership is tracked by reference count in the ordinary way.
105 void SetImmediateOutputFile(lldb::FileSP BORROWED, bool transfer_ownership) {
106 self->SetImmediateOutputFile(BORROWED);
108 void SetImmediateErrorFile(lldb::FileSP BORROWED, bool transfer_ownership) {
109 self->SetImmediateErrorFile(BORROWED);
114 PutCString(const char* string, int len);
116 // wrapping the variadic Printf() with a plain Print()
117 // because it is hard to support varargs in SWIG bridgings
119 void Print (const char* str)
121 self->Printf("%s", str);