From dac43fbb458c9cd8bf0952ad728e8ac716046dae Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Mon, 11 Dec 2017 09:28:14 +0100
Subject: [PATCH] update dummy library

---
 alib2dummy/src/CreateDataType.cpp |  7 +++++
 alib2dummy/src/DataType.cpp       |  8 +++++-
 alib2dummy/src/DataType.h         |  7 +++++
 alib2dummy/src/xml/DataType.cpp   | 45 +++++++++++++++++++++++++++++++
 alib2dummy/src/xml/DataType.h     | 26 ++++++++++++++++++
 5 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 alib2dummy/src/xml/DataType.cpp
 create mode 100644 alib2dummy/src/xml/DataType.h

diff --git a/alib2dummy/src/CreateDataType.cpp b/alib2dummy/src/CreateDataType.cpp
index cf7a5b8111..5ef0ff77f9 100644
--- a/alib2dummy/src/CreateDataType.cpp
+++ b/alib2dummy/src/CreateDataType.cpp
@@ -1,3 +1,10 @@
+/*
+ * CreateDataType.cpp
+ *
+ *  Created on: Dec 7, 2017
+ *      Author: Jan Travnicek
+ */
+
 #include "DataType.h"
 #include <registration/AlgoRegistration.hpp>
 #include <iostream>
diff --git a/alib2dummy/src/DataType.cpp b/alib2dummy/src/DataType.cpp
index 569b1c8f95..8131aa1efe 100644
--- a/alib2dummy/src/DataType.cpp
+++ b/alib2dummy/src/DataType.cpp
@@ -1,3 +1,10 @@
+/*
+ * DataType.cpp
+ *
+ *  Created on: Dec 7, 2017
+ *      Author: Jan Travnicek
+ */
+
 #include <typeinfo>
 #include <registration/ValuePrinterRegistration.hpp>
 #include "DataType.h"
@@ -7,4 +14,3 @@ namespace {
 static auto valuePrinter = registration::ValuePrinterRegister < DataType > ( );
 
 }
-
diff --git a/alib2dummy/src/DataType.h b/alib2dummy/src/DataType.h
index 556345655a..6cd46fa109 100644
--- a/alib2dummy/src/DataType.h
+++ b/alib2dummy/src/DataType.h
@@ -1,3 +1,10 @@
+/*
+ * DataType.h
+ *
+ *  Created on: Dec 7, 2017
+ *      Author: Jan Travnicek
+ */
+
 #include <ostream>
 
 class DataType {
diff --git a/alib2dummy/src/xml/DataType.cpp b/alib2dummy/src/xml/DataType.cpp
new file mode 100644
index 0000000000..e0558f19fc
--- /dev/null
+++ b/alib2dummy/src/xml/DataType.cpp
@@ -0,0 +1,45 @@
+/*
+ * DataType.cpp
+ *
+ *  Created on: Mar 26, 2013
+ *      Author: Jan Travnicek
+ */
+
+#include "DataType.h"
+#include <primitive/xml/Integer.h>
+#include <object/Object.h>
+
+#include <registration/XmlRegistration.hpp>
+
+namespace alib {
+
+DataType xmlApi < DataType >::parse ( ext::deque < sax::Token >::iterator & input ) {
+	sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) );
+	int value = xmlApi < int >::parse ( input );
+	sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, xmlTagName ( ) );
+	return DataType ( value );
+}
+
+bool xmlApi < DataType >::first ( const ext::deque < sax::Token >::const_iterator & input ) {
+	return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) );
+}
+
+const std::string & xmlApi < DataType >::xmlTagName ( ) {
+	static std::string xmlTagName = "DataType";
+	return xmlTagName;
+}
+
+void xmlApi < DataType >::compose ( ext::deque < sax::Token > & output, const DataType & data ) {
+	output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT);
+	xmlApi < int >::compose ( output, data.getA ( ) );
+	output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
+}
+
+} /* namespace alib */
+
+namespace {
+
+static auto xmlWrite = registration::XmlWriterRegister < DataType > ( );
+static auto xmlRead = registration::XmlReaderRegister < DataType > ( );
+
+} /* namespace */
diff --git a/alib2dummy/src/xml/DataType.h b/alib2dummy/src/xml/DataType.h
new file mode 100644
index 0000000000..2ffc0f61eb
--- /dev/null
+++ b/alib2dummy/src/xml/DataType.h
@@ -0,0 +1,26 @@
+/*
+ * DataType.h
+ *
+ *  Created on: Dec 8, 2017
+ *      Author: Jan Travnicek
+ */
+
+#ifndef _XML_DATA_TYPE_H_
+#define _XML_DATA_TYPE_H_
+
+#include <DataType.h>
+#include <core/xmlApi.hpp>
+
+namespace alib {
+
+template < >
+struct xmlApi < DataType > {
+	static DataType 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 DataType & data );
+};
+
+} /* namespace alib */
+
+#endif /* _XML_DATA_TYPE_H_ */
-- 
GitLab