1 //===-- OptionValueFormat.cpp -----------------------------------*- 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 #include "lldb/lldb-python.h"
12 #include "lldb/Interpreter/OptionValueFormat.h"
16 // Other libraries and framework includes
18 #include "lldb/Core/Stream.h"
19 #include "lldb/DataFormatters/FormatManager.h"
20 #include "lldb/Interpreter/Args.h"
23 using namespace lldb_private;
26 OptionValueFormat::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
28 if (dump_mask & eDumpOptionType)
29 strm.Printf ("(%s)", GetTypeAsCString ());
30 if (dump_mask & eDumpOptionValue)
32 if (dump_mask & eDumpOptionType)
33 strm.PutCString (" = ");
34 strm.PutCString (FormatManager::GetFormatAsCString (m_current_value));
39 OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
44 case eVarSetOperationClear:
49 case eVarSetOperationReplace:
50 case eVarSetOperationAssign:
53 error = Args::StringToFormat (value_cstr, new_format, nullptr);
56 m_value_was_set = true;
57 m_current_value = new_format;
63 case eVarSetOperationInsertBefore:
64 case eVarSetOperationInsertAfter:
65 case eVarSetOperationRemove:
66 case eVarSetOperationAppend:
67 case eVarSetOperationInvalid:
68 error = OptionValue::SetValueFromCString (value_cstr, op);
76 OptionValueFormat::DeepCopy () const
78 return OptionValueSP(new OptionValueFormat(*this));