1 //===-- LanguageCategory.h----------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef lldb_LanguageCategory_h_
11 #define lldb_LanguageCategory_h_
12 
13 
14 #include "lldb/DataFormatters/FormatCache.h"
15 #include "lldb/DataFormatters/FormatClasses.h"
16 #include "lldb/lldb-public.h"
17 
18 #include <memory>
19 
20 namespace lldb_private {
21 
22 class LanguageCategory {
23 public:
24   typedef std::unique_ptr<LanguageCategory> UniquePointer;
25 
26   LanguageCategory(lldb::LanguageType lang_type);
27 
28   template <typename ImplSP>
29   bool Get(FormattersMatchData &match_data, ImplSP &format_sp);
30   template <typename ImplSP>
31   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
32                     ImplSP &format_sp);
33 
34   lldb::TypeCategoryImplSP GetCategory() const;
35 
36   FormatCache &GetFormatCache();
37 
38   void Enable();
39 
40   void Disable();
41 
42   bool IsEnabled();
43 
44 private:
45   lldb::TypeCategoryImplSP m_category_sp;
46 
47   HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
48   HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
49   HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
50 
51   template <typename ImplSP>
52   auto &GetHardcodedFinder();
53 
54   lldb_private::FormatCache m_format_cache;
55 
56   bool m_enabled;
57 };
58 
59 } // namespace lldb_private
60 
61 #endif // lldb_LanguageCategory_h_
62