summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/RangeSet.cpp32
-rw-r--r--src/core/RangeSet.hpp8
-rw-r--r--src/core/common/Variant.hpp2
-rw-r--r--src/core/model/Domain.hpp13
4 files changed, 41 insertions, 14 deletions
diff --git a/src/core/RangeSet.cpp b/src/core/RangeSet.cpp
new file mode 100644
index 0000000..c07dc9b
--- /dev/null
+++ b/src/core/RangeSet.cpp
@@ -0,0 +1,32 @@
+/*
+ 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 "RangeSet.hpp"
+
+namespace ousia {
+
+static Cardinality createAny()
+{
+ Cardinality any;
+ any.merge(Range<size_t>::typeRangeFrom(0));
+ return std::move(any);
+}
+
+const Cardinality AnyCardinality = createAny();
+}
+
diff --git a/src/core/RangeSet.hpp b/src/core/RangeSet.hpp
index fc0070f..f5b56e2 100644
--- a/src/core/RangeSet.hpp
+++ b/src/core/RangeSet.hpp
@@ -19,6 +19,7 @@
#ifndef _OUSIA_RANGE_SET_HPP_
#define _OUSIA_RANGE_SET_HPP_
+#include <cstddef>
#include <limits>
#include <set>
@@ -412,6 +413,13 @@ public:
return !(lhs == rhs);
}
};
+
+/**
+ * This is the default cardinality.
+ */
+using Cardinality = RangeSet<size_t>;
+extern const Cardinality AnyCardinality;
+
}
#endif /* _OUSIA_RANGE_SET_HPP_ */
diff --git a/src/core/common/Variant.hpp b/src/core/common/Variant.hpp
index 103c0e7..3c78ccd 100644
--- a/src/core/common/Variant.hpp
+++ b/src/core/common/Variant.hpp
@@ -113,7 +113,7 @@ public:
using arrayType = std::vector<Variant>;
using mapType = std::map<std::string, Variant>;
using objectType = Rooted<Managed>;
- using cardinalityType = RangeSet<size_t>;
+ using cardinalityType = Cardinality;
using rangeType = Range<size_t>;
using functionType = std::shared_ptr<Function>;
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp
index cd649d5..7704d36 100644
--- a/src/core/model/Domain.hpp
+++ b/src/core/model/Domain.hpp
@@ -616,19 +616,6 @@ public:
*/
/**
- * This is the default cardinality.
- */
-
-static Variant::cardinalityType createAny()
-{
- Variant::cardinalityType any;
- any.merge(Range<size_t>::typeRangeFrom(0));
- return std::move(any);
-}
-
-static const Variant AnyCardinality = createAny();
-
-/**
* A StructuredClass specifies nodes in the StructureTree of a document that
* implements this domain. For more information on the StructureTree please
* consult the Header documentation above.