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_DATAFORMATTERS_LANGUAGECATEGORY_H
11 #define LLDB_DATAFORMATTERS_LANGUAGECATEGORY_H
12 
13 #include "lldb/DataFormatters/FormatCache.h"
14 #include "lldb/DataFormatters/FormatClasses.h"
15 #include "lldb/lldb-public.h"
16 
17 #include <memory>
18 
19 namespace lldb_private {
20 
21 class LanguageCategory {
22 public:
23   typedef std::unique_ptr<LanguageCategory> UniquePointer;
24 
25   LanguageCategory(lldb::LanguageType lang_type);
26 
27   template <typename ImplSP>
28   bool Get(FormattersMatchData &match_data, ImplSP &format_sp);
29   template <typename ImplSP>
30   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
31                     ImplSP &format_sp);
32 
33   lldb::TypeCategoryImplSP GetCategory() const;
34 
35   FormatCache &GetFormatCache();
36 
37   void Enable();
38 
39   void Disable();
40 
41   bool IsEnabled();
42 
43 private:
44   lldb::TypeCategoryImplSP m_category_sp;
45 
46   HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
47   HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
48   HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
49 
50   template <typename ImplSP>
51   auto &GetHardcodedFinder();
52 
53   lldb_private::FormatCache m_format_cache;
54 
55   bool m_enabled;
56 };
57 
58 } // namespace lldb_private
59 
60 #endif // LLDB_DATAFORMATTERS_LANGUAGECATEGORY_H
61