1115013Smarcel//===-- Property.h ----------------------------------------------*- C++ -*-===// 2160157Smarcel// 3121642Smarcel// The LLVM Compiler Infrastructure 4121642Smarcel// 5121642Smarcel// This file is distributed under the University of Illinois Open Source 6121642Smarcel// License. See LICENSE.TXT for details. 7121642Smarcel// 8121642Smarcel//===----------------------------------------------------------------------===// 9121642Smarcel 10121642Smarcel#ifndef liblldb_Property_h_ 11115013Smarcel#define liblldb_Property_h_ 12121642Smarcel 13121642Smarcel// C Includes 14121642Smarcel// C++ Includes 15121642Smarcel#include <string> 16121642Smarcel 17121642Smarcel// Other libraries and framework includes 18121642Smarcel// Project includes 19121642Smarcel#include "lldb/lldb-defines.h" 20121642Smarcel#include "lldb/Core/ConstString.h" 21121642Smarcel#include "lldb/Core/Flags.h" 22121642Smarcel#include "lldb/Interpreter/OptionValue.h" 23121642Smarcel 24121642Smarcelnamespace lldb_private { 25129059Smarcel 26129059Smarcel // A structure that can be used to create a global table for all properties. 27129059Smarcel // Property class instances can be constructed using one of these. 28115013Smarcel struct PropertyDefinition 29129059Smarcel { 30129059Smarcel const char *name; 31129059Smarcel OptionValue::Type type; 32129059Smarcel bool global; 33129059Smarcel uintptr_t default_uint_value; 34129059Smarcel const char *default_cstr_value; 35129059Smarcel OptionEnumValueElement *enum_values; 36129059Smarcel const char *description; 37129059Smarcel }; 38115013Smarcel 39115013Smarcel class Property 40115013Smarcel { 41115013Smarcel public: 42129059Smarcel Property (const PropertyDefinition &definition); 43115013Smarcel 44129059Smarcel Property (const ConstString &name, 45115013Smarcel const ConstString &desc, 46129059Smarcel bool is_global, 47115013Smarcel const lldb::OptionValueSP &value_sp); 48129059Smarcel 49115013Smarcel const ConstString & 50115013Smarcel GetName() const 51115013Smarcel { 52115013Smarcel return m_name; 53129059Smarcel } 54115013Smarcel 55115013Smarcel const char * 56115013Smarcel GetDescription () const 57129059Smarcel { 58115013Smarcel return m_description.GetCString(); 59115013Smarcel } 60115013Smarcel 61115013Smarcel const lldb::OptionValueSP & 62115013Smarcel GetValue() const 63115013Smarcel { 64129059Smarcel return m_value_sp; 65115013Smarcel } 66115013Smarcel 67115013Smarcel void 68115013Smarcel SetOptionValue (const lldb::OptionValueSP &value_sp) 69115013Smarcel { 70115013Smarcel m_value_sp = value_sp; 71129059Smarcel } 72129059Smarcel 73129059Smarcel 74129059Smarcel bool 75129059Smarcel IsValid() const 76129059Smarcel { 77129059Smarcel return (bool)m_value_sp; 78129059Smarcel } 79129059Smarcel 80129059Smarcel bool 81129059Smarcel IsGlobal () const 82129059Smarcel { 83129059Smarcel return m_is_global; 84129059Smarcel } 85129059Smarcel 86129059Smarcel void 87129059Smarcel Dump (const ExecutionContext *exe_ctx, 88129059Smarcel Stream &strm, 89129059Smarcel uint32_t dump_mask) const; 90129059Smarcel 91129059Smarcel bool 92129059Smarcel DumpQualifiedName(Stream &strm) const; 93129059Smarcel 94129059Smarcel void 95129059Smarcel DumpDescription (CommandInterpreter &interpreter, 96129059Smarcel Stream &strm, 97129059Smarcel uint32_t output_width, 98129059Smarcel bool display_qualified_name) const; 99129059Smarcel 100129059Smarcel protected: 101129059Smarcel ConstString m_name; 102129059Smarcel ConstString m_description; 103129059Smarcel lldb::OptionValueSP m_value_sp; 104129059Smarcel bool m_is_global; 105129059Smarcel }; 106129059Smarcel 107129059Smarcel} // namespace lldb_private 108129059Smarcel 109129059Smarcel#endif // liblldb_Property_h_ 110129059Smarcel