/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Utility/ScriptedMetadata.h
Line | Count | Source |
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 | 3 | : m_class_name(class_name.data()), m_args_sp(dict_sp) {} |
21 | | |
22 | 194 | ScriptedMetadata(const ProcessInfo &process_info) { |
23 | 194 | lldb::ScriptedMetadataSP metadata_sp = process_info.GetScriptedMetadata(); |
24 | 194 | if (metadata_sp) { |
25 | 3 | m_class_name = metadata_sp->GetClassName(); |
26 | 3 | m_args_sp = metadata_sp->GetArgsSP(); |
27 | 3 | } |
28 | 194 | } |
29 | | |
30 | 7 | explicit operator bool() const { return !m_class_name.empty(); } |
31 | | |
32 | 197 | llvm::StringRef GetClassName() const { return m_class_name; } |
33 | 211 | 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 |