From 8ffd85d98229eff53e0ec008caea5ddbe049be69 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 16 Jun 2018 22:29:22 +0200 Subject: [PATCH] remove deprecated features --- .../regexp/convert/ToAutomatonDerivation.h | 2 +- alib2data/src/alphabet/LabeledSymbol.cpp | 71 ---------- alib2data/src/alphabet/LabeledSymbol.h | 129 ------------------ alib2data/src/alphabet/Symbol.cpp | 36 ----- alib2data/src/alphabet/Symbol.h | 15 -- alib2data/src/alphabet/xml/LabeledSymbol.cpp | 49 ------- alib2data/src/alphabet/xml/LabeledSymbol.h | 26 ---- alib2data/src/label/Label.cpp | 30 ---- alib2data/src/label/Label.h | 8 -- alib2data/src/label/PrimitiveLabel.cpp | 58 -------- alib2data/src/label/PrimitiveLabel.h | 111 --------------- alib2data/src/label/xml/PrimitiveLabel.cpp | 49 ------- alib2data/src/label/xml/PrimitiveLabel.h | 26 ---- alib2data/src/regexp/RegExp.h | 3 - alib2data/src/regexp/formal/FormalRegExp.h | 5 + .../src/regexp/unbounded/UnboundedRegExp.h | 5 + alib2data/test-src/alphabet/SymbolTest.cpp | 38 +----- alib2data/test-src/alphabet/SymbolTest.h | 4 - .../test-src/automaton/AutomatonTest.cpp | 1 - alib2data/test-src/label/LabelTest.cpp | 102 -------------- alib2data/test-src/label/LabelTest.h | 27 ---- alib2data/test-src/string/StringTest.cpp | 1 - .../src/alphabet/string/LabeledSymbol.cpp | 38 ------ alib2str/src/alphabet/string/LabeledSymbol.h | 25 ---- alib2str/src/label/string/PrimitiveLabel.cpp | 38 ------ alib2str/src/label/string/PrimitiveLabel.h | 25 ---- alib2str/test-src/automaton/AutomatonTest.cpp | 1 - alib2str/test-src/grammar/GrammarTest.cpp | 2 - alib2str/test-src/string/StringTest.cpp | 2 - alib2str/test-src/tree/TreeTest.cpp | 2 - 30 files changed, 13 insertions(+), 916 deletions(-) delete mode 100644 alib2data/src/alphabet/LabeledSymbol.cpp delete mode 100644 alib2data/src/alphabet/LabeledSymbol.h delete mode 100644 alib2data/src/alphabet/Symbol.cpp delete mode 100644 alib2data/src/alphabet/xml/LabeledSymbol.cpp delete mode 100644 alib2data/src/alphabet/xml/LabeledSymbol.h delete mode 100644 alib2data/src/label/Label.cpp delete mode 100644 alib2data/src/label/PrimitiveLabel.cpp delete mode 100644 alib2data/src/label/PrimitiveLabel.h delete mode 100644 alib2data/src/label/xml/PrimitiveLabel.cpp delete mode 100644 alib2data/src/label/xml/PrimitiveLabel.h delete mode 100644 alib2data/test-src/label/LabelTest.cpp delete mode 100644 alib2data/test-src/label/LabelTest.h delete mode 100644 alib2str/src/alphabet/string/LabeledSymbol.cpp delete mode 100644 alib2str/src/alphabet/string/LabeledSymbol.h delete mode 100644 alib2str/src/label/string/PrimitiveLabel.cpp delete mode 100644 alib2str/src/label/string/PrimitiveLabel.h diff --git a/alib2algo/src/regexp/convert/ToAutomatonDerivation.h b/alib2algo/src/regexp/convert/ToAutomatonDerivation.h index b9b9ee12bf..8a4ea079a0 100644 --- a/alib2algo/src/regexp/convert/ToAutomatonDerivation.h +++ b/alib2algo/src/regexp/convert/ToAutomatonDerivation.h @@ -39,7 +39,7 @@ public: * Performs conversion. * @return FSM equivalent to original regular expression. */ - template < class T, class SymbolType = typename regexp::SymbolTypeOfRegExp < T > > + template < class T, class SymbolType = typename T::symbol_type > static automaton::DFA < SymbolType, unsigned > convert ( const T & regexp ); }; diff --git a/alib2data/src/alphabet/LabeledSymbol.cpp b/alib2data/src/alphabet/LabeledSymbol.cpp deleted file mode 100644 index 57b31fb6b3..0000000000 --- a/alib2data/src/alphabet/LabeledSymbol.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * LabeledSymbol.cpp - * - * Created on: Mar 26, 2013 - * Author: Martin Zak - */ - -#include "LabeledSymbol.h" -#include "Symbol.h" -#include <object/Object.h> - -#include <registration/ValuePrinterRegistration.hpp> - -namespace alphabet { - -LabeledSymbol::LabeledSymbol(int number) : m_label(label::Label(number)) { - -} - -LabeledSymbol::LabeledSymbol(char character) : m_label(label::Label(character)) { - -} - -LabeledSymbol::LabeledSymbol(std::string label) : m_label(label::Label(std::move(label))) { - -} - -LabeledSymbol::LabeledSymbol(label::Label label) : m_label(std::move(label)) { - -} - -SymbolBase* LabeledSymbol::clone ( ) const & { - return new LabeledSymbol(*this); -} - -SymbolBase* LabeledSymbol::clone() && { - return new LabeledSymbol(std::move(*this)); -} - -const label::Label & LabeledSymbol::getLabel ( ) const & { - return m_label; -} - -label::Label && LabeledSymbol::getLabel ( ) && { - return std::move ( m_label ); -} - -int LabeledSymbol::compare(const LabeledSymbol& other) const { - return this->m_label.getData().compare(other.m_label.getData()); -} - -void LabeledSymbol::operator>>(std::ostream& out) const { - out << "(LabeledSymbol " << this->m_label << ")"; -} - -LabeledSymbol::operator std::string () const { - return (std::string) m_label; -} - -SymbolBase* LabeledSymbol::inc() && { - m_label.inc(); - return NULL; -} - -} /* namespace alphabet */ - -namespace { - -static auto valuePrinter = registration::ValuePrinterRegister < alphabet::LabeledSymbol > ( ); - -} /* namespace */ diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h deleted file mode 100644 index a5716d19f1..0000000000 --- a/alib2data/src/alphabet/LabeledSymbol.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * LabeledSymbol.h - * - * This file is part of Algorithms library toolkit. - * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) - - * Algorithms library toolkit 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. - - * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. - * - * Created on: Mar 26, 2013 - * Author: Martin Zak - */ - -#ifndef LABELED_SYMBOL_H_ -#define LABELED_SYMBOL_H_ - -#include <label/Label.h> -#include "SymbolBase.h" - -namespace alphabet { - -/** - * \brief - * \depricated - * Represents labeled symbol used as a wrapper of label. - */ -class LabeledSymbol : public SymbolBase { - /** - * \brief - * The label of the symbol. - */ - label::Label m_label; - -public: - /** - * \brief - * Creates a new instance of the symbol with integer label. - */ - explicit LabeledSymbol ( int number ); - - /** - * \brief - * Creates a new instance of the symbol with character label. - */ - explicit LabeledSymbol ( char character ); - - /** - * \brief - * Creates a new instance of the symbol with string label. - */ - explicit LabeledSymbol ( std::string label ); - - /** - * \brief - * Creates a new instance of the symbol with preexistent label. - */ - explicit LabeledSymbol ( label::Label label ); - - /** - * @copydoc alphabet::SymbolBase::clone ( ) const & - */ - virtual SymbolBase * clone ( ) const &; - - /** - * @copydoc alphabet::SymbolBase::clone ( ) && - */ - virtual SymbolBase * clone ( ) &&; - - /** - * Getter of the symbol's label. - * - * \return the label of the symbol - */ - const label::Label & getLabel ( ) const &; - - /** - * Getter of the symbol's label. - * - * \return the label of the symbol - */ - label::Label && getLabel ( ) &&; - - /** - * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const - */ - virtual int compare ( const ObjectBase & other ) const { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - - /** - * The actual compare method - * - * \param other the other instance - * - * \returns the actual relation between two by type same symbols - */ - virtual int compare ( const LabeledSymbol & other ) const; - - /** - * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const - */ - virtual void operator >>( std::ostream & out ) const; - - /** - * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const - */ - virtual explicit operator std::string ( ) const; - - /** - * @copydoc object::ObjectBase::inc ( ) && - */ - virtual SymbolBase * inc ( ) &&; -}; - -} /* namespace alphabet */ - -#endif /* LABELED_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/Symbol.cpp b/alib2data/src/alphabet/Symbol.cpp deleted file mode 100644 index 3723ba7a6f..0000000000 --- a/alib2data/src/alphabet/Symbol.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Symbol.cpp - * - * Created on: Apr 16, 2013 - * Author: Jan Travnicek - */ - -#include "Symbol.h" -#include "LabeledSymbol.h" -#include "label/Label.h" - -namespace alphabet { - -void Symbol::inc ( ) { - this->operator ++ ( ); -} - -Symbol::Symbol ( const label::Label & label ) : base::WrapperBase < SymbolBase > ( alphabet::LabeledSymbol { label } ) { -} - -Symbol::Symbol ( label::Label && label ) : base::WrapperBase < SymbolBase > ( alphabet::LabeledSymbol { std::move ( label ) } ) { -} - -Symbol::Symbol ( int number ) : Symbol ( label::Label ( number ) ) { -} - -Symbol::Symbol ( char character ) : Symbol ( label::Label ( character ) ) { -} - -Symbol::Symbol ( std::string string ) : Symbol ( label::Label ( std::move ( string ) ) ) { -} - -Symbol::Symbol ( const char * string ) : Symbol ( ( std::string ) string ) { -} - -} /* namespace alphabet */ diff --git a/alib2data/src/alphabet/Symbol.h b/alib2data/src/alphabet/Symbol.h index 53cad54173..1e23feb833 100644 --- a/alib2data/src/alphabet/Symbol.h +++ b/alib2data/src/alphabet/Symbol.h @@ -11,11 +11,6 @@ #include <base/WrapperBase.hpp> #include "SymbolBase.h" -#include <alib/set> -#include <alib/string> - -#include <label/Label.h> - namespace alphabet { /** @@ -24,16 +19,6 @@ namespace alphabet { class Symbol : public base::WrapperBase < SymbolBase > { using base::WrapperBase < SymbolBase >::WrapperBase; -public: - explicit Symbol ( const label::Label & label ); - explicit Symbol ( label::Label && label ); - explicit Symbol ( int number ); - explicit Symbol ( char character ); - explicit Symbol ( std::string string ); - explicit Symbol ( const char * string ); - - void inc ( ); - }; } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/xml/LabeledSymbol.cpp b/alib2data/src/alphabet/xml/LabeledSymbol.cpp deleted file mode 100644 index 7f3097cf56..0000000000 --- a/alib2data/src/alphabet/xml/LabeledSymbol.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * LabeledSymbol.cpp - * - * Created on: Mar 26, 2013 - * Author: Martin Zak - */ - -#include "LabeledSymbol.h" -#include <alphabet/Symbol.h> -#include <object/Object.h> - -#include <registration/XmlRegistration.hpp> - -namespace core { - -alphabet::LabeledSymbol xmlApi < alphabet::LabeledSymbol >::parse ( ext::deque < sax::Token >::iterator & input ) { - sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); - label::Label data = core::xmlApi < label::Label >::parse ( input ); - sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) ); - return alphabet::LabeledSymbol ( std::move ( data ) ); -} - -bool xmlApi < alphabet::LabeledSymbol >::first ( const ext::deque < sax::Token >::const_iterator & input ) { - return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); -} - -const std::string & xmlApi < alphabet::LabeledSymbol >::xmlTagName ( ) { - static std::string xmlTagName = "LabeledSymbol"; - - return xmlTagName; -} - -void xmlApi < alphabet::LabeledSymbol >::compose ( ext::deque < sax::Token > & output, const alphabet::LabeledSymbol & data ) { - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); - core::xmlApi < label::Label >::compose ( output, data.getLabel ( ) ); - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT ); -} - -} /* namespace core */ - -namespace { - -static auto xmlWrite = registration::XmlWriterRegister < alphabet::LabeledSymbol > ( ); -static auto xmlRead = registration::XmlReaderRegister < alphabet::LabeledSymbol > ( ); - -static auto xmlGroup1 = registration::XmlRegisterTypeInGroup < alphabet::Symbol, alphabet::LabeledSymbol > ( ); -static auto xmlGroup2 = registration::XmlRegisterTypeInGroup < object::Object, alphabet::LabeledSymbol > ( ); - -} /* namespace */ diff --git a/alib2data/src/alphabet/xml/LabeledSymbol.h b/alib2data/src/alphabet/xml/LabeledSymbol.h deleted file mode 100644 index 96f4170cc6..0000000000 --- a/alib2data/src/alphabet/xml/LabeledSymbol.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * LabeledSymbol.h - * - * Created on: Mar 26, 2013 - * Author: Martin Zak - */ - -#ifndef _XML_LABELED_SYMBOL_H_ -#define _XML_LABELED_SYMBOL_H_ - -#include <alphabet/LabeledSymbol.h> -#include <core/xmlApi.hpp> - -namespace core { - -template < > -struct xmlApi < alphabet::LabeledSymbol > { - static alphabet::LabeledSymbol parse ( ext::deque < sax::Token >::iterator & input ); - static bool first ( const ext::deque < sax::Token >::const_iterator & input ); - static const std::string & xmlTagName ( ); - static void compose ( ext::deque < sax::Token > & output, const alphabet::LabeledSymbol & data ); -}; - -} /* namespace core */ - -#endif /* _XML_LABELED_SYMBOL_H_ */ diff --git a/alib2data/src/label/Label.cpp b/alib2data/src/label/Label.cpp deleted file mode 100644 index f798ac7f41..0000000000 --- a/alib2data/src/label/Label.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Label.cpp - * - * Created on: Apr 16, 2013 - * Author: Martin Zak - */ - -#include "Label.h" -#include "PrimitiveLabel.h" -#include <primitive/Primitive.h> - -namespace label { - -void Label::inc ( ) { - this->operator ++ (); -} - -Label::Label ( int number ) : base::WrapperBase < LabelBase > ( label::PrimitiveLabel ( primitive::Primitive ( number ) ) ) { -} - -Label::Label ( char character ) : base::WrapperBase < LabelBase > ( label::PrimitiveLabel { primitive::Primitive ( character ) } ) { -} - -Label::Label ( std::string string ) : base::WrapperBase < LabelBase > ( label::PrimitiveLabel { primitive::Primitive ( std::move ( string ) ) } ) { -} - -Label::Label ( const char * string ) : Label ( ( std::string ) string ) { -} - -} /* namespace label */ diff --git a/alib2data/src/label/Label.h b/alib2data/src/label/Label.h index fed7263972..3cbd5546ba 100644 --- a/alib2data/src/label/Label.h +++ b/alib2data/src/label/Label.h @@ -19,14 +19,6 @@ namespace label { class Label : public base::WrapperBase < LabelBase > { using base::WrapperBase < LabelBase >::WrapperBase; -public: - explicit Label ( int number ); - explicit Label ( char character ); - explicit Label ( std::string string ); - explicit Label ( const char * string ); - - void inc ( ); - }; } /* namespace label */ diff --git a/alib2data/src/label/PrimitiveLabel.cpp b/alib2data/src/label/PrimitiveLabel.cpp deleted file mode 100644 index 586c06f1cd..0000000000 --- a/alib2data/src/label/PrimitiveLabel.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * PrimitiveLabel.cpp - * - * Created on: Mar 26, 2013 - * Author: Jan Travicek - */ - -#include "PrimitiveLabel.h" -#include "UniqueLabel.h" - -#include <registration/ValuePrinterRegistration.hpp> - -namespace label { - -PrimitiveLabel::PrimitiveLabel(primitive::Primitive primitive) : m_primitive(std::move(primitive)) { - -} - -LabelBase* PrimitiveLabel::clone ( ) const & { - return new PrimitiveLabel(*this); -} - -LabelBase* PrimitiveLabel::clone() && { - return new PrimitiveLabel(std::move(*this)); -} - -const primitive::Primitive& PrimitiveLabel::getData() const { - return m_primitive; -} - -primitive::Primitive& PrimitiveLabel::getData() { - return m_primitive; -} - -int PrimitiveLabel::compare(const PrimitiveLabel& other) const { - return m_primitive.getData().compare(other.m_primitive.getData()); -} - -void PrimitiveLabel::operator>>(std::ostream& out) const { - out << "(PrimitiveLabel " << m_primitive << ")"; -} - -PrimitiveLabel::operator std::string() const { - return (std::string) m_primitive; -} - -LabelBase* PrimitiveLabel::inc() && { - m_primitive.inc(); - return NULL; -} - -} /* namespace label */ - -namespace { - -static auto valuePrinter = registration::ValuePrinterRegister < label::PrimitiveLabel > ( ); - -} /* namespace */ diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h deleted file mode 100644 index 547742ab97..0000000000 --- a/alib2data/src/label/PrimitiveLabel.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * PrimitiveLabel.h - * - * This file is part of Algorithms library toolkit. - * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) - - * Algorithms library toolkit 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. - - * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. - * - * Created on: Mar 26, 2013 - * Author: Jan Travnicek - */ - -#ifndef PRIMITIVE_LABEL_H_ -#define PRIMITIVE_LABEL_H_ - -#include <primitive/Primitive.h> -#include "LabelBase.h" - -namespace label { - -/** - * \brief - * \depricated - * Represents a label serving as wrapper of a primitive datatype (int, unsigned, char, etc.) - */ -class PrimitiveLabel final : public LabelBase { - /** - * \brief - * The primitive value of the label. - */ - primitive::Primitive m_primitive; - -public: - /** - * \brief - * Creates a new instance of the label with preexistent primitive. - */ - explicit PrimitiveLabel ( primitive::Primitive primitive ); - - /** - * @copydoc alphabet::SymbolBase::clone ( ) const & - */ - virtual LabelBase * clone ( ) const &; - - /** - * @copydoc alphabet::SymbolBase::clone ( ) && - */ - virtual LabelBase * clone ( ) &&; - - /** - * Getter of the label's primitive value. - * - * \return the primitive value of the label - */ - const primitive::Primitive & getData ( ) const; - - /** - * Getter of the label's primitive value. - * - * \return the primitive value of the label - */ - primitive::Primitive & getData ( ); - - /** - * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const - */ - virtual int compare ( const ObjectBase & other ) const { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - - /** - * The actual compare method - * - * \param other the other instance - * - * \returns the actual relation between two by type same labels - */ - virtual int compare ( const PrimitiveLabel & other ) const; - - /** - * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const - */ - virtual void operator >>( std::ostream & ) const; - - /** - * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const - */ - virtual explicit operator std::string ( ) const; - - /** - * @copydoc object::ObjectBase::inc ( ) && - */ - virtual LabelBase * inc ( ) &&; -}; - -} /* namespace label */ - -#endif /* PRIMITIVE_LABEL_H_ */ diff --git a/alib2data/src/label/xml/PrimitiveLabel.cpp b/alib2data/src/label/xml/PrimitiveLabel.cpp deleted file mode 100644 index e1a858aec8..0000000000 --- a/alib2data/src/label/xml/PrimitiveLabel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * PrimitiveLabel.h - * - * Created on: Apr 10, 2013 - * Author: Jan Travnicek - */ - -#include "PrimitiveLabel.h" -#include <label/Label.h> -#include <object/Object.h> - -#include <registration/XmlRegistration.hpp> - -namespace core { - -label::PrimitiveLabel xmlApi < label::PrimitiveLabel >::parse ( ext::deque < sax::Token >::iterator & input ) { - sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); - label::PrimitiveLabel data(core::xmlApi<primitive::Primitive>::parse(input)); - sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) ); - return data; -} - -bool xmlApi < label::PrimitiveLabel >::first ( const ext::deque < sax::Token >::const_iterator & input ) { - return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); -} - -const std::string & xmlApi < label::PrimitiveLabel >::xmlTagName ( ) { - static std::string xmlTagName = "PrimitiveLabel"; - - return xmlTagName; -} - -void xmlApi < label::PrimitiveLabel >::compose ( ext::deque < sax::Token > & output, const label::PrimitiveLabel & label ) { - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); - core::xmlApi < primitive::Primitive >::compose ( output, label.getData ( ) ); - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT ); -} - -} /* namespace core */ - -namespace { - -static auto xmlWrite = registration::XmlWriterRegister < label::PrimitiveLabel > ( ); -static auto xmlRead = registration::XmlReaderRegister < label::PrimitiveLabel > ( ); - -static auto xmlGroup1 = registration::XmlRegisterTypeInGroup < label::Label, label::PrimitiveLabel > ( ); -static auto xmlGroup2 = registration::XmlRegisterTypeInGroup < object::Object, label::PrimitiveLabel > ( ); - -} /* namespace */ diff --git a/alib2data/src/label/xml/PrimitiveLabel.h b/alib2data/src/label/xml/PrimitiveLabel.h deleted file mode 100644 index 3bee752e91..0000000000 --- a/alib2data/src/label/xml/PrimitiveLabel.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * PrimitiveLabel.h - * - * Created on: Mar 26, 2013 - * Author: Jan Travnicek - */ - -#ifndef _XML_PRIMITIVE_LABEL_H_ -#define _XML_PRIMITIVE_LABEL_H_ - -#include <label/PrimitiveLabel.h> -#include <core/xmlApi.hpp> - -namespace core { - -template < > -struct xmlApi < label::PrimitiveLabel > { - static label::PrimitiveLabel parse ( ext::deque < sax::Token >::iterator & input ); - static bool first ( const ext::deque < sax::Token >::const_iterator & input ); - static const std::string & xmlTagName ( ); - static void compose ( ext::deque < sax::Token > & output, const label::PrimitiveLabel & data ); -}; - -} /* namespace core */ - -#endif /* _XML_PRIMITIVE_LABEL_H_ */ diff --git a/alib2data/src/regexp/RegExp.h b/alib2data/src/regexp/RegExp.h index 11cacc94d1..06d6194a58 100644 --- a/alib2data/src/regexp/RegExp.h +++ b/alib2data/src/regexp/RegExp.h @@ -35,9 +35,6 @@ class RegExp : public base::WrapperBase < RegExpBase > { }; -template < class T > -using SymbolTypeOfRegExp = typename std::decay < decltype (std::declval<T>().getAlphabet()) >::type::value_type; - regexp::RegExp regexpFrom ( const std::string & string ); regexp::RegExp regexpFrom ( const char * string ); diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h index b236203d10..5b971e76bb 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.h +++ b/alib2data/src/regexp/formal/FormalRegExp.h @@ -85,6 +85,11 @@ class FormalRegExp final : public RegExpBase, public core::Components < FormalRe FormalRegExpStructure < SymbolType > m_regExp; public: + /** + * The exposed SymbolType template parameter. + */ + using symbol_type = SymbolType; + /** * \brief Creates a new instance of the expression. The default constructor creates expression describing empty language. */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h index 4f00e8b655..181209d4af 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h @@ -87,6 +87,11 @@ class UnboundedRegExp final : public RegExpBase, public core::Components < Unbou UnboundedRegExpStructure < SymbolType > m_regExp; public: + /** + * The exposed SymbolType template parameter. + */ + using symbol_type = SymbolType; + /** * \brief Creates a new instance of the expression. The default constructor creates expression describing empty language. */ diff --git a/alib2data/test-src/alphabet/SymbolTest.cpp b/alib2data/test-src/alphabet/SymbolTest.cpp index ddd126aa22..35058cfc15 100644 --- a/alib2data/test-src/alphabet/SymbolTest.cpp +++ b/alib2data/test-src/alphabet/SymbolTest.cpp @@ -5,7 +5,6 @@ #include "sax/SaxComposeInterface.h" #include "alphabet/Symbol.h" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BlankSymbol.h" #include "alphabet/StartSymbol.h" #include "alphabet/EndSymbol.h" @@ -25,41 +24,7 @@ void SymbolTest::setUp ( ) { void SymbolTest::tearDown ( ) { } -void SymbolTest::testCopyConstruct ( ) { - alphabet::Symbol symbol = alphabet::Symbol ( "1" ); - - alphabet::Symbol symbol2 ( symbol ); - - CPPUNIT_ASSERT ( symbol == symbol2 ); - - alphabet::Symbol symbol3 ( std::move ( symbol ) ); - - CPPUNIT_ASSERT ( symbol2 == symbol3 ); -} - -void SymbolTest::testXMLParser ( ) { - - alphabet::Symbol symbol = alphabet::Symbol ( "1" ); - - { - ext::deque < sax::Token > tokens = factory::XmlDataFactory::toTokens ( symbol ); - std::string tmp = sax::SaxComposeInterface::composeMemory ( tokens ); - - ext::deque < sax::Token > tokens2 = sax::SaxParseInterface::parseMemory ( tmp ); - alphabet::Symbol symbol2 = factory::XmlDataFactory::fromTokens ( std::move( tokens2 ) ); - - CPPUNIT_ASSERT ( symbol == symbol2 ); - } - { - std::string tmp = factory::XmlDataFactory::toString ( symbol ); - alphabet::Symbol symbol2 = factory::XmlDataFactory::fromString ( tmp ); - - CPPUNIT_ASSERT ( symbol == symbol2 ); - } -} - void SymbolTest::testOrder ( ) { - alphabet::LabeledSymbol ls ( "a" ); alphabet::BlankSymbol bs; alphabet::StartSymbol ss; alphabet::EndSymbol es; @@ -67,7 +32,8 @@ void SymbolTest::testOrder ( ) { alphabet::RankedSymbol < > rs1 ( DefaultSymbolType ( alphabet::BarSymbol { } ), DefaultRankType ( 0 ) ); alphabet::RankedSymbol < > rs2 ( DefaultSymbolType ( alphabet::BarSymbol { } ), DefaultRankType ( 0 ) ); - CPPUNIT_EXCLUSIVE_OR ( bs < ls, ls < bs ); + CPPUNIT_EXCLUSIVE_OR ( bs < ss, ss < bs ); + CPPUNIT_EXCLUSIVE_OR ( bs < es, es < bs ); CPPUNIT_ASSERT ( rs1 == rs2 ); diff --git a/alib2data/test-src/alphabet/SymbolTest.h b/alib2data/test-src/alphabet/SymbolTest.h index 3b7070b978..a5f1948739 100644 --- a/alib2data/test-src/alphabet/SymbolTest.h +++ b/alib2data/test-src/alphabet/SymbolTest.h @@ -6,8 +6,6 @@ class SymbolTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SymbolTest ); - CPPUNIT_TEST( testCopyConstruct ); - CPPUNIT_TEST( testXMLParser ); CPPUNIT_TEST( testOrder ); CPPUNIT_TEST( testDefaultValues ); CPPUNIT_TEST_SUITE_END(); @@ -16,8 +14,6 @@ public: void setUp(); void tearDown(); - void testCopyConstruct(); - void testXMLParser(); void testOrder(); void testDefaultValues(); }; diff --git a/alib2data/test-src/automaton/AutomatonTest.cpp b/alib2data/test-src/automaton/AutomatonTest.cpp index d15c2219e2..3ab29dadf1 100644 --- a/alib2data/test-src/automaton/AutomatonTest.cpp +++ b/alib2data/test-src/automaton/AutomatonTest.cpp @@ -25,7 +25,6 @@ #include "factory/XmlDataFactory.hpp" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BottomOfTheStackSymbol.h" #include "regexp/RegExp.h" diff --git a/alib2data/test-src/label/LabelTest.cpp b/alib2data/test-src/label/LabelTest.cpp deleted file mode 100644 index 08c54d4f7f..0000000000 --- a/alib2data/test-src/label/LabelTest.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include <alib/list> -#include "LabelTest.h" - -#include "sax/SaxParseInterface.h" -#include "sax/SaxComposeInterface.h" - -#include "label/Label.h" -#include "label/PrimitiveLabel.h" - -#include "primitive/Integer.h" -#include "primitive/Character.h" -#include "primitive/String.h" - -#include "factory/XmlDataFactory.hpp" -#include <alib/algorithm> -#include <alib/type_traits> -#include <alib/set> - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( LabelTest, "label" ); -CPPUNIT_TEST_SUITE_REGISTRATION( LabelTest ); - -void LabelTest::setUp() { -} - -void LabelTest::tearDown() { -} - -void LabelTest::testCopyConstruct() { - label::Label label = label::Label("1"); - - label::Label label2(label); - - CPPUNIT_ASSERT( label == label2 ); - - label::Label label3(std::move(label)); - - CPPUNIT_ASSERT( label2 == label3 ); -} - -void LabelTest::testXMLParser() { - - label::Label label = label::Label("1"); - - { - ext::deque<sax::Token> tokens = factory::XmlDataFactory::toTokens(label); - std::string tmp = sax::SaxComposeInterface::composeMemory ( tokens ); - - ext::deque<sax::Token> tokens2 = sax::SaxParseInterface::parseMemory ( tmp ); - label::Label label2 = factory::XmlDataFactory::fromTokens (std::move(tokens2)); - - CPPUNIT_ASSERT( label == label2 ); - } - { - std::string tmp = factory::XmlDataFactory::toString(label); - label::Label label2 = factory::XmlDataFactory::fromString (tmp); - - CPPUNIT_ASSERT( label == label2 ); - } -} - -void LabelTest::testOrder() { - label::PrimitiveLabel s1(primitive::Primitive("1")); - label::PrimitiveLabel c1(primitive::Primitive('1')); - label::PrimitiveLabel i1(primitive::Primitive(1)); - - CPPUNIT_EXCLUSIVE_OR( s1 < i1, i1 < s1); - CPPUNIT_EXCLUSIVE_OR( c1 < i1, i1 < c1); - CPPUNIT_EXCLUSIVE_OR( s1 < c1, c1 < s1); -} - -void LabelTest::testInSet() { - { - ext::set<std::string> set1 { "a", "b", "c" }; - ext::set<std::string> set2 { "a" }; - ext::set<std::string> set3; - - std::set_difference(set1.begin(), set1.end(), set2.begin(), set2.end(), std::insert_iterator<ext::set<std::string>>(set3, set3.begin())); - for(const auto& item : set2) { - set1.erase(item); - } - - CPPUNIT_ASSERT(set1.size() == 2); - CPPUNIT_ASSERT(set3.size() == 2); - } - { - ext::set<label::Label> set1 { label::Label('a'), label::Label('b'), label::Label('c') }; - ext::set<label::Label> set2 { label::Label('a') }; - ext::set<label::Label> set3; - - std::set_difference(set1.begin(), set1.end(), set2.begin(), set2.end(), std::insert_iterator<ext::set<label::Label>>(set3, set3.begin())); - for(const auto& item : set2) { - set1.erase(item); - } - - CPPUNIT_ASSERT(set1.size() == 2); - CPPUNIT_ASSERT(set3.size() == 2); - } -} - -void LabelTest::testProperties ( ) { - CPPUNIT_ASSERT ( std::is_nothrow_move_constructible < label::Label >::value ); -} diff --git a/alib2data/test-src/label/LabelTest.h b/alib2data/test-src/label/LabelTest.h deleted file mode 100644 index 97eb2b2398..0000000000 --- a/alib2data/test-src/label/LabelTest.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef LABEL_TEST_H_ -#define LABEL_TEST_H_ - -#include <cppunit/extensions/HelperMacros.h> - -class LabelTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE( LabelTest ); - CPPUNIT_TEST( testCopyConstruct ); - CPPUNIT_TEST( testXMLParser ); - CPPUNIT_TEST( testOrder ); - CPPUNIT_TEST( testInSet ); - CPPUNIT_TEST( testProperties ); - CPPUNIT_TEST_SUITE_END(); - -public: - void setUp(); - void tearDown(); - - void testCopyConstruct(); - void testXMLParser(); - void testOrder(); - void testInSet(); - void testProperties(); -}; - -#endif // LABEL_TEST_H_ diff --git a/alib2data/test-src/string/StringTest.cpp b/alib2data/test-src/string/StringTest.cpp index 9c75e3c6f8..219c277361 100644 --- a/alib2data/test-src/string/StringTest.cpp +++ b/alib2data/test-src/string/StringTest.cpp @@ -16,7 +16,6 @@ #include "factory/XmlDataFactory.hpp" #include "alphabet/Symbol.h" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BlankSymbol.h" #include <primitive/Character.h> diff --git a/alib2str/src/alphabet/string/LabeledSymbol.cpp b/alib2str/src/alphabet/string/LabeledSymbol.cpp deleted file mode 100644 index 06c9cb4476..0000000000 --- a/alib2str/src/alphabet/string/LabeledSymbol.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * LabeledSymbol.cpp - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#include "LabeledSymbol.h" -#include <alphabet/LabeledSymbol.h> -#include <object/Object.h> -#include <alphabet/Symbol.h> - -#include <registration/StringRegistration.hpp> - -namespace core { - -alphabet::LabeledSymbol stringApi < alphabet::LabeledSymbol >::parse ( std::istream & input ) { - return alphabet::LabeledSymbol ( stringApi < label::Label >::parse ( input ) ); -} - -bool stringApi < alphabet::LabeledSymbol >::first ( std::istream & input ) { - return stringApi < label::Label >::first ( input ); -} - -void stringApi < alphabet::LabeledSymbol >::compose ( std::ostream & output, const alphabet::LabeledSymbol & symbol ) { - stringApi < label::Label >::compose ( output, symbol.getLabel ( ) ); -} - -} /* namespace core */ - -namespace { - -static auto stringWrite = registration::StringWriterRegister < alphabet::Symbol, alphabet::LabeledSymbol > ( ); -static auto stringWrite2 = registration::StringWriterRegister < object::Object, alphabet::LabeledSymbol > ( ); - -static auto stringRead = registration::StringReaderRegister < alphabet::Symbol, alphabet::LabeledSymbol > ( ); - -} /* namespace */ diff --git a/alib2str/src/alphabet/string/LabeledSymbol.h b/alib2str/src/alphabet/string/LabeledSymbol.h deleted file mode 100644 index 2328472bee..0000000000 --- a/alib2str/src/alphabet/string/LabeledSymbol.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * LabeledSymbol.h - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#ifndef _STRING_LABELED_SYMBOL_H_ -#define _STRING_LABELED_SYMBOL_H_ - -#include <alphabet/LabeledSymbol.h> -#include <core/stringApi.hpp> - -namespace core { - -template < > -struct stringApi < alphabet::LabeledSymbol > { - static alphabet::LabeledSymbol parse ( std::istream & input ); - static bool first ( std::istream & input ); - static void compose ( std::ostream & output, const alphabet::LabeledSymbol & symbol ); -}; - -} /* namespace core */ - -#endif /* _STRING_LABELED_SYMBOL_H_ */ diff --git a/alib2str/src/label/string/PrimitiveLabel.cpp b/alib2str/src/label/string/PrimitiveLabel.cpp deleted file mode 100644 index 90e6768707..0000000000 --- a/alib2str/src/label/string/PrimitiveLabel.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * PrimitiveLabel.cpp - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#include "PrimitiveLabel.h" -#include <label/PrimitiveLabel.h> -#include <object/Object.h> -#include <label/Label.h> - -#include <registration/StringRegistration.hpp> - -namespace core { - -label::PrimitiveLabel stringApi < label::PrimitiveLabel >::parse ( std::istream & input ) { - return label::PrimitiveLabel ( stringApi < primitive::Primitive >::parse ( input ) ); -} - -bool stringApi < label::PrimitiveLabel >::first ( std::istream & input ) { - return stringApi < primitive::Primitive >::first ( input ); -} - -void stringApi < label::PrimitiveLabel >::compose ( std::ostream & output, const label::PrimitiveLabel & label ) { - stringApi < primitive::Primitive >::compose ( output, label.getData ( ) ); -} - -} /* namespace core */ - -namespace { - -static auto stringWrite = registration::StringWriterRegister < label::Label, label::PrimitiveLabel > ( ); -static auto stringWrite2 = registration::StringWriterRegister < object::Object, label::PrimitiveLabel > ( ); - -static auto stringRead = registration::StringReaderRegister < label::Label, label::PrimitiveLabel > ( ); - -} /* namespace */ diff --git a/alib2str/src/label/string/PrimitiveLabel.h b/alib2str/src/label/string/PrimitiveLabel.h deleted file mode 100644 index b57617d9a6..0000000000 --- a/alib2str/src/label/string/PrimitiveLabel.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * PrimitiveLabel.h - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#ifndef _STRING_PRIMITIVE_LABEL_H_ -#define _STRING_PRIMITIVE_LABEL_H_ - -#include <label/PrimitiveLabel.h> -#include <core/stringApi.hpp> - -namespace core { - -template < > -struct stringApi < label::PrimitiveLabel > { - static label::PrimitiveLabel parse ( std::istream & input ); - static bool first ( std::istream & input ); - static void compose ( std::ostream & output, const label::PrimitiveLabel & label ); -}; - -} /* namespace core */ - -#endif /* _STRING_PRIMITIVE_LABEL_H_ */ diff --git a/alib2str/test-src/automaton/AutomatonTest.cpp b/alib2str/test-src/automaton/AutomatonTest.cpp index 32ab497e5a..295bd0b844 100644 --- a/alib2str/test-src/automaton/AutomatonTest.cpp +++ b/alib2str/test-src/automaton/AutomatonTest.cpp @@ -17,7 +17,6 @@ #include "factory/XmlDataFactory.hpp" #include "factory/StringDataFactory.hpp" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BottomOfTheStackSymbol.h" #include "regexp/RegExp.h" diff --git a/alib2str/test-src/grammar/GrammarTest.cpp b/alib2str/test-src/grammar/GrammarTest.cpp index ea75061851..aa128a6a70 100644 --- a/alib2str/test-src/grammar/GrammarTest.cpp +++ b/alib2str/test-src/grammar/GrammarTest.cpp @@ -24,8 +24,6 @@ #include "factory/XmlDataFactory.hpp" #include "factory/StringDataFactory.hpp" -#include "alphabet/LabeledSymbol.h" - #include "grammar/string/Regular/RightRG.h" #include "primitive/string/Character.h" diff --git a/alib2str/test-src/string/StringTest.cpp b/alib2str/test-src/string/StringTest.cpp index 70fdeb1c25..c8d0518e1d 100644 --- a/alib2str/test-src/string/StringTest.cpp +++ b/alib2str/test-src/string/StringTest.cpp @@ -12,8 +12,6 @@ #include "factory/XmlDataFactory.hpp" #include "factory/StringDataFactory.hpp" -#include "alphabet/Symbol.h" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BlankSymbol.h" CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StringTest, "string" ); diff --git a/alib2str/test-src/tree/TreeTest.cpp b/alib2str/test-src/tree/TreeTest.cpp index c66d79c1a2..1c58c4d362 100644 --- a/alib2str/test-src/tree/TreeTest.cpp +++ b/alib2str/test-src/tree/TreeTest.cpp @@ -8,8 +8,6 @@ #include "factory/StringDataFactory.hpp" -#include "alphabet/Symbol.h" -#include "alphabet/LabeledSymbol.h" #include "alphabet/BlankSymbol.h" CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( TreeTest, "tree" ); -- GitLab