1 //====-- UserSettingsController.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_UserSettingsController_h_ 11 #define liblldb_UserSettingsController_h_ 12 13 #include "lldb/Utility/Status.h" 14 #include "lldb/lldb-forward.h" 15 #include "lldb/lldb-private-enumerations.h" 16 17 #include "llvm/ADT/StringRef.h" 18 19 #include <vector> 20 21 #include <stddef.h> 22 #include <stdint.h> 23 24 namespace lldb_private { 25 class CommandInterpreter; 26 } 27 namespace lldb_private { 28 class ConstString; 29 } 30 namespace lldb_private { 31 class ExecutionContext; 32 } 33 namespace lldb_private { 34 class Property; 35 } 36 namespace lldb_private { 37 class Stream; 38 } 39 40 namespace lldb_private { 41 42 class Properties { 43 public: Properties()44 Properties() : m_collection_sp() {} 45 Properties(const lldb::OptionValuePropertiesSP & collection_sp)46 Properties(const lldb::OptionValuePropertiesSP &collection_sp) 47 : m_collection_sp(collection_sp) {} 48 ~Properties()49 virtual ~Properties() {} 50 GetValueProperties()51 virtual lldb::OptionValuePropertiesSP GetValueProperties() const { 52 // This function is virtual in case subclasses want to lazily implement 53 // creating the properties. 54 return m_collection_sp; 55 } 56 57 virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, 58 llvm::StringRef property_path, 59 bool will_modify, 60 Status &error) const; 61 62 virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, 63 VarSetOperationType op, 64 llvm::StringRef property_path, 65 llvm::StringRef value); 66 67 virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, 68 Stream &strm, llvm::StringRef property_path, 69 uint32_t dump_mask); 70 71 virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, 72 Stream &strm, uint32_t dump_mask); 73 74 virtual void DumpAllDescriptions(CommandInterpreter &interpreter, 75 Stream &strm) const; 76 77 size_t Apropos(llvm::StringRef keyword, 78 std::vector<const Property *> &matching_properties) const; 79 80 lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx, 81 const ConstString &name); 82 83 // We sometimes need to introduce a setting to enable experimental features, 84 // but then we don't want the setting for these to cause errors when the 85 // setting goes away. Add a sub-topic of the settings using this 86 // experimental name, and two things will happen. One is that settings that 87 // don't find the name will not be treated as errors. Also, if you decide to 88 // keep the settings just move them into the containing properties, and we 89 // will auto-forward the experimental settings to the real one. 90 static const char *GetExperimentalSettingsName(); 91 92 static bool IsSettingExperimental(llvm::StringRef setting); 93 94 protected: 95 lldb::OptionValuePropertiesSP m_collection_sp; 96 }; 97 98 } // namespace lldb_private 99 100 #endif // liblldb_UserSettingsController_h_ 101