7 Copyright (C) 2009-2010, Nicolas VIVIEN
8 Copyright (C) 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)
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.
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.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
24 #include <barry/barry.h>
25 #include <barry/barryalx.h>
33 using namespace Barry
;
38 const char *description
;
42 const static struct Languages langs
[] = {
43 { "en", OS_LANG_ENGLISH
, "English" },
44 { "ar", OS_LANG_ARABIC
, "Arabic" },
45 { "ca", OS_LANG_CATALAN
, "Catalan" },
46 { "cs", OS_LANG_CZECH
, "Czech" },
47 { "de", OS_LANG_GERMAN
, "German" },
48 { "sp", OS_LANG_SPANISH
, "Spanish" },
49 { "fr", OS_LANG_FRENCH
, "French" },
50 { "he", OS_LANG_HEBREW
, "Hebrew" },
51 { "hu", OS_LANG_HUNGARIAN
, "Hungarian" },
52 { "it", OS_LANG_ITALIAN
, "Italian" },
53 { "ja", OS_LANG_JAPANESE
, "Japanese" },
54 { "ko", OS_LANG_KOREAN
, "Korean" },
61 const char *Version
= Barry::Version(major
, minor
);
64 << "balxparse - Command line ALX parser\n"
65 << " Copyright 2009-2010, Nicolas VIVIEN.\n"
66 << " Copyright 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)\n"
67 << " Using: " << Version
<< "\n"
70 << " -i lang Internationalization language\n"
71 << " -d path OS path with all ALX files\n"
72 << " -o file OS ALX filename (Platform.alx)\n"
74 << " <ALX file> ...\n"
75 << " Parse one or several ALX files.\n"
77 << " Language supported :\n"
80 for (int i
=0; langs
[i
].code
!=NULL
; i
++) {
81 string s
= (string
) langs
[i
].code
+ " : " + (string
) langs
[i
].description
;
83 cerr
<< left
<< setfill(' ') << setw(18) << s
;
93 int main(int argc
, char *argv
[], char *envp
[])
103 vector
<string
> filenames
;
105 // process command line options
107 int cmd
= getopt(argc
, argv
, "hi:d:o:");
113 case 'd': // ALX path
117 case 'o': // OS ALX filename (Platform.alx)
121 case 'i': // Language
135 // Put the remaining arguments into an array
136 for (; argc
> 0; argc
--, argv
++) {
137 filenames
.push_back(string(argv
[0]));
144 os
.addProperties("_vendorID", "");
147 if (lang
.length() > 0) {
148 for (int i
=0; langs
[i
].code
!=NULL
; i
++) {
149 string code
= langs
[i
].code
;
152 os
.addProperties("langid", langs
[i
].alxid
);
156 if (osfilename
.length() > 0)
157 os
.loadALXFile(osfilename
, false);
159 if (pathname
.length() > 0)
162 if (!filenames
.empty()) {
163 vector
<string
>::iterator i
= filenames
.begin(), end
= filenames
.end();
164 for( ; i
!= end
; ++i
) {
165 os
.loadALXFile((*i
), true);
172 } catch( std::exception
&e
) {
173 cout
<< e
.what() << endl
;