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

Revision 6, 2.6 KB checked in by lucsch, 11 years ago (diff)

preliminary code for tmdmcreator

Line 
1/***************************************************************************
2 TmDmCreator
3 Create SQL code for ToolMap project
4 -------------------
5 copyright            : (C) 2013 CREALP Lucien Schreiber
6 email                : lucien.schreiber at crealp dot vs dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 *                                                                         *
11 *   This program is free software; you can redistribute it and/or modify  *
12 *   it under the terms of the GNU General Public License as published by  *
13 *   the Free Software Foundation; either version 2 of the License, or     *
14 *   (at your option) any later version.                                   *
15 *                                                                         *
16 ***************************************************************************/
17#include "wx/wxprec.h"
18#ifdef __BORLANDC__
19#pragma hdrstop
20#endif
21#ifndef WX_PRECOMP
22#include "wx/wx.h"
23#endif
24
25#include <wx/app.h>
26#include <wx/cmdline.h>
27#include <wx/dir.h>
28#include <wx/filename.h>
29
30
31static const wxCmdLineEntryDesc cmdLineDesc[] =
32{
33    { wxCMD_LINE_SWITCH, "h", "help", "show this help message",
34        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
35    { 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]"},
39    { wxCMD_LINE_NONE }
40};
41
42
43
44void PrintArray(const wxArrayString & array, const wxString & msg){
45    wxPrintf(msg + _T("\n"));
46    for (unsigned int i = 0; i< array.GetCount(); i++) {
47        wxPrintf(array[i] + _T("\n"));
48    }
49}
50
51
52
53int main(int argc, char **argv){
54    // debugging string for OSX
55    // this is needed for viewing string content with Xcode !!
56    wxString myTest = _T("Test debugging");
57    myTest.ToUTF8().data();
58    myTest.Len();
59   
60    wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
61    wxInitializer initializer;
62    if ( !initializer ){
63        fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
64        return -1;
65    }
66   
67    wxString myLogoTxt = _T("*\n* TmDmCreator \n* Create SQL file for ToolMap projects \n* (c) Copyright 2013 Lucien Schreiber - CREALP . All Rights Reserved. \n*\n");
68    wxCmdLineParser parser(cmdLineDesc, argc, argv);
69    parser.SetLogo(myLogoTxt);
70    if (parser.Parse() != 0) {
71        return 0;
72    }
73   
74    // cmd line is correct !!
75    wxPrintf(myLogoTxt);
76    return 0;
77}
Note: See TracBrowser for help on using the repository browser.