summaryrefslogtreecommitdiff
path: root/xsd/examples/cxx/tree/embedded/xsdbin.cxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:21:29 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:21:29 +0200
commitbada6666c70977a058755ccf232e7d67b24adeed (patch)
tree1e92d50cebce96abaf9bce19e36026c47f77b9ba /xsd/examples/cxx/tree/embedded/xsdbin.cxx
parenteaf34adcbd8095bc6d1f3371b1227f654c7b19fc (diff)
New upstream release
Diffstat (limited to 'xsd/examples/cxx/tree/embedded/xsdbin.cxx')
-rw-r--r--xsd/examples/cxx/tree/embedded/xsdbin.cxx61
1 files changed, 25 insertions, 36 deletions
diff --git a/xsd/examples/cxx/tree/embedded/xsdbin.cxx b/xsd/examples/cxx/tree/embedded/xsdbin.cxx
index 53e2533..656b830 100644
--- a/xsd/examples/cxx/tree/embedded/xsdbin.cxx
+++ b/xsd/examples/cxx/tree/embedded/xsdbin.cxx
@@ -1,5 +1,4 @@
// file : examples/cxx/tree/embedded/xsdbin.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain
// This program loads the XML Schema file(s) and converts them to
@@ -28,11 +27,7 @@
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
-#if _XERCES_VERSION >= 30000
-# include <xercesc/framework/XMLGrammarPoolImpl.hpp>
-#else
-# include <xercesc/internal/XMLGrammarPoolImpl.hpp>
-#endif
+#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
using namespace std;
using namespace xercesc;
@@ -88,10 +83,13 @@ main (int argc, char* argv[])
string base;
string outdir;
- class usage {};
+ struct usage
+ {
+ usage (bool e = true): error (e) {}
+ bool error;
+ };
int argi (1);
- bool help (false);
bool multi_import (true);
bool verbose (false);
@@ -102,10 +100,7 @@ main (int argc, char* argv[])
string a (argv[argi]);
if (a == "--help")
- {
- help = true;
- throw usage ();
- }
+ throw usage (false);
else if (a == "--verbose")
{
verbose = true;
@@ -154,20 +149,22 @@ main (int argc, char* argv[])
base = argv[argi];
}
- catch (usage const&)
+ catch (usage const& e)
{
- cerr << "Usage: " << argv[0] << " [options] <files>" << endl
- << "Options:" << endl
- << " --help Print usage information and exit." << endl
- << " --verbose Print progress information." << endl
- << " --output-dir <dir> Write generated files to <dir>." << endl
- << " --hxx-suffix <sfx> Header file suffix instead of '-schema.hxx'." << endl
- << " --cxx-suffix <sfx> Source file suffix instead of '-schema.cxx'." << endl
- << " --array-name <name> Binary data array name." << endl
- << " --disable-multi-import Disable multiple import support." << endl
- << endl;
-
- return help ? 0 : 1;
+ ostream& o (e.error ? cerr : cout);
+
+ o << "Usage: " << argv[0] << " [options] <files>" << endl
+ << "Options:" << endl
+ << " --help Print usage information and exit." << endl
+ << " --verbose Print progress information." << endl
+ << " --output-dir <dir> Write generated files to <dir>." << endl
+ << " --hxx-suffix <sfx> Header file suffix instead of '-schema.hxx'." << endl
+ << " --cxx-suffix <sfx> Source file suffix instead of '-schema.cxx'." << endl
+ << " --array-name <name> Binary data array name." << endl
+ << " --disable-multi-import Disable multiple import support." << endl
+ << endl;
+
+ return e.error ? 0 : 1;
}
XMLPlatformUtils::Initialize ();
@@ -488,17 +485,9 @@ handle (const SAXParseException& e, severity s)
char* id (XMLString::transcode (xid));
char* msg (XMLString::transcode (e.getMessage ()));
- cerr << id << ":";
-
-#if _XERCES_VERSION >= 30000
- cerr << e.getLineNumber () << ":" << e.getColumnNumber () << " ";
-#else
- XMLSSize_t l (e.getLineNumber ());
- XMLSSize_t c (e.getColumnNumber ());
- cerr << (l == -1 ? 0 : l) << ":" << (c == -1 ? 0 : c) << " ";
-#endif
-
- cerr << (s == s_warning ? "warning: " : "error: ") << msg << endl;
+ cerr << id << ":"
+ << e.getLineNumber () << ":" << e.getColumnNumber () << " "
+ << (s == s_warning ? "warning: " : "error: ") << msg << endl;
XMLString::release (&id);
XMLString::release (&msg);