1 | //===-- NSDictionary.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_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H |
10 | #define LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H |
11 | |
12 | #include "lldb/Core/ValueObject.h" |
13 | #include "lldb/DataFormatters/TypeSummary.h" |
14 | #include "lldb/DataFormatters/TypeSynthetic.h" |
15 | #include "lldb/Utility/ConstString.h" |
16 | #include "lldb/Utility/Stream.h" |
17 | |
18 | #include <map> |
19 | #include <memory> |
20 | |
21 | namespace lldb_private { |
22 | namespace formatters { |
23 | template <bool name_entries> |
24 | bool NSDictionarySummaryProvider(ValueObject &valobj, Stream &stream, |
25 | const TypeSummaryOptions &options); |
26 | |
27 | extern template bool |
28 | NSDictionarySummaryProvider<true>(ValueObject &, Stream &, |
29 | const TypeSummaryOptions &); |
30 | |
31 | extern template bool |
32 | NSDictionarySummaryProvider<false>(ValueObject &, Stream &, |
33 | const TypeSummaryOptions &); |
34 | |
35 | SyntheticChildrenFrontEnd * |
36 | NSDictionarySyntheticFrontEndCreator(CXXSyntheticChildren *, |
37 | lldb::ValueObjectSP); |
38 | |
39 | class NSDictionary_Additionals { |
40 | public: |
41 | class AdditionalFormatterMatching { |
42 | public: |
43 | class Matcher { |
44 | public: |
45 | virtual ~Matcher() = default; |
46 | virtual bool Match(ConstString class_name) = 0; |
47 | |
48 | typedef std::unique_ptr<Matcher> UP; |
49 | }; |
50 | class Prefix : public Matcher { |
51 | public: |
52 | Prefix(ConstString p); |
53 | ~Prefix() override = default; |
54 | bool Match(ConstString class_name) override; |
55 | |
56 | private: |
57 | ConstString m_prefix; |
58 | }; |
59 | class Full : public Matcher { |
60 | public: |
61 | Full(ConstString n); |
62 | ~Full() override = default; |
63 | bool Match(ConstString class_name) override; |
64 | |
65 | private: |
66 | ConstString m_name; |
67 | }; |
68 | typedef Matcher::UP MatcherUP; |
69 | |
70 | MatcherUP GetFullMatch(ConstString n) { return std::make_unique<Full>(args&: n); } |
71 | |
72 | MatcherUP GetPrefixMatch(ConstString p) { |
73 | return std::make_unique<Prefix>(args&: p); |
74 | } |
75 | }; |
76 | |
77 | template <typename FormatterType> |
78 | using AdditionalFormatter = |
79 | std::pair<AdditionalFormatterMatching::MatcherUP, FormatterType>; |
80 | |
81 | template <typename FormatterType> |
82 | using AdditionalFormatters = std::vector<AdditionalFormatter<FormatterType>>; |
83 | |
84 | static AdditionalFormatters<CXXFunctionSummaryFormat::Callback> & |
85 | GetAdditionalSummaries(); |
86 | |
87 | static AdditionalFormatters<CXXSyntheticChildren::CreateFrontEndCallback> & |
88 | GetAdditionalSynthetics(); |
89 | }; |
90 | } // namespace formatters |
91 | } // namespace lldb_private |
92 | |
93 | #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H |
94 |