summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/model/RangeSet.hpp (renamed from src/model/RangeSet.hpp)0
-rw-r--r--src/core/script/Variant.cpp80
-rw-r--r--src/core/script/Variant.hpp274
-rw-r--r--src/gui/components/GridTree.cpp95
-rw-r--r--src/gui/components/GridTree.hpp232
-rw-r--r--src/gui/components/UIGrid.cpp81
-rw-r--r--src/gui/components/UIGrid.hpp49
-rw-r--r--src/gui/components/UIPaneFrame.cpp113
-rw-r--r--src/gui/components/UIPaneFrame.hpp50
-rw-r--r--src/gui/framework/TileTreeNode.cpp115
-rw-r--r--src/gui/framework/TileTreeNode.hpp74
-rw-r--r--src/gui/notepad.cpp19
-rw-r--r--src/gui/notepad.hpp17
-rw-r--r--src/model/GraphNode.cpp46
-rw-r--r--src/model/GraphNode.hpp77
-rw-r--r--src/model/document/Anchor.cpp28
-rw-r--r--src/model/document/Anchor.hpp36
-rw-r--r--src/model/domain/Annotation.cpp30
-rw-r--r--src/model/domain/Annotation.hpp65
-rw-r--r--src/model/domain/AnnotationCategory.hpp60
-rw-r--r--src/model/domain/AnnotationReference.hpp66
-rw-r--r--src/model/domain/Category.cpp19
-rw-r--r--src/model/domain/Category.hpp50
-rw-r--r--src/model/domain/Class.cpp0
-rw-r--r--src/model/domain/Class.hpp99
-rw-r--r--src/model/domain/ClassCategory.hpp60
-rw-r--r--src/model/domain/ClassReference.hpp66
-rw-r--r--src/model/domain/ClassReferenceSet.cpp28
-rw-r--r--src/model/domain/ClassReferenceSet.hpp72
-rw-r--r--src/model/domain/Domain.cpp27
-rw-r--r--src/model/domain/Domain.hpp81
-rw-r--r--src/model/domain/Field.cpp29
-rw-r--r--src/model/domain/Field.hpp69
-rw-r--r--src/model/domain/Layer.cpp27
-rw-r--r--src/model/domain/Layer.hpp60
-rw-r--r--src/model/domain/Structure.cpp31
-rw-r--r--src/model/domain/Structure.hpp47
-rw-r--r--src/model/types/Type.cpp29
-rw-r--r--src/model/types/Type.hpp31
-rw-r--r--src/model/types/Value.cpp29
-rw-r--r--src/model/types/Value.hpp31
-rw-r--r--src/xml/XmlAttributeHandler.hpp138
-rw-r--r--src/xml/XmlElementHandler.hpp146
-rw-r--r--src/xml/XmlReader.cpp155
-rw-r--r--src/xml/XmlReader.hpp87
45 files changed, 354 insertions, 2664 deletions
diff --git a/src/model/RangeSet.hpp b/src/core/model/RangeSet.hpp
index ef86363..ef86363 100644
--- a/src/model/RangeSet.hpp
+++ b/src/core/model/RangeSet.hpp
diff --git a/src/core/script/Variant.cpp b/src/core/script/Variant.cpp
new file mode 100644
index 0000000..623b396
--- /dev/null
+++ b/src/core/script/Variant.cpp
@@ -0,0 +1,80 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "Variant.hpp"
+
+namespace ousia {
+namespace script {
+
+std::ostream& operator<< (std::ostream& os, const Variant &v)
+{
+ switch (v.type) {
+ case VariantType::none:
+ os << "null";
+ break;
+ case VariantType::integer:
+ os << v.integerValue;
+ break;
+ case VariantType::number:
+ os << v.numberValue;
+ break;
+ case VariantType::string:
+ os << "\"" << v.stringValue << "\"";
+ break;
+ case VariantType::array: {
+ bool first = true;
+ os << "[";
+ for (auto &v2 : v.arrayValue) {
+ if (!first) {
+ os << ", ";
+ }
+ os << v2;
+ first = false;
+ }
+ os << "]";
+ break;
+ }
+ case VariantType::map: {
+ bool first = true;
+ os << "{";
+ for (auto &v2 : v.mapValue) {
+ if (!first) {
+ os << ", ";
+ }
+ os << "\"" << v2.first << "\": " << v2.second;
+ first = false;
+ }
+ os << "}";
+ break;
+ }
+ case VariantType::function:
+ os << "<Function>";
+ break;
+ case VariantType::object:
+ os << "<Object>";
+ break;
+ case VariantType::buffer:
+ os << "<Buffer>";
+ break;
+ }
+ return os;
+}
+
+}
+}
+
diff --git a/src/core/script/Variant.hpp b/src/core/script/Variant.hpp
new file mode 100644
index 0000000..208bfa5
--- /dev/null
+++ b/src/core/script/Variant.hpp
@@ -0,0 +1,274 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _OUSIA_VARIANT_HPP_
+#define _OUSIA_VARIANT_HPP_
+
+#include <cstdint>
+#include <ostream>
+#include <string>
+#include <vector>
+#include <map>
+
+namespace ousia {
+namespace script {
+
+/**
+ * Enum containing the possible types a variant may have.
+ */
+enum class VariantType {
+ none, integer, number, string, array, map, function, object, buffer
+};
+
+/**
+ * Instances of the Variant class represent any kind of data that is exchanged
+ * between the host application and the script engine.
+ */
+class Variant {
+
+private:
+ VariantType type;
+
+ union {
+ int64_t integerValue;
+ double numberValue;
+ std::string stringValue;
+ std::vector<Variant> arrayValue;
+ std::map<std::string, Variant> mapValue;
+ };
+
+ /**
+ * Private function calling the destructor of the currently used union
+ * member.
+ */
+ void free() {
+ // Explicitly call the destructor
+ switch (type) {
+ case VariantType::string:
+ stringValue.std::string::~string();
+ break;
+ case VariantType::array:
+ arrayValue.std::vector<Variant>::~vector();
+ break;
+ case VariantType::map:
+ mapValue.std::map<std::string, Variant>::~map();
+ break;
+ default:
+ break;
+ }
+
+ // Reset the type
+ type = VariantType::none;
+ }
+
+ /**
+ * Function for copying the content of the given instance v to this
+ * instance. Callers must make sure the storage space has been freed
+ * beforehand.
+ */
+ void copy(const Variant &v)
+ {
+ type = v.type;
+ switch (type) {
+ case VariantType::integer:
+ integerValue = v.integerValue;
+ break;
+ case VariantType::number:
+ numberValue = v.numberValue;
+ break;
+ case VariantType::string:
+ new (&stringValue) std::string(v.stringValue);
+ break;
+ case VariantType::array:
+ new (&arrayValue) std::vector<Variant>(v.arrayValue);
+ break;
+ case VariantType::map:
+ new (&mapValue) std::map<std::string, Variant>(v.mapValue);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Function for moving the content of the given instance v to this instance.
+ * No copy operation is used. Callers must make sure the storage space has
+ * been freed beforehand.
+ */
+ void move(Variant &v)
+ {
+ type = v.type;
+ switch (type) {
+ case VariantType::integer:
+ integerValue = v.integerValue;
+ break;
+ case VariantType::number:
+ numberValue = v.numberValue;
+ break;
+ case VariantType::string:
+ new (&stringValue) std::string(std::move(v.stringValue));
+ break;
+ case VariantType::array:
+ new (&arrayValue) std::vector<Variant>(std::move(v.arrayValue));
+ break;
+ case VariantType::map:
+ new (&mapValue) std::map<std::string, Variant>(std::move(v.mapValue));
+ break;
+ default:
+ break;
+ }
+
+ // Reset the type of v to "none"
+ v.type = VariantType::none;
+ }
+
+public:
+
+ class EBadEntry {};
+
+ Variant(const Variant &v)
+ {
+ copy(v);
+ }
+
+ Variant(Variant &&v)
+ {
+ move(v);
+ }
+
+ Variant& operator=(const Variant &v)
+ {
+ free();
+ copy(v);
+ return *this;
+ }
+
+ Variant& operator=(Variant &&v)
+ {
+ free();
+ move(v);
+ return *this;
+ }
+
+
+ Variant(int64_t i) :
+ type(VariantType::integer),
+ integerValue(i)
+ {
+ // Do nothing here
+ }
+
+ Variant(double d) :
+ type(VariantType::number),
+ numberValue(d)
+ {
+ // Do nothing here
+ }
+
+ Variant(const char *s) :
+ type(VariantType::string)
+ {
+ new (&stringValue) std::string(s);
+ }
+
+ Variant(const std::vector<Variant> &a) :
+ type(VariantType::array)
+ {
+ new (&arrayValue) std::vector<Variant>(a);
+ }
+
+
+ Variant(const std::map<std::string, Variant> &m) :
+ type(VariantType::map)
+ {
+ new (&mapValue) std::map<std::string, Variant>(m);
+ }
+
+ ~Variant()
+ {
+ free();
+ }
+
+ VariantType getType() const
+ {
+ return type;
+ }
+
+ int64_t getIntegerValue() const
+ {
+ switch (type) {
+ case VariantType::integer:
+ return integerValue;
+ case VariantType::number:
+ return static_cast<int64_t>(numberValue);
+ default:
+ throw EBadEntry{};
+ }
+ }
+
+ double getNumberValue() const
+ {
+ switch (type) {
+ case VariantType::integer:
+ return static_cast<double>(integerValue);
+ case VariantType::number:
+ return numberValue;
+ default:
+ throw EBadEntry{};
+ }
+ }
+
+ std::string getStringValue() const
+ {
+ switch (type) {
+ case VariantType::string:
+ return stringValue;
+ default:
+ throw EBadEntry {};
+ }
+ }
+
+ const std::vector<Variant>& getArrayValue() const
+ {
+ switch (type) {
+ case VariantType::array:
+ return arrayValue;
+ default:
+ throw EBadEntry {};
+ }
+ }
+
+ const std::map<std::string, Variant>& getMapValue() const
+ {
+ switch (type) {
+ case VariantType::map:
+ return mapValue;
+ default:
+ throw EBadEntry {};
+ }
+ }
+
+ friend std::ostream& operator<< (std::ostream& os, const Variant &v);
+
+};
+
+}
+}
+
+#endif /* _OUSIA_VARIANT_HPP_ */
+
diff --git a/src/gui/components/GridTree.cpp b/src/gui/components/GridTree.cpp
deleted file mode 100644
index 000b859..0000000
--- a/src/gui/components/GridTree.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "GridTree.hpp"
-
-#include <iostream>
-
-namespace uigrid {
-
-Splitter getSplitter(Orientation orientation, const Rect &r)
-{
- switch (orientation) {
- case Orientation::vert:
- return Splitter(this, Rect(r.x1, r.y2 - ss, r.x2, r.y2),
- orientation);
- case Orientation::horz:
- return Splitter(this, Rect(r.x1, r.y1, r.x2 - ss, r.y2 - ss),
- orientation);
- default:
- return Rect(0, 0, 0, 0);
- }
-}
-
-void GridTreeNode::gatherBoundingBoxes(std::vector<FrameArea> *areas,
- std::vector<Splitter> *splitters, const Rect &r,
- int splitterSize)
-{
- const int ss = splitterSize;
- const int h = r.h();
- const int w = r.w();
-
- // If this node is a leaf, store the area of the frame and the splitter
- // positions in the given lists and abort.
- if (isLeaf()) {
- if (areas) {
- areas->push_back(FrameArea(this, r));
- }
- if (splitters) {
- splitters->push_back(getSplitter(Orientation::vert, r));
- splitters->push_back(getSplitter(Orientation::horz, r));
- }
- return;
- }
-
- // Recursively descend into the child nodes. Calculate the area the
- // child nodes occupy. The last child should always occupy all remaining
- // space in order to avoid gaps caused by rounding errors.
- unsigned int i = 0;
- switch (orientation) {
- case Orientation::vert: {
- int offsY = r.y1;
- for (auto it = children.begin(); it != children.end();
- it++, i++) {
- const int ch = (i == children.size() - 1)
- ? r.y2 - offsY : h * (*it)->relativeSize;
- (*it)->gatherBoundingBoxes(areas, splitters,
- Rect::bounds(r.x1, offsY, w, ch), splitterSize);
- offsY += ch;
- }
- }
- break;
- case Orientation::horz: {
- int offsX = r.x1;
- for (auto it = children.begin(); it != children.end();
- it++, i++) {
- const int cw = (i == children.size() - 1)
- ? r.x2 - offsX : w * (*it)->relativeSize;
- (*it)->gatherBoundingBoxes(areas, splitters,
- Rect::bounds(offsX, r.y1, cw, h), splitterSize);
- offsX += cw;
- }
- }
- break;
- case Orientation::none:
- break;
- }
-}
-
-}
-
diff --git a/src/gui/components/GridTree.hpp b/src/gui/components/GridTree.hpp
deleted file mode 100644
index 1b0a52a..0000000
--- a/src/gui/components/GridTree.hpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _GRID_TREE_H_
-#define _GRID_TREE_H_
-
-#include <vector>
-#include <list>
-
-namespace uigrid {
-
-class GridTreeNode;
-
-enum class Orientation
-{
- none, horz, vert
-};
-
-struct Rect
-{
- int x1, y1, x2, y2;
-
- Rect(int x1, int y1, int x2, int y2) :
- x1(x1), y1(y1), x2(x2), y2(y2)
- {
- // Do nothing here
- }
-
- static Rect bounds(int x, int y, int w, int h)
- {
- return Rect(x, y, x + w, y + h);
- }
-
- int w() const
- {
- return x2 - x1;
- }
-
- int h() const
- {
- return y2 - y1;
- }
-
-};
-
-struct FrameArea
-{
- GridTreeNode *node;
- Rect r;
-
- FrameArea(GridTreeNode *node, const Rect &r) :
- node(node), r(r)
- {
- // Do nothing here
- }
-};
-
-struct Splitter
-{
- GridTreeNode *node;
- Rect r;
- Orientation orientation;
-
- Splitter(GridTreeNode *node, const Rect &r, Orientation orientation) :
- node(node), r(r), orientation(orientation)
- {
- // Do nothing here
- }
-};
-
-class GridTreeNode
-{
-
-private:
- Orientation orientation;
- float relativeSize;
- GridTreeNode *parent;
- void *data;
-
- std::list<GridTreeNode*> children;
-
- void setParent(GridTreeNode *parent)
- {
- if (this->parent) {
- this->parent->removeChild(this);
- }
- if (parent) {
- parent->addChild(this);
- }
- this->parent = parent;
- }
-
- void removeChild(GridTreeNode *node)
- {
- for (auto it = children.begin(); it != children.end();) {
- if (*it == node) {
- it = children.erase(it);
- } else {
- it++;
- }
- }
- }
-
- void addChild(GridTreeNode *node)
- {
- children.push_back(node);
- }
-
-public:
-
- /**
- * Constructor of the GridTreeNode class.
- *
- * @param orientation describes the orientation of the children of
- * this grid tree node.
- * @param relativeSize contains the size of this node relative to the size
- * of its parent node. The sum of the relativeSizes of all siblings has to
- * be one.
- * @param data is the data that should be attached to the node.
- */
- GridTreeNode(Orientation orientation, float relativeSize = 1.0f,
- GridTreeNode *parent = nullptr, void *data = nullptr) :
- orientation(orientation), relativeSize(relativeSize), parent(nullptr),
- data(data)
- {
- setParent(parent);
- }
-
- ~GridTreeNode()
- {
- // Delete all children
- for (auto c : children) {
- delete c;
- }
- }
-
- /**
- * Returns true if this element of the grid tree is a "leaf" (e.g. this
- * element has no children).
- *
- * @return true if the grid element is a leaf node, false otherwise.
- */
- bool isLeaf() const
- {
- return children.empty();
- }
-
- /**
- * Returns true if this element is the root node (has no parent).
- *
- * @return true if this element is the root node, false otherwise.
- */
- bool isRoot() const
- {
- return parent == nullptr;
- }
-
- /**
- * Sets the relative size of the node.
- *
- * @param relativeSize is the new relative size of the frame. Should be in
- * an interval of [0, 1].
- */
- void setRelativeSize(float relativeSize)
- {
- this->relativeSize = relativeSize;
- }
-
- /**
- * Returns the current relative size of the node.
- *
- * @return the current relative size of the node.
- */
- float getRelativeSize()
- {
- return relativeSize;
- }
-
- /**
- * Returns the data that was attached to this grid tree node.
- *
- * @return the data that was attached to this grid tree node.
- */
- void* getData()
- {
- return data;
- }
-
- /**
- * Gathers the frame areas and the areas for which splitters should be
- * drawn.
- *
- * @param areas is the list into which the frame area descriptors should be
- * inserted.
- * @param splitters is the list into which the splitter descriptors should
- * be inserted. If nullptr is given, the list is not filled
- * @param w is the width of the region for which the splitters should be
- * gathered.
- * @param h is the height of the region for which the splitters should be
- * gathered.
- */
- void gatherBoundingBoxes(std::vector<FrameArea> *areas,
- std::vector<Splitter> *splitters, const Rect &r,
- int splitterSize);
-
- /**
- * Returns the position of the splitter with the given orientation for this
- * element.
- */
- Rect getSplitterPosition(Orientation orientation, const Rect &r);
-
-};
-
-}
-
-#endif /* _GRID_TREE_H_ */
-
diff --git a/src/gui/components/UIGrid.cpp b/src/gui/components/UIGrid.cpp
deleted file mode 100644
index 4d6f0e8..0000000
--- a/src/gui/components/UIGrid.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <QApplication>
-#include <QColor>
-#include <QPainter>
-#include <QPalette>
-
-#include "GridTree.hpp"
-
-#include "UIGrid.hpp"
-
-#include <iostream>
-
-namespace uigrid {
-
-UIGrid::UIGrid(QWidget *parent) :
- QWidget(parent)
-{
- // Enable automatic ereasing of the background
- setAutoFillBackground(true);
-
- // Create the root grid node.
- rootGridNode = new GridTreeNode(Orientation::horz, 1.0);
-
- // Insert two new nodes into the tree
- GridTreeNode *nd1 = new GridTreeNode(Orientation::vert, 0.25, rootGridNode);
- GridTreeNode *nd2 = new GridTreeNode(Orientation::horz, 0.75, rootGridNode);
-
- // Add three nodes as children of the first node
- new GridTreeNode(Orientation::horz, 0.33, nd1);
- new GridTreeNode(Orientation::horz, 0.33, nd1);
- new GridTreeNode(Orientation::horz, 0.33, nd1);
-
- new GridTreeNode(Orientation::vert, 0.75, nd2);
- new GridTreeNode(Orientation::horz, 0.25, nd2);
-}
-
-UIGrid::~UIGrid()
-{
- delete rootGridNode;
-}
-
-void UIGrid::paintEvent(QPaintEvent *event)
-{
- const QPalette &palette = QApplication::palette();
- // Gather all splitter and frame area regions
- std::vector<Splitter> splitters;
- std::vector<FrameArea> areas;
- rootGridNode->gatherBoundingBoxes(&areas, &splitters,
- Rect(0, 0, width(), height()), 5);
-
- QPainter painter(this);
-
- // Draw the splitters (first the background, then the dividing line)
- painter.setPen(palette.mid().color());
- for (auto &c : splitters) {
- QRect r(c.r.x1, c.r.y1, c.r.w(), c.r.h());
- painter.fillRect(r, palette.light());
- }
-
-}
-
-
-}
-
diff --git a/src/gui/components/UIGrid.hpp b/src/gui/components/UIGrid.hpp
deleted file mode 100644
index 14d161d..0000000
--- a/src/gui/components/UIGrid.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _UI_GRID_H_
-#define _UI_GRID_H_
-
-#include <QWidget>
-
-namespace uigrid {
-
-class GridTreeNode;
-
-class UIGrid : public QWidget
-{
- Q_OBJECT
-
-private:
- GridTreeNode *rootGridNode;
-
-protected:
- virtual void paintEvent(QPaintEvent *event);
-
-public:
-
- UIGrid(QWidget *parent);
-
- ~UIGrid();
-
-};
-
-}
-
-#endif /* _UI_GRID_H_ */
-
diff --git a/src/gui/components/UIPaneFrame.cpp b/src/gui/components/UIPaneFrame.cpp
deleted file mode 100644
index 1192bad..0000000
--- a/src/gui/components/UIPaneFrame.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <QBoxLayout>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QPushButton>
-#include <QFrame>
-#include <QColor>
-#include <QToolButton>
-#include <QSizePolicy>
-#include <QLabel>
-#include <QTreeView>
-#include <QDir>
-#include <QFileSystemModel>
-
-#include <gui/components/UIPaneFrame.hpp>
-
-static void setWidgetColor(QWidget *w, const QColor c)
-{
- QPalette p(w->palette());
- p.setColor(QPalette::Background, c);
- w->setAutoFillBackground(true);
- w->setPalette(p);
-}
-
-UIPaneFrame::UIPaneFrame(QWidget *parent) :
- QWidget(parent)
-{
- // Create the layout components
- rootLayout = new QVBoxLayout;
- topLayout = new QHBoxLayout;
- centerLayout = new QVBoxLayout;
- bottomLayout = new QHBoxLayout;
-
- // Assemble the top bar
-// QToolButton *btn = new QToolButton;
-// btn->setIcon(QIcon::fromTheme("user-home"));
-
- QLabel *lbl = new QLabel("Dies ist nur ein Test");
- lbl->setContentsMargins(10, 0, 10, 0);
-
- QToolButton *btn2 = new QToolButton;
- btn2->setIcon(QIcon::fromTheme("edit-find"));
-
- QToolButton *btn3 = new QToolButton;
- btn3->setIcon(QIcon::fromTheme("window-new"));
-
-// topLayout->addWidget(btn);
- topLayout->addWidget(lbl);
- topLayout->addWidget(btn2);
- topLayout->addWidget(btn3);
-
- QTreeView *tree = new QTreeView;
- QFileSystemModel *model = new QFileSystemModel;
- model->setRootPath(QDir::currentPath());
- tree->setModel(model);
- centerLayout->addWidget(tree);
-
- // Remove the spacing of the layout components
- removeLayoutSpacing(rootLayout);
- removeLayoutSpacing(topLayout);
- removeLayoutSpacing(centerLayout);
- removeLayoutSpacing(bottomLayout);
-
- // Create the widget containers
- topContainer = new QWidget;
- centerContainer = new QWidget;
- bottomContainer = new QWidget;
-
- // Assign the layouts to the top and bottom part, add the components to the
- // root layout
- topContainer->setLayout(topLayout);
- topContainer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-
- centerContainer->setLayout(centerLayout);
-
- bottomContainer->setLayout(bottomLayout);
- topContainer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-
- rootLayout->addWidget(topContainer, 0);
- rootLayout->addWidget(centerContainer, 1);
- rootLayout->addWidget(bottomContainer, 0);
-
- this->setLayout(rootLayout);
-}
-
-UIPaneFrame::~UIPaneFrame()
-{
-
-}
-
-void UIPaneFrame::removeLayoutSpacing(QBoxLayout *layout)
-{
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
-}
-
diff --git a/src/gui/components/UIPaneFrame.hpp b/src/gui/components/UIPaneFrame.hpp
deleted file mode 100644
index 32bbca7..0000000
--- a/src/gui/components/UIPaneFrame.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _UI_PANE_FRAME_HPP_
-#define _UI_PANE_FRAME_HPP_
-
-#include <QWidget>
-
-class QBoxLayout;
-class QVBoxLayout;
-class QHBoxLayout;
-
-class UIPaneFrame : public QWidget
-{
- Q_OBJECT
-
-private:
- QVBoxLayout *rootLayout;
- QHBoxLayout *topLayout;
- QVBoxLayout *centerLayout;
- QHBoxLayout *bottomLayout;
- QWidget *topContainer;
- QWidget *centerContainer;
- QWidget *bottomContainer;
-
- void removeLayoutSpacing(QBoxLayout *layout);
-
-public:
- explicit UIPaneFrame(QWidget *parent = 0);
- ~UIPaneFrame();
-
-};
-
-#endif /* _UI_PANE_FRAME_HPP_ */
-
diff --git a/src/gui/framework/TileTreeNode.cpp b/src/gui/framework/TileTreeNode.cpp
deleted file mode 100644
index 58abf65..0000000
--- a/src/gui/framework/TileTreeNode.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "TileTreeNode.hpp"
-
-namespace TiledUI {
-
-TileTreeNode::TileTreeNode() :
- parent(nullptr);
-{
- // Do nothing here
-}
-
-TileTreeNode::TileTreeNode(TileTreeNode *parent) :
- TileTreeNode()
-{
- setParent(parent);
-}
-
-TileTreeNode::~TileTreeNode()
-{
- // Free the memory for all children
- for (auto &c : children) {
- delete c;
- }
-}
-
-void TileTreeNode::setParent(TileTreeNode *newParent)
-{
- // Automatically remove this child from the old parent
- if (parent) {
- parent->removeChild(this);
- }
-
- // Add this element to the new parent
- if (newParent) {
- newParent->addChild(this);
- }
-
- // The current parent is the new parent
- parent = newParent;
-}
-
-bool TileTreeNode::removeChild(GridTreeNode *node, bool recursive)
-{
- // Iterate of the current container and remove the given node
- const int idx = indexOf(node);
- if (indexOf(node) >= 0) {
- children.erase(children.begin() + idx);
- return true;
- }
-
- // Descend into the tree if the recursive flag is set to true and the node
- // was not yet found
- if (recursive) {
- for (auto &c : children) {
- if (c.removeChild(node, true)) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-void TileTreeNode::addChild(TileTreeNode *child, int idx)
-{
- // Make sure the given child is only inserted once into the tree
- removeChild(child, true);
-
- // Insert the child at the given position, or at the end if idx < 0
- if (idx < 0) {
- children.push_back(child);
- } else {
- children.insert(children.begin() + idx, child);
- }
-}
-
-int TileTreeNode::indexOf(TileTreeNode *child)
-{
- int i = 0;
- for (auto it = children.begin(); it != children.end(); it++, i++) {
- if (*it == node) {
- return i;
- }
- }
- return -1;
-}
-
-void TileTreeNode::parentWidget()
-{
- if (parent)
- {
- return parent->parentWidget();
- }
- return nullptr;
-}
-
-}
-
diff --git a/src/gui/framework/TileTreeNode.hpp b/src/gui/framework/TileTreeNode.hpp
deleted file mode 100644
index 07586e1..0000000
--- a/src/gui/framework/TileTreeNode.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- BasicWriter
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _TILE_TREE_NODE_HPP_
-#define _TILE_TREE_NODE_HPP_
-
-#include <QSize>
-#include <QRect>
-
-#include <list>
-
-namespace TiledUI {
-
-class TileTreeNode {
-
-private:
- TileTreeNode *parent;
- std::list<TileTreeNode*> children;
-
-protected:
-
- void setParent(TileTreeNode *newParent);
-
- bool removeChild(TileTreeNode *child, bool recursive = false);
-
- void addChild(TileTreeNode *child, int idx = -1);
-
- int indexOf(TileTreeNode *child);
-
- virtual ();
-
-public:
-
- TileTreeNode();
-
- TileTreeNode(TileTreeNode *parent);
-
- ~TileTreeNode();
-
- virtual QSize minimumSize() const = 0;
-
- virtual QSize maximumSize() const = 0;
-
- virtual QRect geometry() const = 0;
-
- void resize(QSize size);
-
- void resize(int width, int height);
-
- virtual QWidget* parentWidget();
-
- virtual void
-
-};
-
-}
-
-#endif /* _TILE_TREE_NODE_HPP_ */
-
diff --git a/src/gui/notepad.cpp b/src/gui/notepad.cpp
deleted file mode 100644
index e7035f1..0000000
--- a/src/gui/notepad.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <gui/notepad.hpp>
-
-#include <gui/components/UIPaneFrame.hpp>
-//#include <gui/components/UIGrid.hpp>
-
-Notepad::Notepad(QWidget *parent) :
- QMainWindow(parent)
-{
- UIPaneFrame *frame = new UIPaneFrame(this);
- this->setCentralWidget(frame);
-// resize(1024, 768);
-// uigrid::UIGrid *grid = new uigrid::UIGrid(this);
-// setCentralWidget(grid);
-}
-
-Notepad::~Notepad()
-{
-
-}
diff --git a/src/gui/notepad.hpp b/src/gui/notepad.hpp
deleted file mode 100644
index d5c713c..0000000
--- a/src/gui/notepad.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _NOTEPAD_H_
-#define _NOTEPAD_H_
-
-#include <QMainWindow>
-
-class Notepad : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit Notepad(QWidget *parent = 0);
- ~Notepad();
-
-};
-
-#endif /* _NOTEPAD_H_ */
-
diff --git a/src/model/GraphNode.cpp b/src/model/GraphNode.cpp
deleted file mode 100644
index bfb8e63..0000000
--- a/src/model/GraphNode.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "GraphNode.hpp"
-
-#include <iostream>
-#include <sstream>
-
-namespace ousia {
-namespace model {
-
-GraphNode::GraphNode(GraphNodeType type, std::shared_ptr<GraphNode> parent,
- const std::string &name) :
- type(type), parent(parent), name(name)
-{
- // Do nothing here
-}
-
-const std::string GraphNode::getFullyQualifiedName()
-{
- if (parent) {
- std::stringstream ss;
- ss << parent->getFullyQualifiedName() << "." << name;
- return ss.str();
- }
- return name;
-}
-
-}
-}
-
diff --git a/src/model/GraphNode.hpp b/src/model/GraphNode.hpp
deleted file mode 100644
index 73d26a0..0000000
--- a/src/model/GraphNode.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_GRAPH_NODE_HPP_
-#define _OUSIA_MODEL_GRAPH_NODE_HPP_
-
-#include <string>
-#include <memory>
-
-namespace ousia {
-namespace model {
-
-enum class GraphNodeType {
- Domain, Class, Annotation, Structure, ClassCategory, AnnotationCategory
-};
-
-class GraphNode {
-
-private:
- GraphNodeType type;
- std::shared_ptr<GraphNode> parent;
- std::string name;
-
-protected:
- GraphNode(GraphNodeType type, std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "");
-
-public:
- const std::string getFullyQualifiedName();
-
- const std::string& getName()
- {
- return name;
- }
-
- void setName(const std::string &name)
- {
- this->name = name;
- }
-
- std::shared_ptr<GraphNode> getParent()
- {
- return parent;
- }
-
- void setParent(std::shared_ptr<GraphNode> parent)
- {
- this->parent = parent;
- }
-
- GraphNodeType getType()
- {
- return type;
- }
-
-};
-
-}
-}
-
-#endif /* _OUSIA_MODEL_GRAPH_NODE_HPP_ */
-
diff --git a/src/model/document/Anchor.cpp b/src/model/document/Anchor.cpp
deleted file mode 100644
index e153161..0000000
--- a/src/model/document/Anchor.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/domain/Anchor.hpp>
-
-namespace ousia {
-namespace domain {
-
-//This class is fully specified by its header.
-
-}
-}
-
diff --git a/src/model/document/Anchor.hpp b/src/model/document/Anchor.hpp
deleted file mode 100644
index 66ff8eb..0000000
--- a/src/model/document/Anchor.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _ANCHOR_HPP_
-#define _ANCHOR_HPP_
-
-#include <model/GraphNode.hpp>
-
-namespace ousia {
-namespace domain {
-
-class Anchor : public GraphNode {
-
-public:
- using GraphNode::GraphNode;
-
-};
-}
-}
-
-#endif /* _ANCHOR_HPP_ */
diff --git a/src/model/domain/Annotation.cpp b/src/model/domain/Annotation.cpp
deleted file mode 100644
index 42e6ce8..0000000
--- a/src/model/domain/Annotation.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/domain/Annotation.hpp>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-//This class is fully defined by its header.
-
-}
-}
-}
-
diff --git a/src/model/domain/Annotation.hpp b/src/model/domain/Annotation.hpp
deleted file mode 100644
index 0e84d1c..0000000
--- a/src/model/domain/Annotation.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_ANNOTATION_HPP_
-#define _OUSIA_MODEL_DOMAIN_ANNOTATION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-#include "Structure.hpp"
-#include "Field.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-//class Structure;
-//class Field;
-
-class Annotation : public GraphNode {
-
-private:
- std::vector<std::shared_ptr<Structure>> structures;
- std::vector<std::shared_ptr<Field>> fields;
-
-public:
-
- Annotation(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::Annotation, parent, name)
- {
- // Do nothing here
- }
-
- std::vector<std::shared_ptr<Structure>>& getStructures()
- {
- return structures;
- }
-
- std::vector<std::shared_ptr<Field>>& getFields()
- {
- return fields;
- }
-};
-}
-}
-}
-#endif /* _OUSIA_MODEL_DOMAIN_ANNOTATION_HPP_ */
diff --git a/src/model/domain/AnnotationCategory.hpp b/src/model/domain/AnnotationCategory.hpp
deleted file mode 100644
index 8ec6003..0000000
--- a/src/model/domain/AnnotationCategory.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_ANNOTATIONCATEGORY_HPP_
-#define _OUSIA_MODEL_DOMAIN_ANNOTATIONCATEGORY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-
-#include "Annotation.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-class AnnotationCategory : public GraphNode {
-
-private:
- std::vector<std::shared_ptr<Annotation>> annotations;
-
-public:
-
- AnnotationCategory(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::AnnotationCategory, parent, name)
- {
- // Do nothing here
- }
-
- std::vector<std::shared_ptr<Annotation>>& getAnnotations()
- {
- return annotations;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_ANNOTATIONCATEGORY_HPP_ */
-
diff --git a/src/model/domain/AnnotationReference.hpp b/src/model/domain/AnnotationReference.hpp
deleted file mode 100644
index 873938e..0000000
--- a/src/model/domain/AnnotationReference.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_ANNOTATIONREFERENCE_HPP_
-#define _OUSIA_MODEL_DOMAIN_ANNOTATIONREFERENCE_HPP_
-
-#include <string>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-/**
- * A AnnotationReference is an expression resolvable to either a single
- * annotation or any annotation in some given category (* expression).
- */
-class AnnotationReference {
-
-private:
- std::string domainName;
- std::string categoryName;
- /**
- * The annotation name might also be "any".
- */
- std::string className;
-
-public:
-
- const std::string& getDomainName()
- {
- return domainName;
- }
-
- const std::string& getCategoryName()
- {
- return categoryName;
- }
-
- const std::string& getClassName()
- {
- return className;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_ANNOTATIONREFERENCE_HPP_ */
-
diff --git a/src/model/domain/Category.cpp b/src/model/domain/Category.cpp
deleted file mode 100644
index c509285..0000000
--- a/src/model/domain/Category.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-
diff --git a/src/model/domain/Category.hpp b/src/model/domain/Category.hpp
deleted file mode 100644
index 6255e6a..0000000
--- a/src/model/domain/Category.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _CATEGORY_HPP_
-#define _CATEGORY_HPP_
-
-#include <memory>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-
-#include "Class.hpp"
-
-namespace ousia {
-namespace domain {
-
-class Category : public GraphNode {
-
-private:
- std::vector<std::shared_ptr<Class>> classes;
-
-public:
-
- std::vector<std::shared_ptr<Class>>& getClasses()
- {
- return classes;
- }
-
-};
-
-}
-}
-
-#endif /* _CATEGORY_HPP_ */
-
diff --git a/src/model/domain/Class.cpp b/src/model/domain/Class.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/model/domain/Class.cpp
+++ /dev/null
diff --git a/src/model/domain/Class.hpp b/src/model/domain/Class.hpp
deleted file mode 100644
index 6100214..0000000
--- a/src/model/domain/Class.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_CLASS_HPP_
-#define _OUSIA_MODEL_DOMAIN_CLASS_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-#include "ClassReferenceSet.hpp"
-#include "Field.hpp"
-#include "Layer.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-/**
- * A class represents some semantic concept in a given domain that has
- * structural relevance, like headings in a text. Classes are usually expected
- * to be in a "tree-esque" structure: It is not really a tree, but we still
- * think about classes as nodes with children, even though children might be
- * nodes higher up the tree, which leads to cycles.
- */
-class Class : public GraphNode {
-
-private:
-
- std::vector<std::shared_ptr<ClassReferenceSet>> children;
- std::vector<std::shared_ptr<Field>> fields;
- std::vector<std::shared_ptr<Layer>> layers;
-
-public:
-
- Class(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::Class, parent, name)
- {
- // Do nothing here
- }
-
- /**
- * The children of a given class are not resolved on parsing time but lazily
- * during document creation and validation time. This circumvents some
- * problems we would have otherwise like: How do we treat the case that
- * merging two domains adds more possible classes to some given category?
- * How do we treat references to linked domains?
- *
- * Thus we do not specify the children that are allowed but a sequence of
- * sets that define what set of classes is allowed at each point in the
- * children sequence. Please note that each ClassReferenceSet also stores
- * a cardinality, how many children, that are members of this set, have to
- * exist. Therefore this construction can be interpreted as a quasi finite
- * state automaton, e.g.:
- *
- * (class1|class2)* (class3){1,4}
- */
- std::vector<std::shared_ptr<ClassReferenceSet>>& getChildren()
- {
- return children;
- }
-
- std::vector<std::shared_ptr<Field>>& getFields()
- {
- return fields;
- }
-
- /**
- * Layers specify the annotations that are allowed upon instances of this
- * class and its children.
- */
- std::vector<std::shared_ptr<Layer>>& getLayers()
- {
- return layers;
- }
-};
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_CLASS_HPP_ */
-
diff --git a/src/model/domain/ClassCategory.hpp b/src/model/domain/ClassCategory.hpp
deleted file mode 100644
index 2f60284..0000000
--- a/src/model/domain/ClassCategory.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_CLASSCATEGORY_HPP_
-#define _OUSIA_MODEL_DOMAIN_CLASSCATEGORY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-
-#include "Class.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-class ClassCategory : public GraphNode {
-
-private:
- std::vector<std::shared_ptr<Class>> classes;
-
-public:
-
- ClassCategory(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::ClassCategory, parent, name)
- {
- // Do nothing here
- }
-
- std::vector<std::shared_ptr<Class>>& getClasses()
- {
- return classes;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_CLASSCATEGORY_HPP_ */
-
diff --git a/src/model/domain/ClassReference.hpp b/src/model/domain/ClassReference.hpp
deleted file mode 100644
index 807fd76..0000000
--- a/src/model/domain/ClassReference.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_CLASSREFERENCE_HPP_
-#define _OUSIA_MODEL_DOMAIN_CLASSREFERENCE_HPP_
-
-#include <string>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-/**
- * A ClassReference is an expression resolvable to either a single class or
- * any class in some given category (* expression).
- */
-class ClassReference {
-
-private:
- std::string domainName;
- std::string categoryName;
- /**
- * The class name might also be "any".
- */
- std::string className;
-
-public:
-
- const std::string& getDomainName()
- {
- return domainName;
- }
-
- const std::string& getCategoryName()
- {
- return categoryName;
- }
-
- const std::string& getClassName()
- {
- return className;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_CLASSREFERENCE_HPP_ */
-
diff --git a/src/model/domain/ClassReferenceSet.cpp b/src/model/domain/ClassReferenceSet.cpp
deleted file mode 100644
index 14f57a2..0000000
--- a/src/model/domain/ClassReferenceSet.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-namespace ousia {
-namespace model {
-namespace domain {
-
- //For now this class is fully specified by its header.
-
-}
-}
-}
-
-
diff --git a/src/model/domain/ClassReferenceSet.hpp b/src/model/domain/ClassReferenceSet.hpp
deleted file mode 100644
index 61db014..0000000
--- a/src/model/domain/ClassReferenceSet.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_CLASSREFERENCESET_HPP_
-#define _OUSIA_MODEL_DOMAIN_CLASSREFERENCESET_HPP_
-
-#include "ClassReference.hpp"
-#include <model/RangeSet.hpp>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-/**
- * A ClassReferenceSet lazily defines references to classes that are allowed at
- * this point of the domain description. It specifies a set in a twofold meaning:
- * 1.) It defines the set of classes, that are allowed.
- * 2.) It defines how many instances of those classes have to be instantiated
- * in a document that implements this domain standard (cardinality).
- */
-class ClassReferenceSet {
-
-private:
- std::vector<std::shared_ptr<ClassReference>> conjunctions;
- std::shared_ptr<RangeSet<unsigned int>> cardinality;
-
-public:
-
- /**
- * This defines the conjunctions of references to classes that are allowed
- * Please note that each ClassReference again does not have to reference to
- * a single class but can also reference to multiple classes in a *
- * expression.
- */
- std::vector<std::shared_ptr<ClassReference>>& getConjunctions()
- {
- return conjunctions;
- }
-
- std::shared_ptr<RangeSet<unsigned int>> getCardinality()
- {
- return cardinality;
- }
-
- void setCardinality(std::shared_ptr<RangeSet<unsigned int>>)
- {
- this->cardinality = cardinality;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_CLASSREFERENCESET_HPP_ */
-
diff --git a/src/model/domain/Domain.cpp b/src/model/domain/Domain.cpp
deleted file mode 100644
index 9b27e3a..0000000
--- a/src/model/domain/Domain.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "Domain.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-}
-}
-}
diff --git a/src/model/domain/Domain.hpp b/src/model/domain/Domain.hpp
deleted file mode 100644
index 278adc5..0000000
--- a/src/model/domain/Domain.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_DOMAIN_HPP_
-#define _OUSIA_MODEL_DOMAIN_DOMAIN_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-
-#include "Structure.hpp"
-#include "ClassCategory.hpp"
-#include "AnnotationCategory.hpp"
-#include "ClassReferenceSet.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-class Domain : public GraphNode {
-
-private:
- std::shared_ptr<ClassReferenceSet> root;
- std::vector<std::shared_ptr<Structure>> structures;
- std::vector<std::shared_ptr<ClassCategory>> classCategories;
- std::vector<std::shared_ptr<AnnotationCategory>> annotationCategories;
-
-public:
-
- Domain(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::Domain, parent, name)
- {
- // Do nothing here
- }
-
- std::shared_ptr<ClassReferenceSet>& getRoot()
- {
- return root;
- }
-
- std::vector<std::shared_ptr<Structure>>& getStructures()
- {
- return structures;
- }
-
- std::vector<std::shared_ptr<ClassCategory>>& getClassCategories()
- {
- return classCategories;
- }
-
- std::vector<std::shared_ptr<AnnotationCategory>>& getAnnotationCategories()
- {
- return annotationCategories;
- }
-
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_DOMAIN_HPP_ */
-
diff --git a/src/model/domain/Field.cpp b/src/model/domain/Field.cpp
deleted file mode 100644
index af7f81e..0000000
--- a/src/model/domain/Field.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/domain/Field.hpp>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
- //This class is fully specified by its header.
-
-}
-}
-}
diff --git a/src/model/domain/Field.hpp b/src/model/domain/Field.hpp
deleted file mode 100644
index 293a361..0000000
--- a/src/model/domain/Field.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_FIELD_HPP_
-#define _OUSIA_MODEL_DOMAIN_FIELD_HPP_
-
-#include <memory>
-
-#include <model/GraphNode.hpp>
-#include <model/types/Type.hpp>
-
-namespace ousia{
-
-//namespace types {
-// class Type;
-// class Value;
-//}
-namespace model {
-namespace domain {
-
-class Field : public GraphNode {
-
-private:
- std::shared_ptr<types::Type> type;
- bool optional;
-
-public:
- using GraphNode::GraphNode;
-
- std::shared_ptr<types::Type> getType()
- {
- return type;
- }
-
- void setType(std::shared_ptr<types::Type> type)
- {
- this->type = type;
- }
-
- bool getOptional()
- {
- return optional;
- }
-
- void setOptional(bool optional)
- {
- this->optional = optional;
- }
-};
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_FIELD_HPP_ */
diff --git a/src/model/domain/Layer.cpp b/src/model/domain/Layer.cpp
deleted file mode 100644
index fb22b4c..0000000
--- a/src/model/domain/Layer.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/domain/Layer.hpp>
-
-namespace ousia {
-namespace domain {
-
- //This class is fully specified by its header.
-
-}
-}
diff --git a/src/model/domain/Layer.hpp b/src/model/domain/Layer.hpp
deleted file mode 100644
index d419710..0000000
--- a/src/model/domain/Layer.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_LAYER_HPP_
-#define _OUSIA_MODEL_DOMAIN_LAYER_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "AnnotationReference.hpp"
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-/**
- * A Layer lazily defines references to annotations that are allowed upon
- * certain classes. You can interpret a layer as a ClassReferenceSet minus the
- * cardinality.
- */
-class Layer {
-
-private:
- std::vector<std::shared_ptr<AnnotationReference>> conjunctions;
-
-public:
-
- /**
- * This defines the conjunctions of references to annotations that are allowed
- * Please note that each AnnotationReference again does not have to reference to
- * a single class but can also reference to multiple classes in a *
- * expression.
- */
- std::vector<std::shared_ptr<AnnotationReference>>& getConjunctions()
- {
- return conjunctions;
- }
-};
-
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_LAYER_HPP_ */
-
diff --git a/src/model/domain/Structure.cpp b/src/model/domain/Structure.cpp
deleted file mode 100644
index f0f9d1e..0000000
--- a/src/model/domain/Structure.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-
-#include <model/domain/Structure.hpp>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
- //This class for now has no special features that would distinguish it
- //from an abstract GraphNode.
-
-}
-}
-}
diff --git a/src/model/domain/Structure.hpp b/src/model/domain/Structure.hpp
deleted file mode 100644
index 4f0604a..0000000
--- a/src/model/domain/Structure.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_MODEL_DOMAIN_STRUCTURE_HPP_
-#define _OUSIA_MODEL_DOMAIN_STRUCTURE_HPP_
-
-#include <memory>
-#include <string>
-
-#include <model/GraphNode.hpp>
-
-namespace ousia {
-namespace model {
-namespace domain {
-
-class Structure : public GraphNode {
-
-public:
- Structure(std::shared_ptr<GraphNode> parent = nullptr,
- const std::string &name = "") :
- GraphNode(GraphNodeType::Structure, parent, name)
- {
- // Do nothing here
- }
-
-
-};
-}
-}
-}
-
-#endif /* _OUSIA_MODEL_DOMAIN_STRUCTURE_HPP_ */
diff --git a/src/model/types/Type.cpp b/src/model/types/Type.cpp
deleted file mode 100644
index d219b61..0000000
--- a/src/model/types/Type.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/GraphNode.hpp>
-#include <model/types/Type.hpp>
-
-namespace ousia {
-namespace types {
-
-
-//TODO: THIS IS A DUMMY CLASS DECLARATION
-
-}
-}
diff --git a/src/model/types/Type.hpp b/src/model/types/Type.hpp
deleted file mode 100644
index c4a9900..0000000
--- a/src/model/types/Type.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_TYPES_TYPE_HPP_
-#define _OUSIA_TYPES_TYPE_HPP_
-
-namespace ousia {
-namespace types {
-
-class Type {
-
-//TODO: THIS IS A DUMMY CLASS DECLARATION
-};
-}
-}
-#endif /* _OUSIA_TYPES_TYPE_HPP_ */
diff --git a/src/model/types/Value.cpp b/src/model/types/Value.cpp
deleted file mode 100644
index 73d233a..0000000
--- a/src/model/types/Value.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <model/GraphNode.hpp>
-#include <model/types/Value.hpp>
-
-namespace ousia {
-namespace types {
-
-
-//TODO: THIS IS A DUMMY CLASS DECLARATION
-
-}
-}
diff --git a/src/model/types/Value.hpp b/src/model/types/Value.hpp
deleted file mode 100644
index ec9f354..0000000
--- a/src/model/types/Value.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_TYPES_VALUE_HPP_
-#define _OUSIA_TYPES_VALUE_HPP_
-
-namespace ousia {
-namespace types {
-
-class Value {
-
-//TODO: THIS IS A DUMMY CLASS DECLARATION
-};
-}
-}
-#endif /* _OUSIA_TYPES_VALUE_HPP_ */
diff --git a/src/xml/XmlAttributeHandler.hpp b/src/xml/XmlAttributeHandler.hpp
deleted file mode 100644
index 8fae6c3..0000000
--- a/src/xml/XmlAttributeHandler.hpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_XML_XML_ATTRIBUTE_HANDLER_HPP_
-#define _OUSIA_XML_XML_ATTRIBUTE_HANDLER_HPP_
-
-#include <functional>
-#include <string>
-
-namespace ousia {
-namespace xml {
-
-/**
- * The attribute handler class is responsible for handling attributes. It
- * performs type checks and conversion. Note that the name of the attribute is
- * not stored inside the handler, as the attribute handlers are meant to be used
- * alongside a map.
- */
-class XmlAttributeHandler {
-
-private:
- /**
- * Specifies whether this attribute was actually handled (set to true once
- * the setter is called).
- */
- bool handled;
-
- /**
- * Specifies whether this attribute is required or not.
- */
- bool required;
-
- /**
- * Function which returns true if the given string is a valid entry for the
- * type the attribute handler represents.
- */
- std::function<bool(const std::string&)> valid;
-
- /**
- * Function which gets the attribute value and sets the type.
- */
- std::function<void(const std::string&)> setter;
-
- /**
- * Default value (as string) that should be used if no other value for that
- * attribute is given.
- */
- const char *defaultValue;
-
-public:
-
- /**
- * Constructor of the XmlAttributeHandler class.
- *
- * @param required if true, the attribute is marked as "required" and it
- * must occur in the xml.
- * @param valid is a function reference which specifies whether the given
- * string is valid.
- * @param setter is the function that is meant to actually set the value
- * of the attached class.
- * @param defaultValue if given (it does not equal the nullptr), the setter
- * is automatically called with the default value, unless the attribute is
- * actually specified in the XML.
- */
- XmlAttributeHandler(bool required,
- const std::function<bool(const std::string&)> &valid,
- const std::function<void(const std::string&)> &setter,
- const char *defaultValue = nullptr) :
- handled(false), required(required), valid(valid), setter(setter),
- defaultValue(defaultValue)
- {
- // Do nothing here
- }
-
- /**
- * Returns true if the given value for this attribute is valid.
- */
- bool isValid(const std::string &value)
- {
- return valid(value);
- }
-
- /**
- * Calls the setter with the given value. The value should have been checked
- * for validity first.
- */
- void executeSettter(const std::string &value)
- {
- handled = true;
- setter(value);
- }
-
- /**
- * Returns true if this element is required.
- */
- bool isRequired()
- {
- return required;
- }
-
- /**
- * Returns the default value.
- */
- const char* getDefaultValue()
- {
- return defaultValue;
- }
-
- /**
- * Returns true if the attribute was handled.
- */
- bool isHandled()
- {
- return handled;
- }
-
-};
-
-}
-}
-
-#endif /* _OUSIA_XML_XML_ATTRIBUTE_HANDLER_HPP_ */
-
diff --git a/src/xml/XmlElementHandler.hpp b/src/xml/XmlElementHandler.hpp
deleted file mode 100644
index 5d35b36..0000000
--- a/src/xml/XmlElementHandler.hpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_XML_XML_ELEMENT_HANDLER_HPP_
-#define _OUSIA_XML_XML_ELEMENT_HANDLER_HPP_
-
-#include <functional>
-
-namespace ousia {
-namespace xml {
-
-/**
- * Structure used internally for representing a function that is capable of
- * handling a certain xml element tag.
- */
-class XmlElementHandler {
-
-private:
- /**
- * Name of the XML element the handler is capable of handling.
- */
- const char *name;
-
- /**
- * Handler function.
- */
- std::function<bool()> handler;
-
- /**
- * Counter that can be used in order to realize elements that may only
- * appear a certain number of times.
- */
- int count;
-
- /**
- * Contains the current count of matches. Contains the maximum count a
- * certain element must appear. If -1 the element may appear a unlimited
- * number of times.
- */
- int maxCount;
-
- /**
- * A certain other handler this one depends on (the other element must have
- * appeared at least once in order for this handler to match). If set to
- * nullptr no requirement relationship is established.
- */
- const XmlElementHandler *requiredElement;
-
-public:
-
- /**
- * Constructor of the XmlElementHandler structure.
- */
- XmlElementHandler(const char *name, const std::function<bool()> &handler,
- int maxCount = -1, const XmlElementHandler *requiredElement = nullptr) :
- name(name), handler(handler), count(0), maxCount(maxCount),
- requiredElement(requiredElement)
- {
- // Do nothing here
- }
-
- /**
- * Returns the name of the handler.
- */
- const char* getName() const
- {
- return name;
- }
-
- /**
- * Returns true if this handler is currently valid.
- */
- bool valid() const
- {
- return ((maxCount < 0) || (count < maxCount))
- && (!requiredElement || (requiredElement->count > 0));
- }
-
- /**
- * Returns true if this handler matches the current state of the given
- * QXmlStreamReader.
- */
- template<typename StrType>
- bool matches(const StrType &tagName) const
- {
- return valid() && (tagName == name);
- }
-
- /**
- * Executes the given handler.
- */
- bool execute()
- {
- count++;
- return handler();
- }
-
- /**
- * Function which assembles a string containing the names of the expected
- * element types. Used for displaying error messages.
- */
- static std::string expectedElementsStr(const std::vector<XmlElementHandler> &handlers)
- {
- // Calculate a list of valid element handlers
- std::vector<const XmlElementHandler*> validHandlers;
- for (auto &h : handlers) {
- if (h.valid()) {
- validHandlers.push_back(&h);
- }
- }
-
- // Assemble the string containing the list of expected elements
- std::stringstream ss;
- bool first = true;
- for (auto &h : validHandlers) {
- if (!first) {
- ss << ", ";
- }
- ss << h->getName();
- first = false;
- }
- return ss.str();
- }
-
-};
-
-}
-}
-
-#endif /* _OUSIA_XML_XML_ELEMENT_HANDLER_HPP_ */
-
diff --git a/src/xml/XmlReader.cpp b/src/xml/XmlReader.cpp
deleted file mode 100644
index 06090d2..0000000
--- a/src/xml/XmlReader.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <QXmlStreamReader>
-
-#include <functional>
-#include <iostream>
-#include <sstream>
-
-#include "XmlAttributeHandler.hpp"
-#include "XmlElementHandler.hpp"
-#include "XmlReader.hpp"
-
-namespace ousia {
-namespace xml {
-
-XmlReader::XmlReader(QXmlStreamReader &xml) :
- xml(xml)
-{
- // Do nothing here
-}
-
-bool XmlReader::expectOneOf(std::vector<XmlElementHandler> &handlers)
-{
- // Skip all tokens except for "start element" and "end element"
- while (!xml.atEnd()) {
- // TODO: Implement mechanism for using the current state of the
- // XmlStreamReader instead of always reading the next token?
- const auto tokenType = xml.readNext();
- switch (tokenType) {
- case QXmlStreamReader::StartElement:
- for (auto &h : handlers) {
- if (h.matches(xml.name())) {
- return h.execute();
- }
- }
- // Expected tag was not found, display error message
- // TODO: Use better logging mechanism!
- std::cout << "Expected one of the following tags: ("
- << XmlElementHandler::expectedElementsStr(handlers)
- << "); but found element \""
- << xml.name().toString().toStdString()
- << "\" instead!" << std::endl;
- return false;
- /* This is Benjamins noob way of handling things: We just ignore them.
- case QXmlStreamReader::EndElement:
- // Expected tag was not found, instead we found a closing tag!
- // TODO: Use better logging mechanism!
- std::cout << "Expected one of the following tags: ("
- << XmlElementHandler::expectedElementsStr(handlers)
- << "); but found end of element \""
- << xml.name().toString().toStdString()
- << "\" instead!" << std::endl;
- return false;*/
- default:
- continue;
- }
- }
- return false;
-}
-
-bool XmlReader::parseArguments(std::map<std::string, XmlAttributeHandler> &handlers)
-{
- // Iterate the attributes of the current xml node
- for (auto &attr : xml.attributes()) {
- // Convert the name to a std string
- const std::string name = attr.name().toString().toStdString();
- const std::string value = attr.value().toString().toStdString();
-
- // Try to fetch a corresponding attribute in the handlers map
- auto it = handlers.find(name);
- if (it != handlers.end()) {
- XmlAttributeHandler &handler = (*it).second;
- if (handler.isValid(value)) {
- handler.executeSettter(value);
- } else {
- std::cout << "Invalid attribute value \"" << value
- << "\" for attribute " << name << std::endl;
- return false;
- }
- } else {
- std::cout << "Unexpected attribute " << name << std::endl;
- return false;
- }
- }
-
- // Iterate over all handlers to check whether all required handlers have
- // been handled and in order to pass the default value to unhandled handlers
- for (auto &it : handlers) {
- // Fetch the name of the attribute and the handler
- const std::string &name = it.first;
- XmlAttributeHandler &handler = it.second;
- if (!handler.isHandled()) {
- if (handler.isRequired()) {
- std::cout << "Attribute " << name
- << " is required but was not set!" << std::endl;
- return false;
- } else if (handler.getDefaultValue()) {
- handler.executeSettter(handler.getDefaultValue());
- }
- }
- }
-
- return true;
-}
-
-std::shared_ptr<model::GraphNode> XmlReader::process()
-{
- std::shared_ptr<model::GraphNode> res{nullptr};
- std::vector<XmlElementHandler> handlers{
- {"domain", [&](){return (res = this->readDomain()) != nullptr;}}
- };
- if (!expectOneOf(handlers)) {
- std::cout << "Errors occured while parsing XML file!" << std::endl;
- return nullptr;
- }
- return res;
-}
-
-std::shared_ptr<model::domain::Domain> XmlReader::readDomain()
-{
- std::shared_ptr<model::domain::Domain> res{new model::domain::Domain()};
- std::map<std::string, XmlAttributeHandler> handlers{
- std::make_pair("name", XmlAttributeHandler(
- true,
- [&](const std::string& v) -> bool {return true;},
- [&](const std::string& v) -> void {res->setName(v);}
- ))
- };
- if (!parseArguments(handlers)) {
- std::cout << "Errors while parsing arguments for domain node!" << std::endl;
- return nullptr;
- }
- std::cout << res->getName() << std::endl;
- return res;
-}
-
-}
-}
-
diff --git a/src/xml/XmlReader.hpp b/src/xml/XmlReader.hpp
deleted file mode 100644
index f9b949b..0000000
--- a/src/xml/XmlReader.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- Ousía
- Copyright (C) 2014 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _OUSIA_XML_XML_READER_HPP_
-#define _OUSIA_XML_XML_READER_HPP_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <model/GraphNode.hpp>
-#include <model/domain/Domain.hpp>
-
-class QXmlStreamReader;
-
-namespace ousia {
-namespace xml {
-
-class XmlElementHandler;
-class XmlAttributeHandler;
-
-/**
- * The XmlReader class is responsible for parsing the ousia XML documents and
- * deserializing them into the internal object representation.
- */
-class XmlReader {
-
-private:
- /**
- * Reference to the QXmlStreamReader used for accessing the XML data on a
- * token basis.
- */
- QXmlStreamReader &xml;
-
- /**
- * Parses a domain definition from the XML file.
- */
- std::shared_ptr<model::domain::Domain> readDomain();
-
- /**
- * Used internally in order to conveniently expect one xml tag in a set of
- * elements. Returns true if there was an error while waiting for the tag,
- * false otherwise.
- */
- bool expectOneOf(std::vector<XmlElementHandler> &handlers);
-
- /**
- * Used internally to parse the current argument map.
- */
- bool parseArguments(std::map<std::string, XmlAttributeHandler> &handlers);
-
-public:
-
- /**
- * Instanciates the XMLReader class for the given instance of the
- * QXMLStreamReader class.
- */
- XmlReader(QXmlStreamReader &xml);
-
- /**
- * Starts processing the xml and returns the generated graph node.
- */
- std::shared_ptr<model::GraphNode> process();
-
-};
-
-}
-}
-
-#endif /* _OUSIA_XML_XML_READER_HPP_ */
-