1 //===-- OptionValueFormat.h -------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_OptionValueFormat_h_ 11 #define liblldb_OptionValueFormat_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/Interpreter/OptionValue.h" 18 19 namespace lldb_private { 20 21 class OptionValueFormat : public OptionValue 22 { 23 public: OptionValueFormat(lldb::Format value)24 OptionValueFormat (lldb::Format value) : 25 OptionValue(), 26 m_current_value (value), 27 m_default_value (value) 28 { 29 } 30 OptionValueFormat(lldb::Format current_value,lldb::Format default_value)31 OptionValueFormat (lldb::Format current_value, 32 lldb::Format default_value) : 33 OptionValue(), 34 m_current_value (current_value), 35 m_default_value (default_value) 36 { 37 } 38 39 virtual ~OptionValueFormat()40 ~OptionValueFormat() 41 { 42 } 43 44 //--------------------------------------------------------------------- 45 // Virtual subclass pure virtual overrides 46 //--------------------------------------------------------------------- 47 48 virtual OptionValue::Type GetType()49 GetType () const 50 { 51 return eTypeFormat; 52 } 53 54 virtual void 55 DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); 56 57 virtual Error 58 SetValueFromCString (const char *value, 59 VarSetOperationType op = eVarSetOperationAssign); 60 61 virtual bool Clear()62 Clear () 63 { 64 m_current_value = m_default_value; 65 m_value_was_set = false; 66 return true; 67 } 68 69 virtual lldb::OptionValueSP 70 DeepCopy () const; 71 72 //--------------------------------------------------------------------- 73 // Subclass specific functions 74 //--------------------------------------------------------------------- 75 76 lldb::Format GetCurrentValue()77 GetCurrentValue() const 78 { 79 return m_current_value; 80 } 81 82 lldb::Format GetDefaultValue()83 GetDefaultValue() const 84 { 85 return m_default_value; 86 } 87 88 void SetCurrentValue(lldb::Format value)89 SetCurrentValue (lldb::Format value) 90 { 91 m_current_value = value; 92 } 93 94 void SetDefaultValue(lldb::Format value)95 SetDefaultValue (lldb::Format value) 96 { 97 m_default_value = value; 98 } 99 100 protected: 101 lldb::Format m_current_value; 102 lldb::Format m_default_value; 103 }; 104 105 } // namespace lldb_private 106 107 #endif // liblldb_OptionValueFormat_h_ 108