1254721Semaste//===-- Property.h ----------------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef liblldb_Property_h_ 11254721Semaste#define liblldb_Property_h_ 12254721Semaste 13254721Semaste// C Includes 14254721Semaste// C++ Includes 15254721Semaste#include <string> 16254721Semaste 17254721Semaste// Other libraries and framework includes 18254721Semaste// Project includes 19254721Semaste#include "lldb/lldb-defines.h" 20254721Semaste#include "lldb/Core/ConstString.h" 21254721Semaste#include "lldb/Core/Flags.h" 22254721Semaste#include "lldb/Interpreter/OptionValue.h" 23254721Semaste 24254721Semastenamespace lldb_private { 25254721Semaste 26254721Semaste // A structure that can be used to create a global table for all properties. 27254721Semaste // Property class instances can be constructed using one of these. 28254721Semaste struct PropertyDefinition 29254721Semaste { 30254721Semaste const char *name; 31254721Semaste OptionValue::Type type; 32254721Semaste bool global; 33254721Semaste uintptr_t default_uint_value; 34254721Semaste const char *default_cstr_value; 35254721Semaste OptionEnumValueElement *enum_values; 36254721Semaste const char *description; 37254721Semaste }; 38254721Semaste 39254721Semaste class Property 40254721Semaste { 41254721Semaste public: 42254721Semaste Property (const PropertyDefinition &definition); 43254721Semaste 44254721Semaste Property (const ConstString &name, 45254721Semaste const ConstString &desc, 46254721Semaste bool is_global, 47254721Semaste const lldb::OptionValueSP &value_sp); 48254721Semaste 49254721Semaste const ConstString & 50254721Semaste GetName() const 51254721Semaste { 52254721Semaste return m_name; 53254721Semaste } 54254721Semaste 55254721Semaste const char * 56254721Semaste GetDescription () const 57254721Semaste { 58254721Semaste return m_description.GetCString(); 59254721Semaste } 60254721Semaste 61254721Semaste const lldb::OptionValueSP & 62254721Semaste GetValue() const 63254721Semaste { 64254721Semaste return m_value_sp; 65254721Semaste } 66254721Semaste 67254721Semaste void 68254721Semaste SetOptionValue (const lldb::OptionValueSP &value_sp) 69254721Semaste { 70254721Semaste m_value_sp = value_sp; 71254721Semaste } 72254721Semaste 73254721Semaste 74254721Semaste bool 75254721Semaste IsValid() const 76254721Semaste { 77254721Semaste return (bool)m_value_sp; 78254721Semaste } 79254721Semaste 80254721Semaste bool 81254721Semaste IsGlobal () const 82254721Semaste { 83254721Semaste return m_is_global; 84254721Semaste } 85254721Semaste 86254721Semaste void 87254721Semaste Dump (const ExecutionContext *exe_ctx, 88254721Semaste Stream &strm, 89254721Semaste uint32_t dump_mask) const; 90254721Semaste 91254721Semaste bool 92254721Semaste DumpQualifiedName(Stream &strm) const; 93254721Semaste 94254721Semaste void 95254721Semaste DumpDescription (CommandInterpreter &interpreter, 96254721Semaste Stream &strm, 97254721Semaste uint32_t output_width, 98254721Semaste bool display_qualified_name) const; 99254721Semaste 100254721Semaste protected: 101254721Semaste ConstString m_name; 102254721Semaste ConstString m_description; 103254721Semaste lldb::OptionValueSP m_value_sp; 104254721Semaste bool m_is_global; 105254721Semaste }; 106254721Semaste 107254721Semaste} // namespace lldb_private 108254721Semaste 109254721Semaste#endif // liblldb_Property_h_ 110