Changeset 21 for trunk/tmdmcreator/src
- Timestamp:
- 02/25/13 11:47:25 (12 years ago)
- Location:
- trunk/tmdmcreator/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/main.cpp
r18 r21 35 35 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, 36 36 { wxCMD_LINE_SWITCH, "v", "verbose", "Be more verbose" }, 37 { wxCMD_LINE_SWITCH, "t", "toolmap", "toolmap output" }, 38 { wxCMD_LINE_SWITCH, "o", "overwrite", "overwrite output" }, 37 { wxCMD_LINE_SWITCH, "t", "toolmap", "toolmap output (default is SQL)" }, 38 { wxCMD_LINE_SWITCH, "o", "overwrite", "overwrite output" }, 39 { wxCMD_LINE_OPTION, "l", "language", "language column (default is 0)", wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL}, 39 40 { wxCMD_LINE_PARAM, NULL, NULL, "[base structure sql file]"}, 40 41 { wxCMD_LINE_PARAM, NULL, NULL, "[user structure sql file]"}, … … 83 84 bool bVerbose = parser.Found("verbose"); 84 85 bool bToolMap = parser.Found("toolmap"); 86 long myLanguage = 0; 87 if(parser.Found("language", &myLanguage) == true) { 88 wxPrintf(_("Using language column: %ld\n"), myLanguage); 89 } 85 90 if (parser.Found("overwrite") && wxFileExists(parser.GetParam(3))) { 86 91 wxRemoveFile(parser.GetParam(3)); … … 108 113 } 109 114 110 if (myCreator.ProcessFiles(myErrors ) == false) {115 if (myCreator.ProcessFiles(myErrors, myLanguage) == false) { 111 116 if (bVerbose == true) { 112 117 PrintArray(myErrors); -
trunk/tmdmcreator/src/tmdmcreator.cpp
r19 r21 91 91 92 92 93 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg ) {93 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg, int languagecolumn) { 94 94 errorsmsg.Clear(); 95 95 // Copy structure … … 109 109 // Process layers 110 110 TmDmProcessorSimple myProc(m_FileNameUserContent, m_FileNameOutSQL); 111 myProc.SetLanguageColumn(languagecolumn); 111 112 int myThematicLayersStart = myProc.FindBlock(_T("thematic_layers")); 112 113 if (myThematicLayersStart == wxNOT_FOUND) { … … 132 133 // Process attributs 133 134 TmDmProcessorAttributs myProcAttributs (m_FileNameUserContent, m_FileNameOutSQL); 135 myProcAttributs.SetLanguageColumn(languagecolumn); 134 136 int myAttributStart = myProcAttributs.FindBlock(_T("attributs")); 135 137 if (myAttributStart == wxNOT_FOUND) { -
trunk/tmdmcreator/src/tmdmcreator.h
r16 r21 42 42 43 43 bool CheckFiles(wxArrayString & errormsg); 44 bool ProcessFiles(wxArrayString & errorsmsg );44 bool ProcessFiles(wxArrayString & errorsmsg, int languagecolumn); 45 45 }; 46 46 #endif -
trunk/tmdmcreator/src/tmdmprocessor.cpp
r19 r21 21 21 m_FileSrc = src; 22 22 m_FileDst = dest; 23 m_LanguageCol = 0; 23 24 } 24 25 … … 42 43 } 43 44 return wxNOT_FOUND; 45 } 46 47 48 49 wxString TmDmProcessor::SwitchCols(wxArrayString * cols, wxArrayString * values, int item) { 50 if (m_LanguageCol == 0) { 51 return values->Item(item); 52 } 53 54 55 if(cols->Item(item).Contains(_T("_0")) == true) { 56 return values->Item(item + m_LanguageCol); 57 } 58 59 wxString myColName = wxString::Format(_T("_%d"), m_LanguageCol); 60 if (cols->Item(item).Contains(myColName) == true) { 61 return values->Item(item - m_LanguageCol); 62 } 63 return values->Item(item); 64 } 65 66 67 68 void TmDmProcessor::SetLanguageColumn(int value) { 69 m_LanguageCol = value; 44 70 } 45 71 … … 104 130 myInsert.Append(_T(") VALUES (")); 105 131 for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 106 myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i)));132 myInsert.Append(wxString::Format(_T("\"%s\","), SwitchCols(&mySQLCols, &myValues, i))); 107 133 } 108 134 myInsert.RemoveLast(); … … 232 258 wxString myInsert = _T("INSERT INTO `dmn_catalog` VALUES ("); 233 259 for (unsigned int i = START_COL; i< mySQLCols.GetCount(); i++) { 234 myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i)));260 myInsert.Append(wxString::Format(_T("\"%s\","), SwitchCols(&mySQLCols, &myValues, i))); 235 261 } 236 262 myInsert.RemoveLast(); -
trunk/tmdmcreator/src/tmdmprocessor.h
r19 r21 33 33 wxFileName m_FileDst; 34 34 35 int m_LanguageCol; 36 wxString SwitchCols(wxArrayString * cols, wxArrayString * values, int item); 37 35 38 public: 36 39 TmDmProcessor(const wxFileName & src, const wxFileName & dest); … … 39 42 int FindBlock(const wxString & blockname); 40 43 virtual bool ProcessBlock(int blockstart, const wxString & tablename) = 0; 44 45 void SetLanguageColumn(int value); 41 46 }; 42 47
Note: See TracChangeset
for help on using the changeset viewer.