Skip to content
Snippets Groups Projects
Commit 10a68eab authored by Jan Trávníček's avatar Jan Trávníček
Browse files

data: rename BlankSymbol -> Blank

parent 7797749d
No related branches found
No related tags found
1 merge request!217Merge jt
#include "BlankSymbol.h" #include "Blank.h"
   
#include <object/Object.h> #include <object/Object.h>
   
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
   
namespace alphabet { namespace alphabet {
   
BlankSymbol::BlankSymbol() = default; Blank::Blank() = default;
   
ext::ostream & operator << ( ext::ostream & out, const BlankSymbol & ) { ext::ostream & operator << ( ext::ostream & out, const Blank & ) {
return out << "(Blank symbol)"; return out << "(Blank symbol)";
} }
   
...@@ -16,6 +16,6 @@ ext::ostream & operator << ( ext::ostream & out, const BlankSymbol & ) { ...@@ -16,6 +16,6 @@ ext::ostream & operator << ( ext::ostream & out, const BlankSymbol & ) {
   
namespace { namespace {
   
auto valuePrinter = registration::ValuePrinterRegister < alphabet::BlankSymbol > ( ); auto valuePrinter = registration::ValuePrinterRegister < alphabet::Blank > ( );
   
} /* namespace */ } /* namespace */
...@@ -29,13 +29,13 @@ namespace alphabet { ...@@ -29,13 +29,13 @@ namespace alphabet {
* \brief * \brief
* Represents blank symbol used in the turing machine. * Represents blank symbol used in the turing machine.
*/ */
class BlankSymbol { class Blank {
public: public:
/** /**
* \brief * \brief
* Creates a new instance of the symbol. * Creates a new instance of the symbol.
*/ */
explicit BlankSymbol ( ); explicit Blank ( );
   
/** /**
* The three way comparison implementation * The three way comparison implementation
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
* *
* \returns the ordering between this object and the @p other. * \returns the ordering between this object and the @p other.
*/ */
std::strong_ordering operator <=> ( const BlankSymbol & ) const { std::strong_ordering operator <=> ( const Blank & ) const {
return std::strong_ordering::equal; return std::strong_ordering::equal;
} }
   
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
* *
* \returns true if this and other objects are equal, false othervise * \returns true if this and other objects are equal, false othervise
*/ */
bool operator == ( const BlankSymbol & ) const { bool operator == ( const Blank & ) const {
return true; return true;
} }
   
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
* *
* \returns modified output stream * \returns modified output stream
*/ */
friend ext::ostream & operator << ( ext::ostream & out, const BlankSymbol & instance ); friend ext::ostream & operator << ( ext::ostream & out, const Blank & instance );
   
/** /**
* \brief Factory for the symbol construction of the symbol based on given type. * \brief Factory for the symbol construction of the symbol based on given type.
...@@ -77,17 +77,17 @@ public: ...@@ -77,17 +77,17 @@ public:
}; };
   
template < typename Base > template < typename Base >
inline Base BlankSymbol::instance ( ) { inline Base Blank::instance ( ) {
if constexpr ( std::is_integral_v < Base > ) { if constexpr ( std::is_integral_v < Base > ) {
return ' '; return ' ';
} else if constexpr ( std::is_same_v < Base, std::string > ) { } else if constexpr ( std::is_same_v < Base, std::string > ) {
return std::string ( 1, BlankSymbol::instance < char > ( ) ); return std::string ( 1, Blank::instance < char > ( ) );
} else if constexpr ( std::is_same_v < Base, BlankSymbol > ) { } else if constexpr ( std::is_same_v < Base, Blank > ) {
return BlankSymbol ( ); return Blank ( );
} else if constexpr ( std::is_same_v < Base, object::Object > ) { } else if constexpr ( std::is_same_v < Base, object::Object > ) {
return object::ObjectFactory < >::construct ( BlankSymbol ( ) ); return object::ObjectFactory < >::construct ( Blank ( ) );
} else if constexpr ( std::is_same_v < Base, common::ranked_symbol < > > ) { } else if constexpr ( std::is_same_v < Base, common::ranked_symbol < > > ) {
return common::ranked_symbol < > ( BlankSymbol::instance < DefaultSymbolType > ( ), 0u ); return common::ranked_symbol < > ( Blank::instance < DefaultSymbolType > ( ), 0u );
} else { } else {
static_assert ( std::is_same_v < Base, Base >, "Unsupported type of instance" ); static_assert ( std::is_same_v < Base, Base >, "Unsupported type of instance" );
} }
......
#include "BlankSymbol.h" #include "Blank.h"
#include <object/Object.h> #include <object/Object.h>
   
#include <registration/XmlRegistration.hpp> #include <registration/XmlRegistration.hpp>
   
namespace core { namespace core {
   
alphabet::BlankSymbol xmlApi < alphabet::BlankSymbol >::parse ( ext::deque < sax::Token >::iterator & input ) { alphabet::Blank xmlApi < alphabet::Blank >::parse ( ext::deque < sax::Token >::iterator & input ) {
sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) );
sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) );
return alphabet::BlankSymbol ( ); return alphabet::Blank ( );
} }
   
bool xmlApi < alphabet::BlankSymbol >::first ( const ext::deque < sax::Token >::const_iterator & input ) { bool xmlApi < alphabet::Blank >::first ( const ext::deque < sax::Token >::const_iterator & input ) {
return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) );
} }
   
std::string xmlApi < alphabet::BlankSymbol >::xmlTagName ( ) { std::string xmlApi < alphabet::Blank >::xmlTagName ( ) {
return "BlankSymbol"; return "Blank";
} }
   
void xmlApi < alphabet::BlankSymbol >::compose ( ext::deque < sax::Token > & output, const alphabet::BlankSymbol & ) { void xmlApi < alphabet::Blank >::compose ( ext::deque < sax::Token > & output, const alphabet::Blank & ) {
output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT );
output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT ); output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
} }
...@@ -28,9 +28,9 @@ void xmlApi < alphabet::BlankSymbol >::compose ( ext::deque < sax::Token > & out ...@@ -28,9 +28,9 @@ void xmlApi < alphabet::BlankSymbol >::compose ( ext::deque < sax::Token > & out
   
namespace { namespace {
   
auto xmlWrite = registration::XmlWriterRegister < alphabet::BlankSymbol > ( ); auto xmlWrite = registration::XmlWriterRegister < alphabet::Blank > ( );
auto xmlRead = registration::XmlReaderRegister < alphabet::BlankSymbol > ( ); auto xmlRead = registration::XmlReaderRegister < alphabet::Blank > ( );
   
auto xmlGroup = registration::XmlRegisterTypeInGroup < object::Object, alphabet::BlankSymbol > ( ); auto xmlGroup = registration::XmlRegisterTypeInGroup < object::Object, alphabet::Blank > ( );
   
} /* namespace */ } /* namespace */
#pragma once #pragma once
   
#include <alphabet/BlankSymbol.h> #include <alphabet/Blank.h>
#include <core/xmlApi.hpp> #include <core/xmlApi.hpp>
   
namespace core { namespace core {
   
template < > template < >
struct xmlApi < alphabet::BlankSymbol > { struct xmlApi < alphabet::Blank > {
static alphabet::BlankSymbol parse ( ext::deque < sax::Token >::iterator & input ); static alphabet::Blank parse ( ext::deque < sax::Token >::iterator & input );
static bool first ( const ext::deque < sax::Token >::const_iterator & input ); static bool first ( const ext::deque < sax::Token >::const_iterator & input );
static std::string xmlTagName ( ); static std::string xmlTagName ( );
static void compose ( ext::deque < sax::Token > & output, const alphabet::BlankSymbol & data ); static void compose ( ext::deque < sax::Token > & output, const alphabet::Blank & data );
}; };
   
} /* namespace core */ } /* namespace core */
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
   
#include "factory/XmlDataFactory.hpp" #include "factory/XmlDataFactory.hpp"
   
#include "alphabet/BlankSymbol.h"
#include <primitive/xml/Character.h> #include <primitive/xml/Character.h>
#include <container/xml/ObjectsSet.h> #include <container/xml/ObjectsSet.h>
   
......
#include "BlankSymbol.h" #include "Blank.h"
#include <alphabet/BlankSymbol.h> #include <alphabet/Blank.h>
#include <object/Object.h> #include <object/Object.h>
   
#include <registration/StringRegistration.hpp> #include <registration/StringRegistration.hpp>
   
namespace core { namespace core {
   
alphabet::BlankSymbol stringApi < alphabet::BlankSymbol >::parse ( ext::istream & ) { alphabet::Blank stringApi < alphabet::Blank >::parse ( ext::istream & ) {
throw exception::CommonException("parsing BlankSymbol from string not implemented"); throw exception::CommonException("parsing Blank from string not implemented");
} }
   
bool stringApi < alphabet::BlankSymbol >::first ( ext::istream & ) { bool stringApi < alphabet::Blank >::first ( ext::istream & ) {
return false; return false;
} }
   
void stringApi < alphabet::BlankSymbol >::compose ( ext::ostream & output, const alphabet::BlankSymbol & ) { void stringApi < alphabet::Blank >::compose ( ext::ostream & output, const alphabet::Blank & ) {
output << "#B"; output << "#B";
} }
   
...@@ -22,8 +22,8 @@ void stringApi < alphabet::BlankSymbol >::compose ( ext::ostream & output, const ...@@ -22,8 +22,8 @@ void stringApi < alphabet::BlankSymbol >::compose ( ext::ostream & output, const
   
namespace { namespace {
   
auto stringWrite = registration::StringWriterRegister < alphabet::BlankSymbol > ( ); auto stringWrite = registration::StringWriterRegister < alphabet::Blank > ( );
   
auto stringWriteGroup = registration::StringWriterRegisterTypeInGroup < object::Object, alphabet::BlankSymbol > ( ); auto stringWriteGroup = registration::StringWriterRegisterTypeInGroup < object::Object, alphabet::Blank > ( );
   
} /* namespace */ } /* namespace */
#pragma once #pragma once
   
#include <alphabet/BlankSymbol.h> #include <alphabet/Blank.h>
#include <core/stringApi.hpp> #include <core/stringApi.hpp>
   
namespace core { namespace core {
   
template < > template < >
struct stringApi < alphabet::BlankSymbol > { struct stringApi < alphabet::Blank > {
static alphabet::BlankSymbol parse ( ext::istream & input ); static alphabet::Blank parse ( ext::istream & input );
static bool first ( ext::istream & input ); static bool first ( ext::istream & input );
static void compose ( ext::ostream & output, const alphabet::BlankSymbol & symbol ); static void compose ( ext::ostream & output, const alphabet::Blank & symbol );
}; };
   
} /* namespace core */ } /* namespace core */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment