diff options
Diffstat (limited to 'xsd/examples/cxx/tree/embedded')
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/driver.cxx | 41 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/grammar-input-stream.cxx | 20 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/grammar-input-stream.hxx | 13 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/library.xml | 1 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/library.xsd | 1 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/makefile | 16 | ||||
| -rw-r--r-- | xsd/examples/cxx/tree/embedded/xsdbin.cxx | 61 | 
7 files changed, 34 insertions, 119 deletions
| diff --git a/xsd/examples/cxx/tree/embedded/driver.cxx b/xsd/examples/cxx/tree/embedded/driver.cxx index 6e31d3b..5ceafa4 100644 --- a/xsd/examples/cxx/tree/embedded/driver.cxx +++ b/xsd/examples/cxx/tree/embedded/driver.cxx @@ -1,5 +1,4 @@  // file      : examples/cxx/tree/embedded/driver.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com>  // copyright : not copyrighted - public domain  #include <memory>   // std::auto_ptr @@ -12,11 +11,7 @@  #include <xercesc/validators/common/Grammar.hpp> // xercesc::Grammar  #include <xercesc/framework/Wrapper4InputSource.hpp> -#if _XERCES_VERSION >= 30000 -#  include <xercesc/framework/XMLGrammarPoolImpl.hpp> -#else -#  include <xercesc/internal/XMLGrammarPoolImpl.hpp> -#endif +#include <xercesc/framework/XMLGrammarPoolImpl.hpp>  #include <xsd/cxx/xml/string.hxx>  #include <xsd/cxx/xml/dom/auto-ptr.hxx> @@ -86,10 +81,6 @@ main (int argc, char* argv[])      DOMImplementation* impl (        DOMImplementationRegistry::getDOMImplementation (ls_id)); -#if _XERCES_VERSION >= 30000 - -    // Xerces-C++ 3.0.0 and later. -    //      xml::dom::auto_ptr<DOMLSParser> parser (        impl->createLSParser (          DOMImplementationLS::MODE_SYNCHRONOUS, 0, mm, gp.get ())); @@ -150,32 +141,6 @@ main (int argc, char* argv[])      xml::dom::bits::error_handler_proxy<char> ehp (eh);      conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); -#else // _XERCES_VERSION >= 30000 - -    // Same as above but for Xerces-C++ 2 series. -    // -    xml::dom::auto_ptr<DOMBuilder> parser ( -      impl->createDOMBuilder( -        DOMImplementationLS::MODE_SYNCHRONOUS, 0, mm, gp.get ())); - - -    parser->setFeature (XMLUni::fgDOMComments, false); -    parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); -    parser->setFeature (XMLUni::fgDOMEntities, false); -    parser->setFeature (XMLUni::fgDOMNamespaces, true); -    parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); -    parser->setFeature (XMLUni::fgDOMValidation, true); -    parser->setFeature (XMLUni::fgXercesSchema, true); -    parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); -    parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true); -    parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); - -    tree::error_handler<char> eh; -    xml::dom::bits::error_handler_proxy<char> ehp (eh); -    parser->setErrorHandler (&ehp); - -#endif // _XERCES_VERSION >= 30000 -      // Parse XML documents.      //      for (unsigned long i (0); i < 10; ++i) @@ -191,11 +156,7 @@ main (int argc, char* argv[])        // Parse XML to DOM.        // -#if _XERCES_VERSION >= 30000        xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (&wrap)); -#else -      xml_schema::dom::auto_ptr<DOMDocument> doc (parser->parse (wrap)); -#endif        eh.throw_if_failed<xml_schema::parsing> (); diff --git a/xsd/examples/cxx/tree/embedded/grammar-input-stream.cxx b/xsd/examples/cxx/tree/embedded/grammar-input-stream.cxx index 0c94ea6..f3a6d52 100644 --- a/xsd/examples/cxx/tree/embedded/grammar-input-stream.cxx +++ b/xsd/examples/cxx/tree/embedded/grammar-input-stream.cxx @@ -1,5 +1,4 @@  // file      : examples/cxx/tree/embedded/grammar-input-stream.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com>  // copyright : not copyrighted - public domain  #include <cassert> @@ -16,27 +15,14 @@ grammar_input_stream (const XMLByte* data, std::size_t size)  {  } -#if _XERCES_VERSION >= 30000  XMLFilePos grammar_input_stream::  curPos () const  {    return static_cast<XMLFilePos> (vpos_);  } -#else -unsigned int grammar_input_stream:: -curPos () const -{ -  return static_cast<unsigned int> (vpos_); -} -#endif -#if _XERCES_VERSION >= 30000  XMLSize_t grammar_input_stream::  readBytes (XMLByte* const buf, const XMLSize_t size) -#else -unsigned int grammar_input_stream:: -readBytes (XMLByte* const buf, const unsigned int size) -#endif  {    std::size_t i (0); @@ -99,17 +85,11 @@ readBytes (XMLByte* const buf, const unsigned int size)    vpos_ += i; -#if _XERCES_VERSION >= 30000    return static_cast<XMLSize_t> (i); -#else -  return static_cast<unsigned int> (i); -#endif  } -#if _XERCES_VERSION >= 30000  const XMLCh* grammar_input_stream::  getContentType () const  {    return 0;  } -#endif diff --git a/xsd/examples/cxx/tree/embedded/grammar-input-stream.hxx b/xsd/examples/cxx/tree/embedded/grammar-input-stream.hxx index a1b73c6..ed12b7c 100644 --- a/xsd/examples/cxx/tree/embedded/grammar-input-stream.hxx +++ b/xsd/examples/cxx/tree/embedded/grammar-input-stream.hxx @@ -1,5 +1,4 @@  // file      : examples/cxx/tree/embedded/grammar-input-stream.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com>  // copyright : not copyrighted - public domain  #ifndef GRAMMAR_INPUT_STREAM_HXX @@ -16,8 +15,6 @@ class grammar_input_stream: public xercesc::BinInputStream  public :    grammar_input_stream (const XMLByte* data, std::size_t size); -#if _XERCES_VERSION >= 30000 -    virtual XMLFilePos    curPos () const; @@ -27,16 +24,6 @@ public :    virtual const XMLCh*    getContentType () const; -#else - -  virtual unsigned int -  curPos () const; - -  virtual unsigned int -  readBytes (XMLByte* const buf, const unsigned int size); - -#endif -  private :    const XMLByte* data_;    std::size_t size_; diff --git a/xsd/examples/cxx/tree/embedded/library.xml b/xsd/examples/cxx/tree/embedded/library.xml index cb8faf3..f57c042 100644 --- a/xsd/examples/cxx/tree/embedded/library.xml +++ b/xsd/examples/cxx/tree/embedded/library.xml @@ -3,7 +3,6 @@  <!--  file      : examples/cxx/tree/embedded/library.xml -author    : Boris Kolpackov <boris@codesynthesis.com>  copyright : not copyrighted - public domain  --> diff --git a/xsd/examples/cxx/tree/embedded/library.xsd b/xsd/examples/cxx/tree/embedded/library.xsd index f1b4dac..6a9ad01 100644 --- a/xsd/examples/cxx/tree/embedded/library.xsd +++ b/xsd/examples/cxx/tree/embedded/library.xsd @@ -3,7 +3,6 @@  <!--  file      : examples/cxx/tree/embedded/library.xsd -author    : Boris Kolpackov <boris@codesynthesis.com>  copyright : not copyrighted - public domain  --> diff --git a/xsd/examples/cxx/tree/embedded/makefile b/xsd/examples/cxx/tree/embedded/makefile index 0550bd5..d0fdc33 100644 --- a/xsd/examples/cxx/tree/embedded/makefile +++ b/xsd/examples/cxx/tree/embedded/makefile @@ -1,6 +1,5 @@  # file      : examples/cxx/tree/embedded/makefile -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make @@ -33,14 +32,13 @@ $(call import,\  $(driver): $(obj) $(xerces_c.l)  $(xsdbin): $(obj2) $(xerces_c.l) -$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd  $(obj) $(obj2) $(dep): $(xerces_c.l.cpp-options)  genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)  gen  := $(addprefix $(out_base)/,$(genf))  $(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options :=  $(gen): $(out_root)/xsd/xsd  genf += $(xsd:.xsd=-schema.hxx) $(xsd:.xsd=-schema.cxx) @@ -50,7 +48,7 @@ $(out_base)/%: xsdbin := $(xsdbin)  $(out_base)/%-schema.hxx $(out_base)/%-schema.cxx: $(src_base)/%.xsd $(xsdbin)  	$(call message,xsdbin $<,$(xsdbin) --output-dir $(out_base) $<) -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen))  # Convenience alias for default target.  # @@ -83,10 +81,11 @@ $(dist-common):  $(dist): $(dist-common)  	$(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) +$(dist-win): |$(out_root)/.dist-pre  $(dist-win): $(dist-common)  	$(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) -	$(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) - +	$(call message,,todos $(dist_prefix)/$(path)/README.txt) +        # Note: solution files are not automatically generated.  # Clean.  # @@ -115,9 +114,10 @@ endif  $(call include,$(bld_root)/cxx/o-e.make)  $(call include,$(bld_root)/cxx/cxx-o.make)  $(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make)  $(call include,$(scf_root)/xsd/tree/xsd-cxx.make) +$(call include,$(bld_root)/install.make) +  # Dependencies.  #  $(call import,$(src_root)/xsd/makefile) 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); | 
