From 792ef9a2cb12703140a3578f91e1e11b49d1dab4 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sun, 17 Jun 2018 10:46:29 +0200 Subject: [PATCH] remove unused UniqueSymbol --- alib2data/src/alphabet/BarSymbol.cpp | 8 +- alib2data/src/alphabet/BarSymbol.h | 2 +- alib2data/src/alphabet/BlankSymbol.cpp | 8 +- alib2data/src/alphabet/BlankSymbol.h | 2 +- .../src/alphabet/BottomOfTheStackSymbol.cpp | 8 +- .../src/alphabet/BottomOfTheStackSymbol.h | 2 +- alib2data/src/alphabet/EndSymbol.cpp | 8 +- alib2data/src/alphabet/EndSymbol.h | 2 +- alib2data/src/alphabet/InitialSymbol.cpp | 8 +- alib2data/src/alphabet/InitialSymbol.h | 2 +- .../src/alphabet/NonlinearVariableSymbol.cpp | 3 - .../src/alphabet/NonlinearVariableSymbol.h | 10 +- alib2data/src/alphabet/RankedSymbol.cpp | 1 - alib2data/src/alphabet/RankedSymbol.h | 9 +- alib2data/src/alphabet/StartSymbol.cpp | 8 +- alib2data/src/alphabet/StartSymbol.h | 2 +- alib2data/src/alphabet/SymbolBase.h | 5 - alib2data/src/alphabet/UniqueSymbol.cpp | 76 ---------- alib2data/src/alphabet/UniqueSymbol.h | 135 ------------------ alib2data/src/alphabet/VariablesBarSymbol.cpp | 8 +- alib2data/src/alphabet/VariablesBarSymbol.h | 2 +- alib2data/src/alphabet/WildcardSymbol.cpp | 9 +- alib2data/src/alphabet/WildcardSymbol.h | 2 +- alib2data/src/alphabet/xml/UniqueSymbol.cpp | 54 ------- alib2data/src/alphabet/xml/UniqueSymbol.h | 26 ---- alib2str/src/alphabet/string/UniqueSymbol.cpp | 41 ------ alib2str/src/alphabet/string/UniqueSymbol.h | 25 ---- 27 files changed, 49 insertions(+), 417 deletions(-) delete mode 100644 alib2data/src/alphabet/UniqueSymbol.cpp delete mode 100644 alib2data/src/alphabet/UniqueSymbol.h delete mode 100644 alib2data/src/alphabet/xml/UniqueSymbol.cpp delete mode 100644 alib2data/src/alphabet/xml/UniqueSymbol.h delete mode 100644 alib2str/src/alphabet/string/UniqueSymbol.cpp delete mode 100644 alib2str/src/alphabet/string/UniqueSymbol.h diff --git a/alib2data/src/alphabet/BarSymbol.cpp b/alib2data/src/alphabet/BarSymbol.cpp index 85adc641c5..377b4287a0 100644 --- a/alib2data/src/alphabet/BarSymbol.cpp +++ b/alib2data/src/alphabet/BarSymbol.cpp @@ -6,9 +6,9 @@ */ #include "BarSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,8 +38,8 @@ BarSymbol::operator std::string () const { return BarSymbol::instance < std::string > ( ); } -SymbolBase* BarSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * BarSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index ed84a2e9d2..cb44234c8d 100644 --- a/alib2data/src/alphabet/BarSymbol.h +++ b/alib2data/src/alphabet/BarSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/BlankSymbol.cpp b/alib2data/src/alphabet/BlankSymbol.cpp index 937a6cf34e..5c03711203 100644 --- a/alib2data/src/alphabet/BlankSymbol.cpp +++ b/alib2data/src/alphabet/BlankSymbol.cpp @@ -6,9 +6,9 @@ */ #include "BlankSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,8 +38,8 @@ BlankSymbol::operator std::string () const { return BlankSymbol::instance < std::string > ( ); } -SymbolBase* BlankSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * BlankSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h index 1eb01b89e0..963322438e 100644 --- a/alib2data/src/alphabet/BlankSymbol.h +++ b/alib2data/src/alphabet/BlankSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp index 7310ae2b54..3216a76397 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.cpp @@ -6,9 +6,9 @@ */ #include "BottomOfTheStackSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -39,8 +39,8 @@ BottomOfTheStackSymbol::operator std::string () const { ; } -SymbolBase* BottomOfTheStackSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * BottomOfTheStackSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h index 6fd23d7387..33ff6b0257 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/EndSymbol.cpp b/alib2data/src/alphabet/EndSymbol.cpp index a418ff9892..b8f179d179 100644 --- a/alib2data/src/alphabet/EndSymbol.cpp +++ b/alib2data/src/alphabet/EndSymbol.cpp @@ -6,9 +6,9 @@ */ #include "EndSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,8 +38,8 @@ EndSymbol::operator std::string () const { return EndSymbol::instance < std::string > ( ); } -SymbolBase* EndSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * EndSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h index fa623e62a1..8556b731a7 100644 --- a/alib2data/src/alphabet/EndSymbol.h +++ b/alib2data/src/alphabet/EndSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/InitialSymbol.cpp b/alib2data/src/alphabet/InitialSymbol.cpp index e9c5e1fd6e..ba88fdd1a3 100644 --- a/alib2data/src/alphabet/InitialSymbol.cpp +++ b/alib2data/src/alphabet/InitialSymbol.cpp @@ -6,9 +6,9 @@ */ #include "InitialSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,8 +38,8 @@ InitialSymbol::operator std::string() const { return InitialSymbol::instance < std::string > ( ); } -SymbolBase* InitialSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * InitialSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/InitialSymbol.h b/alib2data/src/alphabet/InitialSymbol.h index 8e2749d791..2a441a1101 100644 --- a/alib2data/src/alphabet/InitialSymbol.h +++ b/alib2data/src/alphabet/InitialSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/NonlinearVariableSymbol.cpp b/alib2data/src/alphabet/NonlinearVariableSymbol.cpp index f5995316f5..f5b62b1074 100644 --- a/alib2data/src/alphabet/NonlinearVariableSymbol.cpp +++ b/alib2data/src/alphabet/NonlinearVariableSymbol.cpp @@ -6,9 +6,6 @@ */ #include "NonlinearVariableSymbol.h" -#include "Symbol.h" -#include <object/Object.h> - #include <registration/ValuePrinterRegistration.hpp> namespace { diff --git a/alib2data/src/alphabet/NonlinearVariableSymbol.h b/alib2data/src/alphabet/NonlinearVariableSymbol.h index c1f583e265..9907098103 100644 --- a/alib2data/src/alphabet/NonlinearVariableSymbol.h +++ b/alib2data/src/alphabet/NonlinearVariableSymbol.h @@ -25,11 +25,9 @@ #define NONLINEAR_VARIABLE_SYMBOL_H_ #include "Symbol.h" -#include "UniqueSymbol.h" - -#include <alphabet/common/SymbolNormalize.h> #include <core/normalize.hpp> +#include <alphabet/common/SymbolNormalize.h> namespace alphabet { @@ -106,7 +104,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < class SymbolType > @@ -151,8 +149,8 @@ NonlinearVariableSymbol < SymbolType >::operator std::string ( ) const { } template < class SymbolType > -SymbolBase * NonlinearVariableSymbol < SymbolType >::inc ( ) && { - return new UniqueSymbol ( Symbol ( std::move ( * this ) ), primitive::Integer ( 0 ) ); +object::ObjectBase * NonlinearVariableSymbol < SymbolType >::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/RankedSymbol.cpp b/alib2data/src/alphabet/RankedSymbol.cpp index 6fbcf5fc38..2823d73bb6 100644 --- a/alib2data/src/alphabet/RankedSymbol.cpp +++ b/alib2data/src/alphabet/RankedSymbol.cpp @@ -6,7 +6,6 @@ */ #include "RankedSymbol.h" - #include <registration/ValuePrinterRegistration.hpp> namespace { diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h index edaa0d0433..c8945b9eb9 100644 --- a/alib2data/src/alphabet/RankedSymbol.h +++ b/alib2data/src/alphabet/RankedSymbol.h @@ -27,9 +27,8 @@ #include "SymbolBase.h" #include <common/ranked_symbol.hpp> -#include <alphabet/common/SymbolNormalize.h> - #include <core/normalize.hpp> +#include <alphabet/common/SymbolNormalize.h> namespace alphabet { @@ -127,7 +126,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < class SymbolType, class RankType > @@ -156,8 +155,8 @@ RankedSymbol < SymbolType, RankType >::operator std::string () const { } template < class SymbolType, class RankType > -SymbolBase* RankedSymbol < SymbolType, RankType >::inc() && { - this->m_symbol.inc(); +object::ObjectBase * RankedSymbol < SymbolType, RankType >::inc ( ) && { + this->m_symbol.inc ( ); return NULL; } diff --git a/alib2data/src/alphabet/StartSymbol.cpp b/alib2data/src/alphabet/StartSymbol.cpp index 24488690d6..c173361b99 100644 --- a/alib2data/src/alphabet/StartSymbol.cpp +++ b/alib2data/src/alphabet/StartSymbol.cpp @@ -6,9 +6,9 @@ */ #include "StartSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,8 +38,8 @@ StartSymbol::operator std::string () const { return StartSymbol::instance < std::string > ( ); } -SymbolBase* StartSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * StartSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/StartSymbol.h b/alib2data/src/alphabet/StartSymbol.h index 5ea4b4d88a..7b73cbc7c7 100644 --- a/alib2data/src/alphabet/StartSymbol.h +++ b/alib2data/src/alphabet/StartSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/SymbolBase.h b/alib2data/src/alphabet/SymbolBase.h index bb98b3e2ac..08cef4e3a0 100644 --- a/alib2data/src/alphabet/SymbolBase.h +++ b/alib2data/src/alphabet/SymbolBase.h @@ -26,11 +26,6 @@ public: * @copydoc ObjectBase::clone ( ) && */ virtual SymbolBase * clone ( ) && override = 0; - - /** - * @copydoc ObjectBase::inc ( ) && - */ - virtual SymbolBase * inc ( ) && override = 0; }; } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/UniqueSymbol.cpp b/alib2data/src/alphabet/UniqueSymbol.cpp deleted file mode 100644 index c0f6f2cf44..0000000000 --- a/alib2data/src/alphabet/UniqueSymbol.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * UniqueSymbol.cpp - * - * Created on: Mar 26, 2013 - * Author: Jan Travicek - */ - -#include "UniqueSymbol.h" -#include <sstream> -#include "Symbol.h" -#include <object/Object.h> - -#include <registration/ValuePrinterRegistration.hpp> - -namespace alphabet { - -UniqueSymbol::UniqueSymbol(Symbol symbol, primitive::Integer id) : m_symbol(std::move(symbol)), m_id(std::move(id)) { - -} - -SymbolBase* UniqueSymbol::clone ( ) const & { - return new UniqueSymbol(*this); -} - -SymbolBase* UniqueSymbol::clone() && { - return new UniqueSymbol(std::move(*this)); -} - -const Symbol & UniqueSymbol::getSymbol ( ) const & { - return m_symbol; -} - -Symbol && UniqueSymbol::getSymbol ( ) && { - return std::move ( m_symbol ); -} - -const primitive::Integer & UniqueSymbol::getId ( ) const & { - return m_id; -} - -primitive::Integer && UniqueSymbol::getId ( ) && { - return std::move ( m_id ); -} - -int UniqueSymbol::compare(const UniqueSymbol& other) const { - int res = m_symbol.getData().compare(other.m_symbol.getData()); - if(res == 0) res = m_id.compare(other.m_id); - return res; -} - -void UniqueSymbol::operator>>(std::ostream& out) const { - out << "(UniqueSymbol " << m_symbol << ", " << m_id << ")"; -} - -UniqueSymbol::operator std::string() const { - std::stringstream ss; - ss << "{"; - ss << m_symbol; - ss << ", "; - ss << m_id; - ss << "}"; - return std::move(ss).str(); -} - -SymbolBase* UniqueSymbol::inc() && { - std::move(m_id).inc(); - return NULL; -} - -} /* namespace alphabet */ - -namespace { - -static auto valuePrinter = registration::ValuePrinterRegister < alphabet::UniqueSymbol > ( ); - -} /* namespace */ diff --git a/alib2data/src/alphabet/UniqueSymbol.h b/alib2data/src/alphabet/UniqueSymbol.h deleted file mode 100644 index 174566a146..0000000000 --- a/alib2data/src/alphabet/UniqueSymbol.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * UniqueSymbol.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 SYMBOL_ID_SYMBOL_H_ -#define SYMBOL_ID_SYMBOL_H_ - -#include "Symbol.h" -#include <primitive/Integer.h> - -namespace alphabet { - -/** - * \brief - * Represents symbol based on other symbol with additional differentiation counter. - * - * The UniqueSymbol is used in situations when some symbol is given and one would like to create new based on it but different. For example q vs. q' vs q'', etc. - * - * Primarly the class is used from inc method. - */ -class UniqueSymbol : public SymbolBase { - /** - * The underlying symbol. - */ - Symbol m_symbol; - - /** - * The differentiating number. - */ - primitive::Integer m_id; - -public: - /** - * \brief - * Creates new symbol with given name and set differentiating number. - * - * \param symbol the underlying symbol - * \param id the differentiating number - */ - explicit UniqueSymbol ( Symbol symbol, primitive::Integer id ); - - /** - * @copydoc alphabet::SymbolBase::clone ( ) const & - */ - virtual SymbolBase * clone ( ) const &; - - /** - * @copydoc alphabet::SymbolBase::clone ( ) && - */ - virtual SymbolBase * clone ( ) &&; - - /** - * Getter of the underlying symbol. - * - * \return the underlying symbol - */ - const Symbol & getSymbol ( ) const &; - - /** - * Getter of the underlying symbol. - * - * \return the underlying symbol - */ - Symbol && getSymbol ( ) &&; - - /** - * Getter of the differentiating number. - * - * \return the differentiating number - */ - const primitive::Integer & getId ( ) const &; - - /** - * Getter of the differentiating number. - * - * \return the differentiating number - */ - primitive::Integer && getId ( ) &&; - - /** - * @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 UniqueSymbol & 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 SymbolBase * inc ( ) &&; -}; - -} /* namespace alphabet */ - -#endif /* SYMBOL_ID_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/VariablesBarSymbol.cpp b/alib2data/src/alphabet/VariablesBarSymbol.cpp index 47f1d56ad1..b5149f8969 100644 --- a/alib2data/src/alphabet/VariablesBarSymbol.cpp +++ b/alib2data/src/alphabet/VariablesBarSymbol.cpp @@ -6,9 +6,9 @@ */ #include "VariablesBarSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -37,8 +37,8 @@ VariablesBarSymbol::operator std::string ( ) const { return VariablesBarSymbol::instance < std::string > ( ); } -SymbolBase * VariablesBarSymbol::inc ( ) && { - return new UniqueSymbol ( Symbol ( std::move ( * this ) ), primitive::Integer ( 0 ) ); +object::ObjectBase * VariablesBarSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } } /* namespace alphabet */ diff --git a/alib2data/src/alphabet/VariablesBarSymbol.h b/alib2data/src/alphabet/VariablesBarSymbol.h index f5afe99242..a64557d07d 100644 --- a/alib2data/src/alphabet/VariablesBarSymbol.h +++ b/alib2data/src/alphabet/VariablesBarSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/WildcardSymbol.cpp b/alib2data/src/alphabet/WildcardSymbol.cpp index e48f88b089..7460db141c 100644 --- a/alib2data/src/alphabet/WildcardSymbol.cpp +++ b/alib2data/src/alphabet/WildcardSymbol.cpp @@ -6,9 +6,9 @@ */ #include "WildcardSymbol.h" -#include "Symbol.h" + #include <object/Object.h> -#include "UniqueSymbol.h" +#include <object/UniqueObject.h> #include <registration/ValuePrinterRegistration.hpp> @@ -38,10 +38,11 @@ WildcardSymbol::operator std::string () const { return WildcardSymbol::instance < std::string > ( ); } -SymbolBase* WildcardSymbol::inc() && { - return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); +object::ObjectBase * WildcardSymbol::inc ( ) && { + return new object::UniqueObject ( object::Object ( std::move ( * this ) ), primitive::Integer ( 0 ) ); } + } /* namespace alphabet */ namespace { diff --git a/alib2data/src/alphabet/WildcardSymbol.h b/alib2data/src/alphabet/WildcardSymbol.h index 1e40d41eda..dd040ef487 100644 --- a/alib2data/src/alphabet/WildcardSymbol.h +++ b/alib2data/src/alphabet/WildcardSymbol.h @@ -96,7 +96,7 @@ public: /** * @copydoc object::ObjectBase::inc ( ) && */ - virtual SymbolBase * inc ( ) &&; + virtual object::ObjectBase * inc ( ) &&; }; template < typename Base > diff --git a/alib2data/src/alphabet/xml/UniqueSymbol.cpp b/alib2data/src/alphabet/xml/UniqueSymbol.cpp deleted file mode 100644 index cc57662610..0000000000 --- a/alib2data/src/alphabet/xml/UniqueSymbol.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * UniqueSymbol.cpp - * - * Created on: Mar 26, 2013 - * Author: Jan Travicek - */ - -#include "UniqueSymbol.h" -#include <alphabet/Symbol.h> -#include <object/Object.h> - -#include <registration/XmlRegistration.hpp> -#include <primitive/xml/Integer.h> - -namespace core { - -alphabet::UniqueSymbol xmlApi < alphabet::UniqueSymbol >::parse ( ext::deque < sax::Token >::iterator & input ) { - sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); - - alphabet::Symbol firstSymbol = core::xmlApi < alphabet::Symbol >::parse ( input ); - primitive::Integer secondSymbol = core::xmlApi < primitive::Integer >::parse ( input ); - - sax::FromXMLParserHelper::popToken(input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) ); - return alphabet::UniqueSymbol ( std::move ( firstSymbol ), std::move ( secondSymbol ) ); -} - -bool xmlApi < alphabet::UniqueSymbol >::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::UniqueSymbol >::xmlTagName ( ) { - static std::string xmlTagName = "UniqueSymbol"; - - return xmlTagName; -} - -void xmlApi < alphabet::UniqueSymbol >::compose ( ext::deque < sax::Token > & output, const alphabet::UniqueSymbol & data ) { - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); - core::xmlApi < alphabet::Symbol >::compose ( output, data.getSymbol ( ) ); - core::xmlApi < primitive::Integer >::compose ( output, data.getId ( ) ); - output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT ); -} - -} /* namespace core */ - -namespace { - -static auto xmlWrite = registration::XmlWriterRegister < alphabet::UniqueSymbol > ( ); -static auto xmlRead = registration::XmlReaderRegister < alphabet::UniqueSymbol > ( ); - -static auto xmlGroup1 = registration::XmlRegisterTypeInGroup < alphabet::Symbol, alphabet::UniqueSymbol > ( ); -static auto xmlGroup2 = registration::XmlRegisterTypeInGroup < object::Object, alphabet::UniqueSymbol > ( ); - -} /* namespace */ diff --git a/alib2data/src/alphabet/xml/UniqueSymbol.h b/alib2data/src/alphabet/xml/UniqueSymbol.h deleted file mode 100644 index 67d1cca7a9..0000000000 --- a/alib2data/src/alphabet/xml/UniqueSymbol.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * UniqueSymbol.h - * - * Created on: Mar 26, 2013 - * Author: Jan Travnicek - */ - -#ifndef _XML_SYMBOL_ID_SYMBOL_H_ -#define _XML_SYMBOL_ID_SYMBOL_H_ - -#include <alphabet/UniqueSymbol.h> -#include <core/xmlApi.hpp> - -namespace core { - -template < > -struct xmlApi < alphabet::UniqueSymbol > { - static alphabet::UniqueSymbol 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::UniqueSymbol & data ); -}; - -} /* namespace core */ - -#endif /* _XML_SYMBOL_ID_SYMBOL_H_ */ diff --git a/alib2str/src/alphabet/string/UniqueSymbol.cpp b/alib2str/src/alphabet/string/UniqueSymbol.cpp deleted file mode 100644 index aa05f02213..0000000000 --- a/alib2str/src/alphabet/string/UniqueSymbol.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * UniqueSymbol.cpp - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#include "UniqueSymbol.h" -#include <alphabet/UniqueSymbol.h> -#include <object/Object.h> -#include <alphabet/Symbol.h> -#include <primitive/string/Integer.h> - -#include <registration/StringRegistration.hpp> - -namespace core { - -alphabet::UniqueSymbol stringApi < alphabet::UniqueSymbol >::parse ( std::istream & ) { - throw exception::CommonException("parsing UniqueSymbol from string not implemented"); -} - -bool stringApi < alphabet::UniqueSymbol >::first ( std::istream & ) { - return false; -} - -void stringApi < alphabet::UniqueSymbol >::compose ( std::ostream & output, const alphabet::UniqueSymbol & symbol ) { - output << '<'; - stringApi < alphabet::Symbol >::compose ( output, symbol.getSymbol ( ) ); - output << ", "; - stringApi < primitive::Integer >::compose ( output, symbol.getId ( ) ); - output << '>'; -} - -} /* namespace core */ - -namespace { - -static auto stringWrite = registration::StringWriterRegister < alphabet::Symbol, alphabet::UniqueSymbol > ( ); -static auto stringWrite2 = registration::StringWriterRegister < object::Object, alphabet::UniqueSymbol > ( ); - -} /* namespace */ diff --git a/alib2str/src/alphabet/string/UniqueSymbol.h b/alib2str/src/alphabet/string/UniqueSymbol.h deleted file mode 100644 index 26e294e127..0000000000 --- a/alib2str/src/alphabet/string/UniqueSymbol.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * UniqueSymbol.h - * - * Created on: Sep 27, 2017 - * Author: Jan Travnicek - */ - -#ifndef _STRING_UNIQUE_SYMBOL_H_ -#define _STRING_UNIQUE_SYMBOL_H_ - -#include <alphabet/UniqueSymbol.h> -#include <core/stringApi.hpp> - -namespace core { - -template < > -struct stringApi < alphabet::UniqueSymbol > { - static alphabet::UniqueSymbol parse ( std::istream & input ); - static bool first ( std::istream & input ); - static void compose ( std::ostream & output, const alphabet::UniqueSymbol & symbol ); -}; - -} /* namespace core */ - -#endif /* _STRING_UNIQUE_SYMBOL_H_ */ -- GitLab