1 //===-- ScriptedMetadata.h ------------------------------------ -*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_INTERPRETER_SCRIPTEDMETADATA_H 10 #define LLDB_INTERPRETER_SCRIPTEDMETADATA_H 11 12 #include "OptionGroupPythonClassWithDict.h" 13 14 #include "lldb/Host/Host.h" 15 #include "lldb/Host/ProcessLaunchInfo.h" 16 #include "lldb/Utility/StructuredData.h" 17 18 namespace lldb_private { 19 class ScriptedMetadata { 20 public: ScriptedMetadata(llvm::StringRef class_name,StructuredData::DictionarySP dict_sp)21 ScriptedMetadata(llvm::StringRef class_name, 22 StructuredData::DictionarySP dict_sp) 23 : m_class_name(class_name.data()), m_args_sp(dict_sp) {} 24 ScriptedMetadata(const ProcessLaunchInfo & launch_info)25 ScriptedMetadata(const ProcessLaunchInfo &launch_info) { 26 m_class_name = launch_info.GetScriptedProcessClassName(); 27 m_args_sp = launch_info.GetScriptedProcessDictionarySP(); 28 } 29 ScriptedMetadata(const OptionGroupPythonClassWithDict & option_group)30 ScriptedMetadata(const OptionGroupPythonClassWithDict &option_group) { 31 auto opt_group = const_cast<OptionGroupPythonClassWithDict &>(option_group); 32 m_class_name = opt_group.GetName(); 33 m_args_sp = opt_group.GetStructuredData(); 34 } 35 GetClassName()36 llvm::StringRef GetClassName() const { return m_class_name; } GetArgsSP()37 StructuredData::DictionarySP GetArgsSP() const { return m_args_sp; } 38 39 private: 40 std::string m_class_name; 41 StructuredData::DictionarySP m_args_sp; 42 }; 43 } // namespace lldb_private 44 45 #endif // LLDB_INTERPRETER_SCRIPTEDMETADATA_H 46