Changeset 16 for trunk/tmdmcreator/src/main.cpp
- Timestamp:
- 02/21/13 16:20:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/main.cpp
r6 r16 27 27 #include <wx/dir.h> 28 28 #include <wx/filename.h> 29 #include "tmdmcreator.h" 29 30 30 31 … … 34 35 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, 35 36 { wxCMD_LINE_SWITCH, "v", "verbose", "Be more verbose" }, 36 { wxCMD_LINE_PARAM, NULL, NULL, "[structure sql file]"}, 37 { wxCMD_LINE_PARAM, NULL, NULL, "[content txt file]"}, 38 { wxCMD_LINE_PARAM, NULL, NULL, "[result sql file]"}, 37 { wxCMD_LINE_SWITCH, "t", "toolmap", "toolmap output" }, 38 { wxCMD_LINE_SWITCH, "o", "overwrite", "overwrite output" }, 39 { wxCMD_LINE_PARAM, NULL, NULL, "[base structure sql file]"}, 40 { wxCMD_LINE_PARAM, NULL, NULL, "[user structure sql file]"}, 41 { wxCMD_LINE_PARAM, NULL, NULL, "[user content txt file]"}, 42 { wxCMD_LINE_PARAM, NULL, NULL, "[result file]"}, 39 43 { wxCMD_LINE_NONE } 40 44 }; … … 42 46 43 47 44 void PrintArray(const wxArrayString & array, const wxString & msg){ 45 wxPrintf(msg + _T("\n")); 48 void PrintArray(const wxArrayString & array, const wxString & msg = wxEmptyString){ 49 if (msg != wxEmptyString) { 50 wxPrintf(msg + _T("\n")); 51 } 46 52 for (unsigned int i = 0; i< array.GetCount(); i++) { 47 53 wxPrintf(array[i] + _T("\n")); … … 74 80 // cmd line is correct !! 75 81 wxPrintf(myLogoTxt); 82 83 bool bVerbose = parser.Found("verbose"); 84 bool bToolMap = parser.Found("toolmap"); 85 if (parser.Found("overwrite")) { 86 wxRemoveFile(parser.GetParam(3)); 87 } 88 89 if (bToolMap == true) { 90 wxPrintf(_("Exporting to ToolMap project not supported for now!\n")); 91 return 0; 92 } 93 94 wxASSERT(parser.GetParamCount() == 4); 95 TmDmCreator myCreator; 96 myCreator.SetBaseSQL(wxFileName(parser.GetParam(0))); 97 myCreator.SetUserSQL(wxFileName(parser.GetParam(1))); 98 myCreator.SetUserContent(wxFileName(parser.GetParam(2))); 99 myCreator.SetOutSQL(wxFileName(parser.GetParam(3))); 100 101 wxArrayString myErrors; 102 if (myCreator.CheckFiles(myErrors) == false) { 103 if (bVerbose == true) { 104 PrintArray(myErrors); 105 } 106 wxPrintf(_("Error while checking files, aborting!\n")); 107 return 0; 108 } 109 110 if (myCreator.ProcessFiles(myErrors) == false) { 111 if (bVerbose == true) { 112 PrintArray(myErrors); 113 } 114 wxPrintf(_("Error processing files, aborting\n")); 115 return 0; 116 } 117 118 wxPrintf(_("Processing succeed!\n")); 76 119 return 0; 77 120 }
Note: See TracChangeset
for help on using the changeset viewer.