]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBStream.h
MFV r337210: 9577 remove zfs_dbuf_evict_key tsd
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBStream.h
1 //===-- SBStream.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_SBStream_h_
11 #define LLDB_SBStream_h_
12
13 #include <stdio.h>
14
15 #include "lldb/API/SBDefines.h"
16
17 namespace lldb {
18
19 class LLDB_API SBStream {
20 public:
21   SBStream();
22
23   SBStream(SBStream &&rhs);
24
25   ~SBStream();
26
27   bool IsValid() const;
28
29   // If this stream is not redirected to a file, it will maintain a local
30   // cache for the stream data which can be accessed using this accessor.
31   const char *GetData();
32
33   // If this stream is not redirected to a file, it will maintain a local
34   // cache for the stream output whose length can be accessed using this
35   // accessor.
36   size_t GetSize();
37
38   void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
39
40   void RedirectToFile(const char *path, bool append);
41
42   void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
43
44   void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
45
46   // If the stream is redirected to a file, forget about the file and if
47   // ownership of the file was transferred to this object, close the file.
48   // If the stream is backed by a local cache, clear this cache.
49   void Clear();
50
51 protected:
52   friend class SBAddress;
53   friend class SBBlock;
54   friend class SBBreakpoint;
55   friend class SBBreakpointLocation;
56   friend class SBBreakpointName;
57   friend class SBCommandReturnObject;
58   friend class SBCompileUnit;
59   friend class SBData;
60   friend class SBDebugger;
61   friend class SBDeclaration;
62   friend class SBEvent;
63   friend class SBFileSpec;
64   friend class SBFileSpecList;
65   friend class SBFrame;
66   friend class SBFunction;
67   friend class SBInstruction;
68   friend class SBInstructionList;
69   friend class SBLineEntry;
70   friend class SBMemoryRegionInfo;
71   friend class SBModule;
72   friend class SBModuleSpec;
73   friend class SBModuleSpecList;
74   friend class SBProcess;
75   friend class SBSection;
76   friend class SBSourceManager;
77   friend class SBStructuredData;
78   friend class SBSymbol;
79   friend class SBSymbolContext;
80   friend class SBSymbolContextList;
81   friend class SBTarget;
82   friend class SBThread;
83   friend class SBThreadPlan;
84   friend class SBType;
85   friend class SBTypeEnumMember;
86   friend class SBTypeMemberFunction;
87   friend class SBTypeMember;
88   friend class SBValue;
89   friend class SBWatchpoint;
90
91   lldb_private::Stream *operator->();
92
93   lldb_private::Stream *get();
94
95   lldb_private::Stream &ref();
96
97 private:
98   DISALLOW_COPY_AND_ASSIGN(SBStream);
99   std::unique_ptr<lldb_private::Stream> m_opaque_ap;
100   bool m_is_file;
101 };
102
103 } // namespace lldb
104
105 #endif // LLDB_SBStream_h_