# HG changeset patch # User František Kučera # Date 1532210893 -7200 # Node ID 733334eca89b3dc51ab45ec3a8a969b3f551fa93 # Parent e7234dd45166090b91460c9e0377a5b13ee4de24 move create() method to a factory diff -r e7234dd45166 -r 733334eca89b include/Factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Factory.h Sun Jul 22 00:08:13 2018 +0200 @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +#include "typedefs.h" +#include "TypeId.h" + +namespace relpipe { +namespace writer { + +class Factory { +public: + static RelationalWriter* create(std::ostream &output); +}; + +} +} diff -r e7234dd45166 -r 733334eca89b include/RelationalWriter.h --- a/include/RelationalWriter.h Sat Jul 21 23:46:29 2018 +0200 +++ b/include/RelationalWriter.h Sun Jul 22 00:08:13 2018 +0200 @@ -23,7 +23,6 @@ virtual void writeRecord(std::vector attributes) = 0; - static RelationalWriter* create(std::ostream &output); }; } diff -r e7234dd45166 -r 733334eca89b nbproject/Makefile-Debug.mk --- a/nbproject/Makefile-Debug.mk Sat Jul 21 23:46:29 2018 +0200 +++ b/nbproject/Makefile-Debug.mk Sun Jul 22 00:08:13 2018 +0200 @@ -35,7 +35,7 @@ # Object Files OBJECTFILES= \ - ${OBJECTDIR}/src/RelationalWriter.o + ${OBJECTDIR}/src/Factory.o # C Compiler Flags @@ -62,10 +62,10 @@ ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/librelpipe-lib-writer.cpp.${CND_DLIB_EXT} ${OBJECTFILES} ${LDLIBSOPTIONS} -shared -fPIC -${OBJECTDIR}/src/RelationalWriter.o: src/RelationalWriter.cpp +${OBJECTDIR}/src/Factory.o: src/Factory.cpp ${MKDIR} -p ${OBJECTDIR}/src ${RM} "$@.d" - $(COMPILE.cc) -g -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/RelationalWriter.o src/RelationalWriter.cpp + $(COMPILE.cc) -g -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/Factory.o src/Factory.cpp # Subprojects .build-subprojects: diff -r e7234dd45166 -r 733334eca89b nbproject/Makefile-Release.mk --- a/nbproject/Makefile-Release.mk Sat Jul 21 23:46:29 2018 +0200 +++ b/nbproject/Makefile-Release.mk Sun Jul 22 00:08:13 2018 +0200 @@ -35,7 +35,7 @@ # Object Files OBJECTFILES= \ - ${OBJECTDIR}/src/RelationalWriter.o + ${OBJECTDIR}/src/Factory.o # C Compiler Flags @@ -62,10 +62,10 @@ ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/librelpipe-lib-writer.cpp.${CND_DLIB_EXT} ${OBJECTFILES} ${LDLIBSOPTIONS} -shared -fPIC -${OBJECTDIR}/src/RelationalWriter.o: src/RelationalWriter.cpp +${OBJECTDIR}/src/Factory.o: src/Factory.cpp ${MKDIR} -p ${OBJECTDIR}/src ${RM} "$@.d" - $(COMPILE.cc) -O2 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/RelationalWriter.o src/RelationalWriter.cpp + $(COMPILE.cc) -O2 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/Factory.o src/Factory.cpp # Subprojects .build-subprojects: diff -r e7234dd45166 -r 733334eca89b nbproject/configurations.xml --- a/nbproject/configurations.xml Sat Jul 21 23:46:29 2018 +0200 +++ b/nbproject/configurations.xml Sun Jul 22 00:08:13 2018 +0200 @@ -7,6 +7,7 @@ src/types/BooleanDataTypeWriter.h src/DataTypeWriter.h src/DataTypeWriterBase.h + include/Factory.h src/types/IntegerDataTypeWriter.h include/RelationalWriter.h include/RelpipeWriterException.h @@ -23,7 +24,7 @@ - src/RelationalWriter.cpp + src/Factory.cpp + + @@ -59,7 +62,7 @@ - + @@ -92,6 +95,8 @@ 5 + + @@ -104,7 +109,7 @@ - + diff -r e7234dd45166 -r 733334eca89b src/Factory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Factory.cpp Sun Jul 22 00:08:13 2018 +0200 @@ -0,0 +1,13 @@ +#include "../include/RelationalWriter.h" +#include "../include/Factory.h" +#include "StreamRelationalWriter.h" + +namespace relpipe { +namespace writer { + +RelationalWriter* Factory::create(std::ostream& output) { + return new StreamRelationalWriter(output); +} + +} +} \ No newline at end of file diff -r e7234dd45166 -r 733334eca89b src/RelationalWriter.cpp --- a/src/RelationalWriter.cpp Sat Jul 21 23:46:29 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#include "../include/RelationalWriter.h" -#include "StreamRelationalWriter.h" - -namespace relpipe { -namespace writer { - -RelationalWriter* RelationalWriter::create(std::ostream& output) { - return new StreamRelationalWriter(output); -} - -} -} \ No newline at end of file diff -r e7234dd45166 -r 733334eca89b src/StreamRelationalWriter.h --- a/src/StreamRelationalWriter.h Sat Jul 21 23:46:29 2018 +0200 +++ b/src/StreamRelationalWriter.h Sun Jul 22 00:08:13 2018 +0200 @@ -69,7 +69,7 @@ // Write column names: for (size_t c = 0; c < columnCount; c++) { - wstring columnName = attributes[c].first; + wstring columnName = attributes[c].first; stringWriter.writeValue(output, columnName); }