OptionValueFileSpec.h revision c6e82e4a323d7a7168b05365c53c9bc2e0d418e3
1//===-- OptionValueFileSpec.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_OptionValueFileSpec_h_ 11#define liblldb_OptionValueFileSpec_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/Host/FileSpec.h" 18#include "lldb/Interpreter/OptionValue.h" 19 20namespace lldb_private { 21 22class OptionValueFileSpec : public OptionValue 23{ 24public: 25 OptionValueFileSpec () : 26 OptionValue(), 27 m_current_value (), 28 m_default_value (), 29 m_data_sp() 30 { 31 } 32 33 OptionValueFileSpec (const FileSpec &value) : 34 OptionValue(), 35 m_current_value (value), 36 m_default_value (value), 37 m_data_sp() 38 { 39 } 40 41 OptionValueFileSpec (const FileSpec ¤t_value, 42 const FileSpec &default_value) : 43 OptionValue(), 44 m_current_value (current_value), 45 m_default_value (default_value), 46 m_data_sp() 47 { 48 } 49 50 virtual 51 ~OptionValueFileSpec() 52 { 53 } 54 55 //--------------------------------------------------------------------- 56 // Virtual subclass pure virtual overrides 57 //--------------------------------------------------------------------- 58 59 virtual OptionValue::Type 60 GetType () const 61 { 62 return eTypeFileSpec; 63 } 64 65 virtual void 66 DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); 67 68 virtual Error 69 SetValueFromCString (const char *value, 70 VarSetOperationType op = eVarSetOperationAssign); 71 72 virtual bool 73 Clear () 74 { 75 m_current_value = m_default_value; 76 m_value_was_set = false; 77 m_data_sp.reset(); 78 return true; 79 } 80 81 virtual lldb::OptionValueSP 82 DeepCopy () const; 83 84 virtual size_t 85 AutoComplete (CommandInterpreter &interpreter, 86 const char *s, 87 int match_start_point, 88 int max_return_elements, 89 bool &word_complete, 90 StringList &matches); 91 92 //--------------------------------------------------------------------- 93 // Subclass specific functions 94 //--------------------------------------------------------------------- 95 96 FileSpec & 97 GetCurrentValue() 98 { 99 return m_current_value; 100 } 101 102 const FileSpec & 103 GetCurrentValue() const 104 { 105 return m_current_value; 106 } 107 108 const FileSpec & 109 GetDefaultValue() const 110 { 111 return m_default_value; 112 } 113 114 void 115 SetCurrentValue (const FileSpec &value, bool set_value_was_set) 116 { 117 m_current_value = value; 118 if (set_value_was_set) 119 m_value_was_set = true; 120 m_data_sp.reset(); 121 } 122 123 void 124 SetDefaultValue (const FileSpec &value) 125 { 126 m_default_value = value; 127 } 128 129 const lldb::DataBufferSP & 130 GetFileContents(); 131 132protected: 133 FileSpec m_current_value; 134 FileSpec m_default_value; 135 lldb::DataBufferSP m_data_sp; 136}; 137 138} // namespace lldb_private 139 140#endif // liblldb_OptionValueFileSpec_h_ 141