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:
48 case eVarSetOperationReplace:
49 case eVarSetOperationAssign:
52 error = Args::StringToFormat (value_cstr, new_format, NULL);
55 m_value_was_set = true;
56 m_current_value = new_format;
61 case eVarSetOperationInsertBefore:
62 case eVarSetOperationInsertAfter:
63 case eVarSetOperationRemove:
64 case eVarSetOperationAppend:
65 case eVarSetOperationInvalid:
66 error = OptionValue::SetValueFromCString (value_cstr, op);
74 OptionValueFormat::DeepCopy () const
76 return OptionValueSP(new OptionValueFormat(*this));