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 "lldb/Utility/ProcessInfo.h" 13 #include "lldb/Utility/StructuredData.h" 14 15 namespace lldb_private { 16 class ScriptedMetadata { 17 public: 18 ScriptedMetadata(llvm::StringRef class_name, 19 StructuredData::DictionarySP dict_sp) 20 : m_class_name(class_name.data()), m_args_sp(dict_sp) {} 21 22 ScriptedMetadata(const ProcessInfo &process_info) { 23 lldb::ScriptedMetadataSP metadata_sp = process_info.GetScriptedMetadata(); 24 if (metadata_sp) { 25 m_class_name = metadata_sp->GetClassName(); 26 m_args_sp = metadata_sp->GetArgsSP(); 27 } 28 } 29 30 explicit operator bool() const { return !m_class_name.empty(); } 31 32 llvm::StringRef GetClassName() const { return m_class_name; } 33 StructuredData::DictionarySP GetArgsSP() const { return m_args_sp; } 34 35 private: 36 std::string m_class_name; 37 StructuredData::DictionarySP m_args_sp; 38 }; 39 } // namespace lldb_private 40 41 #endif // LLDB_INTERPRETER_SCRIPTEDMETADATA_H 42