Changeset 17 for trunk/tmdmcreator/src
- Timestamp:
- 02/21/13 17:14:39 (12 years ago)
- Location:
- trunk/tmdmcreator/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/tmdmcreator.cpp
r16 r17 17 17 #include "tmdmcreator.h" 18 18 #include "tmdmcopier.h" 19 #include "tmdmprocessor.h" 19 20 20 21 TmDmCreator::TmDmCreator() { … … 92 93 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg) { 93 94 errorsmsg.Clear(); 94 // Copy structure to out95 // Copy structure 95 96 TmDmCopier myCopier(m_FileNameOutSQL); 96 97 if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { … … 104 105 } 105 106 106 107 107 // Process layers 108 TmDmProcessorSimple myLayerProc(m_FileNameUserContent, m_FileNameOutSQL); 109 int myThematicLayersStart = myLayerProc.FindBlock(_T("thematic_layers")); 110 if (myThematicLayersStart == wxNOT_FOUND) { 111 errorsmsg.Add(wxString::Format(_("'thematic_layers' field not found in %s"), m_FileNameUserContent.GetFullPath())); 112 return false; 113 } 114 if (myLayerProc.ProcessBlock(myThematicLayersStart)==false) { 115 errorsmsg.Add(wxString::Format(_("Processing 'thematic_layers' failed in %s"), m_FileNameUserContent.GetFullPath())); 116 return false; 117 } 108 118 return true; 109 119 } -
trunk/tmdmcreator/src/tmdmprocessor.cpp
r16 r17 18 18 #include "tmdmcopier.h" 19 19 20 TmDmProcessor::TmDmProcessor() { 20 TmDmProcessor::TmDmProcessor(const wxFileName & src, const wxFileName & dest) { 21 m_FileSrc = src; 22 m_FileDst = dest; 21 23 } 22 24 … … 29 31 30 32 int TmDmProcessor::FindBlock(const wxString & blockname) { 33 wxFileInputStream input(m_FileSrc.GetFullPath()); 34 wxTextInputStream text(input); 35 long myLineIndex = 0; 36 while(input.IsOk() && !input.Eof() ){ 37 wxString myLine = text.ReadLine(); 38 if (myLine.StartsWith(blockname)==true){ 39 return myLineIndex; 40 } 41 myLineIndex++; 42 } 31 43 return wxNOT_FOUND; 32 44 } … … 39 51 40 52 41 TmDmProcessorSimple::TmDmProcessorSimple( ) {53 TmDmProcessorSimple::TmDmProcessorSimple(const wxFileName & src, const wxFileName & dest) : TmDmProcessor(src,dest) { 42 54 } 43 55 … … 49 61 50 62 51 bool TmDmProcessorSimple::ProcessBlock(int blockstart, TmDmCopier * copier) { 63 bool TmDmProcessorSimple::ProcessBlock(int blockstart) { 64 wxString mySQLCols = wxEmptyString; 65 wxString mySQLTxt = wxEmptyString; 66 67 wxFileInputStream input(m_FileSrc.GetFullPath()); 68 wxTextInputStream text(input); 69 long myLineIndex = 0; 70 while(input.IsOk() && !input.Eof() ){ 71 if (myLineIndex <= blockstart) { 72 myLineIndex++; 73 continue; 74 } 75 76 wxString myRow = text.ReadLine(); 77 78 // HERE !!! 79 80 81 82 myLineIndex++; 83 } 84 return wxNOT_FOUND; 85 86 87 88 52 89 return false; 53 90 } … … 61 98 62 99 63 TmDmProcessorAttributs::TmDmProcessorAttributs( ) {100 TmDmProcessorAttributs::TmDmProcessorAttributs(const wxFileName & src, const wxFileName & dest) : TmDmProcessor(src,dest) { 64 101 } 65 102 … … 67 104 } 68 105 69 bool TmDmProcessorAttributs::ProcessBlock(int blockstart , TmDmCopier * copier) {106 bool TmDmProcessorAttributs::ProcessBlock(int blockstart) { 70 107 return false; 71 108 } -
trunk/tmdmcreator/src/tmdmprocessor.h
r16 r17 17 17 #define _TMDMPROCESSOR_H_ 18 18 19 // For compilers that support precompilation, includes "wx/wx.h".20 19 #include "wx/wxprec.h" 21 22 // Include wxWidgets' headers23 20 #ifndef WX_PRECOMP 24 21 #include <wx/wx.h> 25 22 #endif 23 #include <wx/filename.h> 24 #include <wx/wfstream.h> 25 #include <wx/txtstrm.h> 26 26 27 27 28 class TmDmCopier; 28 29 class TmDmProcessor { 29 30 protected: 30 TmDmCopier * m_Copier; 31 wxFileName m_FileSrc; 32 wxFileName m_FileDst; 31 33 32 34 public: 33 TmDmProcessor( );35 TmDmProcessor(const wxFileName & src, const wxFileName & dest); 34 36 virtual ~TmDmProcessor(); 35 37 36 38 int FindBlock(const wxString & blockname); 37 virtual bool ProcessBlock(int blockstart , TmDmCopier * copier) = 0;39 virtual bool ProcessBlock(int blockstart) = 0; 38 40 }; 39 41 … … 46 48 class TmDmProcessorSimple : public TmDmProcessor { 47 49 public: 48 TmDmProcessorSimple( );50 TmDmProcessorSimple(const wxFileName & src, const wxFileName & dest); 49 51 virtual ~TmDmProcessorSimple(); 50 52 51 virtual bool ProcessBlock(int blockstart , TmDmCopier * copier);53 virtual bool ProcessBlock(int blockstart); 52 54 }; 53 55 … … 60 62 class TmDmProcessorAttributs : public TmDmProcessor { 61 63 public: 62 TmDmProcessorAttributs( );64 TmDmProcessorAttributs(const wxFileName & src, const wxFileName & dest); 63 65 virtual ~TmDmProcessorAttributs(); 64 66 65 virtual bool ProcessBlock(int blockstart , TmDmCopier * copier);67 virtual bool ProcessBlock(int blockstart); 66 68 }; 67 69 #endif
Note: See TracChangeset
for help on using the changeset viewer.