1
2
3
4
5
6 #ifndef CMAJOR_SYMBOLS_SYMBOL_COLLECTOR_INCLUDED
7 #define CMAJOR_SYMBOLS_SYMBOL_COLLECTOR_INCLUDED
8 #include <cmajor/symbols/NamespaceSymbol.hpp>
9 #include <cmajor/symbols/BasicTypeSymbol.hpp>
10 #include <cmajor/symbols/ClassTypeSymbol.hpp>
11 #include <cmajor/symbols/ConstantSymbol.hpp>
12 #include <cmajor/symbols/ConceptSymbol.hpp>
13 #include <cmajor/symbols/DelegateSymbol.hpp>
14 #include <cmajor/symbols/EnumSymbol.hpp>
15 #include <cmajor/symbols/FunctionSymbol.hpp>
16 #include <cmajor/symbols/InterfaceTypeSymbol.hpp>
17 #include <cmajor/symbols/TypedefSymbol.hpp>
18 #include <cmajor/symbols/VariableSymbol.hpp>
19
20 namespace cmajor { namespace symbols {
21
22 struct ByFullName
23 {
24 bool operator()(Symbol* left, Symbol* right) const;
25 };
26
27 struct ByDocName
28 {
29 bool operator()(Symbol* left, Symbol* right) const;
30 };
31
32 class SymbolCollector
33 {
34 public:
35 SymbolCollector();
36 void AddBasicType(BasicTypeSymbol* basicType);
37 void AddClass(ClassTypeSymbol* class_);
38 void AddConcept(ConceptSymbol* conceptSymbol);
39 void AddConstant(ConstantSymbol* constant);
40 void AddDelegate(DelegateTypeSymbol* delegate);
41 void AddClassDelegate(ClassDelegateTypeSymbol* classDelegate);
42 void AddEnumeratedType(EnumTypeSymbol* enumType);
43 void AddEnumerationConstant(EnumConstantSymbol* enumConstant);
44 void AddFunction(FunctionSymbol* function);
45 void AddInterface(InterfaceTypeSymbol* interface_);
46 void AddTypedef(TypedefSymbol* typedef_);
47 void AddMemberVariable(MemberVariableSymbol* memberVariable);
48 void AddGlobalVariable(GlobalVariableSymbol* globalVariable);
49 void SortByFullName();
50 void SortByDocName();
51 const std::std::vector<BasicTypeSymbol*>&BasicTypes() const{returnbasicTypes;}
52 const std::std::vector<ClassTypeSymbol*>&Classes() const{returnclasses;}
53 const std::std::vector<InterfaceTypeSymbol*>&Interfaces() const{returninterfaces;}
54 const std::std::vector<FunctionSymbol*>&Functions() const{returnfunctions;}
55 const std::std::vector<TypedefSymbol*>&Typedefs() const{returntypedefs;}
56 const std::std::vector<ConceptSymbol*>&Concepts() const{returnconcepts;}
57 const std::std::vector<DelegateTypeSymbol*>&Delegates() const{returndelegates;}
58 const std::std::vector<ClassDelegateTypeSymbol*>&ClassDelegates() const{returnclassDelegates;}
59 const std::std::vector<ConstantSymbol*>&Constants() const{returnconstants;}
60 const std::std::vector<EnumTypeSymbol*>&EnumeratedTypes() const{returnenumeratedTypes;}
61 const std::std::vector<EnumConstantSymbol*>&EnumerationConstants() const{returnenumerationConstants;}
62 const std::std::vector<MemberVariableSymbol*>&MemberVariables() const{returnmemberVariables;}
63 bool IsEmpty() const;
64 private:
65 std::vector<BasicTypeSymbol*> basicTypes;
66 std::vector<ClassTypeSymbol*> classes;
67 std::vector<InterfaceTypeSymbol*> interfaces;
68 std::vector<FunctionSymbol*> functions;
69 std::vector<TypedefSymbol*> typedefs;
70 std::vector<ConceptSymbol*> concepts;
71 std::vector<ConstantSymbol*> constants;
72 std::vector<DelegateTypeSymbol*> delegates;
73 std::vector<ClassDelegateTypeSymbol*> classDelegates;
74 std::vector<EnumTypeSymbol*> enumeratedTypes;
75 std::vector<EnumConstantSymbol*> enumerationConstants;
76 std::vector<MemberVariableSymbol*> memberVariables;
77 std::vector<GlobalVariableSymbol*> globalVariables;
78 };
79
80 } }
81
82 #endif // CMAJOR_SYMBOLS_SYMBOL_COLLECTOR_INCLUDED