src/DataTypeCatalog.h
branchv_0
changeset 8 c87e9c84f7aa
parent 7 489e52138771
child 9 517888868e55
--- a/src/DataTypeCatalog.h	Sat Jul 14 23:24:22 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#pragma once
-
-#include <string>
-#include <iostream>
-#include <vector>
-
-#include "common.h"
-#include "DataType.h"
-#include "BooleanDataType.h"
-#include "IntegerDataType.h"
-#include "StringDataType.h"
-
-using namespace std;
-
-namespace rp_prototype {
-
-class DataTypeCatalog {
-private:
-	BooleanDataType booleanType;
-	IntegerDataType integerType;
-	StringDataType stringType;
-	vector<DataTypeBase*> types = {&booleanType, &integerType, &stringType};
-public:
-
-	integer_t toTypeId(const wstring typeCode) {
-		for (DataTypeBase* dataType : types) if (dataType->supports(typeCode)) return dataType->getTypeId();
-		throw RelpipeException(L"Unsupported data type: " + typeCode, EXIT_CODE_DATA_ERROR);
-	}
-
-	wstring toTypeCode(const integer_t typeId) {
-		for (DataTypeBase* dataType : types) if (dataType->supports(typeId)) return dataType->getTypeCode();
-		throw RelpipeException(L"Unsupported data type: " + typeId, EXIT_CODE_DATA_ERROR);
-	}
-
-	void writeString(ostream &output, const wstring &stringValue, const integer_t typeId) {
-		for (DataTypeBase* dataType : types) if (dataType->supports(typeId)) return dataType->writeString(output, stringValue);
-		throw RelpipeException(L"Unsupported data type: " + typeId, EXIT_CODE_DATA_ERROR);
-	}
-
-	wstring readString(istream &input, const integer_t typeId) {
-		for (DataTypeBase* dataType : types) if (dataType->supports(typeId)) return dataType->readString(input);
-		throw RelpipeException(L"Unsupported data type: " + typeId, EXIT_CODE_DATA_ERROR);
-	}
-
-};
-
-}
\ No newline at end of file