src/DataTypeWriter.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 22 Jul 2018 10:26:22 +0200
branchv_0
changeset 15 8fd6c4d44071
parent 9 0a40752e401d
child 16 3613617d3076
permissions -rw-r--r--
use more TypeId enum

#pragma once

#include "DataTypeWriterBase.h"

namespace relpipe {
namespace writer {

template<typename T> class DataTypeWriter : public DataTypeWriterBase {
public:

	DataTypeWriter(const TypeId typeId, const string_t typeCode) : DataTypeWriterBase(typeId, typeCode) {
	}

	virtual ~DataTypeWriter() {
	};

	virtual void writeValue(std::ostream& output, const T& value) = 0;

	void writeString(std::ostream& output, const string_t &stringValue) override {
		writeValue(output, toValue(stringValue));
	}

	virtual T toValue(const string_t &stringValue) = 0;

};

}
}