SBCommandReturnObject.h revision c2bc7944f7c2f10114426f447259a35acb0b1e18
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 101 size_t 102 GetErrorSize (bool only_if_no_immediate); 103 104 size_t 105 GetOutputSize (bool only_if_no_immediate); 106 107protected: 108 friend class SBCommandInterpreter; 109 friend class SBOptions; 110 111 lldb_private::CommandReturnObject * 112 operator->() const; 113 114 lldb_private::CommandReturnObject * 115 get() const; 116 117 lldb_private::CommandReturnObject & 118 operator*() const; 119 120 lldb_private::CommandReturnObject & 121 ref() const; 122 123 void 124 SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr); 125 126 private: 127 std::auto_ptr<lldb_private::CommandReturnObject> m_opaque_ap; 128}; 129 130} // namespace lldb 131 132#endif // LLDB_SBCommandReturnObject_h_ 133