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 27 OptionValueFileSpec (const FileSpec &value); 28 29 OptionValueFileSpec (const FileSpec ¤t_value, 30 const FileSpec &default_value); 31 32 virtual 33 ~OptionValueFileSpec() 34 { 35 } 36 37 //--------------------------------------------------------------------- 38 // Virtual subclass pure virtual overrides 39 //--------------------------------------------------------------------- 40 41 virtual OptionValue::Type 42 GetType () const 43 { 44 return eTypeFileSpec; 45 } 46 47 virtual void 48 DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); 49 50 virtual Error 51 SetValueFromCString (const char *value, 52 VarSetOperationType op = eVarSetOperationAssign); 53 54 virtual bool 55 Clear () 56 { 57 m_current_value = m_default_value; 58 m_value_was_set = false; 59 m_data_sp.reset(); 60 return true; 61 } 62 63 virtual lldb::OptionValueSP 64 DeepCopy () const; 65 66 virtual size_t 67 AutoComplete (CommandInterpreter &interpreter, 68 const char *s, 69 int match_start_point, 70 int max_return_elements, 71 bool &word_complete, 72 StringList &matches); 73 74 //--------------------------------------------------------------------- 75 // Subclass specific functions 76 //--------------------------------------------------------------------- 77 78 FileSpec & 79 GetCurrentValue() 80 { 81 return m_current_value; 82 } 83 84 const FileSpec & 85 GetCurrentValue() const 86 { 87 return m_current_value; 88 } 89 90 const FileSpec & 91 GetDefaultValue() const 92 { 93 return m_default_value; 94 } 95 96 void 97 SetCurrentValue (const FileSpec &value, bool set_value_was_set) 98 { 99 m_current_value = value; 100 if (set_value_was_set) 101 m_value_was_set = true; 102 m_data_sp.reset(); 103 } 104 105 void 106 SetDefaultValue (const FileSpec &value) 107 { 108 m_default_value = value; 109 } 110 111 const lldb::DataBufferSP & 112 GetFileContents(bool null_terminate); 113 114 void 115 SetCompletionMask (uint32_t mask) 116 { 117 m_completion_mask = mask; 118 } 119 120protected: 121 FileSpec m_current_value; 122 FileSpec m_default_value; 123 lldb::DataBufferSP m_data_sp; 124 uint32_t m_completion_mask; 125}; 126 127} // namespace lldb_private 128 129#endif // liblldb_OptionValueFileSpec_h_ 130