From 9ae327e91b1c3b846bd5f0407a4edbae5b3032f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz> Date: Sat, 22 Feb 2014 17:58:56 +0100 Subject: [PATCH] RegExp: const getter versions --- alib/src/regexp/Alternation.cpp | 4 ++++ alib/src/regexp/Alternation.h | 5 +++++ alib/src/regexp/Concatenation.cpp | 4 ++++ alib/src/regexp/Concatenation.h | 5 +++++ alib/src/regexp/Iteration.cpp | 4 ++++ alib/src/regexp/Iteration.h | 5 +++++ alib/src/regexp/RegExp.cpp | 4 ++++ alib/src/regexp/RegExp.h | 6 ++++++ 8 files changed, 37 insertions(+) diff --git a/alib/src/regexp/Alternation.cpp b/alib/src/regexp/Alternation.cpp index 125fc0b5c0..23e5ed7409 100644 --- a/alib/src/regexp/Alternation.cpp +++ b/alib/src/regexp/Alternation.cpp @@ -46,6 +46,10 @@ list<RegExpElement*>& Alternation::getElements() { return elements; } +const list<RegExpElement*>& Alternation::getElements() const { + return elements; +} + RegExpElement* Alternation::clone() const { return new Alternation(*this); } diff --git a/alib/src/regexp/Alternation.h b/alib/src/regexp/Alternation.h index ab414c41dd..20c154d766 100644 --- a/alib/src/regexp/Alternation.h +++ b/alib/src/regexp/Alternation.h @@ -33,6 +33,11 @@ public: */ list<RegExpElement*>& getElements(); + /** + * @return list of operands + */ + const list<RegExpElement*>& getElements() const; + /** * @copydoc RegExpElement::clone() const */ diff --git a/alib/src/regexp/Concatenation.cpp b/alib/src/regexp/Concatenation.cpp index adadd7b1e1..983e1e2e6b 100644 --- a/alib/src/regexp/Concatenation.cpp +++ b/alib/src/regexp/Concatenation.cpp @@ -46,6 +46,10 @@ list<RegExpElement*>& Concatenation::getElements() { return elements; } +const list<RegExpElement*>& Concatenation::getElements() const { + return elements; +} + RegExpElement* Concatenation::clone() const { return new Concatenation(*this); } diff --git a/alib/src/regexp/Concatenation.h b/alib/src/regexp/Concatenation.h index 38905280fd..4df5512342 100644 --- a/alib/src/regexp/Concatenation.h +++ b/alib/src/regexp/Concatenation.h @@ -33,6 +33,11 @@ public: */ list<RegExpElement*>& getElements(); + /** + * @return list of operands + */ + const list<RegExpElement*>& getElements() const; + /** * @copydoc RegExpElement::clone() const */ diff --git a/alib/src/regexp/Iteration.cpp b/alib/src/regexp/Iteration.cpp index 8092c0a208..8126596a4c 100644 --- a/alib/src/regexp/Iteration.cpp +++ b/alib/src/regexp/Iteration.cpp @@ -53,6 +53,10 @@ RegExpElement* Iteration::getElement() { return element; } +const RegExpElement* Iteration::getElement() const { + return element; +} + void Iteration::setElement(RegExpElement* element) { this->element = element; } diff --git a/alib/src/regexp/Iteration.h b/alib/src/regexp/Iteration.h index 402cc32dbb..7f5c23cbb0 100644 --- a/alib/src/regexp/Iteration.h +++ b/alib/src/regexp/Iteration.h @@ -33,6 +33,11 @@ public: */ RegExpElement* getElement(); + /** + * @return element to iterate + */ + const RegExpElement* getElement() const; + /** * Sets the element to iterate. Doesn't perform the copy, just stores the pointer! * @param element RegExpElement to set diff --git a/alib/src/regexp/RegExp.cpp b/alib/src/regexp/RegExp.cpp index e8eb6ed7c8..5730a96c30 100644 --- a/alib/src/regexp/RegExp.cpp +++ b/alib/src/regexp/RegExp.cpp @@ -62,6 +62,10 @@ RegExpElement* RegExp::getRegExp() { return regExp; } +const RegExpElement* RegExp::getRegExp() const { + return regExp; +} + void RegExp::setRegExp(RegExpElement* regExp) { this->regExp = regExp; } diff --git a/alib/src/regexp/RegExp.h b/alib/src/regexp/RegExp.h index 61f85a6120..19f25308bc 100644 --- a/alib/src/regexp/RegExp.h +++ b/alib/src/regexp/RegExp.h @@ -12,6 +12,7 @@ #include <list> #include <string> #include "RegExpElement.h" +#include "RegExpEmpty.h" namespace regexp { @@ -42,6 +43,11 @@ public: */ RegExpElement* getRegExp(); + /** + * @return Root node of the regular expression tree + */ + const RegExpElement* getRegExp() const; + /** * Sets the root node of the regular expression tree. Doesn't perform copy of the regExp param, * just stores it! -- GitLab