From 13f2cb4895e0ea443bfb1cc3a7813140163db585 Mon Sep 17 00:00:00 2001 From: Tomas Pecka <peckato1@fit.cvut.cz> Date: Tue, 21 Nov 2017 21:46:55 +0100 Subject: [PATCH] Possible fix for #94 --- .../src/alphabet/string/InitialSymbol.cpp | 36 +++++++++++++++++++ alib2str/src/alphabet/string/InitialSymbol.h | 25 +++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 alib2str/src/alphabet/string/InitialSymbol.cpp create mode 100644 alib2str/src/alphabet/string/InitialSymbol.h diff --git a/alib2str/src/alphabet/string/InitialSymbol.cpp b/alib2str/src/alphabet/string/InitialSymbol.cpp new file mode 100644 index 0000000000..14e3be307e --- /dev/null +++ b/alib2str/src/alphabet/string/InitialSymbol.cpp @@ -0,0 +1,36 @@ +/* + * InitialSymbol.cpp + * + * Created on: Nov 21, 2017 + * Author: Tomas Pecka + */ + +#include "InitialSymbol.h" +#include <alphabet/InitialSymbol.h> +#include <alphabet/Symbol.h> +#include <object/Object.h> + +#include <registration/StringRegistration.hpp> + +namespace alib { + +alphabet::InitialSymbol stringApi < alphabet::InitialSymbol >::parse ( std::istream & ) { + throw exception::CommonException ( "parsing InitialSymbol from string not implemented" ); +} + +bool stringApi < alphabet::InitialSymbol >::first ( std::istream & ) { + return false; +} + +void stringApi < alphabet::InitialSymbol >::compose ( std::ostream & output, const alphabet::InitialSymbol & ) { + output << "#I"; +} + +} /* namespace alib */ + +namespace { + +static auto stringWrite = registration::StringWriterRegister < alphabet::Symbol, alphabet::InitialSymbol > ( ); +static auto stringWrite2 = registration::StringWriterRegister < alib::Object, alphabet::InitialSymbol > ( ); + +} /* namespace */ diff --git a/alib2str/src/alphabet/string/InitialSymbol.h b/alib2str/src/alphabet/string/InitialSymbol.h new file mode 100644 index 0000000000..504441ad42 --- /dev/null +++ b/alib2str/src/alphabet/string/InitialSymbol.h @@ -0,0 +1,25 @@ +/* + * InitialSymbol.h + * + * Created on: Nov 21, 2017 + * Author: Tomas Pecka + */ + +#ifndef _STRING_INITIAL_SYMBOL_H_ +#define _STRING_INITIAL_SYMBOL_H_ + +#include <alphabet/InitialSymbol.h> +#include <core/stringApi.hpp> + +namespace alib { + +template < > +struct stringApi < alphabet::InitialSymbol > { + static alphabet::InitialSymbol parse ( std::istream & input ); + static bool first ( std::istream & input ); + static void compose ( std::ostream & output, const alphabet::InitialSymbol & symbol ); +}; + +} /* namespace alib */ + +#endif /* _STRING_INITIAL_SYMBOL_H_ */ -- GitLab