1 //===-- OptionValueSInt64.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/Interpreter/OptionValueSInt64.h"
14 // Other libraries and framework includes
16 #include "lldb/Core/Stream.h"
17 #include "lldb/Interpreter/Args.h"
20 using namespace lldb_private;
23 OptionValueSInt64::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
25 //printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %" PRIi64 "\n", this, exe_ctx, m_current_value);
26 if (dump_mask & eDumpOptionType)
27 strm.Printf ("(%s)", GetTypeAsCString ());
28 // if (dump_mask & eDumpOptionName)
29 // DumpQualifiedName (strm);
30 if (dump_mask & eDumpOptionValue)
32 if (dump_mask & eDumpOptionType)
33 strm.PutCString (" = ");
34 strm.Printf ("%" PRIi64, m_current_value);
39 OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
41 //printf ("%p: SetValueFromCString (s=\"%s\", op=%i)\n", this, value_cstr, op);
45 case eVarSetOperationClear:
49 case eVarSetOperationReplace:
50 case eVarSetOperationAssign:
53 int64_t value = Args::StringToSInt64 (value_cstr, 0, 0, &success);
56 if (value >= m_min_value && value <= m_max_value)
58 m_value_was_set = true;
59 m_current_value = value;
62 error.SetErrorStringWithFormat ("%" PRIi64 " is out of range, valid values must be between %" PRIi64 " and %" PRIi64 ".",
69 error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
74 case eVarSetOperationInsertBefore:
75 case eVarSetOperationInsertAfter:
76 case eVarSetOperationRemove:
77 case eVarSetOperationAppend:
78 case eVarSetOperationInvalid:
79 error = OptionValue::SetValueFromCString (value_cstr, op);
86 OptionValueSInt64::DeepCopy () const
88 return OptionValueSP(new OptionValueSInt64(*this));