From 3cfd37120454d11264a44e2f4a6981dbe11ffa02 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 9 Apr 2014 22:21:22 +0200 Subject: [PATCH] reformat --- alib2/src/AlibException.cpp | 2 +- alib2/src/AlibException.h | 17 ++++++------ alib2/src/alphabet/Epsilon.cpp | 4 +-- alib2/src/alphabet/Epsilon.h | 4 ++- alib2/src/alphabet/Symbol.cpp | 4 +-- alib2/src/alphabet/Symbol.h | 5 ++-- alib2/src/factory/RegExpFactory.cpp | 20 +++++++------- alib2/src/factory/RegExpFactory.h | 18 ++++++------- alib2/src/regexp/Alternation.cpp | 15 ++++++----- alib2/src/regexp/Alternation.h | 13 +++++---- alib2/src/regexp/Concatenation.cpp | 10 +++---- alib2/src/regexp/Concatenation.h | 13 +++++---- alib2/src/regexp/Iteration.cpp | 4 +-- alib2/src/regexp/Iteration.h | 7 +++-- alib2/src/regexp/RegExp.cpp | 8 +++--- alib2/src/regexp/RegExp.h | 13 +++++---- alib2/src/regexp/RegExpElement.cpp | 4 +-- alib2/src/regexp/RegExpElement.h | 16 +++++------ alib2/src/regexp/RegExpElements.h | 10 +++---- alib2/src/regexp/RegExpEmpty.cpp | 5 ++-- alib2/src/regexp/RegExpEmpty.h | 13 +++++---- alib2/src/regexp/RegExpEpsilon.cpp | 4 +-- alib2/src/regexp/RegExpEpsilon.h | 14 +++++----- alib2/src/regexp/RegExpFromXMLParser.cpp | 22 +++++++-------- alib2/src/regexp/RegExpFromXMLParser.h | 24 ++++++++--------- alib2/src/regexp/RegExpSymbol.cpp | 10 +++---- alib2/src/regexp/RegExpSymbol.h | 23 ++++++++-------- alib2/src/regexp/RegExpToXMLPrinter.cpp | 34 +++++++++++------------- alib2/src/regexp/RegExpToXMLPrinter.h | 10 +++---- alib2/src/sax/ParserException.cpp | 3 ++- alib2/src/sax/ParserException.h | 11 ++++---- alib2/src/sax/SaxInterface.cpp | 25 +++++++---------- alib2/src/sax/SaxInterface.h | 15 +++++------ alib2/src/sax/Token.cpp | 6 ++--- alib2/src/sax/Token.h | 16 +++++------ alib2/src/std/type_traits.hpp | 11 ++++++-- alib2/src/std/variant.hpp | 8 ++++-- alib2/src/std/visitor.hpp | 1 + 38 files changed, 217 insertions(+), 225 deletions(-) diff --git a/alib2/src/AlibException.cpp b/alib2/src/AlibException.cpp index 3e6e35b633..054eb0c615 100644 --- a/alib2/src/AlibException.cpp +++ b/alib2/src/AlibException.cpp @@ -2,7 +2,7 @@ * AlibException.cpp * * Created on: Apr 1, 2013 - * Author: martin + * Author: Martin Zak */ #include "AlibException.h" diff --git a/alib2/src/AlibException.h b/alib2/src/AlibException.h index a22efddc47..5cef527fd5 100644 --- a/alib2/src/AlibException.h +++ b/alib2/src/AlibException.h @@ -2,29 +2,27 @@ * AlibException.h * * Created on: Apr 1, 2013 - * Author: martin + * Author: Martin Zak */ -#ifndef ALIBEXCEPTION_H_ -#define ALIBEXCEPTION_H_ +#ifndef ALIB_EXCEPTION_H_ +#define ALIB_EXCEPTION_H_ #include <exception> #include <string> namespace alib { -using namespace std; - /** * Basic exception from which are derived all other exceptions. * Contains reason why the exception occured. */ -class AlibException: public exception { +class AlibException : public std::exception { protected: - string cause; + std::string cause; public: AlibException(); - AlibException(const string& cause); + AlibException(const std::string& cause); virtual ~AlibException() throw (); /** @@ -39,4 +37,5 @@ public: }; } /* namespace alib */ -#endif /* ALIBEXCEPTION_H_ */ + +#endif /* ALIB_EXCEPTION_H_ */ diff --git a/alib2/src/alphabet/Epsilon.cpp b/alib2/src/alphabet/Epsilon.cpp index 22f884f597..a95b26c47a 100644 --- a/alib2/src/alphabet/Epsilon.cpp +++ b/alib2/src/alphabet/Epsilon.cpp @@ -27,8 +27,8 @@ bool Epsilon::operator !=(const Epsilon& other) const { std::ostream& operator<<(std::ostream& out, const Epsilon& symbol) { - out << "Epsilon"; + out << "(Epsilon)"; return out; } -} /* namespace language */ +} /* namespace alphabet */ diff --git a/alib2/src/alphabet/Epsilon.h b/alib2/src/alphabet/Epsilon.h index d36616d7ac..36add1b282 100644 --- a/alib2/src/alphabet/Epsilon.h +++ b/alib2/src/alphabet/Epsilon.h @@ -28,5 +28,7 @@ public: friend std::ostream& operator<<(std::ostream&, const Epsilon&); }; -} + +} /* namespace alphabet */ + #endif /* EPSILON_H_ */ diff --git a/alib2/src/alphabet/Symbol.cpp b/alib2/src/alphabet/Symbol.cpp index b16010e828..29215ae225 100644 --- a/alib2/src/alphabet/Symbol.cpp +++ b/alib2/src/alphabet/Symbol.cpp @@ -35,8 +35,8 @@ bool Symbol::operator !=(const Symbol& other) const { std::ostream& operator<<(std::ostream& out, const Symbol& symbol) { - out << "Symbol " << (symbol.symbol == "" ? "\\epsilon" : symbol.symbol); + out << "(Symbol " << symbol.symbol << ")"; return out; } -} /* namespace language */ +} /* namespace alphabet */ diff --git a/alib2/src/alphabet/Symbol.h b/alib2/src/alphabet/Symbol.h index 9b82e08a35..7bbe40df56 100644 --- a/alib2/src/alphabet/Symbol.h +++ b/alib2/src/alphabet/Symbol.h @@ -17,7 +17,6 @@ namespace alphabet { * Represents symbol in an alphabet. */ class Symbol { -protected: std::string symbol; public: /** @@ -38,5 +37,7 @@ public: friend std::ostream& operator<<(std::ostream&, const Symbol&); }; -} + +} /* namespace alphabet */ + #endif /* SYMBOL_H_ */ diff --git a/alib2/src/factory/RegExpFactory.cpp b/alib2/src/factory/RegExpFactory.cpp index 093a77e3a4..05196f5506 100644 --- a/alib2/src/factory/RegExpFactory.cpp +++ b/alib2/src/factory/RegExpFactory.cpp @@ -2,7 +2,7 @@ * RegExpFactory.cpp * * Created on: Jan 1, 2014 - * Author: martin + * Author: Martin Zak */ #include <iostream> @@ -13,28 +13,28 @@ namespace regexp { -RegExp RegExpFactory::fromFile(const string& filename) { - std::list<Token> tokens; - SaxInterface::parseFile(filename, tokens); +RegExp RegExpFactory::fromFile(const std::string& filename) { + std::list<sax::Token> tokens; + sax::SaxInterface::parseFile(filename, tokens); return parse(tokens); } -RegExp RegExpFactory::fromString(const string& str) { - list<Token> tokens; - SaxInterface::parseMemory(str, tokens); +RegExp RegExpFactory::fromString(const std::string& str) { + std::list<sax::Token> tokens; + sax::SaxInterface::parseMemory(str, tokens); return parse(tokens); } RegExp RegExpFactory::fromStdin() { - return RegExpFactory::fromStream(cin); + return RegExpFactory::fromStream(std::cin); } RegExp RegExpFactory::fromStream(std::istream& in) { - string input(istreambuf_iterator<char>(in), (istreambuf_iterator<char>())); + std::string input(std::istreambuf_iterator<char>(in), (std::istreambuf_iterator<char>())); return RegExpFactory::fromString(input); } -RegExp RegExpFactory::parse(list<sax::Token> tokens) { +RegExp RegExpFactory::parse(std::list<sax::Token> tokens) { RegExpFromXMLParser parser; return parser.parse(tokens); } diff --git a/alib2/src/factory/RegExpFactory.h b/alib2/src/factory/RegExpFactory.h index b9940207f6..84112c3c96 100644 --- a/alib2/src/factory/RegExpFactory.h +++ b/alib2/src/factory/RegExpFactory.h @@ -2,20 +2,17 @@ * RegExpFactory.h * * Created on: Jan 1, 2014 - * Author: martin + * Author: Martin Zak */ -#ifndef REGEXPFACTORY_H_ -#define REGEXPFACTORY_H_ +#ifndef REG_EXP_FACTORY_H_ +#define REG_EXP_FACTORY_H_ #include "../sax/Token.h" #include "../regexp/RegExp.h" namespace regexp { -using namespace std; -using namespace sax; - /** * RegExp builder. */ @@ -26,14 +23,14 @@ public: * @param filename path to the file * @return RegExp */ - static RegExp fromFile(const string& filename); + static RegExp fromFile(const std::string& filename); /** * Parses the XML and returns the RegExp. * @param str string containing the XML * @return RegExp */ - static RegExp fromString(const string& str); + static RegExp fromString(const std::string& str); /** * Parses the XML from stdin and returns the RegExp. @@ -53,8 +50,9 @@ protected: * @param tokens XML represented as list of tokens * @return parsed RegExp */ - static RegExp parse(list<Token> tokens); + static RegExp parse(std::list<sax::Token> tokens); }; } /* namespace regexp */ -#endif /* REGEXPFACTORY_H_ */ + +#endif /* REG_EXP_FACTORY_H_ */ diff --git a/alib2/src/regexp/Alternation.cpp b/alib2/src/regexp/Alternation.cpp index e3fd7b1508..8662f58403 100644 --- a/alib2/src/regexp/Alternation.cpp +++ b/alib2/src/regexp/Alternation.cpp @@ -2,7 +2,7 @@ * Alternation.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "Alternation.h" @@ -10,15 +10,16 @@ namespace regexp { Alternation::Alternation() { + } Alternation::Alternation(const Alternation& other) { - for (auto element : other.elements) { + for (const auto& element : other.elements) { elements.push_back(element->clone()); } } -Alternation& Alternation::operator =(const Alternation& other) { +Alternation& Alternation::operator=(const Alternation& other) { if (this == &other) { return *this; } @@ -28,7 +29,7 @@ Alternation& Alternation::operator =(const Alternation& other) { } elements.clear(); - for (auto element : other.elements) { + for (const auto& element : other.elements) { elements.push_back(element->clone()); } @@ -42,11 +43,11 @@ Alternation::~Alternation() { elements.clear(); } -list<RegExpElement*>& Alternation::getElements() { +std::list<RegExpElement*>& Alternation::getElements() { return elements; } -const list<RegExpElement*>& Alternation::getElements() const { +const std::list<RegExpElement*>& Alternation::getElements() const { return elements; } @@ -104,7 +105,7 @@ bool Alternation::operator==(const Alternation& other) const { return true; } -void Alternation::operator>>(ostream& out) const { +void Alternation::operator>>(std::ostream& out) const { out << "(Alternation"; for(const auto& e : getElements()) out << " " << *e; diff --git a/alib2/src/regexp/Alternation.h b/alib2/src/regexp/Alternation.h index a5e7b56b67..6b14f5bbd2 100644 --- a/alib2/src/regexp/Alternation.h +++ b/alib2/src/regexp/Alternation.h @@ -2,7 +2,7 @@ * Alternation.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #ifndef ALTERNATION_H_ @@ -13,15 +13,13 @@ namespace regexp { -using namespace std; - /** * Represents alternation operator in the regular expression. Contains list of RegExpElement * as operands of the operator. */ class Alternation: public RegExpElement, public std::element<Alternation, RegExpElement::visitor_type> { private: - list<RegExpElement*> elements; + std::list<RegExpElement*> elements; public: Alternation(); Alternation(const Alternation& other); @@ -31,12 +29,12 @@ public: /** * @return list of operands */ - list<RegExpElement*>& getElements(); + std::list<RegExpElement*>& getElements(); /** * @return list of operands */ - const list<RegExpElement*>& getElements() const; + const std::list<RegExpElement*>& getElements() const; /** * @copydoc RegExpElement::clone() const @@ -54,7 +52,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -73,4 +71,5 @@ public: }; } /* namespace regexp */ + #endif /* ALTERNATION_H_ */ diff --git a/alib2/src/regexp/Concatenation.cpp b/alib2/src/regexp/Concatenation.cpp index e2553fc756..a7f4138b28 100644 --- a/alib2/src/regexp/Concatenation.cpp +++ b/alib2/src/regexp/Concatenation.cpp @@ -2,7 +2,7 @@ * Concatenation.cpp * * Created on: Nov 27, 2013 - * Author: martin + * Author: Martin Zak */ #include "Concatenation.h" @@ -28,7 +28,7 @@ Concatenation& Concatenation::operator =(const Concatenation& other) { } elements.clear(); - for (auto element : other.elements) { + for (const auto& element : other.elements) { elements.push_back(element->clone()); } @@ -42,11 +42,11 @@ Concatenation::~Concatenation() { elements.clear(); } -list<RegExpElement*>& Concatenation::getElements() { +std::list<RegExpElement*>& Concatenation::getElements() { return elements; } -const list<RegExpElement*>& Concatenation::getElements() const { +const std::list<RegExpElement*>& Concatenation::getElements() const { return elements; } @@ -95,7 +95,7 @@ bool Concatenation::operator==(const Concatenation& other) const { return true; } -void Concatenation::operator>>(ostream& out) const { +void Concatenation::operator>>(std::ostream& out) const { out << "(Concatenation"; for(const auto& e : getElements()) out << " " << *e; diff --git a/alib2/src/regexp/Concatenation.h b/alib2/src/regexp/Concatenation.h index 03a3115fc5..3d52b41ef8 100644 --- a/alib2/src/regexp/Concatenation.h +++ b/alib2/src/regexp/Concatenation.h @@ -2,7 +2,7 @@ * Concatenation.h * * Created on: Nov 27, 2013 - * Author: martin + * Author: Martin Zak */ #ifndef CONCATENATION_H_ @@ -13,15 +13,13 @@ namespace regexp { -using namespace std; - /** * Represents concatenation operator in the regular expression. Contains list of RegExpElement * as operands of the operator. */ class Concatenation: public RegExpElement, public std::element<Concatenation, RegExpElement::visitor_type> { private: - list<RegExpElement*> elements; + std::list<RegExpElement*> elements; public: Concatenation(); Concatenation(const Concatenation& other); @@ -31,12 +29,12 @@ public: /** * @return list of operands */ - list<RegExpElement*>& getElements(); + std::list<RegExpElement*>& getElements(); /** * @return list of operands */ - const list<RegExpElement*>& getElements() const; + const std::list<RegExpElement*>& getElements() const; /** * @copydoc RegExpElement::clone() const @@ -53,7 +51,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -72,4 +70,5 @@ public: }; } /* namespace regexp */ + #endif /* CONCATENATION_H_ */ diff --git a/alib2/src/regexp/Iteration.cpp b/alib2/src/regexp/Iteration.cpp index 6bd9f31625..436b3eaca3 100644 --- a/alib2/src/regexp/Iteration.cpp +++ b/alib2/src/regexp/Iteration.cpp @@ -2,7 +2,7 @@ * Iteration.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "Iteration.h" @@ -93,7 +93,7 @@ bool Iteration::operator==(const Iteration& other) const { return *(this->element) == *(other.element); } -void Iteration::operator>>(ostream& out) const { +void Iteration::operator>>(std::ostream& out) const { out << "(RegExpIteration " << *element << ")"; } diff --git a/alib2/src/regexp/Iteration.h b/alib2/src/regexp/Iteration.h index 097e249b17..09617598a8 100644 --- a/alib2/src/regexp/Iteration.h +++ b/alib2/src/regexp/Iteration.h @@ -2,7 +2,7 @@ * Iteration.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #ifndef ITERATION_H_ @@ -13,8 +13,6 @@ namespace regexp { -using namespace std; - /** * Represents iteration operator in the regular expression. Contains one RegExpElement * as operand. @@ -61,7 +59,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -80,4 +78,5 @@ public: }; } /* namespace regexp */ + #endif /* ITERATION_H_ */ diff --git a/alib2/src/regexp/RegExp.cpp b/alib2/src/regexp/RegExp.cpp index 6d0ea276b7..cfa2967a77 100644 --- a/alib2/src/regexp/RegExp.cpp +++ b/alib2/src/regexp/RegExp.cpp @@ -2,7 +2,7 @@ * RegExp.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "RegExp.h" @@ -69,8 +69,8 @@ void RegExp::setRegExp(RegExpElement* regExp) { this->regExp = regExp; } -set<alphabet::Symbol> RegExp::getAlphabet() const { - set<alphabet::Symbol> alphabet; +std::set<alphabet::Symbol> RegExp::getAlphabet() const { + std::set<alphabet::Symbol> alphabet; if(regExp) regExp->getAlphabet( alphabet ); @@ -89,7 +89,7 @@ bool RegExp::containsEmptyString() const { return false; } -ostream& operator <<(ostream& out, const RegExp& regexp) { +std::ostream& operator <<(std::ostream& out, const RegExp& regexp) { out << "(RegExp " << *(regexp.regExp) << ")"; return out; } diff --git a/alib2/src/regexp/RegExp.h b/alib2/src/regexp/RegExp.h index 8e25d80d33..eac9004daf 100644 --- a/alib2/src/regexp/RegExp.h +++ b/alib2/src/regexp/RegExp.h @@ -2,11 +2,11 @@ * RegExp.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ -#ifndef REGEXP_H_ -#define REGEXP_H_ +#ifndef REG_EXP_H_ +#define REG_EXP_H_ #include <vector> #include <list> @@ -17,8 +17,6 @@ namespace regexp { -using namespace std; - /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. @@ -77,7 +75,7 @@ public: * @param out output stream to which print the RegExp * @param regexp RegExp to print */ - friend ostream& operator<<(ostream& out, const RegExp& regexp); + friend std::ostream& operator<<(std::ostream& out, const RegExp& regexp); bool operator<(const RegExp&) const; bool operator<=(const RegExp&) const; @@ -88,4 +86,5 @@ public: }; } /* namespace regexp */ -#endif /* REGEXP_H_ */ + +#endif /* REG_EXP_H_ */ diff --git a/alib2/src/regexp/RegExpElement.cpp b/alib2/src/regexp/RegExpElement.cpp index 1f4bee9740..dd880a8d0d 100644 --- a/alib2/src/regexp/RegExpElement.cpp +++ b/alib2/src/regexp/RegExpElement.cpp @@ -2,7 +2,7 @@ * RegExpElement.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "RegExpElement.h" @@ -75,7 +75,7 @@ bool RegExpElement::operator==(const RegExpEmpty& other) const { return false; } -ostream& operator<<(ostream& out, const RegExpElement& regexp) { +std::ostream& operator<<(std::ostream& out, const RegExpElement& regexp) { regexp >> out; return out; } diff --git a/alib2/src/regexp/RegExpElement.h b/alib2/src/regexp/RegExpElement.h index ed283d9125..12db32db1b 100644 --- a/alib2/src/regexp/RegExpElement.h +++ b/alib2/src/regexp/RegExpElement.h @@ -2,11 +2,11 @@ * RegExpElement.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ -#ifndef REGEXPELEMENT_H_ -#define REGEXPELEMENT_H_ +#ifndef REG_EXP_ELEMENT_H_ +#define REG_EXP_ELEMENT_H_ #include "../std/visitor.hpp" #include "../alphabet/Symbol.h" @@ -14,9 +14,6 @@ namespace regexp { -using namespace std; - - class Alternation; class Concatenation; class Iteration; @@ -64,14 +61,14 @@ public: * Prints XML representation of the RegExp to the output stream. * @param out output stream to which print the RegExp */ - virtual void operator>>(ostream& out) const = 0; + virtual void operator>>(std::ostream& out) const = 0; /** * Prints XML representation of the RegExp to the output stream. * @param out output stream to which print the RegExp * @param regexp RegExp to print */ - friend ostream& operator<<(ostream& out, const RegExpElement& regexp); + friend std::ostream& operator<<(std::ostream& out, const RegExpElement& regexp); /** * @return true if this subtree of regexp matches empty string (epsilon) @@ -92,4 +89,5 @@ public: }; } /* namespace regexp */ -#endif /* REGEXPELEMENT_H_ */ + +#endif /* REG_EXP_ELEMENT_H_ */ diff --git a/alib2/src/regexp/RegExpElements.h b/alib2/src/regexp/RegExpElements.h index b0f3401aec..b3d1f02de9 100644 --- a/alib2/src/regexp/RegExpElements.h +++ b/alib2/src/regexp/RegExpElements.h @@ -2,12 +2,11 @@ * RegExpElements.h * * Created on: 14. 3. 2014 - * Author: tomas + * Author: Tomas Pecka */ -#ifndef REGEXPELEMENTS_H_ -#define REGEXPELEMENTS_H_ - +#ifndef REG_EXP_ELEMENTS_H_ +#define REG_EXP_ELEMENTS_H_ #include "Alternation.h" #include "Concatenation.h" @@ -17,5 +16,4 @@ #include "RegExpEmpty.h" #include "RegExpSymbol.h" - -#endif /* REGEXPELEMENTS_H_ */ +#endif /* REG_EXP_ELEMENTS_H_ */ diff --git a/alib2/src/regexp/RegExpEmpty.cpp b/alib2/src/regexp/RegExpEmpty.cpp index 83d0c1f248..9c37ac53e7 100644 --- a/alib2/src/regexp/RegExpEmpty.cpp +++ b/alib2/src/regexp/RegExpEmpty.cpp @@ -2,7 +2,7 @@ * RegExpEmpty.cpp * * Created on: Jan 30, 2014 - * Author: honza + * Author: Jan Travnicek */ #include "RegExpEmpty.h" @@ -53,7 +53,7 @@ bool RegExpEmpty::operator==(const RegExpEmpty&) const { return true; } -void RegExpEmpty::operator>>(ostream& out) const { +void RegExpEmpty::operator>>(std::ostream& out) const { out << "(RegExpEmpty)"; } @@ -70,4 +70,3 @@ bool RegExpEmpty::isEmpty() const { } } /* namespace regexp */ - diff --git a/alib2/src/regexp/RegExpEmpty.h b/alib2/src/regexp/RegExpEmpty.h index 150ebda6af..4b4198c188 100644 --- a/alib2/src/regexp/RegExpEmpty.h +++ b/alib2/src/regexp/RegExpEmpty.h @@ -2,18 +2,16 @@ * RegExpEmpty.h * * Created on: Jan 30, 2014 - * Author: honza + * Author: Jan Travnicek */ -#ifndef REGEXPEMPTY_H_ -#define REGEXPEMPTY_H_ +#ifndef REG_EXP_EMPTY_H_ +#define REG_EXP_EMPTY_H_ #include "RegExpElement.h" namespace regexp { -using namespace std; - /** * Represents empty regular expression in the regular expression. */ @@ -40,7 +38,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -59,4 +57,5 @@ public: }; } /* namespace regexp */ -#endif /* REGEXPEMPTY_H_ */ + +#endif /* REG_EXP_EMPTY_H_ */ diff --git a/alib2/src/regexp/RegExpEpsilon.cpp b/alib2/src/regexp/RegExpEpsilon.cpp index 18940c9d3d..0ed91e5d05 100644 --- a/alib2/src/regexp/RegExpEpsilon.cpp +++ b/alib2/src/regexp/RegExpEpsilon.cpp @@ -2,7 +2,7 @@ * RegExpEpsilon.cpp * * Created on: Jan 30, 2014 - * Author: honza + * Author: Jan Travnicek */ #include "RegExpEpsilon.h" @@ -49,7 +49,7 @@ bool RegExpEpsilon::operator==(const RegExpEpsilon&) const { return true; } -void RegExpEpsilon::operator>>(ostream& out) const { +void RegExpEpsilon::operator>>(std::ostream& out) const { out << "(RegExpEpsilon)"; } diff --git a/alib2/src/regexp/RegExpEpsilon.h b/alib2/src/regexp/RegExpEpsilon.h index 57c64dccdb..24f82b22b1 100644 --- a/alib2/src/regexp/RegExpEpsilon.h +++ b/alib2/src/regexp/RegExpEpsilon.h @@ -2,20 +2,17 @@ * RegExpEpsilon.h * * Created on: Jan 30, 2014 - * Author: honza + * Author: Jan Travnicek */ -#ifndef REGEXPEPSILON_H_ -#define REGEXPEPSILON_H_ +#ifndef REG_EXP_EPSILON_H_ +#define REG_EXP_EPSILON_H_ #include "RegExpElement.h" #include "../alphabet/Epsilon.h" namespace regexp { -using namespace std; -using namespace alphabet; - /** * Represents epsilon in the regular expression. */ @@ -41,7 +38,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -60,4 +57,5 @@ public: }; } /* namespace regexp */ -#endif /* REGEXPEPSILON_H_ */ + +#endif /* REG_EXP_EPSILON_H_ */ diff --git a/alib2/src/regexp/RegExpFromXMLParser.cpp b/alib2/src/regexp/RegExpFromXMLParser.cpp index 53c730e5c3..b9f8af8e7c 100644 --- a/alib2/src/regexp/RegExpFromXMLParser.cpp +++ b/alib2/src/regexp/RegExpFromXMLParser.cpp @@ -10,7 +10,7 @@ namespace regexp { -RegExp RegExpFromXMLParser::parse(list<sax::Token>& input) { +RegExp RegExpFromXMLParser::parse(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "regexp"); RegExp regexp; regexp.setRegExp(parseElement(input)); @@ -19,7 +19,7 @@ RegExp RegExpFromXMLParser::parse(list<sax::Token>& input) { return regexp; } -RegExpElement* RegExpFromXMLParser::parseElement(list<sax::Token>& input) { +RegExpElement* RegExpFromXMLParser::parseElement(std::list<sax::Token>& input) { if (isToken(input, sax::Token::START_ELEMENT, "symbol")) { return parseSymbol(input); } else if (isToken(input, sax::Token::START_ELEMENT, "empty")) { @@ -37,7 +37,7 @@ RegExpElement* RegExpFromXMLParser::parseElement(list<sax::Token>& input) { } } -Alternation* RegExpFromXMLParser::parseAlternation(list<sax::Token>& input) { +Alternation* RegExpFromXMLParser::parseAlternation(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "alternation"); Alternation* alternation = new Alternation; @@ -47,7 +47,7 @@ Alternation* RegExpFromXMLParser::parseAlternation(list<sax::Token>& input) { return alternation; } -Concatenation* RegExpFromXMLParser::parseConcatenation(list<sax::Token>& input) { +Concatenation* RegExpFromXMLParser::parseConcatenation(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "concatenation"); Concatenation* concatenation = new Concatenation(); @@ -58,7 +58,7 @@ Concatenation* RegExpFromXMLParser::parseConcatenation(list<sax::Token>& input) } -Iteration* RegExpFromXMLParser::parseIteration(list<sax::Token>& input) { +Iteration* RegExpFromXMLParser::parseIteration(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "iteration"); Iteration* iteration = new Iteration(); @@ -68,7 +68,7 @@ Iteration* RegExpFromXMLParser::parseIteration(list<sax::Token>& input) { return iteration; } -void RegExpFromXMLParser::parseContent(list<sax::Token>& input, list<RegExpElement*>& elements) { +void RegExpFromXMLParser::parseContent(std::list<sax::Token>& input, std::list<RegExpElement*>& elements) { while (true) { RegExpElement* element = parseElement(input); if(!element) return; @@ -76,7 +76,7 @@ void RegExpFromXMLParser::parseContent(list<sax::Token>& input, list<RegExpEleme } } -RegExpEpsilon* RegExpFromXMLParser::parseEpsilon(list<sax::Token>& input) { +RegExpEpsilon* RegExpFromXMLParser::parseEpsilon(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "epsilon"); RegExpEpsilon* epsilon = new RegExpEpsilon(); @@ -85,7 +85,7 @@ RegExpEpsilon* RegExpFromXMLParser::parseEpsilon(list<sax::Token>& input) { return epsilon; } -RegExpEmpty* RegExpFromXMLParser::parseEmpty(list<sax::Token>& input) { +RegExpEmpty* RegExpFromXMLParser::parseEmpty(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "empty"); RegExpEmpty* empty = new RegExpEmpty(); @@ -94,7 +94,7 @@ RegExpEmpty* RegExpFromXMLParser::parseEmpty(list<sax::Token>& input) { return empty; } -RegExpSymbol* RegExpFromXMLParser::parseSymbol(list<sax::Token>& input) { +RegExpSymbol* RegExpFromXMLParser::parseSymbol(std::list<sax::Token>& input) { popToken(input, sax::Token::START_ELEMENT, "symbol"); if (input.front().getType() == sax::Token::CHARACTER) { @@ -107,11 +107,11 @@ RegExpSymbol* RegExpFromXMLParser::parseSymbol(list<sax::Token>& input) { } } -bool RegExpFromXMLParser::isToken(list<sax::Token>& input, sax::Token::TokenType type, string data) { +bool RegExpFromXMLParser::isToken(std::list<sax::Token>& input, sax::Token::TokenType type, std::string data) { return input.front().getType() == type && input.front().getData() == data; } -void RegExpFromXMLParser::popToken(list<sax::Token>& input, sax::Token::TokenType type, string data) { +void RegExpFromXMLParser::popToken(std::list<sax::Token>& input, sax::Token::TokenType type, std::string data) { if (isToken(input, type, data)) { input.pop_front(); } else { diff --git a/alib2/src/regexp/RegExpFromXMLParser.h b/alib2/src/regexp/RegExpFromXMLParser.h index 20ce98fe82..a6cbac18d6 100644 --- a/alib2/src/regexp/RegExpFromXMLParser.h +++ b/alib2/src/regexp/RegExpFromXMLParser.h @@ -2,7 +2,7 @@ * RegExpFromXMLParser.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #ifndef REG_EXP_FROM_XML_PARSER_H_ @@ -18,17 +18,17 @@ namespace regexp { * Parser used to get RegExp from XML parsed into list of tokens. */ class RegExpFromXMLParser { - void parseContent(list<sax::Token>& input, list<RegExpElement*>& elements); - RegExpElement* parseElement(list<sax::Token>& input); + void parseContent(std::list<sax::Token>& input, std::list<RegExpElement*>& elements); + RegExpElement* parseElement(std::list<sax::Token>& input); - RegExpEpsilon* parseEpsilon(list<sax::Token>& input); - RegExpEmpty* parseEmpty(list<sax::Token>& input); - RegExpSymbol* parseSymbol(list<sax::Token> &input); - Iteration* parseIteration(list<sax::Token> &input); - Alternation* parseAlternation(list<sax::Token> &input); - Concatenation* parseConcatenation(list<sax::Token> &input); - bool isToken(list<sax::Token> &input, sax::Token::TokenType type, string data); - void popToken(list<sax::Token> &input, sax::Token::TokenType type, string data); + RegExpEpsilon* parseEpsilon(std::list<sax::Token>& input); + RegExpEmpty* parseEmpty(std::list<sax::Token>& input); + RegExpSymbol* parseSymbol(std::list<sax::Token> &input); + Iteration* parseIteration(std::list<sax::Token> &input); + Alternation* parseAlternation(std::list<sax::Token> &input); + Concatenation* parseConcatenation(std::list<sax::Token> &input); + bool isToken(std::list<sax::Token> &input, sax::Token::TokenType type, std::string data); + void popToken(std::list<sax::Token> &input, sax::Token::TokenType type, std::string data); public: /** @@ -37,7 +37,7 @@ public: * @return RegExp * @throws ParserException when an error occurs */ - RegExp parse(list<sax::Token>& input); + RegExp parse(std::list<sax::Token>& input); }; } /* namespace regexp */ diff --git a/alib2/src/regexp/RegExpSymbol.cpp b/alib2/src/regexp/RegExpSymbol.cpp index 9f091a5b70..bcc30faf6f 100644 --- a/alib2/src/regexp/RegExpSymbol.cpp +++ b/alib2/src/regexp/RegExpSymbol.cpp @@ -2,7 +2,7 @@ * RegExpSymbol.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "RegExpSymbol.h" @@ -13,7 +13,7 @@ RegExpSymbol::RegExpSymbol() : symbol("") { } -RegExpSymbol::RegExpSymbol(const string& symbol) : +RegExpSymbol::RegExpSymbol(const std::string& symbol) : symbol(symbol) { } @@ -54,7 +54,7 @@ bool RegExpSymbol::operator==(const RegExpSymbol& other) const { return this->symbol == other.symbol; } -void RegExpSymbol::operator>>(ostream& out) const { +void RegExpSymbol::operator>>(std::ostream& out) const { out << "(RegExpSymbol " << symbol << ")"; } @@ -67,10 +67,10 @@ bool RegExpSymbol::isEmpty() const { } void RegExpSymbol::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { - alphabet.insert( Symbol( this->getSymbol( ) ) ); + alphabet.insert( alphabet::Symbol( this->getSymbol( ) ) ); } -const string& RegExpSymbol::getSymbol() const { +const std::string& RegExpSymbol::getSymbol() const { return this->symbol; } diff --git a/alib2/src/regexp/RegExpSymbol.h b/alib2/src/regexp/RegExpSymbol.h index 5325b49a13..8296bce29f 100644 --- a/alib2/src/regexp/RegExpSymbol.h +++ b/alib2/src/regexp/RegExpSymbol.h @@ -2,11 +2,11 @@ * RegExpSymbol.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ -#ifndef REGEXPSYMBOL_H_ -#define REGEXPSYMBOL_H_ +#ifndef REG_EXP_SYMBOL_H_ +#define REG_EXP_SYMBOL_H_ #include <string> #include "RegExpElement.h" @@ -14,17 +14,14 @@ namespace regexp { -using namespace std; -using namespace alphabet; - /** * Represents symbol in the regular expression. Contains name of the symbol. */ class RegExpSymbol : public RegExpElement, public std::element<RegExpSymbol, RegExpElement::visitor_type> { - string symbol; + std::string symbol; public: RegExpSymbol(); - RegExpSymbol(const string& symbol); + RegExpSymbol(const std::string& symbol); /** * @copydoc RegExpElement::clone() const @@ -44,7 +41,7 @@ public: /** * @copydoc RegExpElement::operator>>() const */ - virtual void operator>>(ostream& out) const; + virtual void operator>>(std::ostream& out) const; /** * @copydoc RegExpElement::getAlphabet() const @@ -56,7 +53,10 @@ public: */ virtual bool containsEmptyString() const; - const string& getSymbol() const; + /** + * Returns the string representation of RegExp Symbol. + */ + const std::string& getSymbol() const; /** * @copydoc RegExpElement::isEmpty() const @@ -65,4 +65,5 @@ public: }; } /* namespace regexp */ -#endif /* REGEXPSYMBOL_H_ */ + +#endif /* REG_EXP_SYMBOL_H_ */ diff --git a/alib2/src/regexp/RegExpToXMLPrinter.cpp b/alib2/src/regexp/RegExpToXMLPrinter.cpp index 39e33625a0..5d6d2e797e 100644 --- a/alib2/src/regexp/RegExpToXMLPrinter.cpp +++ b/alib2/src/regexp/RegExpToXMLPrinter.cpp @@ -2,23 +2,21 @@ * RegExpToXMLPrinter.cpp * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #include "RegExpToXMLPrinter.h" namespace regexp { -const string RegExpToXMLPrinter::c_Indentation = "\t"; - -RegExpToXMLPrinter::RegExpToXMLPrinter(ostream& out) : m_Out(out) { +RegExpToXMLPrinter::RegExpToXMLPrinter(std::ostream& out) : m_Out(out) { } void RegExpToXMLPrinter::Visit(const RegExp::element_type& regexp) { - m_Out << "<regexp>" << endl; + m_Out << "<regexp>" << std::endl; regexp.Accept(*this); - m_Out << "</regexp>" << endl; + m_Out << "</regexp>" << std::endl; } void RegExpToXMLPrinter::Visit(const RegExpElement::element_type& element) { @@ -26,51 +24,51 @@ void RegExpToXMLPrinter::Visit(const RegExpElement::element_type& element) { } void RegExpToXMLPrinter::Visit(const Alternation& alternation) { - m_Out << "<alternation>" << endl; - for (auto element : alternation.getElements()) { + m_Out << "<alternation>" << std::endl; + for (const auto& element : alternation.getElements()) { const RegExpElement::element_type& object = static_cast<const RegExpElement::element_type&>(*element); object.Accept(*this); } - m_Out << "</alternation>" << endl; + m_Out << "</alternation>" << std::endl; } void RegExpToXMLPrinter::Visit(const Concatenation& concatenation) { - m_Out <<"<concatenation>" << endl; + m_Out <<"<concatenation>" << std::endl; for (auto element : concatenation.getElements()) { const RegExpElement::element_type& object = static_cast<const RegExpElement::element_type&>(*element); object.Accept(*this); } - m_Out <<"</concatenation>" << endl; + m_Out <<"</concatenation>" << std::endl; } void RegExpToXMLPrinter::Visit(const Iteration& iteration) { - m_Out << "<iteration>" << endl; + m_Out << "<iteration>" << std::endl; const RegExpElement::element_type& object = static_cast<const RegExpElement::element_type&>(*iteration.getElement()); object.Accept(*this); - m_Out << "</iteration>" << endl; + m_Out << "</iteration>" << std::endl; } void RegExpToXMLPrinter::Visit(const RegExpSymbol& symbol) { m_Out << "<symbol>"; m_Out << symbol.getSymbol(); - m_Out << "</symbol>" << endl; + m_Out << "</symbol>" << std::endl; } void RegExpToXMLPrinter::Visit(const RegExpEpsilon& epsilon) { m_Out << "<epsilon>"; - m_Out << "</epsilon>" << endl; + m_Out << "</epsilon>" << std::endl; } void RegExpToXMLPrinter::Visit(const RegExpEmpty& empty) { m_Out << "<empty>"; - m_Out << "</empty>" << endl; + m_Out << "</empty>" << std::endl; } void RegExpToXMLPrinter::Visit(const RegExp& regexp) { - m_Out << "<regexp>" << endl; + m_Out << "<regexp>" << std::endl; regexp.getRegExp()->Accept(*this); - m_Out << "</regexp>" << endl; + m_Out << "</regexp>" << std::endl; } } /* namespace regexp */ diff --git a/alib2/src/regexp/RegExpToXMLPrinter.h b/alib2/src/regexp/RegExpToXMLPrinter.h index 880f455fc8..3f0fdcc019 100644 --- a/alib2/src/regexp/RegExpToXMLPrinter.h +++ b/alib2/src/regexp/RegExpToXMLPrinter.h @@ -2,7 +2,7 @@ * RegExpToXMLPrinter.h * * Created on: Nov 23, 2013 - * Author: martin + * Author: Martin Zak */ #ifndef REGEXP_TO_XML_PRINTER_H_ @@ -15,18 +15,15 @@ namespace regexp { -using namespace std; - /** * This class contains methods to print XML representation of regular expression to the output stream. */ class RegExpToXMLPrinter : public RegExp::visitor_type, public RegExpElement::visitor_type { - static const string c_Indentation; - ostream& m_Out; + std::ostream& m_Out; public: - RegExpToXMLPrinter(ostream& out); + RegExpToXMLPrinter(std::ostream& out); void Visit(const Alternation& alternation); void Visit(const Concatenation& concatenation); @@ -48,4 +45,5 @@ public: }; } /* namespace regexp */ + #endif /* REGEXP_TO_XML_PRINTER_H_ */ diff --git a/alib2/src/sax/ParserException.cpp b/alib2/src/sax/ParserException.cpp index c40a1b2d59..25c6cf790e 100644 --- a/alib2/src/sax/ParserException.cpp +++ b/alib2/src/sax/ParserException.cpp @@ -2,7 +2,7 @@ * ParserException.cpp * * Created on: Apr 16, 2013 - * Author: martin + * Author: Martin Zak */ #include "ParserException.h" @@ -14,6 +14,7 @@ ParserException::ParserException(const Token& expected, const Token& read) : cause = "Parser Exception: Expected: " + expected.getData() + " Read: " + read.getData(); } + ParserException::~ParserException() throw () { } diff --git a/alib2/src/sax/ParserException.h b/alib2/src/sax/ParserException.h index c2a8881ad1..a7af6523dd 100644 --- a/alib2/src/sax/ParserException.h +++ b/alib2/src/sax/ParserException.h @@ -2,15 +2,15 @@ * ParserException.h * * Created on: Apr 16, 2013 - * Author: martin + * Author: Martin Zak */ -#ifndef PARSEREXCEPTION_H_ -#define PARSEREXCEPTION_H_ +#ifndef PARSER_EXCEPTION_H_ +#define PARSER_EXCEPTION_H_ #include "../AlibException.h" #include "Token.h" -#include <string.h> + namespace sax { /** @@ -26,4 +26,5 @@ public: }; } /* namespace sax */ -#endif /* PARSEREXCEPTION_H_ */ + +#endif /* PARSER_EXCEPTION_H_ */ diff --git a/alib2/src/sax/SaxInterface.cpp b/alib2/src/sax/SaxInterface.cpp index 6370398af1..cdc67adaa2 100644 --- a/alib2/src/sax/SaxInterface.cpp +++ b/alib2/src/sax/SaxInterface.cpp @@ -2,7 +2,7 @@ * SaxInterface.cpp * * Created on: 8.8.2012 - * Author: martin + * Author: Martin Zak */ #include "SaxInterface.h" @@ -14,9 +14,6 @@ namespace sax { -using namespace std; -using namespace alib; - void SaxInterface::initSAXHandler(xmlSAXHandler& handler) { memset(&handler, 0, sizeof(handler)); handler.initialized = XML_SAX2_MAGIC; @@ -26,7 +23,7 @@ void SaxInterface::initSAXHandler(xmlSAXHandler& handler) { handler.endElement = &sax::SaxInterface::endElement; } -void SaxInterface::parseMemory(string xmlIn, list<Token>& out) { +void SaxInterface::parseMemory(const std::string& xmlIn, std::list<Token>& out) { xmlSAXHandler handler; initSAXHandler(handler); @@ -34,11 +31,11 @@ void SaxInterface::parseMemory(string xmlIn, list<Token>& out) { xmlCleanupParser(); if (result != 0) { - throw AlibException("Cannot parse the XML string."); + throw alib::AlibException("Cannot parse the XML string."); } } -void SaxInterface::parseFile(string filename, list<Token>& out) { +void SaxInterface::parseFile(const std::string& filename, std::list<Token>& out) { xmlSAXHandler handler; initSAXHandler(handler); @@ -46,14 +43,14 @@ void SaxInterface::parseFile(string filename, list<Token>& out) { xmlCleanupParser(); if (result != 0) { - throw AlibException("Cannot parse the XML file " + filename); + throw alib::AlibException("Cannot parse the XML file " + filename); } } void SaxInterface::characters(void * userData, const xmlChar * ch, int len) { - list<Token> &out = *((list<Token>*) userData); - string tmp((char*) ch, len); + std::list<Token> &out = *((std::list<Token>*) userData); + std::string tmp((char*) ch, len); for (unsigned int i = 0; i < tmp.length(); i++) { if (!isspace(tmp[i])) { @@ -64,15 +61,13 @@ void SaxInterface::characters(void * userData, const xmlChar * ch, int len) { } } -void SaxInterface::startElement(void* userData, const xmlChar* name, const xmlChar** attrs) { - (void)attrs; - - list<Token> &out = *((list<Token>*) userData); +void SaxInterface::startElement(void* userData, const xmlChar* name, const xmlChar** /*attrs*/) { + std::list<Token> &out = *((std::list<Token>*) userData); out.push_back(Token((char*) name, Token::START_ELEMENT)); } void SaxInterface::endElement(void * userData, const xmlChar * name) { - list<Token> &out = *((list<Token>*) userData); + std::list<Token> &out = *((std::list<Token>*) userData); out.push_back(Token((char*) name, Token::END_ELEMENT)); } } /* namespace sax */ diff --git a/alib2/src/sax/SaxInterface.h b/alib2/src/sax/SaxInterface.h index d181b1e1dc..37998926c8 100644 --- a/alib2/src/sax/SaxInterface.h +++ b/alib2/src/sax/SaxInterface.h @@ -2,11 +2,11 @@ * SaxInterface.h * * Created on: 8.8.2012 - * Author: martin + * Author: Martin Zak */ -#ifndef SAXINTERFACE_H_ -#define SAXINTERFACE_H_ +#ifndef SAX_INTERFACE_H_ +#define SAX_INTERFACE_H_ #include <libxml/parser.h> #include <list> @@ -14,8 +14,6 @@ namespace sax { -using namespace std; - /** * This class performs parsing of file or string containing XML. Contains callback * methods for libxml SAX parser. @@ -58,7 +56,7 @@ public: * @param out list of tokens that are returned * @throws AlibException when an error occurs (e.g. XML is not valid) */ - static void parseMemory(string xmlIn, list<Token>& out); + static void parseMemory(const std::string& xmlIn, std::list<Token>& out); /** * Parses the file containing XML. @@ -66,8 +64,9 @@ public: * @param out list of tokens that are returned * @throws AlibException when an error occurs (e.g. file doesn't exist, XML is not valid) */ - static void parseFile(string filename, list<Token>& out); + static void parseFile(const std::string& filename, std::list<Token>& out); }; } /* namespace sax */ -#endif /* SAXINTERFACE_H_ */ + +#endif /* SAX_INTERFACE_H_ */ diff --git a/alib2/src/sax/Token.cpp b/alib2/src/sax/Token.cpp index a0880c8a3e..5e7049694a 100644 --- a/alib2/src/sax/Token.cpp +++ b/alib2/src/sax/Token.cpp @@ -2,14 +2,14 @@ * ParseToken.cpp * * Created on: 9.8.2012 - * Author: martin + * Author: Martin Zak */ #include "Token.h" namespace sax { -Token::Token(const std::string data, const Token::TokenType type) : +Token::Token(const std::string& data, const Token::TokenType type) : data(data), type(type) { } @@ -18,7 +18,7 @@ Token::~Token() { } -std::string Token::getData() const { +const std::string& Token::getData() const { return data; } diff --git a/alib2/src/sax/Token.h b/alib2/src/sax/Token.h index 3f544dabb4..6f3f0c8765 100644 --- a/alib2/src/sax/Token.h +++ b/alib2/src/sax/Token.h @@ -2,18 +2,16 @@ * ParseToken.h * * Created on: 9.8.2012 - * Author: martin + * Author: Martin Zak */ -#ifndef PARSETOKEN_H_ -#define PARSETOKEN_H_ +#ifndef TOKEN_H_ +#define TOKEN_H_ #include <string> namespace sax { -using namespace std; - /** * Represents part of parsed XML. Can be start of tag, end of tag, * tag attribute or array of characters. @@ -26,17 +24,17 @@ public: }; private: - string data; + std::string data; TokenType type; public: - Token(const string, const TokenType); + Token(const std::string&, const TokenType); virtual ~Token(); /** * @return name of the tag or characters read */ - string getData() const; + const std::string& getData() const; /** * @return type of the token - star of the tag, end of the tag, attribute @@ -47,4 +45,4 @@ public: } /* namespace sax */ -#endif /* PARSETOKEN_H_ */ +#endif /* TOKEN_H_ */ diff --git a/alib2/src/std/type_traits.hpp b/alib2/src/std/type_traits.hpp index 1ee68e2268..d357fcdbe6 100644 --- a/alib2/src/std/type_traits.hpp +++ b/alib2/src/std/type_traits.hpp @@ -1,9 +1,15 @@ +/** + * Created on: Feb 28, 2014 + * Author: Jan Travnicek + */ + #ifndef TYPE_TRAITS_HPP_ #define TYPE_TRAITS_HPP_ #include <type_traits> namespace std { + template <typename T> struct is_base_of<T, T> { static const bool value = true; @@ -23,6 +29,7 @@ namespace std { { static const bool value = is_base_of<T, F>::value || is_base_of_any<T, Ts...>::value; }; -} -#endif +} /* namespace std */ + +#endif // TYPE_TRAITS_HPP_ diff --git a/alib2/src/std/variant.hpp b/alib2/src/std/variant.hpp index 3771d4c477..396e628e6f 100644 --- a/alib2/src/std/variant.hpp +++ b/alib2/src/std/variant.hpp @@ -1,8 +1,8 @@ /** * https://gist.github.com/tibordp/6909880 * Created on: Feb 28, 2014 - * Author: Tibor Djurica Potpara - * Modified: Jan Travnicek + * Author: Tibor Djurica Potpara + * Modified: Jan Travnicek */ #ifndef VATIANT_HPP_ @@ -14,6 +14,8 @@ #include "type_traits.hpp" #include <string> +namespace std { + template <size_t arg1, size_t ... others> struct static_max; @@ -192,4 +194,6 @@ public: } }; +} /* namespace std */ + #endif diff --git a/alib2/src/std/visitor.hpp b/alib2/src/std/visitor.hpp index 077357faf2..51bd5b1e3c 100644 --- a/alib2/src/std/visitor.hpp +++ b/alib2/src/std/visitor.hpp @@ -3,6 +3,7 @@ * * Created on: Apr 05, 2014 * Author: Andrew Durward + * Modified: Jan Travnicek */ #ifndef VISITOR_H_ -- GitLab