From 1a61f9a0d551c32d405ae9fce763fd1ff98c36b0 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Mon, 7 Apr 2014 17:19:01 +0200
Subject: [PATCH] rename visitor

---
 alib2/src/regexp/Alternation.h                |  2 +-
 alib2/src/regexp/Concatenation.h              |  2 +-
 alib2/src/regexp/Iteration.h                  |  2 +-
 alib2/src/regexp/RegExp.h                     |  4 +--
 alib2/src/regexp/RegExpElement.h              |  4 +--
 alib2/src/regexp/RegExpEmpty.h                |  2 +-
 alib2/src/regexp/RegExpEpsilon.h              |  2 +-
 alib2/src/regexp/RegExpSymbol.h               |  2 +-
 alib2/src/regexp/RegExpToXMLPrinter.cpp       | 12 ++++-----
 alib2/src/regexp/RegExpToXMLPrinter.h         |  8 +++---
 .../src/{aux/Visitor.hpp => std/visitor.hpp}  | 25 ++++++++-----------
 11 files changed, 31 insertions(+), 34 deletions(-)
 rename alib2/src/{aux/Visitor.hpp => std/visitor.hpp} (66%)

diff --git a/alib2/src/regexp/Alternation.h b/alib2/src/regexp/Alternation.h
index 0a80ba99f0..70bcc6d0c8 100644
--- a/alib2/src/regexp/Alternation.h
+++ b/alib2/src/regexp/Alternation.h
@@ -19,7 +19,7 @@ using namespace std;
  * Represents alternation operator in the regular expression. Contains list of RegExpElement
  * as operands of the operator.
  */
-class Alternation: public RegExpElement, public aux::Element<Alternation, RegExpElement::ElementAux::visitor_type> {
+class Alternation: public RegExpElement, public std::element<Alternation, RegExpElement::visitor_type> {
 private:
 	list<RegExpElement*> elements;
 public:
diff --git a/alib2/src/regexp/Concatenation.h b/alib2/src/regexp/Concatenation.h
index 523ad486b2..b56e4f658a 100644
--- a/alib2/src/regexp/Concatenation.h
+++ b/alib2/src/regexp/Concatenation.h
@@ -19,7 +19,7 @@ using namespace std;
  * Represents concatenation operator in the regular expression. Contains list of RegExpElement
  * as operands of the operator.
  */
-class Concatenation: public RegExpElement, public aux::Element<Concatenation, RegExpElement::ElementAux::visitor_type> {
+class Concatenation: public RegExpElement, public std::element<Concatenation, RegExpElement::visitor_type> {
 private:
 	list<RegExpElement*> elements;
 public:
diff --git a/alib2/src/regexp/Iteration.h b/alib2/src/regexp/Iteration.h
index 615b50b4d9..a21e61fc84 100644
--- a/alib2/src/regexp/Iteration.h
+++ b/alib2/src/regexp/Iteration.h
@@ -19,7 +19,7 @@ using namespace std;
  * Represents iteration operator in the regular expression. Contains one RegExpElement
  * as operand.
  */
-class Iteration: public RegExpElement, public aux::Element<Iteration, RegExpElement::ElementAux::visitor_type> {
+class Iteration: public RegExpElement, public std::element<Iteration, RegExpElement::visitor_type> {
 private:
 	RegExpElement* element;
 public:
diff --git a/alib2/src/regexp/RegExp.h b/alib2/src/regexp/RegExp.h
index f804169c6d..e6fd443b50 100644
--- a/alib2/src/regexp/RegExp.h
+++ b/alib2/src/regexp/RegExp.h
@@ -13,7 +13,7 @@
 #include <string>
 #include "RegExpElement.h"
 #include "RegExpEmpty.h"
-#include "../aux/Visitor.hpp"
+#include "../std/visitor.hpp"
 
 namespace regexp {
 
@@ -23,7 +23,7 @@ using namespace std;
  * Represents regular expression parsed from the XML. Regular expression is stored
  * as a tree of RegExpElement.
  */
-class RegExp : public aux::Element<RegExp, aux::Visitor<RegExp> > {
+class RegExp : public std::element<RegExp, std::visitor<RegExp> > {
 private:
 	RegExpElement* regExp;
 
diff --git a/alib2/src/regexp/RegExpElement.h b/alib2/src/regexp/RegExpElement.h
index ea6e27469f..57eb5990a8 100644
--- a/alib2/src/regexp/RegExpElement.h
+++ b/alib2/src/regexp/RegExpElement.h
@@ -8,7 +8,7 @@
 #ifndef REGEXPELEMENT_H_
 #define REGEXPELEMENT_H_
 
-#include "../aux/Visitor.hpp"
+#include "../std/visitor.hpp"
 
 namespace regexp {
 
@@ -25,7 +25,7 @@ class RegExpEpsilon;
 /**
  * Abstract class representing element in the regular expression. Can be operator or symbol.
  */
-class RegExpElement : virtual public aux::ElementAux<aux::Visitor<Alternation, Concatenation, Iteration, RegExpSymbol, RegExpEmpty, RegExpEpsilon> > {
+class RegExpElement : virtual public std::elementAux<std::visitor<Alternation, Concatenation, Iteration, RegExpSymbol, RegExpEmpty, RegExpEpsilon> > {
 public:
 	virtual ~RegExpElement();
 
diff --git a/alib2/src/regexp/RegExpEmpty.h b/alib2/src/regexp/RegExpEmpty.h
index 50746318f3..a9671e70a1 100644
--- a/alib2/src/regexp/RegExpEmpty.h
+++ b/alib2/src/regexp/RegExpEmpty.h
@@ -17,7 +17,7 @@ using namespace std;
 /**
  * Represents empty regular expression in the regular expression.
  */
-class RegExpEmpty: public RegExpElement, public aux::Element<RegExpEmpty, RegExpElement::ElementAux::visitor_type> {
+class RegExpEmpty: public RegExpElement, public std::element<RegExpEmpty, RegExpElement::visitor_type> {
 public:
 	RegExpEmpty();
 
diff --git a/alib2/src/regexp/RegExpEpsilon.h b/alib2/src/regexp/RegExpEpsilon.h
index 89a9a4763b..6821472c10 100644
--- a/alib2/src/regexp/RegExpEpsilon.h
+++ b/alib2/src/regexp/RegExpEpsilon.h
@@ -19,7 +19,7 @@ using namespace alphabet;
 /**
  * Represents epsilon in the regular expression.
  */
-class RegExpEpsilon: public RegExpElement, public aux::Element<RegExpEpsilon, RegExpElement::ElementAux::visitor_type> {
+class RegExpEpsilon: public RegExpElement, public std::element<RegExpEpsilon, RegExpElement::visitor_type> {
 public:
 	RegExpEpsilon();
 
diff --git a/alib2/src/regexp/RegExpSymbol.h b/alib2/src/regexp/RegExpSymbol.h
index b733950b9d..1d617700d7 100644
--- a/alib2/src/regexp/RegExpSymbol.h
+++ b/alib2/src/regexp/RegExpSymbol.h
@@ -20,7 +20,7 @@ using namespace alphabet;
 /**
  * Represents symbol in the regular expression. Contains name of the symbol.
  */
-class RegExpSymbol : public RegExpElement, public aux::Element<RegExpSymbol, RegExpElement::ElementAux::visitor_type> {
+class RegExpSymbol : public RegExpElement, public std::element<RegExpSymbol, RegExpElement::visitor_type> {
 	string symbol;
 public:
 	RegExpSymbol();
diff --git a/alib2/src/regexp/RegExpToXMLPrinter.cpp b/alib2/src/regexp/RegExpToXMLPrinter.cpp
index a5f7fc2b66..aaa76d058f 100644
--- a/alib2/src/regexp/RegExpToXMLPrinter.cpp
+++ b/alib2/src/regexp/RegExpToXMLPrinter.cpp
@@ -15,17 +15,17 @@ RegExpToXMLPrinter::RegExpToXMLPrinter(ostream& out) : m_Out(out) {
 
 }
 
-void RegExpToXMLPrinter::Visit(const aux::ElementAux<RegExp::visitor_type>& regexp) {
+void RegExpToXMLPrinter::Visit(const std::elementAux<RegExp::visitor_type>& regexp) {
 	m_Out << "<regexp>" << endl;
 	regexp.Accept(*this);
 	m_Out << "</regexp>" << endl;
 }
 
-void RegExpToXMLPrinter::Visit(const aux::ElementAux<RegExpElement::visitor_type>& element) {
+void RegExpToXMLPrinter::Visit(const std::elementAux<RegExpElement::visitor_type>& element) {
 	element.Accept(*this);
 }
 
-void RegExpToXMLPrinter::Visit(const list<aux::ElementAux<RegExpElement::visitor_type>*>& content) {
+void RegExpToXMLPrinter::Visit(const list<std::elementAux<RegExpElement::visitor_type>*>& content) {
 	for (auto element : content) {
 		element->Accept(*this);
 	}
@@ -34,7 +34,7 @@ void RegExpToXMLPrinter::Visit(const list<aux::ElementAux<RegExpElement::visitor
 void RegExpToXMLPrinter::Visit(const Alternation& alternation) {
 	m_Out << "<alternation>" << endl;
 	for (auto element : alternation.getElements()) {
-		aux::ElementAux<RegExpElement::visitor_type>& object = static_cast<aux::ElementAux<RegExpElement::visitor_type>&>(*element);
+		std::elementAux<RegExpElement::visitor_type>& object = static_cast<std::elementAux<RegExpElement::visitor_type>&>(*element);
 		object.Accept(*this);
 	}
 	m_Out << "</alternation>" << endl;
@@ -43,7 +43,7 @@ void RegExpToXMLPrinter::Visit(const Alternation& alternation) {
 void RegExpToXMLPrinter::Visit(const Concatenation& concatenation) {
 	m_Out <<"<concatenation>" << endl;
 	for (auto element : concatenation.getElements()) {
-		aux::ElementAux<RegExpElement::visitor_type>& object = static_cast<aux::ElementAux<RegExpElement::visitor_type>&>(*element);
+		std::elementAux<RegExpElement::visitor_type>& object = static_cast<std::elementAux<RegExpElement::visitor_type>&>(*element);
 		object.Accept(*this);
 	}
 	m_Out <<"</concatenation>" << endl;
@@ -52,7 +52,7 @@ void RegExpToXMLPrinter::Visit(const Concatenation& concatenation) {
 
 void RegExpToXMLPrinter::Visit(const Iteration& iteration) {
 	m_Out << "<iteration>" << endl;
-	const aux::ElementAux<RegExpElement::visitor_type>& object = static_cast<const aux::ElementAux<RegExpElement::visitor_type>&>(*iteration.getElement());
+	const std::elementAux<RegExpElement::visitor_type>& object = static_cast<const std::elementAux<RegExpElement::visitor_type>&>(*iteration.getElement());
 	object.Accept(*this);
 	m_Out << "</iteration>" << endl;
 }
diff --git a/alib2/src/regexp/RegExpToXMLPrinter.h b/alib2/src/regexp/RegExpToXMLPrinter.h
index 0fdd2901ed..c2e634c3b4 100644
--- a/alib2/src/regexp/RegExpToXMLPrinter.h
+++ b/alib2/src/regexp/RegExpToXMLPrinter.h
@@ -11,7 +11,7 @@
 #include <ostream>
 #include "RegExp.h"
 #include "RegExpElements.h"
-#include "../aux/Visitor.hpp"
+#include "../std/visitor.hpp"
 
 namespace regexp {
 
@@ -23,7 +23,7 @@ using namespace std;
 class RegExpToXMLPrinter : public RegExp::visitor_type, public RegExpElement::visitor_type {
 	static const string c_Indentation;
 
-	void Visit(const list<aux::ElementAux<RegExpElement::visitor_type>*>& content);
+	void Visit(const list<std::elementAux<RegExpElement::visitor_type>*>& content);
 
 	ostream& m_Out;
 
@@ -44,8 +44,8 @@ public:
 	 * @param regexp RegExp to print
 	 * @param out output stream to which print the RegExp
 	 */
-	void Visit(const aux::ElementAux<RegExp::visitor_type>& regexp);
-	void Visit(const aux::ElementAux<RegExpElement::visitor_type>& element);
+	void Visit(const std::elementAux<RegExp::visitor_type>& regexp);
+	void Visit(const std::elementAux<RegExpElement::visitor_type>& element);
 };
 
 } /* namespace regexp */
diff --git a/alib2/src/aux/Visitor.hpp b/alib2/src/std/visitor.hpp
similarity index 66%
rename from alib2/src/aux/Visitor.hpp
rename to alib2/src/std/visitor.hpp
index 394584b12e..f2764c9843 100644
--- a/alib2/src/aux/Visitor.hpp
+++ b/alib2/src/std/visitor.hpp
@@ -10,48 +10,45 @@
 
 #include <tuple>
 
-namespace aux {
+namespace std {
 
 // Visitor template declaration
 template<typename... Types>
-class Visitor;
+class visitor;
 
 // specialization for single type    
 template<typename T>
-class Visitor<T> {
+class visitor<T> {
 public:
     virtual void Visit(const T & visitable) = 0;
 };
 
 // specialization for multiple types
 template<typename T, typename... Types>
-class Visitor<T, Types...> : public Visitor<Types...> {
+class visitor<T, Types...> : public visitor<Types...> {
 public:
     // promote the function(s) from the base class
-    using Visitor<Types...>::Visit;
+    using visitor<Types...>::Visit;
 
     virtual void Visit(const T & visitable) = 0;
 };
 
-
-
-
-template<typename VisitorTypes>
-class ElementAux {
+template<typename VisitorType>
+class elementAux {
 public:
-    typedef VisitorTypes visitor_type;
+    typedef VisitorType visitor_type;
     
-    virtual void Accept(VisitorTypes& visitor) const = 0;
+    virtual void Accept(VisitorType& visitor) const = 0;
 };
 
 template<typename Derived, typename VisitorType>
-class Element : virtual public ElementAux<VisitorType> {
+class element : virtual public elementAux<VisitorType> {
 public:
     virtual void Accept(VisitorType& visitor) const {
         visitor.Visit(static_cast<const Derived&>(*this));
     }
 };
 
-} /* namespace aux */
+} /* namespace std */
 
 #endif /* VISITOR_H_ */
\ No newline at end of file
-- 
GitLab