1 //===-- LanguageCategory.h----------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef lldb_LanguageCategory_h_
12 #define lldb_LanguageCategory_h_
13 
14 
15 #include "lldb/DataFormatters/FormatCache.h"
16 #include "lldb/DataFormatters/FormatClasses.h"
17 #include "lldb/lldb-public.h"
18 
19 #include <memory>
20 
21 namespace lldb_private {
22 
23 class LanguageCategory {
24 public:
25   typedef std::unique_ptr<LanguageCategory> UniquePointer;
26 
27   LanguageCategory(lldb::LanguageType lang_type);
28 
29   bool Get(FormattersMatchData &match_data, lldb::TypeFormatImplSP &format_sp);
30 
31   bool Get(FormattersMatchData &match_data, lldb::TypeSummaryImplSP &format_sp);
32 
33   bool Get(FormattersMatchData &match_data,
34            lldb::SyntheticChildrenSP &format_sp);
35 
36   bool Get(FormattersMatchData &match_data,
37            lldb::TypeValidatorImplSP &format_sp);
38 
39   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
40                     lldb::TypeFormatImplSP &format_sp);
41 
42   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
43                     lldb::TypeSummaryImplSP &format_sp);
44 
45   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
46                     lldb::SyntheticChildrenSP &format_sp);
47 
48   bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
49                     lldb::TypeValidatorImplSP &format_sp);
50 
51   lldb::TypeCategoryImplSP GetCategory() const;
52 
53   FormatCache &GetFormatCache();
54 
55   void Enable();
56 
57   void Disable();
58 
59   bool IsEnabled();
60 
61 private:
62   lldb::TypeCategoryImplSP m_category_sp;
63 
64   HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
65   HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
66   HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
67   HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators;
68 
69   lldb_private::FormatCache m_format_cache;
70 
71   bool m_enabled;
72 };
73 
74 } // namespace lldb_private
75 
76 #endif // lldb_LanguageCategory_h_
77