1 //===-- Property.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_Property_h_ 11 #define liblldb_Property_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <string> 16 17 // Other libraries and framework includes 18 // Project includes 19 #include "lldb/lldb-defines.h" 20 #include "lldb/Core/ConstString.h" 21 #include "lldb/Core/Flags.h" 22 #include "lldb/Interpreter/OptionValue.h" 23 24 namespace lldb_private { 25 26 // A structure that can be used to create a global table for all properties. 27 // Property class instances can be constructed using one of these. 28 struct PropertyDefinition 29 { 30 const char *name; 31 OptionValue::Type type; 32 bool global; 33 uintptr_t default_uint_value; 34 const char *default_cstr_value; 35 OptionEnumValueElement *enum_values; 36 const char *description; 37 }; 38 39 class Property 40 { 41 public: 42 Property (const PropertyDefinition &definition); 43 44 Property (const ConstString &name, 45 const ConstString &desc, 46 bool is_global, 47 const lldb::OptionValueSP &value_sp); 48 49 const ConstString & 50 GetName() const 51 { 52 return m_name; 53 } 54 55 const char * 56 GetDescription () const 57 { 58 return m_description.GetCString(); 59 } 60 61 const lldb::OptionValueSP & 62 GetValue() const 63 { 64 return m_value_sp; 65 } 66 67 void 68 SetOptionValue (const lldb::OptionValueSP &value_sp) 69 { 70 m_value_sp = value_sp; 71 } 72 73 74 bool 75 IsValid() const 76 { 77 return (bool)m_value_sp; 78 } 79 80 bool 81 IsGlobal () const 82 { 83 return m_is_global; 84 } 85 86 void 87 Dump (const ExecutionContext *exe_ctx, 88 Stream &strm, 89 uint32_t dump_mask) const; 90 91 bool 92 DumpQualifiedName(Stream &strm) const; 93 94 void 95 DumpDescription (CommandInterpreter &interpreter, 96 Stream &strm, 97 uint32_t output_width, 98 bool display_qualified_name) const; 99 100 protected: 101 ConstString m_name; 102 ConstString m_description; 103 lldb::OptionValueSP m_value_sp; 104 bool m_is_global; 105 }; 106 107 } // namespace lldb_private 108 109 #endif // liblldb_Property_h_ 110