source: trunk/tmdmcreator/src/main.cpp @ 4

Revision 4, 1.8 KB checked in by lucsch, 12 years ago (diff)

preliminary code for tmdmcreator

Line 
1#include "wx/wxprec.h"
2#ifdef __BORLANDC__
3#pragma hdrstop
4#endif
5#ifndef WX_PRECOMP
6#include "wx/wx.h"
7#endif
8
9#include <wx/app.h>
10#include <wx/cmdline.h>
11#include <wx/dir.h>
12#include <wx/filename.h>
13
14#include "database.h"
15#include "silayer.h"
16
17
18
19static const wxCmdLineEntryDesc cmdLineDesc[] =
20{
21    { wxCMD_LINE_SWITCH, "h", "help", "show this help message",
22        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
23    { wxCMD_LINE_SWITCH, "v", "verbose", "Be more verbose" },
24    { wxCMD_LINE_NONE }
25};
26
27
28
29void PrintArray(const wxArrayString & array, const wxString & msg){
30    wxPrintf(msg + _T("\n"));
31    for (unsigned int i = 0; i< array.GetCount(); i++) {
32        wxPrintf(array[i] + _T("\n"));
33    }
34}
35
36
37
38int main(int argc, char **argv){
39    // debugging string for OSX
40    // this is needed for viewing string content with Xcode !!
41    wxString myTest = _T("Test debugging");
42    myTest.ToUTF8().data();
43    myTest.Len();
44   
45    wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
46    wxInitializer initializer;
47    if ( !initializer )
48    {
49        fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
50        return -1;
51    }
52   
53    wxString myLogoTxt = _T("*\n* TmDmCreator \n* Create SQL Command for ToolMap projects \n* (c) Copyright 2013 Lucien Schreiber - CREALP . All Rights Reserved. \n*\n");
54    wxCmdLineParser parser(cmdLineDesc, argc, argv);
55    parser.AddParam(_T("[ToolMap project file]"), wxCMD_LINE_VAL_STRING);
56    parser.AddParam(_T("[SHP directory]"), wxCMD_LINE_VAL_STRING);
57    parser.AddParam(_T("[rule files]"),wxCMD_LINE_VAL_STRING,  wxCMD_LINE_PARAM_MULTIPLE);
58    parser.SetLogo(myLogoTxt);
59   
60    if (parser.Parse() != 0) {
61        return 0;
62    }
63   
64    bool beVerbose = parser.Found("verbose");
65   
66    // cmd line is correct !!
67    wxPrintf(myLogoTxt);   
68    return 0;
69}
Note: See TracBrowser for help on using the repository browser.