1 //===-- StringPrinter.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 liblldb_StringPrinter_h_
11 #define liblldb_StringPrinter_h_
13 #include "lldb/lldb-forward.h"
15 #include "lldb/Core/DataExtractor.h"
17 namespace lldb_private {
21 enum class StringElementType {
28 class ReadStringAndDumpToStreamOptions
32 ReadStringAndDumpToStreamOptions () :
39 m_needs_zero_termination(true),
40 m_escape_non_printables(true),
41 m_ignore_max_length(false)
45 ReadStringAndDumpToStreamOptions (ValueObject& valobj);
47 ReadStringAndDumpToStreamOptions&
48 SetLocation (uint64_t l)
60 ReadStringAndDumpToStreamOptions&
61 SetProcessSP (lldb::ProcessSP p)
73 ReadStringAndDumpToStreamOptions&
86 ReadStringAndDumpToStreamOptions&
87 SetPrefixToken (char p)
94 GetPrefixToken () const
96 return m_prefix_token;
99 ReadStringAndDumpToStreamOptions&
112 ReadStringAndDumpToStreamOptions&
113 SetSourceSize (uint32_t s)
120 GetSourceSize () const
122 return m_source_size;
125 ReadStringAndDumpToStreamOptions&
126 SetNeedsZeroTermination (bool z)
128 m_needs_zero_termination = z;
133 GetNeedsZeroTermination () const
135 return m_needs_zero_termination;
138 ReadStringAndDumpToStreamOptions&
139 SetEscapeNonPrintables (bool e)
141 m_escape_non_printables = e;
146 GetEscapeNonPrintables () const
148 return m_escape_non_printables;
151 ReadStringAndDumpToStreamOptions&
152 SetIgnoreMaxLength (bool e)
154 m_ignore_max_length = e;
159 GetIgnoreMaxLength () const
161 return m_ignore_max_length;
166 lldb::ProcessSP m_process_sp;
170 uint32_t m_source_size;
171 bool m_needs_zero_termination;
172 bool m_escape_non_printables;
173 bool m_ignore_max_length;
176 class ReadBufferAndDumpToStreamOptions
180 ReadBufferAndDumpToStreamOptions () :
186 m_escape_non_printables(true)
190 ReadBufferAndDumpToStreamOptions (ValueObject& valobj);
192 ReadBufferAndDumpToStreamOptions&
193 SetData (DataExtractor d)
199 lldb_private::DataExtractor
205 ReadBufferAndDumpToStreamOptions&
206 SetStream (Stream* s)
218 ReadBufferAndDumpToStreamOptions&
219 SetPrefixToken (char p)
226 GetPrefixToken () const
228 return m_prefix_token;
231 ReadBufferAndDumpToStreamOptions&
244 ReadBufferAndDumpToStreamOptions&
245 SetSourceSize (uint32_t s)
252 GetSourceSize () const
254 return m_source_size;
257 ReadBufferAndDumpToStreamOptions&
258 SetEscapeNonPrintables (bool e)
260 m_escape_non_printables = e;
265 GetEscapeNonPrintables () const
267 return m_escape_non_printables;
271 DataExtractor m_data;
275 uint32_t m_source_size;
276 bool m_escape_non_printables;
279 template <StringElementType element_type>
281 ReadStringAndDumpToStream (ReadStringAndDumpToStreamOptions options);
283 template <StringElementType element_type>
285 ReadBufferAndDumpToStream (ReadBufferAndDumpToStreamOptions options);
287 } // namespace formatters
288 } // namespace lldb_private
290 #endif // liblldb_StringPrinter_h_