LLDB  mainline
OptionValueFormat.cpp
Go to the documentation of this file.
1 //===-- OptionValueFormat.cpp -----------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
13 #include "lldb/Utility/Stream.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
19  uint32_t dump_mask) {
20  if (dump_mask & eDumpOptionType)
21  strm.Printf("(%s)", GetTypeAsCString());
22  if (dump_mask & eDumpOptionValue) {
23  if (dump_mask & eDumpOptionType)
24  strm.PutCString(" = ");
25  strm.PutCString(FormatManager::GetFormatAsCString(m_current_value));
26  }
27 }
28 
29 Status OptionValueFormat::SetValueFromString(llvm::StringRef value,
31  Status error;
32  switch (op) {
34  Clear();
35  NotifyValueChanged();
36  break;
37 
40  Format new_format;
41  error = OptionArgParser::ToFormat(value.str().c_str(), new_format, nullptr);
42  if (error.Success()) {
43  m_value_was_set = true;
44  m_current_value = new_format;
45  NotifyValueChanged();
46  }
47  } break;
48 
54  error = OptionValue::SetValueFromString(value, op);
55  break;
56  }
57  return error;
58 }
59 
60 lldb::OptionValueSP OptionValueFormat::DeepCopy() const {
61  return OptionValueSP(new OptionValueFormat(*this));
62 }
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:61
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
VarSetOperationType
Settable state variable types.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:106
bool Success() const
Test for success condition.
Definition: Status.cpp:287
Definition: SBAddress.h:15
static bool DumpValue(Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const FormatEntity::Entry &entry, ValueObject *valobj)
An error handling class.
Definition: Status.h:44