Changeset 16
- Timestamp:
- 02/21/13 16:20:42 (12 years ago)
- Location:
- trunk/tmdmcreator
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/docs/uml/tmdmcreator/128033.diagram
r15 r16 1 1 format 75 2 2 3 classcanvas 128033 class_ref 128033 // tmdmcreator3 classcanvas 128033 class_ref 128033 // TmDmCreator 4 4 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 5 xyz 34 7520005 xyz 34.2 74 2000 6 6 end 7 7 classcanvas 128161 class_ref 128161 // TmDmCopier 8 8 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 9 xyz 444 166 2000 10 end 11 classcanvas 128289 class_ref 134689 // TMDMCOPIER_MODE 12 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 13 xyz 424 31 2005 9 xyz 400.5 183.9 2000 14 10 end 15 11 classcanvas 128417 class_ref 141217 // TmDmProcessor 16 12 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 17 xyz 332 422 200013 xyz 332.2 422 2000 18 14 end 19 15 classcanvas 128545 class_ref 141345 // TmDmProcessorSimple 20 16 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 21 xyz 443 688200017 xyz 443.6 689.1 2000 22 18 end 23 19 classcanvas 128801 class_ref 141473 // TmDmProcessorAttributs 24 20 draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 25 xyz 5 7 686200021 xyz 55.8 687.1 2000 26 22 end 27 23 relationcanvas 128673 relation_ref 128033 // <generalisation> … … 37 33 relationcanvas 129057 relation_ref 128289 // <unidirectional association> 38 34 from ref 128417 z 2001 to ref 128161 39 role_a_pos 5 96 3113000 no_role_b35 role_a_pos 545 294 3000 no_role_b 40 36 no_multiplicity_a no_multiplicity_b 41 37 end -
trunk/tmdmcreator/docs/uml/tmdmcreator/33.session
r15 r16 1 window_sizes 1920 1032 337 1577 8391361 window_sizes 959 1031 253 700 838 136 2 2 diagrams 3 3 active classdiagram_ref 128033 // tmdmcreator 4 1573 819 100 4 0 04 1573 819 90 4 0 0 5 5 end 6 6 show_stereotypes 7 selected operation_ref 137377 // CheckFiles8 7 open 9 operation_ref 135329 // ~tmdmcreator 10 class_ref 134689 // TMDMCOPIER_MODE 8 class_ref 128161 // TmDmCopier 11 9 classrelation_ref 128289 // m_Copier (<unidirectional association>) 12 10 class_ref 141345 // TmDmProcessorSimple -
trunk/tmdmcreator/docs/uml/tmdmcreator/tmdmcreator.prj
r15 r16 1 1 format 75 2 2 "tmdmcreator" 3 revision 33 revision 4 4 4 modified_by 33 "lucien" 5 5 … … 62 62 end 63 63 64 class 128033 " tmdmcreator"64 class 128033 "TmDmCreator" 65 65 visibility package 66 66 cpp_decl "${comment}${template}class ${name}${inherit} { … … 118 118 end 119 119 120 operation 135201 " tmdmcreator"120 operation 135201 "TmDmCreator" 121 121 public explicit_return_type "" 122 122 nparams 0 … … 132 132 end 133 133 134 operation 135329 "~ tmdmcreator"134 operation 135329 "~TmDmCreator" 135 135 cpp_virtual public explicit_return_type "" 136 136 nparams 0 … … 277 277 explicit_switch_type "" 278 278 279 attribute 128289 "m_CopyMode"280 private type class_ref 134689 // TMDMCOPIER_MODE281 cpp_decl " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value};282 "283 java_decl ""284 php_decl ""285 python_decl ""286 idl_decl ""287 set_oper operation_ref 128417 // SetCopyMode288 end289 290 279 operation 128033 "TmDmCopier" 291 280 public explicit_return_type "" … … 317 306 end 318 307 319 operation 128417 "SetCopyMode"320 force_body_gen public explicit_return_type "void"321 nparams 1322 param in name "value" type class_ref 134689 // TMDMCOPIER_MODE323 cpp_decl " ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${t0} ${p0}${)}${const}${volatile}${throw};324 "325 cpp_def "${comment}${inline}${type} ${class}::${name}${(}${t0} ${p0}${)}${const}${volatile}${throw}${staticnl}{326 m_CopyMode = ${p0};327 }328 "329 cpp_name_spec "SetCopyMode"330 331 java_name_spec "set${Name}"332 333 php_name_spec "set${Name}"334 335 python_name_spec "set${Name}"336 337 idl_name_spec "set_${name}"338 set_of_attribute attribute_ref 128289 // m_CopyMode339 end340 341 308 operation 128545 "CopyFrom" 342 309 public explicit_return_type "bool" … … 369 336 end 370 337 371 operation 135457 "IsCopyAllowed" 372 public explicit_return_type "bool" 373 nparams 0 374 cpp_decl " ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${)}${const}${volatile}${throw}${abstract}; 375 " 376 cpp_def "${comment}${inline}${type} ${class}::${name}${(}${)}${const}${volatile}${throw}${staticnl}{ 377 ${body}} 378 " 379 380 381 382 383 end 384 end 385 386 class 134689 "TMDMCOPIER_MODE" 387 visibility package stereotype "enum" 388 cpp_decl "${comment}enum ${name} { 389 ${items} 390 }; 391 " 392 java_decl "${comment}${@}${visibility}${final}${abstract}enum ${name}${implements} { 393 ${items}; 394 ${members}} 395 " 396 php_decl "${comment}${visibility}final class ${name} { 397 ${items}} 398 " 399 python_2_2 python_decl "class ${name}: 400 ${docstring}${members} 401 " 402 idl_decl "${comment}enum ${name} { 403 ${items}}; 404 " 405 explicit_switch_type "" 406 407 attribute 128033 "TMDMCOPIER_MODE_ERASE" 408 public type class_ref 134689 // TMDMCOPIER_MODE 409 init_value "0" 410 cpp_decl " ${name}${value},${comment}" 411 java_decl "" 412 php_decl "" 413 python_decl "" 414 idl_decl "" 415 end 416 417 attribute 128161 "TMDMCOPIER_MODE_APPEND" 418 public type class_ref 134689 // TMDMCOPIER_MODE 419 cpp_decl " ${name}${value},${comment}" 338 attribute 141985 "m_File" 339 private explicit_type "wxFFile" 340 cpp_decl " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; 341 " 420 342 java_decl "" 421 343 php_decl "" … … 501 423 502 424 end 503 504 425 end 505 426 … … 696 617 ${namespace_end}" 697 618 associated_classes 698 class_ref 128033 // tmdmcreator619 class_ref 128033 // TmDmCreator 699 620 end 700 621 end … … 757 678 ${namespace_end}" 758 679 associated_classes 759 class_ref 134689 // TMDMCOPIER_MODE760 680 class_ref 128161 // TmDmCopier 761 681 end -
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 } -
trunk/tmdmcreator/src/tmdmcopier.cpp
r15 r16 2 2 tmdmcopier.cpp 3 3 ------------------- 4 copyright : (C) 2013 CREALP Lucien Schreiber 4 copyright : (C) 2013 CREALP Lucien Schreiber 5 5 email : lucien.schreiber at crealp dot vs dot ch 6 6 ***************************************************************************/ … … 18 18 19 19 TmDmCopier::TmDmCopier(const wxFileName & destfile) { 20 m_File = new wxFFile(); 21 bool bOpen = m_File->Open(destfile.GetFullPath(), "a"); 22 wxASSERT(bOpen == true); 20 23 } 21 24 25 26 22 27 TmDmCopier::~TmDmCopier() { 28 wxDELETE(m_File); 23 29 } 24 30 25 void TmDmCopier::SetCopyMode(TMDMCOPIER_MODE value) { 26 m_CopyMode = value; 31 32 33 bool TmDmCopier::CopyFrom(const wxFileName & filename) { 34 wxFFile mySrcFile; 35 if (mySrcFile.Open(filename.GetFullPath()) == false) { 36 m_Errors.Add(wxString::Format(_("Unable to open: %s"), filename.GetFullPath())); 37 return false; 38 } 39 40 wxString mySrcTxt; 41 if(mySrcFile.ReadAll(&mySrcTxt)==false){ 42 m_Errors.Add(wxString::Format(_("Reading from: %s failed!"), filename.GetFullPath())); 43 return false; 44 } 45 return CopyFrom(mySrcTxt); 27 46 } 28 47 29 bool TmDmCopier::CopyFrom(const wxFileName & filename) { 48 49 50 bool TmDmCopier::CopyFrom(const wxString & text) { 51 if (m_File->Write(text) == false) { 52 m_Errors.Add(wxString::Format(_("Writing to: %s failed!"), m_File->GetName())); 53 return false; 54 } 55 56 return true; 30 57 } 31 58 32 bool TmDmCopier::CopyFrom(const wxString & text) { 59 60 61 wxArrayString TmDmCopier::GetErrors(){ 62 return m_Errors; 33 63 } 34 35 bool TmDmCopier::IsCopyAllowed() {36 }37 -
trunk/tmdmcreator/src/tmdmcopier.h
r15 r16 23 23 24 24 #include <wx/filename.h> 25 #include <wx/ffile.h> 25 26 26 enum TMDMCOPIER_MODE {27 TMDMCOPIER_MODE_ERASE = 0,28 TMDMCOPIER_MODE_APPEND29 };30 27 31 28 32 29 class TmDmCopier { 33 30 private: 34 TMDMCOPIER_MODE m_CopyMode; 31 wxFFile * m_File; 32 wxArrayString m_Errors; 35 33 36 34 public: … … 38 36 virtual ~TmDmCopier(); 39 37 40 void SetCopyMode(TMDMCOPIER_MODE value);41 38 bool CopyFrom(const wxFileName & filename); 42 39 bool CopyFrom(const wxString & text); 43 bool IsCopyAllowed(); 40 41 wxArrayString GetErrors(); 44 42 }; 45 43 #endif -
trunk/tmdmcreator/src/tmdmcreator.cpp
r15 r16 16 16 17 17 #include "tmdmcreator.h" 18 #include "tmdmcopier.h" 18 19 19 tmdmcreator::tmdmcreator() {20 TmDmCreator::TmDmCreator() { 20 21 } 21 22 22 23 23 24 24 tmdmcreator::~tmdmcreator() {25 TmDmCreator::~TmDmCreator() { 25 26 } 26 27 27 28 28 29 29 void tmdmcreator::SetBaseSQL(wxFileName value) {30 void TmDmCreator::SetBaseSQL(wxFileName value) { 30 31 m_FileNameBaseSQL = value; 31 32 } … … 33 34 34 35 35 void tmdmcreator::SetUserSQL(wxFileName value) {36 void TmDmCreator::SetUserSQL(wxFileName value) { 36 37 m_FileNameUserSQL = value; 37 38 } … … 39 40 40 41 41 void tmdmcreator::SetUserContent(wxFileName value) {42 void TmDmCreator::SetUserContent(wxFileName value) { 42 43 m_FileNameUserContent = value; 43 44 } … … 45 46 46 47 47 void tmdmcreator::SetOutSQL(wxFileName value) {48 void TmDmCreator::SetOutSQL(wxFileName value) { 48 49 m_FileNameOutSQL = value; 49 50 } 50 51 51 52 52 53 bool tmdmcreator::CheckFiles(wxArrayString & errormsg) { 54 return false; 53 bool TmDmCreator::_CheckExistsAndExt(const wxFileName & filename, const wxString & extension, wxArrayString * errormsg){ 54 wxASSERT(errormsg); 55 if (filename.Exists() == false) { 56 errormsg->Add(wxString::Format(_("File: %s didn't exists!"), filename.GetFullPath())); 57 return false; 58 } 59 if (filename.GetExt().Lower() != extension) { 60 errormsg->Add(wxString::Format(_("Wrong extension for: %s (expected: %s)"), filename.GetFullPath(), extension)); 61 return false; 62 } 63 return true; 55 64 } 56 65 57 66 58 67 59 bool tmdmcreator::ProcessFiles(wxArrayString & errorsmsg) { 60 return false; 68 bool TmDmCreator::CheckFiles(wxArrayString & errormsg) { 69 errormsg.Clear(); 70 if (_CheckExistsAndExt(m_FileNameBaseSQL, _T("sql"), &errormsg) == false) { 71 return false; 72 } 73 if (_CheckExistsAndExt(m_FileNameUserSQL, _T("sql"), &errormsg) == false) { 74 return false; 75 } 76 if (_CheckExistsAndExt(m_FileNameUserContent, _T("txt"), &errormsg) == false) { 77 return false; 78 } 79 if (m_FileNameOutSQL.Exists()) { 80 errormsg.Add(wxString::Format(_("output file: %s allready exists!"), m_FileNameOutSQL.GetFullPath())); 81 return false; 82 } 83 if (m_FileNameOutSQL.IsDirWritable() == false){ 84 errormsg.Add(wxString::Format(_T("Writing not permitted into %s"), m_FileNameOutSQL.GetPath())); 85 return false; 86 } 87 return true; 61 88 } 62 89 90 91 92 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg) { 93 errorsmsg.Clear(); 94 // Copy structure to out 95 TmDmCopier myCopier(m_FileNameOutSQL); 96 if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { 97 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameBaseSQL.GetFullPath())); 98 return false; 99 } 100 101 if (myCopier.CopyFrom(m_FileNameUserSQL) == false) { 102 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameUserSQL.GetFullPath())); 103 return false; 104 } 105 106 107 108 return true; 109 } 110 -
trunk/tmdmcreator/src/tmdmcreator.h
r15 r16 21 21 #include <wx/wx.h> 22 22 #endif 23 24 23 #include <wx/filename.h> 25 24 26 class tmdmcreator {25 class TmDmCreator { 27 26 private: 28 27 wxFileName m_FileNameBaseSQL; … … 31 30 wxFileName m_FileNameOutSQL; 32 31 32 bool _CheckExistsAndExt(const wxFileName & filename, const wxString & extension, wxArrayString * errormsg); 33 33 34 public: 34 tmdmcreator();35 virtual ~ tmdmcreator();36 35 TmDmCreator(); 36 virtual ~TmDmCreator(); 37 37 38 void SetBaseSQL(wxFileName value); 38 39 void SetUserSQL(wxFileName value); … … 41 42 42 43 bool CheckFiles(wxArrayString & errormsg); 43 bool ProcessFiles(wxArrayString & errorsmsg); 44 bool ProcessFiles(wxArrayString & errorsmsg); 44 45 }; 45 46 #endif -
trunk/tmdmcreator/src/tmdmprocessor.cpp
r15 r16 2 2 tmdmprocessor.cpp 3 3 ------------------- 4 copyright : (C) 2013 CREALP Lucien Schreiber 4 copyright : (C) 2013 CREALP Lucien Schreiber 5 5 email : lucien.schreiber at crealp dot vs dot ch 6 6 ***************************************************************************/ … … 21 21 } 22 22 23 24 23 25 TmDmProcessor::~TmDmProcessor() { 24 26 } 25 27 28 29 26 30 int TmDmProcessor::FindBlock(const wxString & blockname) { 31 return wxNOT_FOUND; 27 32 } 33 34 35 36 37 38 39 28 40 29 41 TmDmProcessorSimple::TmDmProcessorSimple() { 30 42 } 31 43 44 45 32 46 TmDmProcessorSimple::~TmDmProcessorSimple() { 33 47 } 34 48 49 50 35 51 bool TmDmProcessorSimple::ProcessBlock(int blockstart, TmDmCopier * copier) { 52 return false; 36 53 } 54 55 56 57 58 59 60 61 37 62 38 63 TmDmProcessorAttributs::TmDmProcessorAttributs() { … … 43 68 44 69 bool TmDmProcessorAttributs::ProcessBlock(int blockstart, TmDmCopier * copier) { 70 return false; 45 71 } 46 72 -
trunk/tmdmcreator/src/tmdmprocessor.h
r15 r16 2 2 tmdmprocessor.h 3 3 ------------------- 4 copyright : (C) 2013 CREALP Lucien Schreiber 4 copyright : (C) 2013 CREALP Lucien Schreiber 5 5 email : lucien.schreiber at crealp dot vs dot ch 6 6 ***************************************************************************/ … … 25 25 #endif 26 26 27 28 27 class TmDmCopier; 29 30 28 class TmDmProcessor { 31 29 protected: 32 30 TmDmCopier * m_Copier; 31 32 public: 33 TmDmProcessor(); 34 virtual ~TmDmProcessor(); 35 36 int FindBlock(const wxString & blockname); 37 virtual bool ProcessBlock(int blockstart, TmDmCopier * copier) = 0; 38 }; 33 39 34 40 35 public:36 TmDmProcessor();37 41 38 virtual ~TmDmProcessor();39 42 40 int FindBlock(const wxString & blockname);41 43 42 virtual bool ProcessBlock(int blockstart, TmDmCopier * copier) = 0;43 44 45 46 class TmDmProcessorSimple : public TmDmProcessor { 47 public: 48 TmDmProcessorSimple(); 49 virtual ~TmDmProcessorSimple(); 50 51 virtual bool ProcessBlock(int blockstart, TmDmCopier * copier); 44 52 }; 45 class TmDmProcessorSimple : public TmDmProcessor {46 public:47 TmDmProcessorSimple();48 53 49 virtual ~TmDmProcessorSimple();50 54 55 56 57 58 59 60 class TmDmProcessorAttributs : public TmDmProcessor { 61 public: 62 TmDmProcessorAttributs(); 63 virtual ~TmDmProcessorAttributs(); 64 51 65 virtual bool ProcessBlock(int blockstart, TmDmCopier * copier); 52 53 };54 class TmDmProcessorAttributs : public TmDmProcessor {55 public:56 TmDmProcessorAttributs();57 58 virtual ~TmDmProcessorAttributs();59 60 virtual bool ProcessBlock(int blockstart, TmDmCopier * copier);61 62 66 }; 63 67 #endif
Note: See TracChangeset
for help on using the changeset viewer.