From b3f8230d07fe097db1838d53a1f079955d93b8b5 Mon Sep 17 00:00:00 2001 From: Aleksey Lobanov Date: Tue, 16 Jun 2015 16:58:30 +0300 Subject: [PATCH] Added primitive for Crossword Exporting. Added first exporting function --- Makefile | 8 ++++---- src/crossbasetypes.hpp | 6 ++++++ src/crossexport.hpp | 19 +++++++++++++++++++ wxCrossGen/wxCrossGen.mk | 18 +++++++++--------- wxCrossGen/wxCrossGen.txt | 2 +- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 68fba5b..c1fa320 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .PHONY: clean All All: - @echo "----------Building project:[ CrossBench - Release ]----------" - @cd "CrossBench" && $(MAKE) -f "CrossBench.mk" + @echo "----------Building project:[ wxCrossGen - Release ]----------" + @cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk" clean: - @echo "----------Cleaning project:[ CrossBench - Release ]----------" - @cd "CrossBench" && $(MAKE) -f "CrossBench.mk" clean + @echo "----------Cleaning project:[ wxCrossGen - Release ]----------" + @cd "wxCrossGen" && $(MAKE) -f "wxCrossGen.mk" clean diff --git a/src/crossbasetypes.hpp b/src/crossbasetypes.hpp index 65ec6b2..5a98e2f 100644 --- a/src/crossbasetypes.hpp +++ b/src/crossbasetypes.hpp @@ -28,4 +28,10 @@ struct WordInfo { bool direct; }; +struct FilledCrossword { + GridType grid; + std::vector< WordInfo > words; + std::vector< wxString > ans; +}; + #endif // CROSSBASETYPES_HPP diff --git a/src/crossexport.hpp b/src/crossexport.hpp index 672dc8d..222ca49 100644 --- a/src/crossexport.hpp +++ b/src/crossexport.hpp @@ -5,4 +5,23 @@ #include "crossbasetypes.hpp" +//wxTextFile::GetEOL() + +void exportToString(const FilledCrossword &cross, const bool prn_ans, wxString &str_out){ + +} + +bool exportToFile(const FilledCrossword &cross, const bool prn_ans, const wxString path){ + wxTextFile f(path); + if ( f.Exists() ) + return false; + f.Create(); + wxString cont; + exportToString(cross, prn_ans, cont); + f.AddLine(cont); + f.Write(); + f.Close(); + return true; +} + #endif // CROSSEXPORT_HPP diff --git a/wxCrossGen/wxCrossGen.mk b/wxCrossGen/wxCrossGen.mk index f0b6236..d984fe9 100644 --- a/wxCrossGen/wxCrossGen.mk +++ b/wxCrossGen/wxCrossGen.mk @@ -2,12 +2,12 @@ ## Auto Generated makefile by CodeLite IDE ## any manual changes will be erased ## -## Debug +## Release ProjectName :=wxCrossGen -ConfigurationName :=Debug +ConfigurationName :=Release WorkspacePath := "/data/Sync/SyncProjects/CrossGen" ProjectPath := "/data/Sync/SyncProjects/CrossGen/wxCrossGen" -IntermediateDirectory :=./Debug +IntermediateDirectory :=../Release OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := @@ -28,14 +28,14 @@ LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c OutputFile :=$(IntermediateDirectory)/$(ProjectName).out -Preprocessors := +Preprocessors :=$(PreprocessorSwitch)NDEBUG ObjectSwitch :=-o ArchiveOutputSwitch := PreprocessOnlySwitch :=-E ObjectsFileList :="wxCrossGen.txt" PCHCompileFlags := MakeDirCommand :=mkdir -p -LinkOptions := $(shell wx-config --debug=yes --libs --unicode=yes) +LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes) IncludePath := $(IncludeSwitch). $(IncludeSwitch)../src IncludePCH := RcIncludePath := @@ -50,8 +50,8 @@ LibPath := $(LibraryPathSwitch). AR := /usr/bin/ar rcu CXX := /usr/bin/g++-4.8 CC := /usr/bin/gcc-4.8 -CXXFLAGS := -std=c++11 -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) -CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors) +CXXFLAGS := -std=c++11 -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) ASFLAGS := AS := /usr/bin/as @@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects) $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) $(IntermediateDirectory)/.d: - @test -d ./Debug || $(MakeDirCommand) ./Debug + @test -d ../Release || $(MakeDirCommand) ../Release PreBuild: @@ -101,6 +101,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp ## Clean ## clean: - $(RM) -r ./Debug/ + $(RM) -r ../Release/ diff --git a/wxCrossGen/wxCrossGen.txt b/wxCrossGen/wxCrossGen.txt index 6716386..b7e8d8a 100644 --- a/wxCrossGen/wxCrossGen.txt +++ b/wxCrossGen/wxCrossGen.txt @@ -1 +1 @@ -./Debug/main.cpp.o +../Release/main.cpp.o