1 //===-- SBStream.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBStream_h_
11 #define LLDB_SBStream_h_
15 #include "lldb/API/SBDefines.h"
19 class LLDB_API SBStream {
23 SBStream(SBStream &&rhs);
29 // If this stream is not redirected to a file, it will maintain a local cache
30 // for the stream data which can be accessed using this accessor.
31 const char *GetData();
33 // If this stream is not redirected to a file, it will maintain a local cache
34 // for the stream output whose length can be accessed using this accessor.
37 void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
39 void RedirectToFile(const char *path, bool append);
41 void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
43 void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
45 // If the stream is redirected to a file, forget about the file and if
46 // ownership of the file was transferred to this object, close the file. If
47 // the stream is backed by a local cache, clear this cache.
51 friend class SBAddress;
53 friend class SBBreakpoint;
54 friend class SBBreakpointLocation;
55 friend class SBBreakpointName;
56 friend class SBCommandReturnObject;
57 friend class SBCompileUnit;
59 friend class SBDebugger;
60 friend class SBDeclaration;
62 friend class SBFileSpec;
63 friend class SBFileSpecList;
65 friend class SBFunction;
66 friend class SBInstruction;
67 friend class SBInstructionList;
68 friend class SBLineEntry;
69 friend class SBMemoryRegionInfo;
70 friend class SBModule;
71 friend class SBModuleSpec;
72 friend class SBModuleSpecList;
73 friend class SBProcess;
74 friend class SBSection;
75 friend class SBSourceManager;
76 friend class SBStructuredData;
77 friend class SBSymbol;
78 friend class SBSymbolContext;
79 friend class SBSymbolContextList;
80 friend class SBTarget;
81 friend class SBThread;
82 friend class SBThreadPlan;
84 friend class SBTypeEnumMember;
85 friend class SBTypeMemberFunction;
86 friend class SBTypeMember;
88 friend class SBWatchpoint;
90 lldb_private::Stream *operator->();
92 lldb_private::Stream *get();
94 lldb_private::Stream &ref();
97 DISALLOW_COPY_AND_ASSIGN(SBStream);
98 std::unique_ptr<lldb_private::Stream> m_opaque_ap;
104 #endif // LLDB_SBStream_h_