Upstream tarball 20080721
[amule.git] / src / utils / aLinkCreator / src / alcc.h
blob082fcb41294570a8b8c74895a6eee6552207231f
1 ////////////////////////////////////////////////////////////////////////////////
2 /// Name: Main wxBase App
3 ///
4 /// Purpose: aMule ed2k link creator
5 ///
6 /// Author: ThePolish <thepolish@vipmail.ru>
7 ///
8 /// Copyright (c) 2004-2008 ThePolish
9 ///
10 /// This program is free software; you can redistribute it and/or modify
11 /// it under the terms of the GNU General Public License as published by
12 /// the Free Software Foundation; either version 2 of the License, or
13 /// (at your option) any later version.
14 ///
15 /// This program is distributed in the hope that it will be useful,
16 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
17 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 /// GNU General Public License for more details.
19 ///
20 /// You should have received a copy of the GNU General Public License
21 /// along with this program; if not, write to the
22 /// Free Software Foundation, Inc.,
23 /// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 ////////////////////////////////////////////////////////////////////////////////
26 #ifndef _ALCC_H
27 #define _ALCC_H
30 #ifdef __BORLANDC__
31 #pragma hdrstop
32 #endif
34 // For all others, include the necessary headers
35 #ifndef WX_PRECOMP
36 #include "wx/wx.h"
37 #endif
39 #include <wx/cmdline.h>
41 //-----------------------------------------------------------------------------
42 // This can be put in a separete include file
43 #include <wx/strconv.h>
44 static wxCSConv aMuleConv(wxT("iso8859-1"));
45 #ifdef wxUSE_UNICODE
46 #define unicode2char(x) (const char*) aMuleConv.cWX2MB(x)
47 #define char2unicode(x) aMuleConv.cMB2WX(x)
48 #else
49 #define unicode2char(x) x.c_str()
50 #define char2unicode(x) x
51 #endif
52 //-----------------------------------------------------------------------------
54 /// Command line parameters
55 static const wxCmdLineEntryDesc cmdLineDesc[] =
58 wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), wxT("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
60 { wxCMD_LINE_SWITCH, wxT("v"), wxT("verbose"), wxT("be verbose"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL},
62 { wxCMD_LINE_SWITCH, wxT("p"), wxT("parthashes"), wxT("add part-hashes to ed2k link"), wxCMD_LINE_VAL_NONE,wxCMD_LINE_PARAM_OPTIONAL },
64 { wxCMD_LINE_PARAM, NULL, NULL, wxT("input files"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE },
66 { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 }
70 // Application
71 class alcc : public wxAppConsole
73 private:
74 bool m_flagVerbose ;
75 bool m_flagPartHashes;
76 wxArrayString m_filesToHash;
78 /// Parse command line
79 virtual void OnInitCmdLine(wxCmdLineParser& cmdline);
81 /// Command line preocessing
82 virtual bool OnCmdLineParsed(wxCmdLineParser& cmdline);
84 protected:
85 wxLocale m_locale; // Used to tell wxCas to use aMule catalog
87 public:
88 /// Application
89 virtual int OnRun ();
91 /// Cleaning on exit
92 virtual int OnExit();
95 DECLARE_APP(alcc)
97 #endif /* _ALCC_H */
99 // File_checked_for_headers