/* * BlankSymbol.cpp * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ #include "BlankSymbol.h" #include <sax/FromXMLParserHelper.h> #include "Symbol.h" #include "../object/Object.h" #include "../XmlApi.hpp" #include "UniqueSymbol.h" namespace alphabet { BlankSymbol::BlankSymbol() { } SymbolBase* BlankSymbol::clone() const { return new BlankSymbol(*this); } SymbolBase* BlankSymbol::plunder() && { return new BlankSymbol(std::move(*this)); } int BlankSymbol::compare(const BlankSymbol&) const { return 0; } void BlankSymbol::operator>>(std::ostream& out) const { out << "(Blank symbol)"; } BlankSymbol::operator std::string () const { return "B"; } BlankSymbol BlankSymbol::BLANK = BlankSymbol(); const std::string BlankSymbol::XML_TAG_NAME = "BlankSymbol"; BlankSymbol BlankSymbol::parse(std::deque<sax::Token>::iterator& input) { sax::FromXMLParserHelper::popToken(input, sax::Token::TokenType::START_ELEMENT, BlankSymbol::XML_TAG_NAME); sax::FromXMLParserHelper::popToken(input, sax::Token::TokenType::END_ELEMENT, BlankSymbol::XML_TAG_NAME); return BlankSymbol(); } void BlankSymbol::compose(std::deque<sax::Token>& out) const { out.emplace_back(BlankSymbol::XML_TAG_NAME, sax::Token::TokenType::START_ELEMENT); out.emplace_back(BlankSymbol::XML_TAG_NAME, sax::Token::TokenType::END_ELEMENT); } SymbolBase* BlankSymbol::next() const { return new UniqueSymbol(Symbol(*this), primitive::Integer(0)); } SymbolBase* BlankSymbol::inc() && { return new UniqueSymbol(Symbol(std::move(*this)), primitive::Integer(0)); } } /* namespace alphabet */ namespace alib { auto blankSymbolParserRegister = xmlApi<alphabet::Symbol>::ParserRegister<alphabet::BlankSymbol>(); auto blankSymbolParserRegister2 = xmlApi<alib::Object>::ParserRegister<alphabet::BlankSymbol>(); } /* namespace alib */