TypeCategory.h revision 296417
1296417Sdim//===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef lldb_TypeCategory_h_
11254721Semaste#define lldb_TypeCategory_h_
12254721Semaste
13254721Semaste// C Includes
14254721Semaste// C++ Includes
15296417Sdim#include <initializer_list>
16296417Sdim#include <memory>
17296417Sdim#include <string>
18296417Sdim#include <vector>
19254721Semaste
20254721Semaste// Other libraries and framework includes
21254721Semaste// Project includes
22254721Semaste#include "lldb/lldb-public.h"
23254721Semaste#include "lldb/lldb-enumerations.h"
24254721Semaste
25258884Semaste#include "lldb/DataFormatters/FormatClasses.h"
26262528Semaste#include "lldb/DataFormatters/FormattersContainer.h"
27254721Semaste
28262528Semastenamespace lldb_private {
29262528Semaste
30262528Semaste    template <typename FormatterImpl>
31262528Semaste    class FormatterContainerPair
32254721Semaste    {
33262528Semaste    public:
34262528Semaste        typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
35262528Semaste        typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl> RegexMatchContainer;
36254721Semaste
37262528Semaste        typedef typename ExactMatchContainer::MapType ExactMatchMap;
38262528Semaste        typedef typename RegexMatchContainer::MapType RegexMatchMap;
39262528Semaste
40262528Semaste        typedef typename ExactMatchContainer::MapValueType MapValueType;
41254721Semaste
42262528Semaste        typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
43262528Semaste        typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
44254721Semaste
45296417Sdim        typedef typename ExactMatchContainer::ForEachCallback ExactMatchForEachCallback;
46296417Sdim        typedef typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
47296417Sdim
48262528Semaste        FormatterContainerPair (const char* exact_name,
49262528Semaste                                const char* regex_name,
50262528Semaste                                IFormatChangeListener* clist) :
51262528Semaste            m_exact_sp(new ExactMatchContainer(std::string(exact_name),clist)),
52262528Semaste            m_regex_sp(new RegexMatchContainer(std::string(regex_name),clist))
53262528Semaste        {
54262528Semaste        }
55262528Semaste
56262528Semaste        ~FormatterContainerPair () = default;
57262528Semaste
58262528Semaste        ExactMatchContainerSP
59262528Semaste        GetExactMatch () const
60262528Semaste        {
61262528Semaste            return m_exact_sp;
62262528Semaste        }
63262528Semaste
64262528Semaste        RegexMatchContainerSP
65262528Semaste        GetRegexMatch () const
66262528Semaste        {
67262528Semaste            return m_regex_sp;
68262528Semaste        }
69262528Semaste
70296417Sdim        uint32_t
71296417Sdim        GetCount ()
72296417Sdim        {
73296417Sdim            return GetExactMatch()->GetCount() + GetRegexMatch()->GetCount();
74296417Sdim        }
75296417Sdim
76262528Semaste    private:
77262528Semaste        ExactMatchContainerSP m_exact_sp;
78262528Semaste        RegexMatchContainerSP m_regex_sp;
79262528Semaste    };
80258054Semaste
81262528Semaste    class TypeCategoryImpl
82262528Semaste    {
83262528Semaste    private:
84262528Semaste        typedef FormatterContainerPair<TypeFormatImpl> FormatContainer;
85262528Semaste        typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer;
86262528Semaste        typedef FormatterContainerPair<TypeFilterImpl> FilterContainer;
87280031Sdim        typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
88258054Semaste
89254721Semaste#ifndef LLDB_DISABLE_PYTHON
90296417Sdim        typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
91296417Sdim#endif // LLDB_DISABLE_PYTHON
92262528Semaste
93254721Semaste    public:
94254721Semaste        typedef uint16_t FormatCategoryItems;
95254721Semaste        static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
96258054Semaste
97262528Semaste        typedef FormatContainer::ExactMatchContainerSP FormatContainerSP;
98262528Semaste        typedef FormatContainer::RegexMatchContainerSP RegexFormatContainerSP;
99254721Semaste
100262528Semaste        typedef SummaryContainer::ExactMatchContainerSP SummaryContainerSP;
101262528Semaste        typedef SummaryContainer::RegexMatchContainerSP RegexSummaryContainerSP;
102258054Semaste
103262528Semaste        typedef FilterContainer::ExactMatchContainerSP FilterContainerSP;
104262528Semaste        typedef FilterContainer::RegexMatchContainerSP RegexFilterContainerSP;
105254721Semaste#ifndef LLDB_DISABLE_PYTHON
106262528Semaste        typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
107262528Semaste        typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
108296417Sdim#endif // LLDB_DISABLE_PYTHON
109254721Semaste
110280031Sdim        typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
111280031Sdim        typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
112280031Sdim
113296417Sdim        template <typename T>
114296417Sdim        class ForEachCallbacks
115296417Sdim        {
116296417Sdim        public:
117296417Sdim            ForEachCallbacks () = default;
118296417Sdim            ~ForEachCallbacks () = default;
119296417Sdim
120296417Sdim            template<typename U = TypeFormatImpl>
121296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
122296417Sdim            SetExact (FormatContainer::ExactMatchForEachCallback callback)
123296417Sdim            {
124296417Sdim                m_format_exact = callback;
125296417Sdim                return *this;
126296417Sdim            }
127296417Sdim            template<typename U = TypeFormatImpl>
128296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
129296417Sdim            SetWithRegex (FormatContainer::RegexMatchForEachCallback callback)
130296417Sdim            {
131296417Sdim                m_format_regex = callback;
132296417Sdim                return *this;
133296417Sdim            }
134296417Sdim
135296417Sdim            template<typename U = TypeSummaryImpl>
136296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
137296417Sdim            SetExact (SummaryContainer::ExactMatchForEachCallback callback)
138296417Sdim            {
139296417Sdim                m_summary_exact = callback;
140296417Sdim                return *this;
141296417Sdim            }
142296417Sdim            template<typename U = TypeSummaryImpl>
143296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
144296417Sdim            SetWithRegex (SummaryContainer::RegexMatchForEachCallback callback)
145296417Sdim            {
146296417Sdim                m_summary_regex = callback;
147296417Sdim                return *this;
148296417Sdim            }
149296417Sdim
150296417Sdim            template<typename U = TypeFilterImpl>
151296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
152296417Sdim            SetExact (FilterContainer::ExactMatchForEachCallback callback)
153296417Sdim            {
154296417Sdim                m_filter_exact = callback;
155296417Sdim                return *this;
156296417Sdim            }
157296417Sdim            template<typename U = TypeFilterImpl>
158296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
159296417Sdim            SetWithRegex (FilterContainer::RegexMatchForEachCallback callback)
160296417Sdim            {
161296417Sdim                m_filter_regex = callback;
162296417Sdim                return *this;
163296417Sdim            }
164296417Sdim
165296417Sdim#ifndef LLDB_DISABLE_PYTHON
166296417Sdim            template<typename U = SyntheticChildren>
167296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
168296417Sdim            SetExact (SynthContainer::ExactMatchForEachCallback callback)
169296417Sdim            {
170296417Sdim                m_synth_exact = callback;
171296417Sdim                return *this;
172296417Sdim            }
173296417Sdim            template<typename U = SyntheticChildren>
174296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
175296417Sdim            SetWithRegex (SynthContainer::RegexMatchForEachCallback callback)
176296417Sdim            {
177296417Sdim                m_synth_regex = callback;
178296417Sdim                return *this;
179296417Sdim            }
180296417Sdim#endif // LLDB_DISABLE_PYTHON
181296417Sdim            template<typename U = TypeValidatorImpl>
182296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
183296417Sdim            SetExact (ValidatorContainer::ExactMatchForEachCallback callback)
184296417Sdim            {
185296417Sdim                m_validator_exact = callback;
186296417Sdim                return *this;
187296417Sdim            }
188296417Sdim            template<typename U = TypeValidatorImpl>
189296417Sdim            typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
190296417Sdim            SetWithRegex (ValidatorContainer::RegexMatchForEachCallback callback)
191296417Sdim            {
192296417Sdim                m_validator_regex = callback;
193296417Sdim                return *this;
194296417Sdim            }
195296417Sdim
196296417Sdim            FormatContainer::ExactMatchForEachCallback
197296417Sdim            GetFormatExactCallback () const
198296417Sdim            {
199296417Sdim                return m_format_exact;
200296417Sdim            }
201296417Sdim            FormatContainer::RegexMatchForEachCallback
202296417Sdim            GetFormatRegexCallback () const
203296417Sdim            {
204296417Sdim                return m_format_regex;
205296417Sdim            }
206296417Sdim
207296417Sdim            SummaryContainer::ExactMatchForEachCallback
208296417Sdim            GetSummaryExactCallback () const
209296417Sdim            {
210296417Sdim                return m_summary_exact;
211296417Sdim            }
212296417Sdim            SummaryContainer::RegexMatchForEachCallback
213296417Sdim            GetSummaryRegexCallback () const
214296417Sdim            {
215296417Sdim                return m_summary_regex;
216296417Sdim            }
217296417Sdim
218296417Sdim            FilterContainer::ExactMatchForEachCallback
219296417Sdim            GetFilterExactCallback () const
220296417Sdim            {
221296417Sdim                return m_filter_exact;
222296417Sdim            }
223296417Sdim            FilterContainer::RegexMatchForEachCallback
224296417Sdim            GetFilterRegexCallback () const
225296417Sdim            {
226296417Sdim                return m_filter_regex;
227296417Sdim            }
228296417Sdim
229296417Sdim#ifndef LLDB_DISABLE_PYTHON
230296417Sdim            SynthContainer::ExactMatchForEachCallback
231296417Sdim            GetSynthExactCallback () const
232296417Sdim            {
233296417Sdim                return m_synth_exact;
234296417Sdim            }
235296417Sdim            SynthContainer::RegexMatchForEachCallback
236296417Sdim            GetSynthRegexCallback () const
237296417Sdim            {
238296417Sdim                return m_synth_regex;
239296417Sdim            }
240296417Sdim#endif // LLDB_DISABLE_PYTHON
241296417Sdim
242296417Sdim            ValidatorContainer::ExactMatchForEachCallback
243296417Sdim            GetValidatorExactCallback () const
244296417Sdim            {
245296417Sdim                return m_validator_exact;
246296417Sdim            }
247296417Sdim            ValidatorContainer::RegexMatchForEachCallback
248296417Sdim            GetValidatorRegexCallback () const
249296417Sdim            {
250296417Sdim                return m_validator_regex;
251296417Sdim            }
252296417Sdim
253296417Sdim        private:
254296417Sdim            FormatContainer::ExactMatchForEachCallback m_format_exact;
255296417Sdim            FormatContainer::RegexMatchForEachCallback m_format_regex;
256296417Sdim
257296417Sdim            SummaryContainer::ExactMatchForEachCallback m_summary_exact;
258296417Sdim            SummaryContainer::RegexMatchForEachCallback m_summary_regex;
259296417Sdim
260296417Sdim            FilterContainer::ExactMatchForEachCallback m_filter_exact;
261296417Sdim            FilterContainer::RegexMatchForEachCallback m_filter_regex;
262296417Sdim
263296417Sdim#ifndef LLDB_DISABLE_PYTHON
264296417Sdim            SynthContainer::ExactMatchForEachCallback m_synth_exact;
265296417Sdim            SynthContainer::RegexMatchForEachCallback m_synth_regex;
266296417Sdim#endif // LLDB_DISABLE_PYTHON
267296417Sdim
268296417Sdim            ValidatorContainer::ExactMatchForEachCallback m_validator_exact;
269296417Sdim            ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
270296417Sdim        };
271296417Sdim
272254721Semaste        TypeCategoryImpl (IFormatChangeListener* clist,
273296417Sdim                          ConstString name,
274296417Sdim                          std::initializer_list<lldb::LanguageType> langs = {});
275254721Semaste
276296417Sdim        template <typename T>
277296417Sdim        void
278296417Sdim        ForEach (const ForEachCallbacks<T> &foreach)
279296417Sdim        {
280296417Sdim            GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
281296417Sdim            GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
282296417Sdim
283296417Sdim            GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
284296417Sdim            GetRegexTypeSummariesContainer()->ForEach(foreach.GetSummaryRegexCallback());
285296417Sdim
286296417Sdim            GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
287296417Sdim            GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
288296417Sdim
289296417Sdim#ifndef LLDB_DISABLE_PYTHON
290296417Sdim            GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
291296417Sdim            GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
292296417Sdim#endif // LLDB_DISABLE_PYTHON
293296417Sdim
294296417Sdim            GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback());
295296417Sdim            GetRegexTypeValidatorsContainer()->ForEach(foreach.GetValidatorRegexCallback());
296296417Sdim        }
297296417Sdim
298262528Semaste        FormatContainerSP
299262528Semaste        GetTypeFormatsContainer ()
300258054Semaste        {
301262528Semaste            return m_format_cont.GetExactMatch();
302258054Semaste        }
303258054Semaste
304262528Semaste        RegexFormatContainerSP
305262528Semaste        GetRegexTypeFormatsContainer ()
306258054Semaste        {
307262528Semaste            return m_format_cont.GetRegexMatch();
308258054Semaste        }
309258054Semaste
310296417Sdim        FormatContainer&
311296417Sdim        GetFormatContainer ()
312296417Sdim        {
313296417Sdim            return m_format_cont;
314296417Sdim        }
315296417Sdim
316262528Semaste        SummaryContainerSP
317262528Semaste        GetTypeSummariesContainer ()
318254721Semaste        {
319262528Semaste            return m_summary_cont.GetExactMatch();
320254721Semaste        }
321254721Semaste
322262528Semaste        RegexSummaryContainerSP
323262528Semaste        GetRegexTypeSummariesContainer ()
324254721Semaste        {
325262528Semaste            return m_summary_cont.GetRegexMatch();
326254721Semaste        }
327254721Semaste
328296417Sdim        SummaryContainer&
329296417Sdim        GetSummaryContainer ()
330296417Sdim        {
331296417Sdim            return m_summary_cont;
332296417Sdim        }
333296417Sdim
334262528Semaste        FilterContainerSP
335262528Semaste        GetTypeFiltersContainer ()
336254721Semaste        {
337262528Semaste            return m_filter_cont.GetExactMatch();
338254721Semaste        }
339254721Semaste
340262528Semaste        RegexFilterContainerSP
341262528Semaste        GetRegexTypeFiltersContainer ()
342254721Semaste        {
343262528Semaste            return m_filter_cont.GetRegexMatch();
344254721Semaste        }
345296417Sdim
346296417Sdim        FilterContainer&
347296417Sdim        GetFilterContainer ()
348296417Sdim        {
349296417Sdim            return m_filter_cont;
350296417Sdim        }
351258054Semaste
352262528Semaste        FormatContainer::MapValueType
353258054Semaste        GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp);
354254721Semaste
355262528Semaste        SummaryContainer::MapValueType
356254721Semaste        GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
357254721Semaste
358262528Semaste        FilterContainer::MapValueType
359254721Semaste        GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
360254721Semaste
361254721Semaste#ifndef LLDB_DISABLE_PYTHON
362262528Semaste        SynthContainer::MapValueType
363254721Semaste        GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
364254721Semaste#endif
365254721Semaste
366280031Sdim        ValidatorContainer::MapValueType
367280031Sdim        GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp);
368280031Sdim
369254721Semaste        lldb::TypeNameSpecifierImplSP
370258054Semaste        GetTypeNameSpecifierForFormatAtIndex (size_t index);
371258054Semaste
372258054Semaste        lldb::TypeNameSpecifierImplSP
373254721Semaste        GetTypeNameSpecifierForSummaryAtIndex (size_t index);
374258054Semaste
375262528Semaste        FormatContainer::MapValueType
376258054Semaste        GetFormatAtIndex (size_t index);
377254721Semaste
378262528Semaste        SummaryContainer::MapValueType
379254721Semaste        GetSummaryAtIndex (size_t index);
380254721Semaste
381262528Semaste        FilterContainer::MapValueType
382254721Semaste        GetFilterAtIndex (size_t index);
383254721Semaste
384254721Semaste        lldb::TypeNameSpecifierImplSP
385254721Semaste        GetTypeNameSpecifierForFilterAtIndex (size_t index);
386254721Semaste
387254721Semaste#ifndef LLDB_DISABLE_PYTHON
388262528Semaste        SynthContainerSP
389262528Semaste        GetTypeSyntheticsContainer ()
390254721Semaste        {
391262528Semaste            return m_synth_cont.GetExactMatch();
392254721Semaste        }
393254721Semaste
394262528Semaste        RegexSynthContainerSP
395262528Semaste        GetRegexTypeSyntheticsContainer ()
396254721Semaste        {
397262528Semaste            return m_synth_cont.GetRegexMatch();
398254721Semaste        }
399254721Semaste
400296417Sdim        SynthContainer&
401296417Sdim        GetSyntheticsContainer ()
402296417Sdim        {
403296417Sdim            return m_synth_cont;
404296417Sdim        }
405296417Sdim
406262528Semaste        SynthContainer::MapValueType
407254721Semaste        GetSyntheticAtIndex (size_t index);
408254721Semaste
409254721Semaste        lldb::TypeNameSpecifierImplSP
410254721Semaste        GetTypeNameSpecifierForSyntheticAtIndex (size_t index);
411296417Sdim#endif // LLDB_DISABLE_PYTHON
412254721Semaste
413280031Sdim        ValidatorContainerSP
414280031Sdim        GetTypeValidatorsContainer ()
415280031Sdim        {
416280031Sdim            return m_validator_cont.GetExactMatch();
417280031Sdim        }
418280031Sdim
419280031Sdim        RegexValidatorContainerSP
420280031Sdim        GetRegexTypeValidatorsContainer ()
421280031Sdim        {
422280031Sdim            return m_validator_cont.GetRegexMatch();
423280031Sdim        }
424280031Sdim
425280031Sdim        ValidatorContainer::MapValueType
426280031Sdim        GetValidatorAtIndex (size_t index);
427280031Sdim
428280031Sdim        lldb::TypeNameSpecifierImplSP
429280031Sdim        GetTypeNameSpecifierForValidatorAtIndex (size_t index);
430280031Sdim
431254721Semaste        bool
432254721Semaste        IsEnabled () const
433254721Semaste        {
434254721Semaste            return m_enabled;
435254721Semaste        }
436254721Semaste
437254721Semaste        uint32_t
438254721Semaste        GetEnabledPosition()
439254721Semaste        {
440254721Semaste            if (m_enabled == false)
441254721Semaste                return UINT32_MAX;
442254721Semaste            else
443254721Semaste                return m_enabled_position;
444254721Semaste        }
445254721Semaste
446254721Semaste        bool
447296417Sdim        Get(ValueObject& valobj,
448296417Sdim            const FormattersMatchVector& candidates,
449296417Sdim            lldb::TypeFormatImplSP& entry,
450296417Sdim            uint32_t* reason = nullptr);
451258054Semaste
452258054Semaste        bool
453296417Sdim        Get(ValueObject& valobj,
454296417Sdim            const FormattersMatchVector& candidates,
455296417Sdim            lldb::TypeSummaryImplSP& entry,
456296417Sdim            uint32_t* reason = nullptr);
457254721Semaste
458254721Semaste        bool
459296417Sdim        Get(ValueObject& valobj,
460296417Sdim            const FormattersMatchVector& candidates,
461296417Sdim            lldb::SyntheticChildrenSP& entry,
462296417Sdim            uint32_t* reason = nullptr);
463254721Semaste
464280031Sdim        bool
465296417Sdim        Get(ValueObject& valobj,
466296417Sdim            const FormattersMatchVector& candidates,
467296417Sdim            lldb::TypeValidatorImplSP& entry,
468296417Sdim            uint32_t* reason = nullptr);
469280031Sdim
470254721Semaste        void
471254721Semaste        Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
472254721Semaste
473254721Semaste        bool
474254721Semaste        Delete (ConstString name,
475254721Semaste                FormatCategoryItems items = ALL_ITEM_TYPES);
476254721Semaste
477254721Semaste        uint32_t
478254721Semaste        GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
479254721Semaste
480254721Semaste        const char*
481254721Semaste        GetName ()
482254721Semaste        {
483254721Semaste            return m_name.GetCString();
484254721Semaste        }
485296417Sdim
486296417Sdim        size_t
487296417Sdim        GetNumLanguages ();
488254721Semaste
489296417Sdim        lldb::LanguageType
490296417Sdim        GetLanguageAtIndex (size_t idx);
491296417Sdim
492296417Sdim        void
493296417Sdim        AddLanguage (lldb::LanguageType lang);
494296417Sdim
495254721Semaste        bool
496296417Sdim        HasLanguage (lldb::LanguageType lang);
497254721Semaste
498296417Sdim        std::string
499296417Sdim        GetDescription ();
500296417Sdim
501296417Sdim        bool
502296417Sdim        AnyMatches(ConstString type_name,
503296417Sdim                   FormatCategoryItems items = ALL_ITEM_TYPES,
504296417Sdim                   bool only_enabled = true,
505296417Sdim                   const char** matching_category = nullptr,
506296417Sdim                   FormatCategoryItems* matching_type = nullptr);
507296417Sdim
508254721Semaste        typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
509254721Semaste
510254721Semaste    private:
511262528Semaste        FormatContainer m_format_cont;
512262528Semaste        SummaryContainer m_summary_cont;
513262528Semaste        FilterContainer m_filter_cont;
514254721Semaste#ifndef LLDB_DISABLE_PYTHON
515262528Semaste        SynthContainer m_synth_cont;
516296417Sdim#endif // LLDB_DISABLE_PYTHON
517280031Sdim        ValidatorContainer m_validator_cont;
518254721Semaste
519254721Semaste        bool m_enabled;
520254721Semaste
521254721Semaste        IFormatChangeListener* m_change_listener;
522254721Semaste
523254721Semaste        Mutex m_mutex;
524254721Semaste
525254721Semaste        ConstString m_name;
526254721Semaste
527296417Sdim        std::vector<lldb::LanguageType> m_languages;
528296417Sdim
529254721Semaste        uint32_t m_enabled_position;
530254721Semaste
531254721Semaste        void
532254721Semaste        Enable (bool value, uint32_t position);
533254721Semaste
534254721Semaste        void
535254721Semaste        Disable ()
536254721Semaste        {
537254721Semaste            Enable(false, UINT32_MAX);
538254721Semaste        }
539254721Semaste
540296417Sdim        bool
541296417Sdim        IsApplicable (ValueObject& valobj);
542296417Sdim
543280031Sdim        uint32_t
544280031Sdim        GetLastEnabledPosition ()
545280031Sdim        {
546280031Sdim            return m_enabled_position;
547280031Sdim        }
548280031Sdim
549280031Sdim        void
550280031Sdim        SetEnabledPosition (uint32_t p)
551280031Sdim        {
552280031Sdim            m_enabled_position = p;
553280031Sdim        }
554280031Sdim
555296417Sdim        friend class FormatManager;
556296417Sdim        friend class LanguageCategory;
557254721Semaste        friend class TypeCategoryMap;
558254721Semaste
559262528Semaste        friend class FormattersContainer<ConstString, TypeFormatImpl>;
560262528Semaste        friend class FormattersContainer<lldb::RegularExpressionSP, TypeFormatImpl>;
561258054Semaste
562262528Semaste        friend class FormattersContainer<ConstString, TypeSummaryImpl>;
563262528Semaste        friend class FormattersContainer<lldb::RegularExpressionSP, TypeSummaryImpl>;
564254721Semaste
565262528Semaste        friend class FormattersContainer<ConstString, TypeFilterImpl>;
566262528Semaste        friend class FormattersContainer<lldb::RegularExpressionSP, TypeFilterImpl>;
567254721Semaste
568254721Semaste#ifndef LLDB_DISABLE_PYTHON
569262528Semaste        friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
570262528Semaste        friend class FormattersContainer<lldb::RegularExpressionSP, ScriptedSyntheticChildren>;
571296417Sdim#endif // LLDB_DISABLE_PYTHON
572280031Sdim
573280031Sdim        friend class FormattersContainer<ConstString, TypeValidatorImpl>;
574280031Sdim        friend class FormattersContainer<lldb::RegularExpressionSP, TypeValidatorImpl>;
575254721Semaste    };
576254721Semaste
577254721Semaste} // namespace lldb_private
578254721Semaste
579296417Sdim#endif // lldb_TypeCategory_h_
580