Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:51

0001 //===-- Property.h ----------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_PROPERTY_H
0010 #define LLDB_INTERPRETER_PROPERTY_H
0011 
0012 #include "lldb/Interpreter/OptionValue.h"
0013 #include "lldb/Utility/Flags.h"
0014 #include "lldb/lldb-defines.h"
0015 #include "lldb/lldb-private-types.h"
0016 
0017 #include <string>
0018 
0019 namespace lldb_private {
0020 
0021 // A structure that can be used to create a global table for all properties.
0022 // Property class instances can be constructed using one of these.
0023 struct PropertyDefinition {
0024   const char *name;
0025   OptionValue::Type type;
0026   bool global; // false == this setting is a global setting by default
0027   uintptr_t default_uint_value;
0028   const char *default_cstr_value;
0029   OptionEnumValues enum_values;
0030   const char *description;
0031 };
0032 
0033 using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
0034 
0035 class Property {
0036 public:
0037   Property(const PropertyDefinition &definition);
0038 
0039   Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
0040            const lldb::OptionValueSP &value_sp);
0041 
0042   llvm::StringRef GetName() const { return m_name; }
0043   llvm::StringRef GetDescription() const { return m_description; }
0044 
0045   const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
0046 
0047   void SetOptionValue(const lldb::OptionValueSP &value_sp) {
0048     m_value_sp = value_sp;
0049   }
0050 
0051   bool IsValid() const { return (bool)m_value_sp; }
0052 
0053   bool IsGlobal() const { return m_is_global; }
0054 
0055   void Dump(const ExecutionContext *exe_ctx, Stream &strm,
0056             uint32_t dump_mask) const;
0057 
0058   bool DumpQualifiedName(Stream &strm) const;
0059 
0060   void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
0061                        uint32_t output_width,
0062                        bool display_qualified_name) const;
0063 
0064   void SetValueChangedCallback(std::function<void()> callback);
0065 
0066 protected:
0067   std::string m_name;
0068   std::string m_description;
0069   lldb::OptionValueSP m_value_sp;
0070   bool m_is_global;
0071 };
0072 
0073 } // namespace lldb_private
0074 
0075 #endif // LLDB_INTERPRETER_PROPERTY_H