Changeset 17 for trunk


Ignore:
Timestamp:
02/21/13 17:14:39 (12 years ago)
Author:
lucsch
Message:

Preliminary code for processing user_content.txt

Location:
trunk/tmdmcreator
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tmdmcreator/docs/uml/tmdmcreator/128033.diagram

    r16 r17  
    33classcanvas 128033 class_ref 128033 // TmDmCreator 
    44  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.2 74 2000 
     5  xyz 34 74.4 2000 
    66end 
    77classcanvas 128161 class_ref 128161 // TmDmCopier 
    88  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 400.5 183.9 2000 
     9  xyz 400.3 184.9 2000 
    1010end 
    1111classcanvas 128417 class_ref 141217 // TmDmProcessor 
    1212  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 332.2 422 2000 
     13  xyz 196.5 408 2000 
    1414end 
    1515classcanvas 128545 class_ref 141345 // TmDmProcessorSimple 
    1616  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 443.6 689.1 2000 
     17  xyz 363.2 588.3 2000 
    1818end 
    1919classcanvas 128801 class_ref 141473 // TmDmProcessorAttributs 
    2020  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 55.8 687.1 2000 
     21  xyz 18.9 694.5 2000 
    2222end 
    2323relationcanvas 128673 relation_ref 128033 // <generalisation> 
     
    3131  no_multiplicity_a no_multiplicity_b 
    3232end 
    33 relationcanvas 129057 relation_ref 128289 // <unidirectional association> 
    34   from ref 128417 z 2001 to ref 128161 
    35   role_a_pos 545 294 3000 no_role_b 
    36   no_multiplicity_a no_multiplicity_b 
    3733end 
    38 end 
  • trunk/tmdmcreator/docs/uml/tmdmcreator/33.session

    r16 r17  
    55end 
    66show_stereotypes 
     7selected operation_ref 136097 // TmDmProcessorSimple 
    78open 
    89  class_ref 128161 // TmDmCopier 
    9   classrelation_ref 128289 // m_Copier (<unidirectional association>) 
     10  operation_ref 136481 // ProcessBlock 
    1011  class_ref 141345 // TmDmProcessorSimple 
    1112  class_ref 141473 // TmDmProcessorAttributs 
  • trunk/tmdmcreator/docs/uml/tmdmcreator/tmdmcreator.prj

    r16 r17  
    11format 75 
    22"tmdmcreator" 
    3   revision 4 
     3  revision 5 
    44  modified_by 33 "lucien" 
    55 
     
    359359      explicit_switch_type "" 
    360360       
    361       classrelation 128289 // m_Copier (<unidirectional association>) 
    362         relation 128289 ---> 
    363           a role_name "m_Copier" protected 
    364             cpp default "    ${comment}${static}${mutable}${volatile}${const}${type} * ${name}${value}; 
    365 " 
    366             classrelation_ref 128289 // m_Copier (<unidirectional association>) 
    367           b parent class_ref 128161 // TmDmCopier 
     361      attribute 148513 "m_FileSrc" 
     362        protected explicit_type "wxFileName" 
     363        cpp_decl "    ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; 
     364" 
     365        java_decl "" 
     366        php_decl "" 
     367        python_decl "" 
     368        idl_decl "" 
     369      end 
     370 
     371      attribute 148641 "m_FileDst" 
     372        protected explicit_type "wxFileName" 
     373        cpp_decl "    ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; 
     374" 
     375        java_decl "" 
     376        php_decl "" 
     377        python_decl "" 
     378        idl_decl "" 
    368379      end 
    369380 
    370381      operation 135585 "TmDmProcessor" 
    371382        public explicit_return_type "" 
    372         nparams 0 
    373         cpp_decl "    ${comment}${inline}${name}${(}${)}${volatile}${throw}; 
    374 " 
    375         cpp_def "${comment}${inline}${class}::${name}${(}${)}${volatile}${throw} { 
     383        nparams 2 
     384          param in name "src" explicit_type "wxFileName" 
     385          param in name "dest" explicit_type "wxFileName" 
     386        cpp_decl "    ${comment}${inline}${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw}; 
     387" 
     388        cpp_def "${comment}${inline}${class}::${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw} { 
    376389  ${body}} 
    377390" 
     
    447460      operation 136097 "TmDmProcessorSimple" 
    448461        public explicit_return_type "" 
    449         nparams 0 
    450         cpp_decl "    ${comment}${inline}${name}${(}${)}${volatile}${throw}; 
    451 " 
    452         cpp_def "${comment}${inline}${class}::${name}${(}${)}${volatile}${throw} { 
     462        nparams 2 
     463          param in name "src" explicit_type "wxFileName" 
     464          param in name "dest" explicit_type "wxFileName" 
     465        cpp_decl "    ${comment}${inline}${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw}; 
     466" 
     467        cpp_def "${comment}${inline}${class}::${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw} { 
    453468  ${body}} 
    454469" 
     
    512527      operation 135841 "TmDmProcessorAttributs" 
    513528        public explicit_return_type "" 
    514         nparams 0 
    515         cpp_decl "    ${comment}${inline}${name}${(}${)}${volatile}${throw}; 
    516 " 
    517         cpp_def "${comment}${inline}${class}::${name}${(}${)}${volatile}${throw} { 
     529        nparams 2 
     530          param in name "src" explicit_type "wxFileName" 
     531          param in name "dest" explicit_type "wxFileName" 
     532        cpp_decl "    ${comment}${inline}${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw}; 
     533" 
     534        cpp_def "${comment}${inline}${class}::${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${volatile}${throw} { 
    518535  ${body}} 
    519536" 
  • trunk/tmdmcreator/src/tmdmcreator.cpp

    r16 r17  
    1717#include "tmdmcreator.h" 
    1818#include "tmdmcopier.h" 
     19#include "tmdmprocessor.h" 
    1920 
    2021TmDmCreator::TmDmCreator() { 
     
    9293bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg) { 
    9394    errorsmsg.Clear(); 
    94     // Copy structure to out 
     95    // Copy structure 
    9596    TmDmCopier myCopier(m_FileNameOutSQL); 
    9697    if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { 
     
    104105    } 
    105106     
    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    } 
    108118    return true; 
    109119} 
  • trunk/tmdmcreator/src/tmdmprocessor.cpp

    r16 r17  
    1818#include "tmdmcopier.h" 
    1919 
    20 TmDmProcessor::TmDmProcessor() { 
     20TmDmProcessor::TmDmProcessor(const wxFileName & src, const wxFileName & dest) { 
     21    m_FileSrc = src; 
     22    m_FileDst = dest; 
    2123} 
    2224 
     
    2931 
    3032int 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    } 
    3143    return wxNOT_FOUND; 
    3244} 
     
    3951 
    4052 
    41 TmDmProcessorSimple::TmDmProcessorSimple() { 
     53TmDmProcessorSimple::TmDmProcessorSimple(const wxFileName & src, const wxFileName & dest) : TmDmProcessor(src,dest) { 
    4254} 
    4355 
     
    4961 
    5062 
    51 bool TmDmProcessorSimple::ProcessBlock(int blockstart, TmDmCopier * copier) { 
     63bool 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     
    5289    return false; 
    5390} 
     
    6198 
    6299 
    63 TmDmProcessorAttributs::TmDmProcessorAttributs() { 
     100TmDmProcessorAttributs::TmDmProcessorAttributs(const wxFileName & src, const wxFileName & dest) : TmDmProcessor(src,dest) { 
    64101} 
    65102 
     
    67104} 
    68105 
    69 bool TmDmProcessorAttributs::ProcessBlock(int blockstart, TmDmCopier * copier) { 
     106bool TmDmProcessorAttributs::ProcessBlock(int blockstart) { 
    70107    return false; 
    71108} 
  • trunk/tmdmcreator/src/tmdmprocessor.h

    r16 r17  
    1717#define _TMDMPROCESSOR_H_ 
    1818 
    19 // For compilers that support precompilation, includes "wx/wx.h". 
    2019#include "wx/wxprec.h" 
    21  
    22 // Include wxWidgets' headers 
    2320#ifndef WX_PRECOMP 
    2421#include <wx/wx.h> 
    2522#endif 
     23#include <wx/filename.h> 
     24#include <wx/wfstream.h> 
     25#include <wx/txtstrm.h> 
     26 
    2627 
    2728class TmDmCopier; 
    2829class TmDmProcessor { 
    2930protected: 
    30     TmDmCopier * m_Copier; 
     31    wxFileName m_FileSrc; 
     32    wxFileName m_FileDst; 
    3133     
    3234public: 
    33     TmDmProcessor(); 
     35    TmDmProcessor(const wxFileName & src, const wxFileName & dest); 
    3436    virtual ~TmDmProcessor(); 
    3537     
    3638    int FindBlock(const wxString & blockname); 
    37     virtual bool ProcessBlock(int blockstart, TmDmCopier * copier) = 0; 
     39    virtual bool ProcessBlock(int blockstart) = 0; 
    3840}; 
    3941 
     
    4648class TmDmProcessorSimple : public TmDmProcessor { 
    4749public: 
    48     TmDmProcessorSimple(); 
     50    TmDmProcessorSimple(const wxFileName & src, const wxFileName & dest); 
    4951    virtual ~TmDmProcessorSimple(); 
    5052     
    51     virtual bool ProcessBlock(int blockstart, TmDmCopier * copier); 
     53    virtual bool ProcessBlock(int blockstart); 
    5254}; 
    5355 
     
    6062class TmDmProcessorAttributs : public TmDmProcessor { 
    6163public: 
    62     TmDmProcessorAttributs(); 
     64    TmDmProcessorAttributs(const wxFileName & src, const wxFileName & dest); 
    6365    virtual ~TmDmProcessorAttributs(); 
    6466     
    65     virtual bool ProcessBlock(int blockstart, TmDmCopier * copier); 
     67    virtual bool ProcessBlock(int blockstart); 
    6668}; 
    6769#endif 
Note: See TracChangeset for help on using the changeset viewer.