From 4dedb85d2408c90dea1d3c36d8f3a985a4b26024 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 21 Nov 2014 08:59:17 +0100 Subject: working on ManagedContainers.hpp --- src/core/dom/Typesystem.hpp | 87 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/core/dom/Typesystem.hpp (limited to 'src/core/dom') diff --git a/src/core/dom/Typesystem.hpp b/src/core/dom/Typesystem.hpp new file mode 100644 index 0000000..201aed2 --- /dev/null +++ b/src/core/dom/Typesystem.hpp @@ -0,0 +1,87 @@ +/* + Ousía + Copyright (C) 2014, 2015 Benjamin Paaßen, Andreas Stöckel + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _OUSIA_DOM_TYPESYSTEM_HPP_ +#define _OUSIA_DOM_TYPESYSTEM_HPP_ + +#include +#include + +#include + +#include "Node.hpp" + +namespace ousia { +namespace dom { + +class Type; + +class TypeInstance : public Managed { +public: + const Owned type; + + TypeInstance(Manager &mgr, Handle type) + : Managed(mgr), type(acquire(type)) + { + } +}; + +class Type : public Node { +public: + using Node::Node; + + virtual bool isFinal() const { return true; } + + virtual bool isPrimitive() const { return true; } + + virtual Rooted create() = 0; + + virtual Rooted parse(const std::string &str) = 0; +}; + +class Typesystem : public Node { +private: + const std::vector> types; + const std::vector> constants; + +protected: + void doResolve(std::vector> &res, + const std::vector &path, Filter filter, + void *filterData, unsigned idx, + VisitorSet &visited) override; + +public: + using Node::Node; + + const &std::vector> getTypes() { return types; } + + const &std::vector> getConstants() { return constants; } + + void addType(Handle type) { + types.push_back(acquire(type)); + } + + void addConstant(Handle ) { + + } +}; +} +} + +#endif /* _OUSIA_DOM_TYPESYSTEM_HPP_ */ + -- cgit v1.2.3