summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-11-07 04:29:20 +0000
committerMichi Henning <michi@zeroc.com>2006-11-07 04:29:20 +0000
commit289f67db5e2b35767fd0e925c474ed001b49033f (patch)
treefb7fd6a34f075c50a5d78475d8a0c67fe4b28bd9 /cpp/src
parentbug 1444: allow test to detect target JDK version (diff)
downloadice-289f67db5e2b35767fd0e925c474ed001b49033f.tar.bz2
ice-289f67db5e2b35767fd0e925c474ed001b49033f.tar.xz
ice-289f67db5e2b35767fd0e925c474ed001b49033f.zip
Fixed a few coding style issues.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cpp/Main.cpp88
-rw-r--r--cpp/src/slice2cppe/Main.cpp79
-rw-r--r--cpp/src/slice2cs/Main.cpp82
-rw-r--r--cpp/src/slice2docbook/Main.cpp66
-rw-r--r--cpp/src/slice2freeze/Main.cpp596
-rw-r--r--cpp/src/slice2freezej/Main.cpp288
-rw-r--r--cpp/src/slice2java/Main.cpp95
-rw-r--r--cpp/src/slice2javae/Main.cpp74
-rw-r--r--cpp/src/slice2py/Main.cpp77
-rw-r--r--cpp/src/slice2rb/Main.cpp66
-rw-r--r--cpp/src/slice2vb/Main.cpp82
11 files changed, 721 insertions, 872 deletions
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index c80913c5104..ca7d1d6a40c 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -46,20 +46,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string include;
- string output;
- string dllExport;
- bool impl;
- bool depend;
- bool debug;
- bool ice;
- bool checksum;
- bool stream;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -98,6 +84,7 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
@@ -109,50 +96,47 @@ main(int argc, char* argv[])
vector<string> extraHeaders = opts.argVec("add-header");
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
- {
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
- }
- if(opts.isSet("I"))
- {
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
- }
- preprocess = opts.isSet("E");
- if(opts.isSet("include-dir"))
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- include = opts.optArg("include-dir");
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("output-dir"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -U\"" + *i + "\"";
}
- if(opts.isSet("dll-export"))
+
+ vector<string> includePaths;
+ includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- dllExport = opts.optArg("dll-export");
+ cppArgs += " -I\"" + *i + "\"";
}
- impl = opts.isSet("impl");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- checksum = opts.isSet("checksum");
- stream = opts.isSet("stream");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string include = opts.optArg("include-dir");
+
+ string output = opts.optArg("output-dir");
+
+ string dllExport = opts.optArg("dll-export");
+
+ bool impl = opts.isSet("impl");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool checksum = opts.isSet("checksum");
+
+ bool stream = opts.isSet("stream");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2cppe/Main.cpp b/cpp/src/slice2cppe/Main.cpp
index cda1051a7b7..f015f8a88b3 100644
--- a/cpp/src/slice2cppe/Main.cpp
+++ b/cpp/src/slice2cppe/Main.cpp
@@ -44,18 +44,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string include;
- string output;
- string dllExport;
- bool impl;
- bool depend;
- bool debug;
- bool ice;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -92,6 +80,7 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICEE_STRING_VERSION << endl;
@@ -103,48 +92,42 @@ main(int argc, char* argv[])
vector<string>extraHeaders = opts.argVec("add-header");
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
- {
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
- }
- if(opts.isSet("I"))
- {
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
- }
- preprocess = opts.isSet("E");
- if(opts.isSet("include-dir"))
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- include = opts.optArg("include-dir");
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("output-dir"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -U\"" + *i + "\"";
}
- if(opts.isSet("dll-export"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- dllExport = opts.optArg("dll-export");
+ cppArgs += " -I\"" + *i + "\"";
}
- impl = opts.isSet("impl");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string include = opts.optArg("include-dir");
+
+ string output = opts.optArg("output-dir");
+
+ string dllExport = opts.optArg("dll-export");
+
+ bool impl = opts.isSet("impl");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp
index 701d0ecfc19..f096462a198 100644
--- a/cpp/src/slice2cs/Main.cpp
+++ b/cpp/src/slice2cs/Main.cpp
@@ -43,20 +43,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool tie;
- bool impl;
- bool implTie;
- bool depend;
- bool debug;
- bool ice;
- bool checksum;
- bool stream;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -92,49 +78,53 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -I\"" + *i + "\"";
}
- tie = opts.isSet("tie");
- impl = opts.isSet("impl");
- implTie = opts.isSet("impl-tie");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- checksum = opts.isSet("checksum");
- stream = opts.isSet("stream");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool tie = opts.isSet("tie");
+
+ bool impl = opts.isSet("impl");
+
+ bool implTie = opts.isSet("impl-tie");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool checksum = opts.isSet("checksum");
+
+ bool stream = opts.isSet("stream");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index d876e955e1b..7ab115bc62b 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -42,16 +42,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- bool preprocess;
- bool standAlone;
- bool chapter;
- bool noIndex;
- bool debug;
- bool ice;
- bool caseSensitive;
- bool sortFields;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -84,43 +74,47 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("U"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("I");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("I");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -I\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- standAlone = opts.isSet("stand-alone");
- chapter = opts.isSet("chapter");
- noIndex = opts.isSet("noindex");
- sortFields = opts.isSet("sort-fields");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ bool standAlone = opts.isSet("stand-alone");
+
+ bool chapter = opts.isSet("chapter");
+
+ bool noIndex = opts.isSet("noindex");
+
+ bool sortFields = opts.isSet("sort-fields");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index c9860371e8f..98c0875405f 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -1176,20 +1176,6 @@ writeIndex(const string& n, UnitPtr& u, const Index& index, Output& H, Output& C
int
main(int argc, char* argv[])
{
- string cppArgs;
- string headerExtension;
- string sourceExtension;
- vector<string> includePaths;
- bool preprocess;
- string include;
- string dllExport;
- vector<Dict> dicts;
- vector<Index> indices;
- string output;
- bool debug = false;
- bool ice = false;
- bool caseSensitive = false;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -1227,391 +1213,379 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- headerExtension = opts.optArg("header-ext");
- sourceExtension = opts.optArg("source-ext");
+ string headerExtension = opts.optArg("header-ext");
+ string sourceExtension = opts.optArg("source-ext");
+ string cppArgs;
vector<string> extraHeaders = opts.argVec("add-header");
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cppArgs += " -D\"" + *i + "\"";
+ }
- if(opts.isSet("D"))
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- if(opts.isSet("U"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -I\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ bool preprocess= opts.isSet("E");
+
+ string include = opts.optArg("include-dir");
+
+ string dllExport = opts.optArg("dll-export");
+
+ vector<Dict> dicts;
+ optargs = opts.argVec("dict");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Dict dict;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
{
- cppArgs += " -I\"" + *i + "\"";
+ dict.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
}
- }
- preprocess= opts.isSet("E");
- if(opts.isSet("include-dir"))
- {
- include = opts.optArg("include-dir");
- }
- if(opts.isSet("dll-export"))
- {
- dllExport = opts.optArg("dll-export");
- }
- if(opts.isSet("dict"))
- {
- vector<string> optargs = opts.argVec("dict");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ pos = s.find(',');
+ if(pos != string::npos)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Dict dict;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
+ if(s.find("[\"") == 0)
{
- dict.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- if(s.find("[\"") == 0)
+ string::size_type end = s.find("\"]");
+ if(end != string::npos && end < pos)
{
- string::size_type end = s.find("\"]");
- if(end != string::npos && end < pos)
- {
- dict.key = s.substr(end + 2, pos - end - 2);
- dict.keyMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.key = s.substr(0, pos);
- }
+ dict.key = s.substr(end + 2, pos - end - 2);
+ dict.keyMetaData.push_back(s.substr(2, end - 2));
}
else
{
dict.key = s.substr(0, pos);
}
- s.erase(0, pos + 1);
}
- pos = s.find(',');
- if(pos == string::npos)
+ else
+ {
+ dict.key = s.substr(0, pos);
+ }
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos == string::npos)
+ {
+ if(s.find("[\"") == 0)
{
- if(s.find("[\"") == 0)
+ string::size_type end = s.find("\"]");
+ if(end != string::npos)
{
- string::size_type end = s.find("\"]");
- if(end != string::npos)
- {
- dict.value = s.substr(end + 2);
- dict.valueMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.value = s;
- }
+ dict.value = s.substr(end + 2);
+ dict.valueMetaData.push_back(s.substr(2, end - 2));
}
else
{
dict.value = s;
}
- dict.sort = false;
}
else
{
- if(s.find("[\"") == 0)
+ dict.value = s;
+ }
+ dict.sort = false;
+ }
+ else
+ {
+ if(s.find("[\"") == 0)
+ {
+ string::size_type end = s.find("\"]");
+ if(end != string::npos && end < pos)
{
- string::size_type end = s.find("\"]");
- if(end != string::npos && end < pos)
- {
- dict.value = s.substr(end + 2, pos - end - 2);
- dict.valueMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.value = s.substr(0, pos);
- }
+ dict.value = s.substr(end + 2, pos - end - 2);
+ dict.valueMetaData.push_back(s.substr(2, end - 2));
}
else
{
dict.value = s.substr(0, pos);
}
- s.erase(0, pos + 1);
-
- pos = s.find(',');
- if(pos == string::npos)
- {
- if(s != "sort")
- {
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- dict.sort = true;
- }
- else
- {
- string sort = s.substr(0, pos);
- s.erase(0, pos + 1);
- if(sort != "sort")
- {
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- dict.sort = true;
- dict.userCompare = s;
- }
}
-
- if(dict.name.empty())
+ else
{
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ dict.value = s.substr(0, pos);
}
+ s.erase(0, pos + 1);
- if(dict.key.empty())
+ pos = s.find(',');
+ if(pos == string::npos)
{
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ if(s != "sort")
+ {
+ cerr << argv[0] << ": " << *i
+ << ": nothing or ',sort' expected after value-type" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ dict.sort = true;
}
-
- if(dict.value.empty())
+ else
{
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ string sort = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ if(sort != "sort")
+ {
+ cerr << argv[0] << ": " << *i
+ << ": nothing or ',sort' expected after value-type" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ dict.sort = true;
+ dict.userCompare = s;
}
+ }
- dicts.push_back(dict);
+ if(dict.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
- }
- if(opts.isSet("index"))
- {
- vector<string> optargs = opts.argVec("index");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+
+ if(dict.key.empty())
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Index index;
+ cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.type = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- string caseString;
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- index.member = s;
- caseString = "case-sensitive";
- }
+ if(dict.value.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- if(index.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ dicts.push_back(dict);
+ }
+
+ vector<Index> indices;
+ optargs = opts.argVec("index");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Index index;
- if(index.type.empty())
- {
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.type = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ string caseString;
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ caseString = "case-sensitive";
+ }
- if(index.member.empty())
- {
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
+ if(index.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- indices.push_back(index);
+ if(index.type.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.member.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ indices.push_back(index);
}
- if(opts.isSet("dict-index"))
+
+ optargs = opts.argVec("dict-index");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("dict-index");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ string dictName;
+ DictIndex index;
+ index.sort = false;
+ index.caseSensitive = true;
+
+ string::size_type pos = s.find(',');
+ if(pos == string::npos)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- string dictName;
- DictIndex index;
- index.sort = false;
- index.caseSensitive = true;
+ dictName = s;
+ }
+ else
+ {
+ dictName = s.substr(0, pos);
+ s.erase(0, pos + 1);
- string::size_type pos = s.find(',');
- if(pos == string::npos)
+ bool done = false;
+ while(!done)
{
- dictName = s;
- }
- else
- {
- dictName = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- bool done = false;
- while(!done)
+ pos = s.find(',');
+ if(pos == string::npos)
{
- pos = s.find(',');
- if(pos == string::npos)
+ if(s == "sort")
{
- if(s == "sort")
- {
- index.sort = true;
- }
- else if(s == "case-sensitive")
- {
- index.caseSensitive = true;
- }
- else if(s == "case-insensitive")
- {
- index.caseSensitive = false;
- }
- else if(index.member.empty())
+ index.sort = true;
+ }
+ else if(s == "case-sensitive")
+ {
+ index.caseSensitive = true;
+ }
+ else if(s == "case-insensitive")
+ {
+ index.caseSensitive = false;
+ }
+ else if(index.member.empty())
+ {
+ if(s == "\\sort")
{
- if(s == "\\sort")
- {
- index.member = "sort";
- }
- else
- {
- index.member = s;
- }
+ index.member = "sort";
}
else
{
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ index.member = s;
}
- done = true;
}
else
{
- string subs = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- if(subs == "sort")
- {
- index.sort = true;
- index.userCompare = s;
- done = true;
- }
- else if(subs == "case-sensitive")
- {
- index.caseSensitive = true;
- }
- else if(subs == "case-insensitive")
- {
- index.caseSensitive = false;
- }
- else if(index.member.empty())
+ cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ done = true;
+ }
+ else
+ {
+ string subs = s.substr(0, pos);
+ s.erase(0, pos + 1);
+
+ if(subs == "sort")
+ {
+ index.sort = true;
+ index.userCompare = s;
+ done = true;
+ }
+ else if(subs == "case-sensitive")
+ {
+ index.caseSensitive = true;
+ }
+ else if(subs == "case-insensitive")
+ {
+ index.caseSensitive = false;
+ }
+ else if(index.member.empty())
+ {
+ if(subs == "\\sort")
{
- if(subs == "\\sort")
- {
- index.member = "sort";
- }
- else
- {
- index.member = subs;
- }
+ index.member = "sort";
}
else
{
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ index.member = subs;
}
}
- }
- }
-
- if(dictName.empty())
- {
- cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- bool found = false;
- for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
- {
- if(p->name == dictName)
- {
- if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
+ else
{
- cerr << argv[0] << ": --dict-index " << *i
- << ": this dict-index is defined twice" << endl;
+ cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ usage(argv[0]);
return EXIT_FAILURE;
}
- p->indices.push_back(index);
- found = true;
- break;
}
}
- if(!found)
+ }
+
+ if(dictName.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ bool found = false;
+ for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
+ {
+ if(p->name == dictName)
{
- cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
+ {
+ cerr << argv[0] << ": --dict-index " << *i
+ << ": this dict-index is defined twice" << endl;
+ return EXIT_FAILURE;
+ }
+ p->indices.push_back(index);
+ found = true;
+ break;
}
}
+ if(!found)
+ {
+ cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
- if(opts.isSet("output-dir"))
- {
- output = opts.optArg("output-dir");
- }
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- caseSensitive = opts.isSet("case-sensitive");
+
+ string output = opts.optArg("output-dir");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(dicts.empty() && indices.empty())
{
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index 770f89a4f58..8c8c6735310 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -1073,19 +1073,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string include;
- vector<Dict> dicts;
- vector<Index> indices;
- string output;
- bool depend;
- bool debug;
- bool ice;
- StringList globalMetadata;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -1121,158 +1108,152 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- if(opts.isSet("include-dir"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- include = opts.optArg("include-dir");
+ cppArgs += " -I\"" + *i + "\"";
}
- if(opts.isSet("dict"))
- {
- vector<string> optargs = opts.argVec("dict");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Dict dict;
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.key = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- dict.value = s;
+ bool preprocess = opts.isSet("E");
- if(dict.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ string include = opts.optArg("include-dir");
- if(dict.key.empty())
- {
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ vector<Dict> dicts;
+ optargs = opts.argVec("dict");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Dict dict;
- if(dict.value.empty())
- {
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.key = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ dict.value = s;
- dicts.push_back(dict);
+ if(dict.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
- }
- if(opts.isSet("index"))
- {
- vector<string> optargs = opts.argVec("index");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+
+ if(dict.key.empty())
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Index index;
+ cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.type = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- string caseString;
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- index.member = s;
- caseString = "case-sensitive";
- }
+ if(dict.value.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- if(index.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ dicts.push_back(dict);
+ }
- if(index.type.empty())
- {
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ vector<Index> indices;
+ optargs = opts.argVec("index");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Index index;
- if(index.member.empty())
- {
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.type = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ string caseString;
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ caseString = "case-sensitive";
+ }
+
+ if(index.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.type.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- indices.push_back(index);
+ if(index.member.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ indices.push_back(index);
}
+
if(opts.isSet("dict-index"))
{
vector<string> optargs = opts.argVec("dict-index");
@@ -1355,19 +1336,20 @@ main(int argc, char* argv[])
}
}
}
- if(opts.isSet("output-dir"))
- {
- output = opts.optArg("output-dir");
- }
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- if(opts.isSet("meta"))
- {
- vector<string> v = opts.argVec("meta");
- copy(v.begin(), v.end(), back_inserter(globalMetadata));
- }
- caseSensitive = opts.isSet("case-sensitive");
+
+ string output = opts.optArg("output-dir");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ StringList globalMetadata;
+ vector<string> v = opts.argVec("meta");
+ copy(v.begin(), v.end(), back_inserter(globalMetadata));
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(dicts.empty() && indices.empty())
{
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index bb4a66ce102..8148956dd91 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -48,21 +48,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool tie;
- bool impl;
- bool implTie;
- bool depend;
- bool debug;
- bool ice;
- string checksumClass;
- bool stream;
- StringList globalMetadata;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -99,57 +84,57 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
- {
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
- }
- if(opts.isSet("I"))
- {
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
- }
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -D\"" + *i + "\"";
}
- tie = opts.isSet("tie");
- impl = opts.isSet("impl");
- implTie = opts.isSet("impl-tie");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- if(opts.isSet("checksum"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- checksumClass = opts.optArg("checksum");
+ cppArgs += " -U\"" + *i + "\"";
}
- stream = opts.isSet("stream");
- if(opts.isSet("meta"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- vector<string> v = opts.argVec("meta");
- copy(v.begin(), v.end(), back_inserter(globalMetadata));
+ cppArgs += " -I\"" + *i + "\"";
}
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool tie = opts.isSet("tie");
+
+ bool impl = opts.isSet("impl");
+
+ bool implTie = opts.isSet("impl-tie");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ string checksumClass = opts.optArg("checksum");
+
+ bool stream = opts.isSet("stream");
+
+ StringList globalMetadata;
+ vector<string> v = opts.argVec("meta");
+ copy(v.begin(), v.end(), back_inserter(globalMetadata));
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2javae/Main.cpp b/cpp/src/slice2javae/Main.cpp
index 294dccdf143..a5b71a01607 100644
--- a/cpp/src/slice2javae/Main.cpp
+++ b/cpp/src/slice2javae/Main.cpp
@@ -41,18 +41,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool tie;
- bool impl;
- bool implTie;
- bool depend;
- bool debug;
- bool ice;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -86,47 +74,49 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICEE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -I\"" + *i + "\"";
}
- tie = opts.isSet("tie");
- impl = opts.isSet("impl");
- implTie = opts.isSet("impl-tie");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool tie = opts.isSet("tie");
+
+ bool impl = opts.isSet("impl");
+
+ bool implTie = opts.isSet("impl-tie");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp
index d970dbe5557..c0ecd103ddf 100644
--- a/cpp/src/slice2py/Main.cpp
+++ b/cpp/src/slice2py/Main.cpp
@@ -384,18 +384,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool debug;
- bool ice;
- bool all;
- bool noPackage;
- bool checksum;
- bool caseSensitive;
- string prefix;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -429,50 +417,49 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
- {
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
- }
- if(opts.isSet("I"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -U\"" + *i + "\"";
}
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- all = opts.isSet("all");
- noPackage = opts.isSet("no-package");
- checksum = opts.isSet("checksum");
- if(opts.isSet("prefix"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- prefix = opts.optArg("prefix");
+ cppArgs += " -I\"" + *i + "\"";
}
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool all = opts.isSet("all");
+
+ bool noPackage = opts.isSet("no-package");
+
+ bool checksum = opts.isSet("checksum");
+
+ string prefix = opts.optArg("prefix");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp
index b83d228a5a0..fdf2d4c4ae9 100644
--- a/cpp/src/slice2rb/Main.cpp
+++ b/cpp/src/slice2rb/Main.cpp
@@ -54,16 +54,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool debug;
- bool ice;
- bool all;
- bool checksum;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -95,45 +85,45 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D" + *i;
- }
- }
- if(opts.isSet("U"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U" + *i;
- }
+ cppArgs += " -D" + *i;
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I" + *i;
- }
+ cppArgs += " -U" + *i;
}
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -I" + *i;
}
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- all = opts.isSet("all");
- checksum = opts.isSet("checksum");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool all = opts.isSet("all");
+
+ bool checksum = opts.isSet("checksum");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{
diff --git a/cpp/src/slice2vb/Main.cpp b/cpp/src/slice2vb/Main.cpp
index 259262a9367..a4baad2ebb9 100644
--- a/cpp/src/slice2vb/Main.cpp
+++ b/cpp/src/slice2vb/Main.cpp
@@ -43,20 +43,6 @@ usage(const char* n)
int
main(int argc, char* argv[])
{
- string cppArgs;
- vector<string> includePaths;
- bool preprocess;
- string output;
- bool tie;
- bool impl;
- bool implTie;
- bool depend;
- bool debug;
- bool ice;
- bool checksum;
- bool stream;
- bool caseSensitive;
-
IceUtil::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
@@ -92,49 +78,53 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- if(opts.isSet("D"))
- {
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D\"" + *i + "\"";
- }
- }
- if(opts.isSet("U"))
+
+ string cppArgs;
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U\"" + *i + "\"";
- }
+ cppArgs += " -D\"" + *i + "\"";
}
- if(opts.isSet("I"))
+
+ optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
{
- includePaths = opts.argVec("I");
- for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
- {
- cppArgs += " -I\"" + *i + "\"";
- }
+ cppArgs += " -U\"" + *i + "\"";
}
- preprocess = opts.isSet("E");
- if(opts.isSet("output-dir"))
+
+ vector<string> includePaths = opts.argVec("I");
+ for(vector<string>::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i)
{
- output = opts.optArg("output-dir");
+ cppArgs += " -I\"" + *i + "\"";
}
- tie = opts.isSet("tie");
- impl = opts.isSet("impl");
- implTie = opts.isSet("impl-tie");
- depend = opts.isSet("depend");
- debug = opts.isSet("debug");
- ice = opts.isSet("ice");
- checksum = opts.isSet("checksum");
- stream = opts.isSet("stream");
- caseSensitive = opts.isSet("case-sensitive");
+
+ bool preprocess = opts.isSet("E");
+
+ string output = opts.optArg("output-dir");
+
+ bool tie = opts.isSet("tie");
+
+ bool impl = opts.isSet("impl");
+
+ bool implTie = opts.isSet("impl-tie");
+
+ bool depend = opts.isSet("depend");
+
+ bool debug = opts.isSet("debug");
+
+ bool ice = opts.isSet("ice");
+
+ bool checksum = opts.isSet("checksum");
+
+ bool stream = opts.isSet("stream");
+
+ bool caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
{