1
2
3
4
5
6 #ifndef SNGCPP_SYMBOLS_ENUMERATION_SYMBOL_INCLUDED
7 #define SNGCPP_SYMBOLS_ENUMERATION_SYMBOL_INCLUDED
8 #include <sngcpp/symbols/TypeSymbol.hpp>
9 #include <sngcpp/ast/Enumeration.hpp>
10
11 namespace sngcpp { namespace symbols {
12
13 using namespace sngcpp::ast;
14
15 class EnumTypeSymbol : public TypeSymbol
16 {
17 public:
18 EnumTypeSymbol(const Span& span_, const std::u32string& name_, EnumKey enumKey_);
19 std::u32string KindStr() override { return U"enum"; }
20 std::unique_ptr<sngxml::dom::Element> CreateElement() override;
21 bool IsEnumTypeSymbol() const override { return true; }
22 bool IsParentSymbol() const override { return true; }
23 TypeSymbol* BaseType() { return baseType; }
24 void SetBaseType(TypeSymbol* baseType_) { baseType = baseType_; }
25 void SetFileId(const std::u32string& fileId_) { fileId = fileId_; }
26 const std::u32string& FileId() const { return fileId; }
27 void SetFileName(const std::string& fileName_) { fileName = fileName_; }
28 const std::string& FileName() const { return fileName; }
29 private:
30 EnumKey enumKey;
31 TypeSymbol* baseType;
32 std::u32string fileId;
33 std::string fileName;
34 };
35
36 class EnumeratorSymbol : public Symbol
37 {
38 public:
39 EnumeratorSymbol(const Span& span_, const std::u32string& name_, const std::u32string& value_);
40 TypeSymbol* GetType() override { return Parent()->GetType(); }
41 std::u32string KindStr() override { return U"enumerator"; }
42 std::unique_ptr<sngxml::dom::Element> CreateElement() override;
43 bool IsEnumeratorSymbol() const override { return true; }
44 const std::u32string& Value() const { return value; }
45 private:
46 std::u32string value;
47 };
48
49 } }
50
51 #endif // SNGCPP_SYMBOLS_ENUMERATION_SYMBOL_INCLUDED