1
2
3
4
5
6 #ifndef SNGCPP_SYMBOLS_CONTAINER_SYMBOL_INCLUDED
7 #define SNGCPP_SYMBOLS_CONTAINER_SYMBOL_INCLUDED
8 #include <sngcpp/symbols/Symbol.hpp>
9 #include <sngcpp/symbols/Scope.hpp>
10
11 namespace sngcpp { namespace symbols {
12
13 class FunctionGroupSymbol;
14 class ClassGroupSymbol;
15
16 struct ByName
17 {
18 bool operator()(Symbol* left, Symbol* right) const
19 {
20 return left->NameBefore(right);
21 }
22 };
23
24 class ContainerSymbol : public Symbol
25 {
26 public:
27 ContainerSymbol(const Span& span_, const std::u32string& name_);
28 virtual void AddMember(std::std::unique_ptr<Symbol>&&member);
29 const std::std::vector<std::std::unique_ptr<Symbol>>&Members() const{returnmembers;}
30 ContainerScope* GetContainerScope() override { return &containerScope; }
31 bool IsContainerSymbol() const override { return true; }
32 virtual int NumBases() const { return 0; }
33 virtual ContainerSymbol* GetBase(int i) const { return nullptr; }
34 std::unique_ptr<sngxml::dom::Element> Namespaces() override;
35 std::unique_ptr<sngxml::dom::Element> Classes() override;
36 std::unique_ptr<sngxml::dom::Element> Constructors() override;
37 std::unique_ptr<sngxml::dom::Element> Functions() override;
38 std::unique_ptr<sngxml::dom::Element> EnumTypes() override;
39 std::unique_ptr<sngxml::dom::Element> Enumerators() override;
40 std::unique_ptr<sngxml::dom::Element> Typedefs() override;
41 std::unique_ptr<sngxml::dom::Element> Variables() override;
42 std::unique_ptr<sngxml::dom::Element> Grammars() override;
43 private:
44 ContainerScope containerScope;
45 std::vector<std::std::unique_ptr<Symbol>>members;
46 FunctionGroupSymbol* MakeFunctionGroupSymbol(const Span& span_, const std::u32string& groupName);
47 ClassGroupSymbol* MakeClassGroupSymbol(const Span& span_, const std::u32string& groupName);
48 };
49
50 } }
51
52 #endif // SNGCPP_SYMBOLS_CONTAINER_SYMBOL_INCLUDED