summaryrefslogtreecommitdiff
path: root/src/core/model/Syntax.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-03-31 23:39:10 +0200
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2016-04-25 22:19:27 +0200
commit648aa3b32fb75ced3a02bc32900901c4f33fb8be (patch)
treeb32b24bc7c2e6e22cf610e175b8fc506fa73938a /src/core/model/Syntax.hpp
parentd383fef02412829c2d2212a9b486f20bae89eacb (diff)
Add equals and smaller than operator to SyntaxDescriptor (for std::sort or the use in std::set)
Diffstat (limited to 'src/core/model/Syntax.hpp')
-rw-r--r--src/core/model/Syntax.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/model/Syntax.hpp b/src/core/model/Syntax.hpp
index 97a2995..91b2226 100644
--- a/src/core/model/Syntax.hpp
+++ b/src/core/model/Syntax.hpp
@@ -158,6 +158,29 @@ struct SyntaxDescriptor {
}
/**
+ * Equality operator, returns true if the two SyntaxDescriptor instances
+ * are exactly equal.
+ *
+ * @param o1 is the first syntax descriptor for the comparison.
+ * @param o2 is the second syntax descriptor for the comparison.
+ * @return true if the two syntax descriptors equal, false otherwise.
+ */
+ friend bool operator==(const SyntaxDescriptor &o1,
+ const SyntaxDescriptor &o2);
+
+ /**
+ * Orders two SyntaxDescriptor instances by their depth, open, close and
+ * shortForm TokenId and the descriptor pointer. Additionally,
+ * SyntaxDescriptors belonging to FieldDescriptors are prefered.
+ *
+ * @param o1 is the first syntax descriptor for the comparison.
+ * @param o2 is the second syntax descriptor for the comparison.
+ * @return true if o1 is should be ordered before o2.
+ */
+ friend bool operator<(const SyntaxDescriptor &o1,
+ const SyntaxDescriptor &o2);
+
+ /**
* Inserts all tokens referenced in this SyntaxDescriptor into the
* given TokenSet. Skips token ids set to Tokens::Empty.
*