From b1014116e1beadaaa0b11558df32d429e60370d0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 12 Sep 2022 21:21:39 +0300 Subject: Use ad hoc rules to compile options.cli files --- xsd/build/root.build | 2 + xsd/doc/.gitignore | 7 +- xsd/doc/buildfile | 363 +++-- xsd/doc/cxx/.gitignore | 4 +- xsd/doc/cxx/parser/guide/.gitignore | 2 - xsd/doc/cxx/tree/guide/.gitignore | 2 - xsd/doc/cxx/tree/manual/.gitignore | 2 - xsd/doc/pregenerated/xsd.1 | 1480 +++++++++++++++++++++ xsd/doc/pregenerated/xsd.xhtml | 1600 +++++++++++++++++++++++ xsd/manifest | 2 +- xsd/xsd/.gitignore | 6 +- xsd/xsd/buildfile | 114 +- xsd/xsd/cxx/.gitignore | 1 + xsd/xsd/pregenerated/xsd/cxx/options.cxx | 681 ++++++++++ xsd/xsd/pregenerated/xsd/cxx/options.hxx | 443 +++++++ xsd/xsd/pregenerated/xsd/cxx/options.ixx | 603 +++++++++ xsd/xsd/pregenerated/xsd/cxx/parser/options.cxx | 726 ++++++++++ xsd/xsd/pregenerated/xsd/cxx/parser/options.hxx | 186 +++ xsd/xsd/pregenerated/xsd/cxx/parser/options.ixx | 162 +++ xsd/xsd/pregenerated/xsd/cxx/tree/options.cxx | 1293 ++++++++++++++++++ xsd/xsd/pregenerated/xsd/cxx/tree/options.hxx | 414 ++++++ xsd/xsd/pregenerated/xsd/cxx/tree/options.ixx | 504 +++++++ xsd/xsd/pregenerated/xsd/options.cxx | 1240 ++++++++++++++++++ xsd/xsd/pregenerated/xsd/options.hxx | 698 ++++++++++ xsd/xsd/pregenerated/xsd/options.ixx | 549 ++++++++ 25 files changed, 10901 insertions(+), 183 deletions(-) delete mode 100644 xsd/doc/cxx/parser/guide/.gitignore delete mode 100644 xsd/doc/cxx/tree/guide/.gitignore delete mode 100644 xsd/doc/cxx/tree/manual/.gitignore create mode 100644 xsd/doc/pregenerated/xsd.1 create mode 100644 xsd/doc/pregenerated/xsd.xhtml create mode 100644 xsd/xsd/cxx/.gitignore create mode 100644 xsd/xsd/pregenerated/xsd/cxx/options.cxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/options.hxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/options.ixx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/parser/options.cxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/parser/options.hxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/parser/options.ixx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/tree/options.cxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/tree/options.hxx create mode 100644 xsd/xsd/pregenerated/xsd/cxx/tree/options.ixx create mode 100644 xsd/xsd/pregenerated/xsd/options.cxx create mode 100644 xsd/xsd/pregenerated/xsd/options.hxx create mode 100644 xsd/xsd/pregenerated/xsd/options.ixx diff --git a/xsd/build/root.build b/xsd/build/root.build index 2b83ae1..cf9d6a6 100644 --- a/xsd/build/root.build +++ b/xsd/build/root.build @@ -3,6 +3,8 @@ config [bool] config.xsd.develop ?= false +develop = $config.xsd.develop + define cli: file cli{*}: extension = cli diff --git a/xsd/doc/.gitignore b/xsd/doc/.gitignore index 7ae560f..19b80b4 100644 --- a/xsd/doc/.gitignore +++ b/xsd/doc/.gitignore @@ -1,2 +1,5 @@ -xsd.1 -xsd.xhtml +/xsd.1 +/xsd.xhtml + +*.ps +*.pdf diff --git a/xsd/doc/buildfile b/xsd/doc/buildfile index b15831a..5e9a82b 100644 --- a/xsd/doc/buildfile +++ b/xsd/doc/buildfile @@ -25,172 +25,269 @@ png{*}: extension = png define svg: file svg{*}: extension = svg -import! [metadata] cli = cli%exe{cli} +./: css{default} xsd{custom-literals} {png svg}{**} -# Import the html2ps and ps2pdf14 programs only if present on the system. This -# way a distribution that includes pre-generated files can be built without -# installing these programs. +# Man pages. # -import? html2ps = html2ps%exe{html2ps} -import? ps2pdf14 = ps2pdf14%exe{ps2pdf14} -if $config.xsd.develop -{ - if ($html2ps == [null] || $ps2pdf14 == [null]) - warn "html2ps and/or ps2pdf14 are not available, not generating .ps and .pdf documentation" -} - -./: xsd{custom-literals} +## Consumption build ($develop == false). +# -# Generate the man pages. +# Use pregenerated versions in the consumption build. # -ops = $(src_root)/xsd/cxx/cli{options tree/options parser/options} +./: pregenerated/{man1 xhtml}{*}: include = (!$develop) -doc_version = [string] "$version.major\.$version.minor\.$version.patch" -if $version.pre_release - doc_version += "-$version.pre_release_string" +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{man1 xhtml}{*}: dist = (!$develop) -# Let's take the last for-digit number to cover 2000-2021,2022. # -doc_year = $regex.replace($copyright, '.+[-, ]([0-9][0-9][0-9][0-9]) .+', '\1') +## -man_options = -v project="XSD" \ - -v version="$doc_version" \ - -v copyright="$copyright" \ - -I $src_root \ - --stdout \ - --suppress-undocumented \ - --exclude-base +## Development build ($develop == true). +# +./: {man1 xhtml}{xsd}: include = $develop -# Note: *logue and *-header are not real man pages. -# -./: man1{xsd}: $ops \ - file{xsd-prologue.1 \ - xsd-tree-header.1 \ - xsd-parser-header.1 \ - xsd-epilogue.1} \ - $cli +if $develop { - dist = true # Include into the distribution for user's convenience. + doc_version = [string] "$version.major\.$version.minor\.$version.patch" + if $version.pre_release + doc_version += "-$version.pre_release_string" + + # Let's take the last four-digit number to cover 2000-2021,2022. + # + doc_year = $regex.replace($copyright, '.+[-, ]([0-9][0-9][0-9][0-9]) .+', '\1') + + man_options = -v project="XSD" \ + -v version="$doc_version" \ + -v copyright="$copyright" \ + -I $src_root \ + --stdout \ + --suppress-undocumented \ + --exclude-base + + import! [metadata] cli = cli%exe{cli} } + +# In the development build distribute regenerated versions, remapping their +# locations to the paths of the pregenerated versions (which are only +# distributed in the consumption build; see above). This way we make sure that +# the distributed files are always up-to-date. +# +{man1 xhtml}{xsd}: dist = ($develop ? pregenerated/ : false) + +ops = ../xsd/cxx/cli{options tree/options parser/options} + +man1{xsd}: $ops \ + file{xsd-prologue.1 \ + xsd-tree-header.1 \ + xsd-parser-header.1 \ + xsd-epilogue.1} \ + $cli +% +if $develop {{ - diag cli --man ($<[0]) + o = $path($>) # Use the copyright year to approximate the last authoring date. # - $cli --generate-man -v date="January $doc_year" \ - $man_options \ - --class CXX::options \ - --class options \ - --man-prologue-file $path($<[3]) \ - $path($<[0]) >$path($>) - - $cli --generate-man -v date="January $doc_year" \ - $man_options \ - --man-prologue-file $path($<[4]) \ - $path($<[1]) >>$path($>) - - $cli --generate-man -v date="January $doc_year" \ - $man_options \ - --man-prologue-file $path($<[5]) \ - --man-epilogue-file $path($<[6]) \ - $path($<[2]) >>$path($>) + $cli --generate-man $man_options \ + -v date="January $doc_year" \ + --class CXX::options \ + --class options \ + --man-prologue-file $path($<[3]) \ + $path($<[0]) >$o + + $cli --generate-man $man_options \ + -v date="January $doc_year" \ + --man-prologue-file $path($<[4]) \ + $path($<[1]) >>$o + + $cli --generate-man $man_options \ + -v date="January $doc_year" \ + --man-prologue-file $path($<[5]) \ + --man-epilogue-file $path($<[6]) \ + $path($<[2]) >>$o + + # If the result differs from the pregenerated version, copy it over. + # + if! diff $src_base/pregenerated/xsd.1 $o >- + cp $o $src_base/pregenerated/xsd.1 + end }} -# Note: *logue and *-header are not real xhtml files. -# -./: xhtml{xsd}: $ops \ - file{xsd-prologue.xhtml \ - xsd-tree-header.xhtml \ - xsd-parser-header.xhtml \ - xsd-epilogue.xhtml} \ - css{*} \ - $cli -{ - dist = true -} +xhtml{xsd}: $ops \ + file{xsd-prologue.xhtml \ + xsd-tree-header.xhtml \ + xsd-parser-header.xhtml \ + xsd-epilogue.xhtml} \ + $cli +% +if $develop {{ - diag cli --html ($<[0]) - - $cli --generate-html -v date="January $doc_year" \ - $man_options \ - --class CXX::options \ - --class options \ - --html-prologue-file $path($<[3]) \ - $path($<[0]) >$path($>) - - $cli --generate-html -v date="January $doc_year" \ - $man_options \ - --html-prologue-file $path($<[4]) \ - $path($<[1]) >>$path($>) - - $cli --generate-html -v date="January $doc_year" \ - $man_options \ - --html-prologue-file $path($<[5]) \ - --html-epilogue-file $path($<[6]) \ - $path($<[2]) >>$path($>) + o = $path($>) + + $cli --generate-html $man_options \ + -v date="January $doc_year" \ + --class CXX::options \ + --class options \ + --html-prologue-file $path($<[3]) \ + $path($<[0]) >$o + + $cli --generate-html $man_options \ + -v date="January $doc_year" \ + --html-prologue-file $path($<[4]) \ + $path($<[1]) >>$o + + $cli --generate-html $man_options \ + -v date="January $doc_year" \ + --html-prologue-file $path($<[5]) \ + --html-epilogue-file $path($<[6]) \ + $path($<[2]) >>$o + + if! diff $src_base/pregenerated/xsd.xhtml $o >- + cp $o $src_base/pregenerated/xsd.xhtml + end }} -# Generate the user guide/manual ps/pdf files if the html2ps and ps2pdf14 -# programs are imported and handle (install, distribute, etc) the -# pre-generated files otherwise, if present. # -for d: cxx/parser/guide/ cxx/tree/guide/ cxx/tree/manual/ -{ - p = "([dir_path] $path.leaf($path.directory($d)))" # parser, tree - l = "([dir_path] $path.leaf($d))" # guide, manual - f = "cxx-$p-$l" # cxx-parser-guide, etc +## - ./: $d/{png svg}{*} +# Manuals/guides. +# +# This case is slightly more involved because we make the generation of the +# manuals/guides ps/pdf files optional and also don't keep the result in the +# repository. Specifically: +# +# 1. In the consumption build we will install/redistribute ps/pdf if present. +# +# 2. In the development build we will generate ps/pdf if we are able to import +# the needed tools, issuing a warning otherwise. +# +# 3. We generate manuals/guides xhtml files from the templates and distribute +# them. - ./: $d/xhtml{index}: $d/in{index} +manuals = cxx/parser/guide/index cxx/tree/guide/index cxx/tree/manual/index + +for m: $manuals +{ + ./: xhtml{$m}: in{$m} { in.symbol = '@' dist = true clean = ($src_root != $out_root) } +} + +## Consumption build ($develop == false). +# + +# Use pregenerated versions, if exist, in the consumption build. +# +./: pregenerated/{ps pdf}{**}: include = (!$develop) + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{ps pdf}{*}: dist = (!$develop) + +# +## + +## Development build ($develop == true). +# - if ($html2ps != [null] && $ps2pdf14 != [null]) +html2pdf = false + +if $develop +{ + # Import the html2ps and ps2pdf programs from the system, if available. + # + import? html2ps = html2ps%exe{html2ps} + import? ps2pdf = ps2pdf14%exe{ps2pdf14} + + html2pdf = ($html2ps != [null] && $ps2pdf != [null]) + + if! $html2pdf + warn "html2ps and/or ps2pdf14 are not available, not generating .ps and .pdf documentation" +} + +for m: $manuals +{ + d = $directory($m) # cxx/parser/guide/, etc + p = "$leaf($directory($d))" # parser, tree + l = "$leaf($d)" # guide, manual + f = "cxx-$p-$l" # cxx-parser-guide, etc + + pf = $d/$f # cxx/parser/guide/cxx-parser-guide, etc + cf = $d/$l # cxx/parser/guide/guide, etc + + ./: {ps pdf}{$pf}: include = $html2pdf + + # In the development build distribute regenerated versions, remapping their + # locations to the paths of the pregenerated versions (which are only + # distributed in the consumption build; see above). This way we make sure + # that the distributed files are always up-to-date. + # + {ps pdf}{$pf}: \ + dist = ($html2pdf ? $relative([dir_path] "pregenerated/$d", $d) : false) + + pdf{$pf}: ps{$pf}: xhtml{$m} html2ps{$cf} + + html2ps{$cf}: in{$cf} { - # Note that we include these generated files into the distribution and - # don't remove them when cleaning in src (so that clean results in a state - # identical to distributed). - # - ./: $d/ps{$f}: $d/xhtml{index} $d/html2ps{$l} $html2ps - { - base = $src_base/$d - - dist = true - clean = ($src_root != $out_root) - } - {{ - diag html2ps ($<[0]) - - # Note: --base must include trailing directory separator. - # - $html2ps --base $base -f $path($<[1]) -o $path($>) $path($<[0]) - }} - - ./: $d/pdf{$f}: $d/ps{$f} $ps2pdf14 - { - dist = true - clean = ($src_root != $out_root) - } - {{ - diag ps2pdf14 ($<[0]) - - $ps2pdf14 -dOptimize=true -dEmbedAllFonts=true $path($<[0]) $path($>) - }} - - $d/html2ps{$l}: $d/in{$l} - { - in.symbol = '@' - } + in.symbol = '@' } - else - ./: $d/{ps pdf}{+$f} $d/file{$l.html2ps.in} } -doc{*}: install.subdirs = true +# Note: the pregenerated file may not exist, thus --no-cleanup option is +# required for the mkdir and cp builtin calls. Strictly speaking we don't +# really need to copy them since they are not stored in the repository, but +# let's do that for consistency with the distributed source tree. +# +ps{~'/cxx-.+-(.+)/'}: xhtml{~'/index/'} html2ps{~'/\1/'} $html2ps +% +if $html2pdf +{{ + # cxx/parser/guide/, etc + # + d = [dir_path] $leaf($directory($path($>[0])), $out_base) + + # Note: --base must include trailing directory separator. + # + options = --base $src_base/$d + + diag html2ps ($<[0]) + $html2ps $options -f $path($<[1]) -o $path($>) $path($<[0]) + + # Note: must include trailing directory separator (see cp for details). + # + d = $src_base/pregenerated/$d + + mkdir -p --no-cleanup $d + cp --no-cleanup $path($>) $d +}} + +pdf{~'/(cxx-.+-.+)/'}: ps{~'/\1/'} $ps2pdf +% +if $html2pdf +{{ + options = -dOptimize=true -dEmbedAllFonts=true + + diag ps2pdf ($<[0]) + $ps2pdf $options $path($<[0]) $path($>) + + # Note: must include trailing directory separator (see cp for details). + # + d = $src_base/pregenerated/$leaf($directory($path($>[0])), $out_base) + + mkdir -p --no-cleanup $d + cp --no-cleanup $path($>) $d +}} + +# +## + +doc{*}: install.subdirs = true +pregenerated/doc{*}: install.subdirs = true diff --git a/xsd/doc/cxx/.gitignore b/xsd/doc/cxx/.gitignore index 239cc7f..45f6b1e 100644 --- a/xsd/doc/cxx/.gitignore +++ b/xsd/doc/cxx/.gitignore @@ -1,2 +1,2 @@ -*.ps -*.pdf +*.xhtml +*.html2ps diff --git a/xsd/doc/cxx/parser/guide/.gitignore b/xsd/doc/cxx/parser/guide/.gitignore deleted file mode 100644 index 17828e9..0000000 --- a/xsd/doc/cxx/parser/guide/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -index.xhtml -guide.html2ps diff --git a/xsd/doc/cxx/tree/guide/.gitignore b/xsd/doc/cxx/tree/guide/.gitignore deleted file mode 100644 index 17828e9..0000000 --- a/xsd/doc/cxx/tree/guide/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -index.xhtml -guide.html2ps diff --git a/xsd/doc/cxx/tree/manual/.gitignore b/xsd/doc/cxx/tree/manual/.gitignore deleted file mode 100644 index 39e8d48..0000000 --- a/xsd/doc/cxx/tree/manual/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -index.xhtml -manual.html2ps diff --git a/xsd/doc/pregenerated/xsd.1 b/xsd/doc/pregenerated/xsd.1 new file mode 100644 index 0000000..f74a3b0 --- /dev/null +++ b/xsd/doc/pregenerated/xsd.1 @@ -0,0 +1,1480 @@ +.\" Process this file with +.\" groff -man -Tascii xsd.1 +.\" +.TH XSD 1 "January 2022" "XSD 4.2.0-b.4" +.SH NAME +xsd \- W3C XML Schema to C++ Compiler +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH SYNOPSIS +.\"-------------------------------------------------------------------- +.B xsd +.I command +.B [ +.I options +.B ] +.I file +.B [ +.I file +.B ...] +.in +.B xsd help +.B [ +.I command +.B ] +.in +.B xsd version +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH DESCRIPTION +.\"-------------------------------------------------------------------- +.B xsd +generates vocabulary-specific, statically-typed C++ mapping from W3C XML +Schema definitions. Particular mapping to produce is selected by a +.IR command . +Each mapping has a number of mapping-specific +.I options +that should appear, if any, after the +.IR command . +Input files should be W3C XML Schema definitions. The exact set of the +generated files depends on the selected mapping and options. +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH COMMANDS +.\"-------------------------------------------------------------------- +.IP \fBcxx-tree\fR +Generate the C++/Tree mapping. For each input file in the form +.B name.xsd +the following C++ files are generated: +.B name.hxx +(header file), +.B name.ixx +(inline file, generated only if the +.B --generate-inline +option is specified), +.B name.cxx +(source file), and +.B name-fwd.hxx +(forward declaration file, generated only if the +.B --generate-forward +option is specified). + +.IP \fBcxx-parser\fR +Generate the C++/Parser mapping. For each input file in the form +.B name.xsd +the following C++ files are generated: +.B name-pskel.hxx +(parser skeleton header file), +.B name-pskel.ixx +(parser skeleton inline file, generated only if the +.B --generate-inline +option is specified), and +.B name-pskel.cxx +(parser skeleton source file). If the +.B --generate-noop-impl +or +.B --generate-print-impl +option is specified, the following additional sample implementation files +are generated: +.B name-pimpl.hxx +(parser implementation header file) and +.B name-pimpl.cxx +(parser implementation source file). If the +.B --generate-test-driver +option is specified, the additional +.B name-driver.cxx +test driver file is generated. + +.IP \fBhelp\fR +Print usage information and exit. Use +.PP +.RS +.RS 3 +.B xsd help +.I command +.RE +.PP +for command-specific help. +.RE +.IP \fBversion\fR +Print version and exit. +.\"-------------------------------------------------------------------- +.SH OPTIONS +.\"-------------------------------------------------------------------- +Command-specific +.IR options , +if any, should appear after the corresponding +.IR command . + +.\" +.\" Common options. +.\" +.SS common options +. +.IP "\fB--std\fR \fIversion\fR" +Specify the C++ standard that the generated code should conform to\. Valid +values are \fBc++98\fR (default) and \fBc++11\fR\. + +The C++ standard affects various aspects of the generated code that are +discussed in more detail in various mapping-specific documentation\. Overall, +when C++11 is selected, the generated code relies on the move semantics and +uses \fBstd::unique_ptr\fR instead of deprecated \fBstd::auto_ptr\fR\. + +When the C++11 mode is selected, you normally don't need to perform any extra +steps other than enable C++11 in your C++ compiler, if required\. The XSD +compiler will automatically add the necessary macro defines to the generated +header files that will switch the header-only XSD runtime library +(\fBlibxsd\fR) to the C++11 mode\. However, if you include any of the XSD +runtime headers directly in your application (normally you just include the +generated headers), then you will need to define the \fBXSD_CXX11\fR macro for +your entire project\. +.IP "\fB--char-type\fR \fItype\fR" +Generate code using the provided character \fItype\fR instead of the default +\fBchar\fR\. Valid values are \fBchar\fR and \fBwchar_t\fR\. +.IP "\fB--char-encoding\fR \fIenc\fR" +Specify the character encoding that should be used in the generated code\. +Valid values for the \fBchar\fR character type are \fButf8\fR (default), +\fBiso8859-1\fR, \fBlcp\fR (Xerces-C++ local code page), and \fBcustom\fR\. If +you pass \fBcustom\fR as the value then you will need to include the +transcoder implementation header for your encoding at the beginning of the +generated header files (see the \fB--hxx-prologue\fR option)\. + +For the \fBwchar_t\fR character type the only valid value is \fBauto\fR and +the encoding is automatically selected between UTF-16 and UTF-32/UCS-4, +depending on the \fBwchar_t\fR type size\. +.IP "\fB--output-dir\fR \fIdir\fR" +Write generated files to \fIdir\fR instead of the current directory\. +.IP "\fB--generate-inline\fR" +Generate simple functions inline\. This option triggers creation of the inline +file\. +.IP "\fB--generate-xml-schema\fR" +Generate a C++ header file as if the schema being compiled defines the XML +Schema namespace\. For the C++/Tree mapping, the resulting file will contain +definitions for all XML Schema built-in types\. For the C++/Parser mapping, +the resulting file will contain definitions for all the parser skeletons and +implementations corresponding to the XML Schema built-in types\. + +The schema file provided to the compiler need not exist and is only used to +derive the name of the resulting header file\. Use the +\fB--extern-xml-schema\fR option to include this file in the generated files +for other schemas\. +.IP "\fB--extern-xml-schema\fR \fIfile\fR" +Include a header file derived from \fIfile\fR instead of generating the XML +Schema namespace mapping inline\. The provided file need not exist and is only +used to derive the name of the included header file\. Use the +\fB--generate-xml-schema\fR option to generate this header file\. +.IP "\fB--namespace-map\fR \fIxns\fR=\fIcns\fR" +Map XML Schema namespace \fIxns\fR to C++ namespace \fIcns\fR\. Repeat this +option to specify mapping for more than one XML Schema namespace\. For +example, the following option: + +\fB--namespace-map http://example\.com/foo/bar=foo::bar\fR + +Will map the \fBhttp://example\.com/foo/bar\fR XML Schema namespace to the +\fBfoo::bar\fR C++ namespace\. +.IP "\fB--namespace-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema namespace names to C++ namespace names\. \fIregex\fR is a Perl-like +regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR'\. Escaping of the delimiter character +in \fIpattern\fR or \fIreplacement\fR is not supported\. + +All the regular expressions are pushed into a stack with the last specified +expression considered first\. The first match that succeeds is used\. Regular +expressions are applied to a string in the form + +\fIfilename\fR \fInamespace\fR\fR + +For example, if you have file \fBhello\.xsd\fR with namespace +\fBhttp://example\.com/hello\fR and you run \fBxsd\fR on this file, then the +string in question will be: + +\fBhello\.xsd\. http://example\.com/hello\fR + +For the built-in XML Schema namespace the string is: + +\fBXMLSchema\.xsd http://www\.w3\.org/2001/XMLSchema\fR + +The following three steps are performed for each regular expression until the +match is found: + +1\. The expression is applied and if the result is empty the next expression +is considered\. + +2\. All '\fB/\fR' are replaced with '\fB::\fR'\. + +3\. The result is verified to be a valid C++ scope name (e\.g\., +\fBfoo::bar\fR)\. If this test succeeds, the result is used as a C++ namespace +name\. + +As an example, the following expression maps XML Schema namespaces in the +form \fBhttp://example\.com/foo/bar\fR to C++ namespaces in the form +\fBfoo::bar\fR: + +\fB%\.* http://example\.com/(\.+)%$1%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--namespace-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--namespace-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--reserved-name\fR \fIn\fR[=\fIr\fR]" +Add name \fIn\fR to the list of names that should not be used as identifiers\. +The name can optionally be followed by \fB=\fR and the replacement name +\fIr\fR that should be used instead\. All the C++ keywords are already in this +list\. +.IP "\fB--include-with-brackets\fR" +Use angle brackets (<>) instead of quotes ("") in generated \fB#include\fR +directives\. +.IP "\fB--include-prefix\fR \fIprefix\fR" +Add \fIprefix\fR to generated \fB#include\fR directive paths\. + +For example, if you had the following import element in your schema + +\fB\fR + +and compiled this fragment with \fB--include-prefix schemas/\fR, then the +include directive in the generated code would be: + +\fB#include "schemas/base\.hxx"\fR +.IP "\fB--include-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to transform +\fB#include\fR directive paths\. \fIregex\fR is a Perl-like regular expression +in the form \fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any +character can be used as a delimiter instead of '\fB/\fR'\. Escaping of the +delimiter character in \fIpattern\fR or \fIreplacement\fR is not supported\. + +All the regular expressions are pushed into a stack with the last specified +expression considered first\. The first match that succeeds is used\. + +As an example, the following expression transforms paths in the form +\fBschemas/foo/bar\fR to paths in the form \fBgenerated/foo/bar\fR: + +\fB%schemas/(\.+)%generated/$1%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--include-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--include-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--guard-prefix\fR \fIprefix\fR" +Add \fIprefix\fR to generated header inclusion guards\. The prefix is +transformed to upper case and characters that are illegal in a preprocessor +macro name are replaced with underscores\. If this option is not specified +then the directory part of the input schema file is used as a prefix\. +.IP "\fB--hxx-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB\.hxx\fR to construct +the name of the header file\. Note that this suffix is also used to construct +names of header files corresponding to included/imported schemas\. +.IP "\fB--ixx-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB\.ixx\fR to construct +the name of the inline file\. +.IP "\fB--cxx-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB\.cxx\fR to construct +the name of the source file\. +.IP "\fB--fwd-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB-fwd\.hxx\fR to +construct the name of the forward declaration file\. +.IP "\fB--hxx-regex\fR \fIregex\fR" +Use the provided expression to construct the name of the header file\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Note that this +expression is also used to construct names of header files corresponding to +included/imported schemas\. See also the REGEX AND SHELL QUOTING section +below\. +.IP "\fB--ixx-regex\fR \fIregex\fR" +Use the provided expression to construct the name of the inline file\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. See also the REGEX +AND SHELL QUOTING section below\. +.IP "\fB--cxx-regex\fR \fIregex\fR" +Use the provided expression to construct the name of the source file\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. See also the REGEX +AND SHELL QUOTING section below\. +.IP "\fB--fwd-regex\fR \fIregex\fR" +Use the provided expression to construct the name of the forward declaration +file\. \fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. See also the REGEX +AND SHELL QUOTING section below\. +.IP "\fB--hxx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the header file\. +.IP "\fB--ixx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the inline file\. +.IP "\fB--cxx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the source file\. +.IP "\fB--fwd-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the forward declaration file\. +.IP "\fB--prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of each generated file for which there is +no file-specific prologue\. +.IP "\fB--hxx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the header file\. +.IP "\fB--ixx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the inline file\. +.IP "\fB--cxx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the source file\. +.IP "\fB--fwd-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the forward declaration file\. +.IP "\fB--epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of each generated file for which there is no +file-specific epilogue\. +.IP "\fB--hxx-prologue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the beginning of the header file\. +.IP "\fB--ixx-prologue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the beginning of the inline file\. +.IP "\fB--cxx-prologue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the beginning of the source file\. +.IP "\fB--fwd-prologue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the beginning of the forward +declaration file\. +.IP "\fB--prologue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the beginning of each generated file +for which there is no file-specific prologue file\. +.IP "\fB--hxx-epilogue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the end of the header file\. +.IP "\fB--ixx-epilogue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the end of the inline file\. +.IP "\fB--cxx-epilogue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the end of the source file\. +.IP "\fB--fwd-epilogue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the end of the forward declaration +file\. +.IP "\fB--epilogue-file\fR \fIfile\fR" +Insert the content of the \fIfile\fR at the end of each generated file for +which there is no file-specific epilogue file\. +.IP "\fB--export-symbol\fR \fIsymbol\fR" +Insert \fIsymbol\fR in places where DLL export/import control statements +(\fB__declspec(dllexport/dllimport)\fR) are necessary\. +.IP "\fB--export-xml-schema\fR" +Export/import types in the XML Schema namespace using the export symbol +provided with the \fB--export-symbol\fR option\. The \fBXSD_NO_EXPORT\fR macro +can be used to omit this code during C++ compilation, which may be useful if +you would like to use the same generated code across multiple platforms\. +.IP "\fB--export-maps\fR" +Export polymorphism support maps from a Win32 DLL into which this generated +code is placed\. This is necessary when your type hierarchy is split across +several DLLs since otherwise each DLL will have its own set of maps\. In this +situation the generated code for the DLL which contains base types and/or +substitution group heads should be compiled with this option and the generated +code for all other DLLs should be compiled with \fB--import-maps\fR\. This +option is only valid together with \fB--generate-polymorphic\fR\. The +\fBXSD_NO_EXPORT\fR macro can be used to omit this code during C++ +compilation, which may be useful if you would like to use the same generated +code across multiple platforms\. +.IP "\fB--import-maps\fR" +Import polymorphism support maps to a Win32 DLL or executable into which this +generated code is linked\. See the \fB--export-maps\fR option documentation +for details\. This options is only valid together with +\fB--generate-polymorphic\fR\. The \fBXSD_NO_EXPORT\fR macro can be used to +omit this code during C++ compilation, which may be useful if you would like +to use the same generated code across multiple platforms\. +.IP "\fB--generate-dep\fR" +Generate \fBmake\fR dependency information\. This option triggers the creation +of the \fB\.d\fR file containing the dependencies of the generated files on +the main schema file as well as all the schema files that it includes/imports, +transitively\. This dependency file is then normally included into the main +\fBmakefile\fR to implement automatic dependency tracking\. + +Note also that automatic dependency generation is not supported in the +file-per-type mode (\fB--file-per-type\fR)\. In this case, all the generated +files are produced with a single compiler invocation and depend on all the +schemas\. As a result, it is easier to establish such a dependency manually, +perhaps with the help of the \fB--file-list*\fR options\. +.IP "\fB--generate-dep-only\fR" +Generate \fBmake\fR dependency information only\. +.IP "\fB--dep-phony\fR" +Generate phony targets for included/imported schema files, causing each to +depend on nothing\. Such dummy rules work around \fBmake\fR errors caused by +the removal of schema files without also updating the dependency file to +match\. +.IP "\fB--dep-target\fR \fItarget\fR" +Change the target of the dependency rule\. By default it contains all the +generated C++ files as well as the dependency file itself, without any +directory prefixes\. If you require multiple targets, then you can specify +them as a single, space-separated argument or you can repeat this option +multiple times\. +.IP "\fB--dep-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB\.d\fR to construct +the name of the dependency file\. +.IP "\fB--dep-regex\fR \fIregex\fR" +Use the provided expression to construct the name of the dependency file\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. See also the REGEX +AND SHELL QUOTING section below\. +.IP "\fB--disable-warning\fR \fIwarn\fR" +Disable printing warning with id \fIwarn\fR\. If \fBall\fR is specified for +the warning id then all warnings are disabled\. +.IP "\fB--options-file\fR \fIfile\fR" +Read additional options from \fIfile\fR\. Each option should appearing on a +separate line optionally followed by space and an option value\. Empty lines +and lines starting with \fB#\fR are ignored\. Option values can be enclosed in +double (\fB"\fR) or single (\fB'\fR) quotes to preserve leading and trailing +whitespaces as well as to specify empty values\. If the value itself contains +trailing or leading quotes, enclose it with an extra pair of quotes, for +example \fB'"x"'\fR\. Non-leading and non-trailing quotes are interpreted as +being part of the option value\. + +The semantics of providing options in a file is equivalent to providing the +same set of options in the same order on the command line at the point where +the \fB--options-file\fR option is specified except that the shell escaping +and quoting is not required\. You can repeat this option to specify more than +one options file\. +.IP "\fB--show-sloc\fR" +Show the number of generated physical source lines of code (SLOC)\. +.IP "\fB--sloc-limit\fR \fInum\fR" +Check that the number of generated physical source lines of code (SLOC) does +not exceed \fInum\fR\. +.IP "\fB--proprietary-license\fR" +Indicate that the generated code is licensed under a proprietary license +instead of the GPL\. +.IP "\fB--custom-literals\fR \fIfile\fR" +Load custom XML string to C++ literal mappings from \fIfile\fR\. This +mechanism can be useful if you are using a custom character encoding and some +of the strings in your schemas, for example element/attribute names or +enumeration values, contain non-ASCII characters\. In this case you will need +to provide a custom mapping to C++ literals for such strings\. The format of +this file is specified in the \fBcustom-literals\.xsd\fR XML Schema file that +can be found in the documentation directory\. +.IP "\fB--preserve-anonymous\fR" +Preserve anonymous types\. By default anonymous types are automatically named +with names derived from the enclosing elements/attributes\. Because mappings +implemented by this compiler require all types to be named, this option is +only useful if you want to make sure your schemas don't have anonymous types\. +.IP "\fB--show-anonymous\fR" +Show elements and attributes that are of anonymous types\. This option only +makes sense together with the \fB--preserve-anonymous\fR option\. +.IP "\fB--anonymous-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to derive names for +anonymous types from the enclosing attributes/elements\. \fIregex\fR is a +Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR'\. Escaping of the delimiter character +in \fIpattern\fR or \fIreplacement\fR is not supported\. + +All the regular expressions are pushed into a stack with the last specified +expression considered first\. The first match that succeeds is used\. Regular +expressions are applied to a string in the form + +\fIfilename\fR \fInamespace\fR \fIxpath\fR\fR + +For instance: + +\fBhello\.xsd http://example\.com/hello element\fR + +\fBhello\.xsd http://example\.com/hello type/element\fR + +As an example, the following expression makes all the derived names start with +capital letters\. This could be useful when your naming convention requires +type names to start with capital letters: + +\fB%\.* \.* (\.+/)*(\.+)%\eu$2%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--anonymous-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--anonymous-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--location-map\fR \fIol\fR=\fInl\fR" +Map the original schema location \fIol\fR that is specified in the XML Schema +include or import elements to new schema location \fInl\fR\. Repeat this +option to map more than one schema location\. For example, the following +option maps the \fBhttp://example\.com/foo\.xsd\fR URL to the \fBfoo\.xsd\fR +local file\. + +\fB--location-map http://example\.com/foo\.xsd=foo\.xsd\fR +.IP "\fB--location-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to map schema +locations that are specified in the XML Schema include or import elements\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR'\. Escaping of the delimiter character +in \fIpattern\fR or \fIreplacement\fR is not supported\. All the regular +expressions are pushed into a stack with the last specified expression +considered first\. The first match that succeeds is used\. + +For example, the following expression maps URL locations in the form +\fBhttp://example\.com/foo/bar\.xsd\fR to local files in the form +\fBbar\.xsd\fR: + +\fB%http://\.+/(\.+)%$1%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--location-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--location-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--file-per-type\fR" +Generate a separate set of C++ files for each type defined in XML Schema\. +Note that in this mode you only need to compile the root schema(s) and the +code will be generated for all included and imported schemas\. This +compilation mode is primarily useful when some of your schemas cannot be +compiled separately or have cyclic dependencies which involve type +inheritance\. Other options related to this mode are: \fB--type-file-regex\fR, +\fB--schema-file-regex\fR, \fB--fat-type-file\fR, and \fB--file-list\fR\. +.IP "\fB--type-file-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate type +names to file names when the \fB--file-per-type\fR option is specified\. +\fIregex\fR is a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR'\. Escaping of the delimiter character +in \fIpattern\fR or \fIreplacement\fR is not supported\. All the regular +expressions are pushed into a stack with the last specified expression +considered first\. The first match that succeeds is used\. Regular expressions +are applied to a string in the form + +\fInamespace\fR \fItype-name\fR\fR + +For example, the following expression maps type \fBfoo\fR that is defined in +the \fBhttp://example\.com/bar\fR namespace to file name \fBbar-foo\fR: + +\fB%http://example\.com/(\.+) (\.+)%$1-$2%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--type-file-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--type-file-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--schema-file-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate schema +file names when the \fB--file-per-type\fR option is specified\. \fIregex\fR is +a Perl-like regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR'\. Escaping of the delimiter character +in \fIpattern\fR or \fIreplacement\fR is not supported\. All the regular +expressions are pushed into a stack with the last specified expression +considered first\. The first match that succeeds is used\. Regular Expressions +are applied to the absolute filesystem path of a schema file and the result, +including the directory part, if any, is used to derive the \fB#include\fR +directive paths as well as the generated C++ file paths\. This option, along +with \fB--type-file-regex\fR are primarily useful to place the generated files +into subdirectories or to resolve file name conflicts\. + +For example, the following expression maps schema files in the +\fBfoo/1\.0\.0/\fR subdirectory to the files in the \fBfoo/\fR subdirectory\. +As a result, the \fB#include\fR directive paths for such schemas will be in +the \fBfoo/schema\.hxx\fR form and the generated C++ files will be placed into +the \fBfoo/\fR subdirectory: + +\fB%\.*/foo/1\.0\.0/(\.+)%foo/$1%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--schema-file-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--schema-file-regex\fR option\. Use this option to find out why your +regular expressions don't do what you expected them to do\. +.IP "\fB--fat-type-file\fR" +Generate code corresponding to global elements into type files instead of +schema files when the \fB--type-file-regex\fR option is specified\. This +option is primarily useful when trying to minimize the amount of object code +that is linked to an executable by packaging compiled generated code into a +static (archive) library\. +.IP "\fB--file-list\fR \fIfile\fR" +Write a list of generated C++ files to \fIfile\fR\. This option is primarily +useful in the file-per-type compilation mode (\fB--file-per-type\fR) to create +a list of generated C++ files, for example, as a makefile fragment\. +.IP "\fB--file-list-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the file list\. As a convenience, all +occurrences of the \fB\en\fR character sequence in \fItext\fR are replaced +with new lines\. This option can, for example, be used to assign the generated +file list to a makefile variable\. +.IP "\fB--file-list-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the file list\. As a convenience, all +occurrences of the \fB\en\fR character sequence in \fItext\fR are replaced +with new lines\. +.IP "\fB--file-list-delim\fR \fItext\fR" +Delimit file names written to the file list with \fItext\fR instead of new +lines\. As a convenience, all occurrences of the \fB\en\fR character sequence +in \fItext\fR are replaced with new lines\. +.\" +.\" C++/Tree options. +.\" +.SS cxx-tree command options +.IP "\fB--generate-polymorphic\fR" +Generate polymorphism-aware code\. Specify this option if you use substitution +groups or \fBxsi:type\fR\. Use the \fB--polymorphic-type\fR or +\fB--polymorphic-type-all\fR option to specify which type hierarchies are +polymorphic\. +.IP "\fB--polymorphic-type\fR \fItype\fR" +Indicate that \fItype\fR is a root of a polymorphic type hierarchy\. The +compiler can often automatically determine which types are polymorphic based +on the substitution group declarations\. However, you may need to use this +option if you are not using substitution groups or if substitution groups are +defined in another schema\. You need to specify this option when compiling +every schema file that references \fItype\fR\. The \fItype\fR argument is an +XML Schema type name that can be optionally qualified with a namespace in the +\fInamespace\fR\fB#\fR\fIname\fR\fR form\. +.IP "\fB--polymorphic-type-all\fR" +Indicate that all types should be treated as polymorphic\. +.IP "\fB--polymorphic-plate\fR \fInum\fR" +Specify the polymorphic map plate the generated code should register on\. This +functionality is primarily useful to segregate multiple schemas that define +the same polymorphic types\. +.IP "\fB--ordered-type\fR \fItype\fR" +Indicate that element order in \fItype\fR is significant\. An example would be +a complex type with unbounded choice as a content model where the element +order in XML has application-specific semantics\. For ordered types the +compiler generates a special container data member and a corresponding set of +accessors and modifiers that are used to capture the order of elements and, +for mixed content, of text\. + +The \fItype\fR argument is an XML Schema type name that can be optionally +qualified with a namespace in the \fInamespace\fR\fB#\fR\fIname\fR\fR form\. +Note also that you will need to specify this option when compiling every +schema file that has other ordered types derived from this type\. +.IP "\fB--ordered-type-derived\fR" +Automatically treat types derived from ordered bases as also ordered\. This is +primarily useful if you would like to be able to iterate over the complete +content using the content order container\. +.IP "\fB--ordered-type-mixed\fR" +Automatically treat complex types with mixed content as ordered\. +.IP "\fB--ordered-type-all\fR" +Indicate that element order in all types is significant\. +.IP "\fB--order-container\fR \fItype\fR" +Specify a custom class template that should be used as a container for the +content order in ordered types instead of the default \fBstd::vector\fR\. See +\fB--ordered-type\fR for more information on ordered type\. This option is +primarily useful if you need to perform more complex lookups in the content +order container, for example by element id\. In this case, a container like +Boost multi-index may be more convenient\. Note that if using a custom +container, you will also most likely need to include the relevant headers +using the \fB--hxx-prologue*\fR options\. +.IP "\fB--generate-serialization\fR" +Generate serialization functions\. Serialization functions convert the object +model back to XML\. +.IP "\fB--generate-ostream\fR" +Generate ostream insertion operators (\fBoperator<<\fR) for generated types\. +This allows one to easily print a fragment or the whole object model for +debugging or logging\. +.IP "\fB--generate-doxygen\fR" +Generate documentation comments suitable for extraction by the Doxygen +documentation system\. Documentation from annotations is added to the comments +if present in the schema\. +.IP "\fB--generate-comparison\fR" +Generate comparison operators (\fBoperator==\fR and \fBoperator!=\fR) for +complex types\. Comparison is performed member-wise\. +.IP "\fB--generate-default-ctor\fR" +Generate default constructors even for types that have required members\. +Required members of an instance constructed using such a constructor are not +initialized and accessing them results in undefined behavior\. +.IP "\fB--generate-from-base-ctor\fR" +Generate constructors that expect an instance of a base type followed by all +required members\. +.IP "\fB--suppress-assignment\fR" +Suppress the generation of copy assignment operators for complex types\. If +this option is specified, the copy assignment operators for such types are +declared private and left unimplemented\. +.IP "\fB--generate-detach\fR" +Generate detach functions for required elements and attributes\. Detach +functions for optional and sequence cardinalities are provided by the +respective containers\. These functions, for example, allow you to move +sub-trees in the object model either within the same tree or between different +trees\. +.IP "\fB--generate-wildcard\fR" +Generate accessors and modifiers as well as parsing and serialization code for +XML Schema wildcards (\fBany\fR and \fBanyAttribute\fR)\. XML content matched +by wildcards is presented as DOM fragments\. Note that you need to initialize +the Xerces-C++ runtime if you are using this option\. +.IP "\fB--generate-any-type\fR" +Extract and store content of the XML Schema \fBanyType\fR type as a DOM +fragment\. Note that you need to initialize the Xerces-C++ runtime if you are +using this option\. +.IP "\fB--generate-insertion\fR \fIos\fR" +Generate data representation stream insertion operators for the \fIos\fR +output stream type\. Repeat this option to specify more than one stream type\. +The ACE CDR stream (\fBACE_OutputCDR\fR) and RPC XDR are recognized by the +compiler and the necessary \fB#include\fR directives are automatically +generated\. For custom stream types use the \fB--hxx-prologue*\fR options to +provide the necessary declarations\. +.IP "\fB--generate-extraction\fR \fIis\fR" +Generate data representation stream extraction constructors for the \fIis\fR +input stream type\. Repeat this option to specify more than one stream type\. +The ACE CDR stream (\fBACE_InputCDR\fR) and RPC XDR are recognized by the +compiler and the necessary \fB#include\fR directives are automatically +generated\. For custom stream types use the \fB--hxx-prologue*\fR options to +provide the necessary declarations\. +.IP "\fB--generate-forward\fR" +Generate a separate header file with forward declarations for the types being +generated\. +.IP "\fB--suppress-parsing\fR" +Suppress the generation of the parsing functions and constructors\. Use this +option to reduce the generated code size when parsing from XML is not needed\. +.IP "\fB--generate-element-type\fR" +Generate types instead of parsing and serialization functions for root +elements\. This is primarily useful to distinguish object models with the same +root type but with different root elements\. +.IP "\fB--generate-element-map\fR" +Generate a root element map that allows uniform parsing and serialization of +multiple root elements\. This option is only valid together with +\fB--generate-element-type\fR\. +.IP "\fB--generate-intellisense\fR" +Generate workarounds for IntelliSense bugs in Visual Studio 2005 (8\.0)\. When +this option is used, the resulting code is slightly more verbose\. +IntelliSense in Visual Studio 2008 (9\.0) and later does not require these +workarounds\. Support for IntelliSense in Visual Studio 2003 (7\.1) is +improved with this option but is still incomplete\. +.IP "\fB--omit-default-attributes\fR" +Omit attributes with default and fixed values from serialized XML documents\. +.IP "\fB--type-naming\fR \fIstyle\fR" +Specify the type naming convention that should be used in the generated code\. +Valid styles are \fBknr\fR (default), \fBucc\fR, and \fBjava\fR\. See the +NAMING CONVENTION section below for more information\. +.IP "\fB--function-naming\fR \fIstyle\fR" +Specify the function naming convention that should be used in the generated +code\. Valid styles are \fBknr\fR (default), \fBlcc\fR, \fBucc\fR, and +\fBjava\fR\. See the NAMING CONVENTION section below for more information\. +.IP "\fB--type-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema type names to C++ type names\. See the NAMING CONVENTION section below +for more information\. +.IP "\fB--accessor-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes to C++ accessor function names\. See the +NAMING CONVENTION section below for more information\. +.IP "\fB--one-accessor-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality one to C++ accessor +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--opt-accessor-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality optional to C++ accessor +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--seq-accessor-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality sequence to C++ accessor +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--modifier-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes to C++ modifier function names\. See the +NAMING CONVENTION section below for more information\. +.IP "\fB--one-modifier-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality one to C++ modifier +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--opt-modifier-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality optional to C++ modifier +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--seq-modifier-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema names of elements/attributes with cardinality sequence to C++ modifier +function names\. See the NAMING CONVENTION section below for more +information\. +.IP "\fB--parser-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema element names to C++ parsing function names\. See the NAMING CONVENTION +section below for more information\. +.IP "\fB--serializer-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema element names to C++ serialization function names\. See the NAMING +CONVENTION section below for more information\. +.IP "\fB--const-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema-derived names to C++ constant names\. See the NAMING CONVENTION section +below for more information\. +.IP "\fB--enumerator-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema enumeration values to C++ enumerator names\. See the NAMING CONVENTION +section below for more information\. +.IP "\fB--element-type-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to translate XML +Schema element names to C++ element type names\. See the NAMING CONVENTION +section below for more information\. +.IP "\fB--name-regex-trace\fR" +Trace the process of applying regular expressions specified with the name +transformation options\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--root-element-first\fR" +Treat only the first global element as a document root\. By default all global +elements are considered document roots\. +.IP "\fB--root-element-last\fR" +Treat only the last global element as a document root\. By default all global +elements are considered document roots\. +.IP "\fB--root-element-all\fR" +Treat all global elements as document roots\. This is the default behavior\. +By explicitly specifying this option you can suppress the warning that is +issued if more than one global element is defined\. +.IP "\fB--root-element-none\fR" +Do not treat any global elements as document roots\. By default all global +elements are considered document roots\. +.IP "\fB--root-element\fR \fIelement\fR" +Treat only \fIelement\fR as a document root\. Repeat this option to specify +more than one root element\. +.IP "\fB--custom-type\fR \fImap\fR" +Use a custom C++ type instead of the generated class\. The \fImap\fR argument +is in the form \fIname\fR[\fB=\fR\fItype\fR[\fB/\fR\fIbase\fR]]\fR, where +\fIname\fR is a type name as defined in XML Schema and \fItype\fR is a C++ +type name that should be used instead\. If \fItype\fR is not present or empty +then the custom type is assumed to have the same name and be defined in the +same namespace as the generated class would have\. If \fIbase\fR is specified +then the generated class is still generated but with that name\. +.IP "\fB--custom-type-regex\fR \fIregex\fR" +Use custom C++ types instead of the generated classes\. The \fIregex\fR +argument is in the form +\fB/\fR\fIname-pat\fR\fB/\fR[\fItype-sub\fR\fB/\fR[\fIbase-sub\fR\fB/\fR]]\fR, +where \fIname-pat\fR is a regex pattern that will be matched against type +names as defined in XML Schema and \fItype-sub\fR is a C++ type name +substitution that should be used instead\. If \fItype-sub\fR is not present or +its substitution results in an empty string then the custom type is assumed to +have the same name and be defined in the same namespace as the generated class +would have\. If \fIbase-sub\fR is present and its substitution results in a +non-empty string then the generated class is still generated but with the +result of this substitution as its name\. The pattern and substitutions are in +the Perl regular expression format\. See also the REGEX AND SHELL QUOTING +section below\. +.IP "\fB--parts\fR \fInum\fR" +Split generated source code into \fInum\fR parts\. This is useful when +translating large, monolithic schemas and a C++ compiler is not able to +compile the resulting source code at once (usually due to insufficient +memory)\. +.IP "\fB--parts-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default '\fB-\fR' to separate the file name +from the part number\. +\" +\" C++/Parser +\" +.SS cxx-parser command options +.IP "\fB--type-map\fR \fImapfile\fR" +Read XML Schema to C++ type mapping information from \fImapfile\fR\. Repeat +this option to specify several type maps\. Type maps are considered in order +of appearance and the first match is used\. By default all user-defined types +are mapped to \fBvoid\fR\. See the TYPE MAP section below for more +information\. +.IP "\fB--xml-parser\fR \fIparser\fR" +Use \fIparser\fR as the underlying XML parser\. Valid values are \fBxerces\fR +for Xerces-C++ (default) and \fBexpat\fR for Expat\. +.IP "\fB--generate-validation\fR" +Generate validation code\. The validation code ("perfect parser") ensures that +instance documents conform to the schema\. Validation code is generated by +default when the selected underlying XML parser is non-validating +(\fBexpat\fR)\. +.IP "\fB--suppress-validation\fR" +Suppress the generation of validation code\. Validation is suppressed by +default when the selected underlying XML parser is validating (\fBxerces\fR)\. +.IP "\fB--generate-polymorphic\fR" +Generate polymorphism-aware code\. Specify this option if you use substitution +groups or \fBxsi:type\fR\. +.IP "\fB--generate-noop-impl\fR" +Generate a sample parser implementation that does nothing (no operation)\. The +sample implementation can then be filled with the application-specific code\. +For an input file in the form \fBname\.xsd\fR this option triggers the +generation of two additional C++ files in the form: \fBname-pimpl\.hxx\fR +(parser implementation header file) and \fBname-pimpl\.cxx\fR (parser +implementation source file)\. +.IP "\fB--generate-print-impl\fR" +Generate a sample parser implementation that prints the XML data to +STDOUT\fR\. For an input file in the form \fBname\.xsd\fR this option triggers +the generation of two additional C++ files in the form: \fBname-pimpl\.hxx\fR +(parser implementation header file) and \fBname-pimpl\.cxx\fR (parser +implementation source file)\. +.IP "\fB--generate-test-driver\fR" +Generate a test driver for the sample parser implementation\. For an input +file in the form \fBname\.xsd\fR this option triggers the generation of an +additional C++ file in the form \fBname-driver\.cxx\fR\. +.IP "\fB--force-overwrite\fR" +Force overwriting of the existing implementation and test driver files\. Use +this option only if you do not mind loosing the changes you have made in the +sample implementation or test driver files\. +.IP "\fB--root-element-first\fR" +Indicate that the first global element is the document root\. This information +is used to generate the test driver for the sample implementation\. +.IP "\fB--root-element-last\fR" +Indicate that the last global element is the document root\. This information +is used to generate the test driver for the sample implementation\. +.IP "\fB--root-element\fR \fIelement\fR" +Indicate that \fIelement\fR is the document root\. This information is used to +generate the test driver for the sample implementation\. +.IP "\fB--skel-type-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB_pskel\fR to construct +the names of the generated parser skeletons\. +.IP "\fB--skel-file-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB-pskel\fR to construct +the names of the generated parser skeleton files\. +.IP "\fB--impl-type-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB_pimpl\fR to construct +the names of the parser implementations for the built-in XML Schema types as +well as sample parser implementations\. +.IP "\fB--impl-file-suffix\fR \fIsuffix\fR" +Use the provided \fIsuffix\fR instead of the default \fB-pimpl\fR to construct +the names of the generated sample parser implementation files\. +\" +\" NAMING CONVENTION +\" + +.SH NAMING CONVENTION +The compiler can be instructed to use a particular naming convention in +the generated code. A number of widely-used conventions can be selected +using the +.B --type-naming +and +.B --function-naming +options. A custom naming convention can be achieved using the +.BR --type-regex , +.BR --accessor-regex , +.BR --one-accessor-regex , +.BR --opt-accessor-regex , +.BR --seq-accessor-regex , +.BR --modifier-regex , +.BR --one-modifier-regex , +.BR --opt-modifier-regex , +.BR --seq-modifier-regex , +.BR --parser-regex , +.BR --serializer-regex , +.BR --const-regex , +.BR --enumerator-regex , +and +.B --element-type-regex +options. + +The +.B --type-naming +option specifies the convention that should be used for naming C++ types. +Possible values for this option are +.B knr +(default), +.BR ucc , +and +.BR java . +The +.B knr +value (stands for K&R) signifies the standard, lower-case naming convention +with the underscore used as a word delimiter, for example: foo, foo_bar. +The +.B ucc +(stands for upper-camel-case) and +.B java +values a synonyms for the same naming convention where the first letter +of each word in the name is capitalized, for example: Foo, FooBar. + +Similarly, the +.B --function-naming +option specifies the convention that should be used for naming C++ functions. +Possible values for this option are +.B knr +(default), +.BR lcc , +and +.BR java . +The +.B knr +value (stands for K&R) signifies the standard, lower-case naming convention +with the underscore used as a word delimiter, for example: foo(), foo_bar(). +The +.B lcc +value (stands for lower-camel-case) signifies a naming convention where the +first letter of each word except the first is capitalized, for example: foo(), +fooBar(). The +.B ucc +value (stands for upper-camel-case) signifies a naming convention where the +first letter of each word is capitalized, for example: Foo(), FooBar(). The +.B java +naming convention is similar to the lower-camel-case one except that accessor +functions are prefixed with get, modifier functions are prefixed with set, +parsing functions are prefixed with parse, and serialization functions are +prefixed with serialize, for example: getFoo(), setFooBar(), parseRoot(), +serializeRoot(). + +Note that the naming conventions specified with the +.B --type-naming +and +.B --function-naming +options perform only limited transformations on the +names that come from the schema in the form of type, attribute, and element +names. In other words, to get consistent results, your schemas should follow +a similar naming convention as the one you would like to have in the generated +code. Alternatively, you can use the +.B --*-regex +options (discussed below) to perform further transformations on the names +that come from the schema. + +The +.BR --type-regex , +.BR --accessor-regex , +.BR --one-accessor-regex , +.BR --opt-accessor-regex , +.BR --seq-accessor-regex , +.BR --modifier-regex , +.BR --one-modifier-regex , +.BR --opt-modifier-regex , +.BR --seq-modifier-regex , +.BR --parser-regex , +.BR --serializer-regex , +.BR --const-regex , +.BR --enumerator-regex , +and +.B --element-type-regex +options allow you to specify extra regular expressions for each name +category in addition to the predefined set that is added depending on +the +.B --type-naming +and +.B --function-naming +options. Expressions that are provided with the +.B --*-regex +options are evaluated prior to any predefined expressions. This allows +you to selectively override some or all of the predefined transformations. +When debugging your own expressions, it is often useful to see which +expressions match which names. The +.B --name-regex-trace +option allows you to trace the process of applying +regular expressions to names. + +The value for the +.B --*-regex +options should be a perl-like regular expression in the form +.BI / pattern / replacement /\fR. +Any character can be used as a delimiter instead of +.BR / . +Escaping of the delimiter character in +.I pattern +or +.I replacement +is not supported. All the regular expressions for each category are pushed +into a category-specific stack with the last specified expression +considered first. The first match that succeeds is used. For the +.B --one-accessor-regex +(accessors with cardinality one), +.B --opt-accessor-regex +(accessors with cardinality optional), and +.B --seq-accessor-regex +(accessors with cardinality sequence) categories the +.B --accessor-regex +expressions are used as a fallback. For the +.BR --one-modifier-regex , +.BR --opt-modifier-regex , +and +.B --seq-modifier-regex +categories the +.B --modifier-regex +expressions are used as a fallback. For the +.B --element-type-regex +category the +.B --type-regex +expressions are used as a fallback. + +The type name expressions +.RB ( --type-regex ) +are evaluated on the name string that has the following format: + +[\fInamespace \fR]\fIname\fR[\fB,\fIname\fR][\fB,\fIname\fR][\fB,\fIname\fR] + +The element type name expressions +.RB ( --element-type-regex ), +effective only when the +.B --generate-element-type +option is specified, are evaluated on the name string that has the following +format: + +.I namespace name + +In the type name format the +.I namespace +part followed by a space is only present for global type names. For global +types and elements defined in schemas without a target namespace, the +.I namespace +part is empty but the space is still present. In the type name format after +the initial +.I name +component, up to three additional +.I name +components can be present, separated by commas. For example: + +.B http://example.com/hello type + +.B foo + +.B foo,iterator + +.B foo,const,iterator + +The following set of predefined regular expressions is used to transform +type names when the upper-camel-case naming convention is selected: + +.B /(?:[^ ]* )?([^,]+)/\\\\u$1/ + +.B /(?:[^ ]* )?([^,]+),([^,]+)/\\\\u$1\\\\u$2/ + +.B /(?:[^ ]* )?([^,]+),([^,]+),([^,]+)/\\\\u$1\\\\u$2\\\\u$3/ + +.B /(?:[^ ]* )?([^,]+),([^,]+),([^,]+),([^,]+)/\\\\u$1\\\\u$2\\\\u$3\\\\u$4/ + +The accessor and modifier expressions +.RB ( --*accessor-regex +and +.BR --*modifier-regex ) +are evaluated on the name string that has the following format: + +\fIname\fR[\fB,\fIname\fR][\fB,\fIname\fR] + +After the initial +.I name +component, up to two additional +.I name +components can be present, separated by commas. For example: + +.B foo + +.B dom,document + +.B foo,default,value + +The following set of predefined regular expressions is used to transform +accessor names when the +.B java +naming convention is selected: + +.B /([^,]+)/get\\\\u$1/ + +.B /([^,]+),([^,]+)/get\\\\u$1\\\\u$2/ + +.B /([^,]+),([^,]+),([^,]+)/get\\\\u$1\\\\u$2\\\\u$3/ + +For the parser, serializer, and enumerator categories, the corresponding +regular expressions are evaluated on local names of elements and on +enumeration values, respectively. For example, the following predefined +regular expression is used to transform parsing function names when the +.B java +naming convention is selected: + +.B /(.+)/parse\\\\u$1/ + +The const category is used to create C++ constant names for the +element/wildcard/text content ids in ordered types. + +See also the REGEX AND SHELL QUOTING section below. + +\" +\" TYPE MAP +\" +.SH TYPE MAP +Type map files are used in C++/Parser to define a mapping between XML +Schema and C++ types. The compiler uses this information to determine +the return types of +.B post_* +functions in parser skeletons corresponding to XML Schema types +as well as argument types for callbacks corresponding to elements +and attributes of these types. + +The compiler has a set of predefined mapping rules that map built-in +XML Schema types to suitable C++ types (discussed below) and all +other types to +.BR void . +By providing your own type maps you can override these predefined rules. +The format of the type map file is presented below: + +.RS +.B namespace +.I schema-namespace +[ +.I cxx-namespace +] +.br +.B { +.br + ( +.B include +.IB file-name ; +)* +.br + ([ +.B type +] +.I schema-type cxx-ret-type +[ +.I cxx-arg-type +.RB ] ; +)* +.br +.B } +.br +.RE + +Both +.I schema-namespace +and +.I schema-type +are regex patterns while +.IR cxx-namespace , +.IR cxx-ret-type , +and +.I cxx-arg-type +are regex pattern substitutions. All names can be optionally enclosed +in \fR" "\fR, for example, to include white-spaces. + +.I schema-namespace +determines XML Schema namespace. Optional +.I cxx-namespace +is prefixed to every C++ type name in this namespace declaration. +.I cxx-ret-type +is a C++ type name that is used as a return type for the +.B post_* +functions. Optional +.I cxx-arg-type +is an argument type for callback functions corresponding to elements and +attributes of this type. If +.I cxx-arg-type +is not specified, it defaults to +.I cxx-ret-type +if +.I cxx-ret-type +ends with +.B * +or +.B & +(that is, it is a pointer or a reference) and +.B const +\fIcxx-ret-type\fB&\fR otherwise. +.I file-name +is a file name either in the \fR" "\fR or < > format and is added with the +.B #include +directive to the generated code. + +The \fB#\fR character starts a comment that ends with a new line or end of +file. To specify a name that contains \fB#\fR enclose it in \fR" "\fR. For +example: + +.RS +namespace http://www.example.com/xmlns/my my +.br +{ +.br + include "my.hxx"; +.br + + # Pass apples by value. + # + apple apple; +.br + + # Pass oranges as pointers. + # + orange orange_t*; +.br +} +.br +.RE + +In the example above, for the +.B http://www.example.com/xmlns/my#orange +XML Schema type, the +.B my::orange_t* +C++ type will be used as both return and argument types. + +Several namespace declarations can be specified in a single file. +The namespace declaration can also be completely omitted to map +types in a schema without a namespace. For instance: + +.RS +include "my.hxx"; +.br +apple apple; +.br + +namespace http://www.example.com/xmlns/my +.br +{ +.br + orange "const orange_t*"; +.br +} +.br +.RE + + +The compiler has a number of predefined mapping rules that can be +presented as the following map files. The string-based XML Schema +built-in types are mapped to either +.B std::string +or +.B std::wstring +depending on the character type selected with the +.B --char-type +option +.RB ( char +by default). + +.RS +namespace http://www.w3.org/2001/XMLSchema +.br +{ +.br + boolean bool bool; +.br + + byte "signed char" "signed char"; +.br + unsignedByte "unsigned char" "unsigned char"; +.br + + short short short; +.br + unsignedShort "unsigned short" "unsigned short"; +.br + + int int int; +.br + unsignedInt "unsigned int" "unsigned int"; +.br + + long "long long" "long long"; +.br + unsignedLong "unsigned long long" "unsigned long long"; +.br + + integer "long long" "long long"; +.br + + negativeInteger "long long" "long long"; +.br + nonPositiveInteger "long long" "long long"; +.br + + positiveInteger "unsigned long long" "unsigned long long"; +.br + nonNegativeInteger "unsigned long long" "unsigned long long"; +.br + + float float float; +.br + double double double; +.br + decimal double double; +.br + + string std::string; +.br + normalizedString std::string; +.br + token std::string; +.br + Name std::string; +.br + NMTOKEN std::string; +.br + NCName std::string; +.br + ID std::string; +.br + IDREF std::string; +.br + language std::string; +.br + anyURI std::string; +.br + + NMTOKENS xml_schema::string_sequence; +.br + IDREFS xml_schema::string_sequence; +.br + + QName xml_schema::qname; +.br + + base64Binary std::auto_ptr +.br + std::auto_ptr; +.br + hexBinary std::auto_ptr +.br + std::auto_ptr; +.br + + date xml_schema::date; +.br + dateTime xml_schema::date_time; +.br + duration xml_schema::duration; +.br + gDay xml_schema::gday; +.br + gMonth xml_schema::gmonth; +.br + gMonthDay xml_schema::gmonth_day; +.br + gYear xml_schema::gyear; +.br + gYearMonth xml_schema::gyear_month; +.br + time xml_schema::time; +.br +} +.br +.RE + + +The last predefined rule maps anything that wasn't mapped by previous +rules to +.BR void : + +.RS +namespace .* +.br +{ +.br + .* void void; +.br +} +.br +.RE + +When you provide your own type maps with the +.B --type-map +option, they are evaluated first. This allows you to selectively override +predefined rules. + +.\" +.\" REGEX AND SHELL QUOTING +.\" +.SH REGEX AND SHELL QUOTING +When entering a regular expression argument in the shell command line +it is often necessary to use quoting (enclosing the argument in " " +or ' ') in order to prevent the shell from interpreting certain +characters, for example, spaces as argument separators and $ as +variable expansions. + +Unfortunately it is hard to achieve this in a manner that is portable +across POSIX shells, such as those found on GNU/Linux and UNIX, and +Windows shell. For example, if you use " " for quoting you will get +a wrong result with POSIX shells if your expression contains $. The +standard way of dealing with this on POSIX systems is to use ' ' +instead. Unfortunately, Windows shell does not remove ' ' from +arguments when they are passed to applications. As a result you may +have to use ' ' for POSIX and " " for Windows ($ is not treated as +a special character on Windows). + +Alternatively, you can save regular expression options into a file, +one option per line, and use this file with the +.B --options-file +option. With this approach you don't need to worry about shell quoting. + +.\" +.\" DIAGNOSTICS +.\" +.SH DIAGNOSTICS +If the input file is not a valid W3C XML Schema definition, +.B xsd +will issue diagnostic messages to +.B STDERR +and exit with non-zero exit code. +.SH BUGS +Send bug reports to the xsd-users@codesynthesis.com mailing list. +.SH COPYRIGHT +Copyright (c) 2005-2022 Code Synthesis Tools CC. + +Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, +version 1.2; with no Invariant Sections, no Front-Cover Texts and +no Back-Cover Texts. Copy of the license can be obtained from +https://www.codesynthesis.com/licenses/fdl-1.2.txt diff --git a/xsd/doc/pregenerated/xsd.xhtml b/xsd/doc/pregenerated/xsd.xhtml new file mode 100644 index 0000000..4737ab6 --- /dev/null +++ b/xsd/doc/pregenerated/xsd.xhtml @@ -0,0 +1,1600 @@ + + + + + + XSD 4.2.0-b.4 Compiler Command Line Manual + + + + + + + + + + + + +
+
+ +

NAME

+ +

xsd - W3C XML Schema to C++ Compiler

+ +

SYNOPSIS

+ +
+
xsd command [options] file [file ...]
+
xsd help [command]
+
xsd version
+
+ +

DESCRIPTION

+ +

xsd generates vocabulary-specific, statically-typed + C++ mapping from W3C XML Schema definitions. Particular mapping to + produce is selected by a command. Each mapping has + a number of mapping-specific options that should + appear, if any, after the command. Input files should + be W3C XML Schema definitions. The exact set of the generated files depends + on the selected mapping and options.

+ +

COMMANDS

+ +
+
cxx-tree
+
Generate the C++/Tree mapping. For each input file in the form + name.xsd the following C++ files are generated: + name.hxx (header file), + name.ixx (inline file, generated only if the + --generate-inline option is specified), + name.cxx (source file), and + name-fwd.hxx (forward declaration file, generated + only if the --generate-forward option is + specified).
+ +
cxx-parser
+
Generate the C++/Parser mapping. For each input file in the form + name.xsd the following C++ files are generated: + name-pskel.hxx (parser skeleton header file), + name-pskel.ixx (parser skeleton inline file, + generated only if the --generate-inline + option is specified), and + name-pskel.cxx (parser skeleton source file). + If the --generate-noop-impl or + --generate-print-impl option is specified, + the following additional sample implementation files are generated: + name-pimpl.hxx (parser implementation header + file) and + name-pimpl.cxx (parser implementation source + file). If the --generate-test-driver option + is specified, the additional name-driver.cxx + test driver file is generated.
+ +
help
+
Print usage information and exit. Use +

xsd help command

+ for command-specific help. +
+ +
version
+
Print version and exit.
+
+ +

OPTIONS

+ +

Command-specific options, if any, should appear + after the corresponding command.

+ +

COMMON OPTIONS

+
+
--std version
+
Specify the C++ standard that the generated code should conform to. + Valid values are c++98 (default) and + c++11. + +

The C++ standard affects various aspects of the generated code that are + discussed in more detail in various mapping-specific documentation. + Overall, when C++11 is selected, the generated code relies on the move + semantics and uses std::unique_ptr instead of + deprecated std::auto_ptr.

+ +

When the C++11 mode is selected, you normally don't need to perform any + extra steps other than enable C++11 in your C++ compiler, if required. The + XSD compiler will automatically add the necessary macro defines to the + generated header files that will switch the header-only XSD runtime + library (libxsd) to the C++11 mode. However, if you + include any of the XSD runtime headers directly in your application + (normally you just include the generated headers), then you will need to + define the XSD_CXX11 macro for your entire + project.

+ +
--char-type type
+
Generate code using the provided character type + instead of the default char. Valid values are + char and wchar_t.
+ +
--char-encoding enc
+
Specify the character encoding that should be used in the generated + code. Valid values for the char character type are + utf8 (default), iso8859-1, + lcp (Xerces-C++ local code page), and + custom. If you pass custom as the + value then you will need to include the transcoder implementation header + for your encoding at the beginning of the generated header files (see the + --hxx-prologue option). + +

For the wchar_t character type the only valid value + is auto and the encoding is automatically selected + between UTF-16 and UTF-32/UCS-4, depending on the + wchar_t type size.

+ +
--output-dir dir
+
Write generated files to dir instead of the + current directory.
+ +
--generate-inline
+
Generate simple functions inline. This option triggers creation of the + inline file.
+ +
--generate-xml-schema
+
Generate a C++ header file as if the schema being compiled defines the + XML Schema namespace. For the C++/Tree mapping, the resulting file will + contain definitions for all XML Schema built-in types. For the C++/Parser + mapping, the resulting file will contain definitions for all the parser + skeletons and implementations corresponding to the XML Schema built-in + types. + +

The schema file provided to the compiler need not exist and is only + used to derive the name of the resulting header file. Use the + --extern-xml-schema option to include this file in the + generated files for other schemas.

+ +
--extern-xml-schema file
+
Include a header file derived from file instead of + generating the XML Schema namespace mapping inline. The provided file need + not exist and is only used to derive the name of the included header file. + Use the --generate-xml-schema option to generate this + header file.
+ +
--namespace-map xns=cns
+
Map XML Schema namespace xns to C++ namespace + cns. Repeat this option to specify mapping for more + than one XML Schema namespace. For example, the following option: + +

--namespace-map + http://example.com/foo/bar=foo::bar

+ +

Will map the http://example.com/foo/bar XML Schema + namespace to the foo::bar C++ namespace.

+ +
--namespace-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema namespace names to C++ namespace names. + regex is a Perl-like regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. + +

All the regular expressions are pushed into a stack with the last + specified expression considered first. The first match that succeeds is + used. Regular expressions are applied to a string in the form

+ +

filename namespace

+ +

For example, if you have file hello.xsd with + namespace http://example.com/hello and you run + xsd on this file, then the string in question will + be:

+ +

hello.xsd. + http://example.com/hello

+ +

For the built-in XML Schema namespace the string is:

+ +

XMLSchema.xsd + http://www.w3.org/2001/XMLSchema

+ +

The following three steps are performed for each regular expression + until the match is found:

+ +

1. The expression is applied and if the result is empty the next + expression is considered.

+ +

2. All '/' are replaced with + '::'.

+ +

3. The result is verified to be a valid C++ scope name (e.g., + foo::bar). If this test succeeds, the result is used + as a C++ namespace name.

+ +

As an example, the following expression maps XML Schema namespaces in + the form http://example.com/foo/bar to C++ namespaces + in the form foo::bar:

+ +

%.* http://example.com/(.+)%$1%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--namespace-regex-trace
+
Trace the process of applying regular expressions specified with the + --namespace-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--reserved-name n[=r]
+
Add name n to the list of names that should not be + used as identifiers. The name can optionally be followed by + = and the replacement name r that + should be used instead. All the C++ keywords are already in this + list.
+ +
--include-with-brackets
+
Use angle brackets (<>) instead of quotes ("") in generated + #include directives.
+ +
--include-prefix prefix
+
Add prefix to generated + #include directive paths. + +

For example, if you had the following import element in your schema

+ +

<import namespace="..." + schemaLocation="base.xsd"/>

+ +

and compiled this fragment with --include-prefix + schemas/, then the include directive in the generated code + would be:

+ +

#include "schemas/base.hxx"

+ +
--include-regex regex
+
Add regex to the list of regular expressions used + to transform #include directive paths. + regex is a Perl-like regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. + +

All the regular expressions are pushed into a stack with the last + specified expression considered first. The first match that succeeds is + used.

+ +

As an example, the following expression transforms paths in the form + schemas/foo/bar to paths in the form + generated/foo/bar:

+ +

%schemas/(.+)%generated/$1%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--include-regex-trace
+
Trace the process of applying regular expressions specified with the + --include-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--guard-prefix prefix
+
Add prefix to generated header inclusion guards. + The prefix is transformed to upper case and characters that are illegal in + a preprocessor macro name are replaced with underscores. If this option is + not specified then the directory part of the input schema file is used as + a prefix.
+ +
--hxx-suffix suffix
+
Use the provided suffix instead of the default + .hxx to construct the name of the header file. Note + that this suffix is also used to construct names of header files + corresponding to included/imported schemas.
+ +
--ixx-suffix suffix
+
Use the provided suffix instead of the default + .ixx to construct the name of the inline file.
+ +
--cxx-suffix suffix
+
Use the provided suffix instead of the default + .cxx to construct the name of the source file.
+ +
--fwd-suffix suffix
+
Use the provided suffix instead of the default + -fwd.hxx to construct the name of the forward + declaration file.
+ +
--hxx-regex regex
+
Use the provided expression to construct the name of the header file. + regex is a Perl-like regular expression in the form + /pattern/replacement/. + Note that this expression is also used to construct names of header files + corresponding to included/imported schemas. See also the REGEX AND SHELL + QUOTING section below.
+ +
--ixx-regex regex
+
Use the provided expression to construct the name of the inline file. + regex is a Perl-like regular expression in the form + /pattern/replacement/. See + also the REGEX AND SHELL QUOTING section below.
+ +
--cxx-regex regex
+
Use the provided expression to construct the name of the source file. + regex is a Perl-like regular expression in the form + /pattern/replacement/. See + also the REGEX AND SHELL QUOTING section below.
+ +
--fwd-regex regex
+
Use the provided expression to construct the name of the forward + declaration file. regex is a Perl-like regular + expression in the form + /pattern/replacement/. See + also the REGEX AND SHELL QUOTING section below.
+ +
--hxx-prologue text
+
Insert text at the beginning of the header + file.
+ +
--ixx-prologue text
+
Insert text at the beginning of the inline + file.
+ +
--cxx-prologue text
+
Insert text at the beginning of the source + file.
+ +
--fwd-prologue text
+
Insert text at the beginning of the forward + declaration file.
+ +
--prologue text
+
Insert text at the beginning of each generated + file for which there is no file-specific prologue.
+ +
--hxx-epilogue text
+
Insert text at the end of the header file.
+ +
--ixx-epilogue text
+
Insert text at the end of the inline file.
+ +
--cxx-epilogue text
+
Insert text at the end of the source file.
+ +
--fwd-epilogue text
+
Insert text at the end of the forward declaration + file.
+ +
--epilogue text
+
Insert text at the end of each generated file for + which there is no file-specific epilogue.
+ +
--hxx-prologue-file file
+
Insert the content of the file at the beginning of + the header file.
+ +
--ixx-prologue-file file
+
Insert the content of the file at the beginning of + the inline file.
+ +
--cxx-prologue-file file
+
Insert the content of the file at the beginning of + the source file.
+ +
--fwd-prologue-file file
+
Insert the content of the file at the beginning of + the forward declaration file.
+ +
--prologue-file file
+
Insert the content of the file at the beginning of + each generated file for which there is no file-specific prologue + file.
+ +
--hxx-epilogue-file file
+
Insert the content of the file at the end of the + header file.
+ +
--ixx-epilogue-file file
+
Insert the content of the file at the end of the + inline file.
+ +
--cxx-epilogue-file file
+
Insert the content of the file at the end of the + source file.
+ +
--fwd-epilogue-file file
+
Insert the content of the file at the end of the + forward declaration file.
+ +
--epilogue-file file
+
Insert the content of the file at the end of each + generated file for which there is no file-specific epilogue file.
+ +
--export-symbol symbol
+
Insert symbol in places where DLL export/import + control statements (__declspec(dllexport/dllimport)) + are necessary.
+ +
--export-xml-schema
+
Export/import types in the XML Schema namespace using the export + symbol provided with the --export-symbol option. The + XSD_NO_EXPORT macro can be used to omit this code + during C++ compilation, which may be useful if you would like to use the + same generated code across multiple platforms.
+ +
--export-maps
+
Export polymorphism support maps from a Win32 DLL into which this + generated code is placed. This is necessary when your type hierarchy is + split across several DLLs since otherwise each DLL will have its own set + of maps. In this situation the generated code for the DLL which contains + base types and/or substitution group heads should be compiled with this + option and the generated code for all other DLLs should be compiled with + --import-maps. This option is only valid together with + --generate-polymorphic. The + XSD_NO_EXPORT macro can be used to omit this code + during C++ compilation, which may be useful if you would like to use the + same generated code across multiple platforms.
+ +
--import-maps
+
Import polymorphism support maps to a Win32 DLL or executable into + which this generated code is linked. See the + --export-maps option documentation for details. This + options is only valid together with + --generate-polymorphic. The + XSD_NO_EXPORT macro can be used to omit this code + during C++ compilation, which may be useful if you would like to use the + same generated code across multiple platforms.
+ +
--generate-dep
+
Generate make dependency information. This option + triggers the creation of the .d file containing the + dependencies of the generated files on the main schema file as well as all + the schema files that it includes/imports, transitively. This dependency + file is then normally included into the main makefile + to implement automatic dependency tracking. + +

Note also that automatic dependency generation is not supported in the + file-per-type mode (--file-per-type). In this case, + all the generated files are produced with a single compiler invocation and + depend on all the schemas. As a result, it is easier to establish such a + dependency manually, perhaps with the help of the + --file-list* options.

+ +
--generate-dep-only
+
Generate make dependency information only.
+ +
--dep-phony
+
Generate phony targets for included/imported schema files, causing + each to depend on nothing. Such dummy rules work around + make errors caused by the removal of schema files + without also updating the dependency file to match.
+ +
--dep-target target
+
Change the target of the dependency rule. By default it contains all + the generated C++ files as well as the dependency file itself, without any + directory prefixes. If you require multiple targets, then you can specify + them as a single, space-separated argument or you can repeat this option + multiple times.
+ +
--dep-suffix suffix
+
Use the provided suffix instead of the default + .d to construct the name of the dependency file.
+ +
--dep-regex regex
+
Use the provided expression to construct the name of the dependency + file. regex is a Perl-like regular expression in the + form + /pattern/replacement/. See + also the REGEX AND SHELL QUOTING section below.
+ +
--disable-warning warn
+
Disable printing warning with id warn. If + all is specified for the warning id then all warnings + are disabled.
+ +
--options-file file
+
Read additional options from file. Each option + should appearing on a separate line optionally followed by space and an + option value. Empty lines and lines starting with # + are ignored. Option values can be enclosed in double + (") or single (') quotes to + preserve leading and trailing whitespaces as well as to specify empty + values. If the value itself contains trailing or leading quotes, enclose + it with an extra pair of quotes, for example '"x"'. + Non-leading and non-trailing quotes are interpreted as being part of the + option value. + +

The semantics of providing options in a file is equivalent to providing + the same set of options in the same order on the command line at the point + where the --options-file option is specified except + that the shell escaping and quoting is not required. You can repeat this + option to specify more than one options file.

+ +
--show-sloc
+
Show the number of generated physical source lines of code + (SLOC).
+ +
--sloc-limit num
+
Check that the number of generated physical source lines of code + (SLOC) does not exceed num.
+ +
--proprietary-license
+
Indicate that the generated code is licensed under a proprietary + license instead of the GPL.
+ +
--custom-literals file
+
Load custom XML string to C++ literal mappings from + file. This mechanism can be useful if you are using a + custom character encoding and some of the strings in your schemas, for + example element/attribute names or enumeration values, contain non-ASCII + characters. In this case you will need to provide a custom mapping to C++ + literals for such strings. The format of this file is specified in the + custom-literals.xsd XML Schema file that can be found + in the documentation directory.
+ +
--preserve-anonymous
+
Preserve anonymous types. By default anonymous types are automatically + named with names derived from the enclosing elements/attributes. Because + mappings implemented by this compiler require all types to be named, this + option is only useful if you want to make sure your schemas don't have + anonymous types.
+ +
--show-anonymous
+
Show elements and attributes that are of anonymous types. This option + only makes sense together with the + --preserve-anonymous option.
+ +
--anonymous-regex regex
+
Add regex to the list of regular expressions used + to derive names for anonymous types from the enclosing + attributes/elements. regex is a Perl-like regular + expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. + +

All the regular expressions are pushed into a stack with the last + specified expression considered first. The first match that succeeds is + used. Regular expressions are applied to a string in the form

+ +

filename namespace + xpath

+ +

For instance:

+ +

hello.xsd http://example.com/hello + element

+ +

hello.xsd http://example.com/hello + type/element

+ +

As an example, the following expression makes all the derived names + start with capital letters. This could be useful when your naming + convention requires type names to start with capital letters:

+ +

%.* .* (.+/)*(.+)%\u$2%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--anonymous-regex-trace
+
Trace the process of applying regular expressions specified with the + --anonymous-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--location-map ol=nl
+
Map the original schema location ol that is + specified in the XML Schema include or import elements to new schema + location nl. Repeat this option to map more than one + schema location. For example, the following option maps the + http://example.com/foo.xsd URL to the + foo.xsd local file. + +

--location-map + http://example.com/foo.xsd=foo.xsd

+ +
--location-regex regex
+
Add regex to the list of regular expressions used + to map schema locations that are specified in the XML Schema include or + import elements. regex is a Perl-like regular + expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. All the regular + expressions are pushed into a stack with the last specified expression + considered first. The first match that succeeds is used. + +

For example, the following expression maps URL locations in the form + http://example.com/foo/bar.xsd to local files in the + form bar.xsd:

+ +

%http://.+/(.+)%$1%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--location-regex-trace
+
Trace the process of applying regular expressions specified with the + --location-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--file-per-type
+
Generate a separate set of C++ files for each type defined in XML + Schema. Note that in this mode you only need to compile the root schema(s) + and the code will be generated for all included and imported schemas. This + compilation mode is primarily useful when some of your schemas cannot be + compiled separately or have cyclic dependencies which involve type + inheritance. Other options related to this mode are: + --type-file-regex, + --schema-file-regex, + --fat-type-file, and + --file-list.
+ +
--type-file-regex regex
+
Add regex to the list of regular expressions used + to translate type names to file names when the + --file-per-type option is specified. + regex is a Perl-like regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. All the regular + expressions are pushed into a stack with the last specified expression + considered first. The first match that succeeds is used. Regular + expressions are applied to a string in the form + +

namespace type-name

+ +

For example, the following expression maps type foo + that is defined in the http://example.com/bar + namespace to file name bar-foo:

+ +

%http://example.com/(.+) + (.+)%$1-$2%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--type-file-regex-trace
+
Trace the process of applying regular expressions specified with the + --type-file-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--schema-file-regex regex
+
Add regex to the list of regular expressions used + to translate schema file names when the + --file-per-type option is specified. + regex is a Perl-like regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/'. + Escaping of the delimiter character in pattern or + replacement is not supported. All the regular + expressions are pushed into a stack with the last specified expression + considered first. The first match that succeeds is used. Regular + Expressions are applied to the absolute filesystem path of a schema file + and the result, including the directory part, if any, is used to derive + the #include directive paths as well as the generated + C++ file paths. This option, along with + --type-file-regex are primarily useful to place the + generated files into subdirectories or to resolve file name conflicts. + +

For example, the following expression maps schema files in the + foo/1.0.0/ subdirectory to the files in the + foo/ subdirectory. As a result, the + #include directive paths for such schemas will be in + the foo/schema.hxx form and the generated C++ files + will be placed into the foo/ subdirectory:

+ +

%.*/foo/1.0.0/(.+)%foo/$1%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--schema-file-regex-trace
+
Trace the process of applying regular expressions specified with the + --schema-file-regex option. Use this option to find + out why your regular expressions don't do what you expected them to + do.
+ +
--fat-type-file
+
Generate code corresponding to global elements into type files instead + of schema files when the --type-file-regex option is + specified. This option is primarily useful when trying to minimize the + amount of object code that is linked to an executable by packaging + compiled generated code into a static (archive) library.
+ +
--file-list file
+
Write a list of generated C++ files to file. This + option is primarily useful in the file-per-type compilation mode + (--file-per-type) to create a list of generated C++ + files, for example, as a makefile fragment.
+ +
--file-list-prologue text
+
Insert text at the beginning of the file list. As + a convenience, all occurrences of the \n character + sequence in text are replaced with new lines. This + option can, for example, be used to assign the generated file list to a + makefile variable.
+ +
--file-list-epilogue text
+
Insert text at the end of the file list. As a + convenience, all occurrences of the \n character + sequence in text are replaced with new lines.
+ +
--file-list-delim text
+
Delimit file names written to the file list with + text instead of new lines. As a convenience, all + occurrences of the \n character sequence in + text are replaced with new lines.
+
+ +

CXX-TREE COMMAND OPTIONS

+
+
--generate-polymorphic
+
Generate polymorphism-aware code. Specify this option if you use + substitution groups or xsi:type. Use the + --polymorphic-type or + --polymorphic-type-all option to specify which type + hierarchies are polymorphic.
+ +
--polymorphic-type type
+
Indicate that type is a root of a polymorphic type + hierarchy. The compiler can often automatically determine which types are + polymorphic based on the substitution group declarations. However, you may + need to use this option if you are not using substitution groups or if + substitution groups are defined in another schema. You need to specify + this option when compiling every schema file that references + type. The type argument is an XML + Schema type name that can be optionally qualified with a namespace in the + namespace#name form.
+ +
--polymorphic-type-all
+
Indicate that all types should be treated as polymorphic.
+ +
--polymorphic-plate num
+
Specify the polymorphic map plate the generated code should register + on. This functionality is primarily useful to segregate multiple schemas + that define the same polymorphic types.
+ +
--ordered-type type
+
Indicate that element order in type is + significant. An example would be a complex type with unbounded choice as a + content model where the element order in XML has application-specific + semantics. For ordered types the compiler generates a special container + data member and a corresponding set of accessors and modifiers that are + used to capture the order of elements and, for mixed content, of text. + +

The type argument is an XML Schema type name that + can be optionally qualified with a namespace in the + namespace#name form. Note also that you + will need to specify this option when compiling every schema file that has + other ordered types derived from this type.

+ +
--ordered-type-derived
+
Automatically treat types derived from ordered bases as also ordered. + This is primarily useful if you would like to be able to iterate over the + complete content using the content order container.
+ +
--ordered-type-mixed
+
Automatically treat complex types with mixed content as ordered.
+ +
--ordered-type-all
+
Indicate that element order in all types is significant.
+ +
--order-container type
+
Specify a custom class template that should be used as a container for + the content order in ordered types instead of the default + std::vector. See --ordered-type + for more information on ordered type. This option is primarily useful if + you need to perform more complex lookups in the content order container, + for example by element id. In this case, a container like Boost + multi-index may be more convenient. Note that if using a custom container, + you will also most likely need to include the relevant headers using the + --hxx-prologue* options.
+ +
--generate-serialization
+
Generate serialization functions. Serialization functions convert the + object model back to XML.
+ +
--generate-ostream
+
Generate ostream insertion operators + (operator<<) for generated types. This allows + one to easily print a fragment or the whole object model for debugging or + logging.
+ +
--generate-doxygen
+
Generate documentation comments suitable for extraction by the Doxygen + documentation system. Documentation from annotations is added to the + comments if present in the schema.
+ +
--generate-comparison
+
Generate comparison operators (operator== and + operator!=) for complex types. Comparison is performed + member-wise.
+ +
--generate-default-ctor
+
Generate default constructors even for types that have required + members. Required members of an instance constructed using such a + constructor are not initialized and accessing them results in undefined + behavior.
+ +
--generate-from-base-ctor
+
Generate constructors that expect an instance of a base type followed + by all required members.
+ +
--suppress-assignment
+
Suppress the generation of copy assignment operators for complex + types. If this option is specified, the copy assignment operators for such + types are declared private and left unimplemented.
+ +
--generate-detach
+
Generate detach functions for required elements and attributes. Detach + functions for optional and sequence cardinalities are provided by the + respective containers. These functions, for example, allow you to move + sub-trees in the object model either within the same tree or between + different trees.
+ +
--generate-wildcard
+
Generate accessors and modifiers as well as parsing and serialization + code for XML Schema wildcards (any and + anyAttribute). XML content matched by wildcards is + presented as DOM fragments. Note that you need to initialize the + Xerces-C++ runtime if you are using this option.
+ +
--generate-any-type
+
Extract and store content of the XML Schema + anyType type as a DOM fragment. Note that you need to + initialize the Xerces-C++ runtime if you are using this option.
+ +
--generate-insertion os
+
Generate data representation stream insertion operators for the + os output stream type. Repeat this option to specify + more than one stream type. The ACE CDR stream + (ACE_OutputCDR) and RPC XDR are recognized by the + compiler and the necessary #include directives are + automatically generated. For custom stream types use the + --hxx-prologue* options to provide the necessary + declarations.
+ +
--generate-extraction is
+
Generate data representation stream extraction constructors for the + is input stream type. Repeat this option to specify + more than one stream type. The ACE CDR stream + (ACE_InputCDR) and RPC XDR are recognized by the + compiler and the necessary #include directives are + automatically generated. For custom stream types use the + --hxx-prologue* options to provide the necessary + declarations.
+ +
--generate-forward
+
Generate a separate header file with forward declarations for the + types being generated.
+ +
--suppress-parsing
+
Suppress the generation of the parsing functions and constructors. Use + this option to reduce the generated code size when parsing from XML is not + needed.
+ +
--generate-element-type
+
Generate types instead of parsing and serialization functions for root + elements. This is primarily useful to distinguish object models with the + same root type but with different root elements.
+ +
--generate-element-map
+
Generate a root element map that allows uniform parsing and + serialization of multiple root elements. This option is only valid + together with --generate-element-type.
+ +
--generate-intellisense
+
Generate workarounds for IntelliSense bugs in Visual Studio 2005 + (8.0). When this option is used, the resulting code is slightly more + verbose. IntelliSense in Visual Studio 2008 (9.0) and later does not + require these workarounds. Support for IntelliSense in Visual Studio 2003 + (7.1) is improved with this option but is still incomplete.
+ +
--omit-default-attributes
+
Omit attributes with default and fixed values from serialized XML + documents.
+ +
--type-naming style
+
Specify the type naming convention that should be used in the + generated code. Valid styles are knr (default), + ucc, and java. See the NAMING + CONVENTION section below for more information.
+ +
--function-naming style
+
Specify the function naming convention that should be used in the + generated code. Valid styles are knr (default), + lcc, ucc, and + java. See the NAMING CONVENTION section below for more + information.
+ +
--type-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema type names to C++ type names. See the NAMING + CONVENTION section below for more information.
+ +
--accessor-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes to C++ accessor + function names. See the NAMING CONVENTION section below for more + information.
+ +
--one-accessor-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality one + to C++ accessor function names. See the NAMING CONVENTION section below + for more information.
+ +
--opt-accessor-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality + optional to C++ accessor function names. See the NAMING CONVENTION section + below for more information.
+ +
--seq-accessor-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality + sequence to C++ accessor function names. See the NAMING CONVENTION section + below for more information.
+ +
--modifier-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes to C++ modifier + function names. See the NAMING CONVENTION section below for more + information.
+ +
--one-modifier-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality one + to C++ modifier function names. See the NAMING CONVENTION section below + for more information.
+ +
--opt-modifier-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality + optional to C++ modifier function names. See the NAMING CONVENTION section + below for more information.
+ +
--seq-modifier-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema names of elements/attributes with cardinality + sequence to C++ modifier function names. See the NAMING CONVENTION section + below for more information.
+ +
--parser-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema element names to C++ parsing function names. See + the NAMING CONVENTION section below for more information.
+ +
--serializer-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema element names to C++ serialization function names. + See the NAMING CONVENTION section below for more information.
+ +
--const-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema-derived names to C++ constant names. See the + NAMING CONVENTION section below for more information.
+ +
--enumerator-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema enumeration values to C++ enumerator names. See + the NAMING CONVENTION section below for more information.
+ +
--element-type-regex regex
+
Add regex to the list of regular expressions used + to translate XML Schema element names to C++ element type names. See the + NAMING CONVENTION section below for more information.
+ +
--name-regex-trace
+
Trace the process of applying regular expressions specified with the + name transformation options. Use this option to find out why your regular + expressions don't do what you expected them to do.
+ +
--root-element-first
+
Treat only the first global element as a document root. By default all + global elements are considered document roots.
+ +
--root-element-last
+
Treat only the last global element as a document root. By default all + global elements are considered document roots.
+ +
--root-element-all
+
Treat all global elements as document roots. This is the default + behavior. By explicitly specifying this option you can suppress the + warning that is issued if more than one global element is defined.
+ +
--root-element-none
+
Do not treat any global elements as document roots. By default all + global elements are considered document roots.
+ +
--root-element element
+
Treat only element as a document root. Repeat this + option to specify more than one root element.
+ +
--custom-type map
+
Use a custom C++ type instead of the generated class. The + map argument is in the form + name[=type[/base]], where + name is a type name as defined in XML Schema and type is a + C++ type name that should be used instead. If type is not present + or empty then the custom type is assumed to have the same name and be + defined in the same namespace as the generated class would have. If + base is specified then the generated class is still generated but + with that name.
+ +
--custom-type-regex regex
+
Use custom C++ types instead of the generated classes. The + regex argument is in the form + /name-pat/[type-sub/[base-sub/]], + where name-pat is a regex pattern that will be matched against type + names as defined in XML Schema and type-sub is a C++ type name + substitution that should be used instead. If type-sub is not + present or its substitution results in an empty string then the custom + type is assumed to have the same name and be defined in the same namespace + as the generated class would have. If base-sub is present and its + substitution results in a non-empty string then the generated class is + still generated but with the result of this substitution as its name. The + pattern and substitutions are in the Perl regular expression format. See + also the REGEX AND SHELL QUOTING section below.
+ +
--parts num
+
Split generated source code into num parts. This + is useful when translating large, monolithic schemas and a C++ compiler is + not able to compile the resulting source code at once (usually due to + insufficient memory).
+ +
--parts-suffix suffix
+
Use suffix instead of the default + '-' to separate the file name from the part + number.
+
+ +

CXX-PARSER COMMAND OPTIONS

+
+
--type-map mapfile
+
Read XML Schema to C++ type mapping information from + mapfile. Repeat this option to specify several type + maps. Type maps are considered in order of appearance and the first match + is used. By default all user-defined types are mapped to + void. See the TYPE MAP section below for more + information.
+ +
--xml-parser parser
+
Use parser as the underlying XML parser. Valid + values are xerces for Xerces-C++ (default) and + expat for Expat.
+ +
--generate-validation
+
Generate validation code. The validation code ("perfect parser") + ensures that instance documents conform to the schema. Validation code is + generated by default when the selected underlying XML parser is + non-validating (expat).
+ +
--suppress-validation
+
Suppress the generation of validation code. Validation is suppressed + by default when the selected underlying XML parser is validating + (xerces).
+ +
--generate-polymorphic
+
Generate polymorphism-aware code. Specify this option if you use + substitution groups or xsi:type.
+ +
--generate-noop-impl
+
Generate a sample parser implementation that does nothing (no + operation). The sample implementation can then be filled with the + application-specific code. For an input file in the form + name.xsd this option triggers the generation of two + additional C++ files in the form: name-pimpl.hxx + (parser implementation header file) and name-pimpl.cxx + (parser implementation source file).
+ +
--generate-print-impl
+
Generate a sample parser implementation that prints the XML data to + STDOUT. For an input file in the form + name.xsd this option triggers the generation of two + additional C++ files in the form: name-pimpl.hxx + (parser implementation header file) and name-pimpl.cxx + (parser implementation source file).
+ +
--generate-test-driver
+
Generate a test driver for the sample parser implementation. For an + input file in the form name.xsd this option triggers + the generation of an additional C++ file in the form + name-driver.cxx.
+ +
--force-overwrite
+
Force overwriting of the existing implementation and test driver + files. Use this option only if you do not mind loosing the changes you + have made in the sample implementation or test driver files.
+ +
--root-element-first
+
Indicate that the first global element is the document root. This + information is used to generate the test driver for the sample + implementation.
+ +
--root-element-last
+
Indicate that the last global element is the document root. This + information is used to generate the test driver for the sample + implementation.
+ +
--root-element element
+
Indicate that element is the document root. This + information is used to generate the test driver for the sample + implementation.
+ +
--skel-type-suffix suffix
+
Use the provided suffix instead of the default + _pskel to construct the names of the generated parser + skeletons.
+ +
--skel-file-suffix suffix
+
Use the provided suffix instead of the default + -pskel to construct the names of the generated parser + skeleton files.
+ +
--impl-type-suffix suffix
+
Use the provided suffix instead of the default + _pimpl to construct the names of the parser + implementations for the built-in XML Schema types as well as sample parser + implementations.
+ +
--impl-file-suffix suffix
+
Use the provided suffix instead of the default + -pimpl to construct the names of the generated sample + parser implementation files.
+
+ +

NAMING CONVENTION

+ +

The compiler can be instructed to use a particular naming + convention in the generated code. A number of widely-used + conventions can be selected using the --type-naming + and --function-naming options. A custom + naming convention can be achieved using the + --type-regex, + --accessor-regex, + --one-accessor-regex, + --opt-accessor-regex, + --seq-accessor-regex, + --modifier-regex, + --one-modifier-regex, + --opt-modifier-regex, + --seq-modifier-regex, + --parser-regex, + --serializer-regex, + --const-regex, + --enumerator-regex, and + --element-type-regex options. +

+ +

The --type-naming option specifies the + convention that should be used for naming C++ types. Possible + values for this option are knr (default), + ucc, and java. The + knr value (stands for K&R) signifies + the standard, lower-case naming convention with the underscore + used as a word delimiter, for example: foo, + foo_bar. The ucc (stands + for upper-camel-case) and + java values a synonyms for the same + naming convention where the first letter of each word in the + name is capitalized, for example: Foo, + FooBar.

+ +

Similarly, the --function-naming option + specifies the convention that should be used for naming C++ + functions. Possible values for this option are knr + (default), lcc, ucc, and + java. The knr value (stands + for K&R) signifies the standard, lower-case naming convention + with the underscore used as a word delimiter, for example: + foo(), foo_bar(). The lcc + value (stands for lower-camel-case) signifies a naming convention + where the first letter of each word except the first is capitalized, + for example: foo(), fooBar(). The + ucc value (stands for upper-camel-case) signifies + a naming convention where the first letter of each word is capitalized, + for example: Foo(), FooBar(). + The java naming convention is similar to + the lower-camel-case one except that accessor functions are prefixed + with get, modifier functions are prefixed + with set, parsing functions are prefixed + with parse, and serialization functions are + prefixed with serialize, for example: + getFoo(), setFooBar(), + parseRoot(), serializeRoot().

+ +

Note that the naming conventions specified with the + --type-naming and + --function-naming options perform only limited + transformations on the names that come from the schema in the + form of type, attribute, and element names. In other words, to + get consistent results, your schemas should follow a similar + naming convention as the one you would like to have in the + generated code. Alternatively, you can use the + --*-regex options (discussed below) + to perform further transformations on the names that come from + the schema.

+ +

The + --type-regex, + --accessor-regex, + --one-accessor-regex, + --opt-accessor-regex, + --seq-accessor-regex, + --modifier-regex, + --one-modifier-regex, + --opt-modifier-regex, + --seq-modifier-regex, + --parser-regex, + --serializer-regex, + --const-regex, + --enumerator-regex, and + --element-type-regex options allow you to + specify extra regular expressions for each name category in + addition to the predefined set that is added depending on + the --type-naming and + --function-naming options. Expressions + that are provided with the --*-regex + options are evaluated prior to any predefined expressions. + This allows you to selectively override some or all of the + predefined transformations. When debugging your own expressions, + it is often useful to see which expressions match which names. + The --name-regex-trace option allows you + to trace the process of applying regular expressions to + names.

+ +

The value for the --*-regex options should be + a perl-like regular expression in the form + /pattern/replacement/. + Any character can be used as a delimiter instead of /. + Escaping of the delimiter character in pattern or + replacement is not supported. + All the regular expressions for each category are pushed into a + category-specific stack with the last specified expression + considered first. The first match that succeeds is used. For the + --one-accessor-regex (accessors with cardinality one), + --opt-accessor-regex (accessors with cardinality optional), and + --seq-accessor-regex (accessors with cardinality sequence) + categories the --accessor-regex expressions are + used as a fallback. For the + --one-modifier-regex, + --opt-modifier-regex, and + --seq-modifier-regex + categories the --modifier-regex expressions are + used as a fallback. For the --element-type-regex + category the --type-regex expressions are + used as a fallback.

+ +

The type name expressions (--type-regex) + are evaluated on the name string that has the following + format:

+ +

[namespace ]name[,name][,name][,name]

+ +

The element type name expressions + (--element-type-regex), effective only when + the --generate-element-type option is specified, + are evaluated on the name string that has the following + format:

+ +

namespace name

+ +

In the type name format the namespace part + followed by a space is only present for global type names. For + global types and elements defined in schemas without a target + namespace, the namespace part is empty but + the space is still present. In the type name format after the + initial name component, up to three additional + name components can be present, separated + by commas. For example:

+ +

http://example.com/hello type

+

foo

+

foo,iterator

+

foo,const,iterator

+ +

The following set of predefined regular expressions is used to + transform type names when the upper-camel-case naming convention + is selected:

+ +

/(?:[^ ]* )?([^,]+)/\u$1/

+

/(?:[^ ]* )?([^,]+),([^,]+)/\u$1\u$2/

+

/(?:[^ ]* )?([^,]+),([^,]+),([^,]+)/\u$1\u$2\u$3/

+

/(?:[^ ]* )?([^,]+),([^,]+),([^,]+),([^,]+)/\u$1\u$2\u$3\u$4/

+ +

The accessor and modifier expressions + (--*accessor-regex and + --*modifier-regex) are evaluated on the name string + that has the following format:

+ +

name[,name][,name]

+ +

After the initial name component, up to two + additional name components can be present, + separated by commas. For example:

+ +

foo

+

dom,document

+

foo,default,value

+ +

The following set of predefined regular expressions is used to + transform accessor names when the java naming + convention is selected:

+ +

/([^,]+)/get\u$1/

+

/([^,]+),([^,]+)/get\u$1\u$2/

+

/([^,]+),([^,]+),([^,]+)/get\u$1\u$2\u$3/

+ +

For the parser, serializer, and enumerator categories, the + corresponding regular expressions are evaluated on local names of + elements and on enumeration values, respectively. For example, the + following predefined regular expression is used to transform parsing + function names when the java naming convention + is selected:

+ +

/(.+)/parse\u$1/

+ +

The const category is used to create C++ constant names for the + element/wildcard/text content ids in ordered types.

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +

TYPE MAP

+ +

Type map files are used in C++/Parser to define a mapping between + XML Schema and C++ types. The compiler uses this information + to determine the return types of post_* + functions in parser skeletons corresponding to XML Schema + types as well as argument types for callbacks corresponding + to elements and attributes of these types.

+ +

The compiler has a set of predefined mapping rules that map + built-in XML Schema types to suitable C++ types (discussed + below) and all other types to void. + By providing your own type maps you can override these predefined + rules. The format of the type map file is presented below: +

+ +
+namespace <schema-namespace> [<cxx-namespace>]
+{
+  (include <file-name>;)*
+  ([type] <schema-type> <cxx-ret-type> [<cxx-arg-type>];)*
+}
+  
+ +

Both <schema-namespace> and + <schema-type> are regex patterns while + <cxx-namespace>, + <cxx-ret-type>, and + <cxx-arg-type> are regex pattern + substitutions. All names can be optionally enclosed in + " ", for example, to include white-spaces.

+ +

<schema-namespace> determines XML + Schema namespace. Optional <cxx-namespace> + is prefixed to every C++ type name in this namespace declaration. + <cxx-ret-type> is a C++ type name that is + used as a return type for the post_* functions. + Optional <cxx-arg-type> is an argument + type for callback functions corresponding to elements and attributes + of this type. If + <cxx-arg-type> is not specified, it defaults + to <cxx-ret-type> if <cxx-ret-type> + ends with * or & (that is, + it is a pointer or a reference) and + const <cxx-ret-type>& + otherwise. + <file-name> is a file name either in the + " " or < > format + and is added with the #include directive to + the generated code.

+ +

The # character starts a comment that ends + with a new line or end of file. To specify a name that contains + # enclose it in " ". + For example:

+ +
+namespace http://www.example.com/xmlns/my my
+{
+  include "my.hxx";
+
+  # Pass apples by value.
+  #
+  apple apple;
+
+  # Pass oranges as pointers.
+  #
+  orange orange_t*;
+}
+  
+ +

In the example above, for the + http://www.example.com/xmlns/my#orange + XML Schema type, the my::orange_t* C++ type will + be used as both return and argument types.

+ +

Several namespace declarations can be specified in a single + file. The namespace declaration can also be completely + omitted to map types in a schema without a namespace. For + instance:

+ +
+include "my.hxx";
+apple apple;
+
+namespace http://www.example.com/xmlns/my
+{
+  orange "const orange_t*";
+}
+  
+ +

The compiler has a number of predefined mapping rules that can be + presented as the following map files. The string-based XML Schema + built-in types are mapped to either std::string + or std::wstring depending on the character type + selected with the --char-type option + (char by default).

+ +
+namespace http://www.w3.org/2001/XMLSchema
+{
+  boolean bool bool;
+
+  byte "signed char" "signed char";
+  unsignedByte "unsigned char" "unsigned char";
+
+  short short short;
+  unsignedShort "unsigned short" "unsigned short";
+
+  int int int;
+  unsignedInt "unsigned int" "unsigned int";
+
+  long "long long" "long long";
+  unsignedLong "unsigned long long" "unsigned long long";
+
+  integer "long long" "long long";
+
+  negativeInteger "long long" "long long";
+  nonPositiveInteger "long long" "long long";
+
+  positiveInteger "unsigned long long" "unsigned long long";
+  nonNegativeInteger "unsigned long long" "unsigned long long";
+
+  float float float;
+  double double double;
+  decimal double double;
+
+  string std::string;
+  normalizedString std::string;
+  token std::string;
+  Name std::string;
+  NMTOKEN std::string;
+  NCName std::string;
+  ID std::string;
+  IDREF std::string;
+  language std::string;
+  anyURI std::string;
+
+  NMTOKENS xml_schema::string_sequence;
+  IDREFS xml_schema::string_sequence;
+
+  QName xml_schema::qname;
+
+  base64Binary std::auto_ptr<xml_schema::buffer>
+               std::auto_ptr<xml_schema::buffer>;
+  hexBinary std::auto_ptr<xml_schema::buffer>
+            std::auto_ptr<xml_schema::buffer>;
+
+  date xml_schema::date;
+  dateTime xml_schema::date_time;
+  duration xml_schema::duration;
+  gDay xml_schema::gday;
+  gMonth xml_schema::gmonth;
+  gMonthDay xml_schema::gmonth_day;
+  gYear xml_schema::gyear;
+  gYearMonth xml_schema::gyear_month;
+  time xml_schema::time;
+}
+  
+ +

The last predefined rule maps anything that wasn't mapped by + previous rules to void:

+ +
+namespace .*
+{
+  .* void void;
+}
+  
+ + +

When you provide your own type maps with the + --type-map option, they are evaluated first. + This allows you to selectively override predefined rules.

+ +

REGEX AND SHELL QUOTING

+ +

When entering a regular expression argument in the shell + command line it is often necessary to use quoting (enclosing + the argument in " " or + ' ') in order to prevent the shell + from interpreting certain characters, for example, spaces as + argument separators and $ as variable + expansions.

+ +

Unfortunately it is hard to achieve this in a manner that is + portable across POSIX shells, such as those found on + GNU/Linux and UNIX, and Windows shell. For example, if you + use " " for quoting you will get a + wrong result with POSIX shells if your expression contains + $. The standard way of dealing with this + on POSIX systems is to use ' ' instead. + Unfortunately, Windows shell does not remove ' ' + from arguments when they are passed to applications. As a result you + may have to use ' ' for POSIX and + " " for Windows ($ is + not treated as a special character on Windows).

+ +

Alternatively, you can save regular expression options into + a file, one option per line, and use this file with the + --options-file option. With this approach + you don't need to worry about shell quoting.

+ +

DIAGNOSTICS

+ +

If the input file is not a valid W3C XML Schema definition, + xsd will issue diagnostic messages to STDERR + and exit with non-zero exit code.

+ +

BUGS

+ +

Send bug reports to the + xsd-users@codesynthesis.com mailing list.

+ +
+ +
+ + diff --git a/xsd/manifest b/xsd/manifest index f65e557..9f099fc 100644 --- a/xsd/manifest +++ b/xsd/manifest @@ -18,6 +18,6 @@ depends: * bpkg >= 0.15.0 depends: libxsd-frontend ^2.1.0- depends: libcutl ^1.11.0- depends: libxerces-c ^3.0.0 -depends: * cli ^1.2.0- +depends: * cli ^1.2.0- ? ($config.xsd.develop) tests: * xsd-tests == $ examples: * xsd-examples == $ diff --git a/xsd/xsd/.gitignore b/xsd/xsd/.gitignore index 2d9360c..8c86c4a 100644 --- a/xsd/xsd/.gitignore +++ b/xsd/xsd/.gitignore @@ -1,3 +1,3 @@ -xsd -options.?xx -version.hxx +/xsd +/version.hxx +/options.?xx diff --git a/xsd/xsd/buildfile b/xsd/xsd/buildfile index eac0ff9..d4e7af5 100644 --- a/xsd/xsd/buildfile +++ b/xsd/xsd/buildfile @@ -5,13 +5,10 @@ import libs = libxsd-frontend%lib{xsd-frontend} import libs += libcutl%lib{cutl} import libs += libxerces-c%lib{xerces-c} -import! [metadata] cli = cli%exe{cli} - ops = options cxx/options cxx/parser/options cxx/tree/options -./: exe{xsd}: {hxx ixx txx cxx}{** -{$ops} -version} \ - {hxx ixx cxx}{$ops} \ - {hxx}{version} \ +./: exe{xsd}: {hxx ixx txx cxx}{** -version -{$ops} -pregenerated/**} \ + {hxx}{version} \ $libs # Target metadata, see also --build2-metadata in xsd.cxx. @@ -28,51 +25,96 @@ exe{xsd}: hxx{version}: in{version} $src_root/manifest -# Generated options parser. +## Consumption build ($develop == false). # -# Note: tracking .cli dependencies manually. + +# Use pregenerated versions in the consumption build. # -cli_options = --std c++11 -I $src_root --generate-specifier \ ---generate-file-scanner --suppress-undocumented \ ---ostream-type ::std::wostream --exclude-base \ ---include-with-brackets --option-length 28 \ ---cxx-prologue '#include ' +exe{xsd}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop) -<{hxx ixx cxx}{options}>: cli{options} -{ - cli_options += --include-prefix xsd --guard-prefix XSD -} +if! $develop + cxx.poptions =+ "-I($src_base/pregenerated)" # Note: must come first. -: cxx/cli{options} cli{options} -{ - cli_options += --include-prefix xsd/cxx --guard-prefix XSD_CXX -} +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{hxx ixx cxx}{*}: dist = (!$develop) -: cxx/parser/cli{options} cxx/cli{options} \ - cli{options} -{ - cli_options += --include-prefix xsd/cxx/parser --guard-prefix XSD_CXX_PARSER -} +# +## + +## Development build ($develop == true). +# -: cxx/tree/cli{options} cxx/cli{options} \ - cli{options} +exe{xsd}: {hxx ixx cxx}{$ops}: include = $develop + +if $develop + import! [metadata] cli = cli%exe{cli} + +# In the development build distribute regenerated {hxx ixx cxx}{options}, +# remapping their locations to the paths of the pregenerated versions (which +# are only distributed in the consumption build; see above). This way we make +# sure that the distributed files are always up-to-date. +# +for f: $ops { - cli_options += --include-prefix xsd/cxx/tree --guard-prefix XSD_CXX_TREE + d = $directory($f) # empty, cxx/, etc. + + <{hxx ixx cxx}{$f}>: cli{$f} + { + dist = ($develop ? $relative([dir_path] "pregenerated/xsd/$d", $d) : false) + + # Symlink the generated code in src for convenience of development. + # + backlink = true + } } : cli{~'/\1/'} $cli -{ - # Symlink the generated code in src for convenience of development. - # - backlink = true -} +% +if $develop {{ - diag cli ($<[0]) - $cli $cli_options -o $directory($path($>[0])) $path($<[0]) + t = $path($>[0]).t + + depdb dyndep --byproduct --file $t + + h = $path($>[0]) + i = $path($>[1]) + c = $path($>[2]) + + d = $directory($h) + p = $string($leaf($d, $out_root)) # xsd, xsd/cxx, etc + + options = --std c++11 -I $src_root --include-prefix $p \ + --guard-prefix $regex.replace($ucase($p), '[/\\]', '_') \ + --generate-specifier --generate-file-scanner \ + --suppress-undocumented --ostream-type ::std::wostream \ + --exclude-base --include-with-brackets --option-length 28 \ + --cxx-prologue '#include ' + + $cli $options --generate-dep --dep-file $t -o $d $path($<[0]) + + # If the result differs from the pregenerated version, copy it over. + # + d = [dir_path] $src_base/pregenerated/$p + + dh = $d/$leaf($h) + di = $d/$leaf($i) + dc = $d/$leaf($c) + + if diff $dh $h >- && \ + diff $di $i >- && \ + diff $dc $c >- + exit + end + + cp $h $dh + cp $i $di + cp $c $dc }} -# Build options. # +## + # Pass the copyright notice extracted from the LICENSE file. # obj{xsd cxx/parser/generator cxx/tree/generator}: \ diff --git a/xsd/xsd/cxx/.gitignore b/xsd/xsd/cxx/.gitignore new file mode 100644 index 0000000..c6e608b --- /dev/null +++ b/xsd/xsd/cxx/.gitignore @@ -0,0 +1 @@ +options.?xx diff --git a/xsd/xsd/pregenerated/xsd/cxx/options.cxx b/xsd/xsd/pregenerated/xsd/cxx/options.cxx new file mode 100644 index 0000000..f4d3fa7 --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/options.cxx @@ -0,0 +1,681 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include +// +// End prologue. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cli +{ + template + struct parser + { + static void + parse (X& x, bool& xs, scanner& s) + { + using namespace std; + + const char* o (s.next ()); + if (s.more ()) + { + string v (s.next ()); + istringstream is (v); + if (!(is >> x && is.peek () == istringstream::traits_type::eof ())) + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (bool& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (std::string& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + x = s.next (); + else + throw missing_value (o); + + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::pair& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser::parse (x.first, xs, s); + } + }; + + template + struct parser > + { + static void + parse (std::vector& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.push_back (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::set& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.insert (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::map& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, s); + } + + template + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, x.*S, s); + } +} + +#include + +namespace CXX +{ + // options + // + + options:: + options () + : std_ (cxx_version::cxx98), + std_specified_ (false), + char_type_ ("char"), + char_type_specified_ (false), + char_encoding_ (), + char_encoding_specified_ (false), + output_dir_ (), + output_dir_specified_ (false), + generate_inline_ (), + generate_xml_schema_ (), + extern_xml_schema_ (), + extern_xml_schema_specified_ (false), + namespace_map_ (), + namespace_map_specified_ (false), + namespace_regex_ (), + namespace_regex_specified_ (false), + namespace_regex_trace_ (), + reserved_name_ (), + reserved_name_specified_ (false), + include_with_brackets_ (), + include_prefix_ (), + include_prefix_specified_ (false), + include_regex_ (), + include_regex_specified_ (false), + include_regex_trace_ (), + guard_prefix_ (), + guard_prefix_specified_ (false), + hxx_suffix_ (".hxx"), + hxx_suffix_specified_ (false), + ixx_suffix_ (".ixx"), + ixx_suffix_specified_ (false), + cxx_suffix_ (".cxx"), + cxx_suffix_specified_ (false), + fwd_suffix_ ("-fwd.hxx"), + fwd_suffix_specified_ (false), + hxx_regex_ (), + hxx_regex_specified_ (false), + ixx_regex_ (), + ixx_regex_specified_ (false), + cxx_regex_ (), + cxx_regex_specified_ (false), + fwd_regex_ (), + fwd_regex_specified_ (false), + hxx_prologue_ (), + hxx_prologue_specified_ (false), + ixx_prologue_ (), + ixx_prologue_specified_ (false), + cxx_prologue_ (), + cxx_prologue_specified_ (false), + fwd_prologue_ (), + fwd_prologue_specified_ (false), + prologue_ (), + prologue_specified_ (false), + hxx_epilogue_ (), + hxx_epilogue_specified_ (false), + ixx_epilogue_ (), + ixx_epilogue_specified_ (false), + cxx_epilogue_ (), + cxx_epilogue_specified_ (false), + fwd_epilogue_ (), + fwd_epilogue_specified_ (false), + epilogue_ (), + epilogue_specified_ (false), + hxx_prologue_file_ (), + hxx_prologue_file_specified_ (false), + ixx_prologue_file_ (), + ixx_prologue_file_specified_ (false), + cxx_prologue_file_ (), + cxx_prologue_file_specified_ (false), + fwd_prologue_file_ (), + fwd_prologue_file_specified_ (false), + prologue_file_ (), + prologue_file_specified_ (false), + hxx_epilogue_file_ (), + hxx_epilogue_file_specified_ (false), + ixx_epilogue_file_ (), + ixx_epilogue_file_specified_ (false), + cxx_epilogue_file_ (), + cxx_epilogue_file_specified_ (false), + fwd_epilogue_file_ (), + fwd_epilogue_file_specified_ (false), + epilogue_file_ (), + epilogue_file_specified_ (false), + export_symbol_ (), + export_symbol_specified_ (false), + export_xml_schema_ (), + export_maps_ (), + import_maps_ (), + generate_dep_ (), + generate_dep_only_ (), + dep_phony_ (), + dep_target_ (), + dep_target_specified_ (false), + dep_suffix_ (".d"), + dep_suffix_specified_ (false), + dep_regex_ (), + dep_regex_specified_ (false) + { + } + + ::cli::usage_para options:: + print_usage (::std::wostream& os, ::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::cli::usage_para::text) + os << ::std::endl; + + os << "--std Specify the C++ standard that the generated code" << ::std::endl + << " should conform to." << ::std::endl; + + os << "--char-type Generate code using the provided character " << ::std::endl + << " instead of the default char." << ::std::endl; + + os << "--char-encoding Specify the character encoding that should be used" << ::std::endl + << " in the generated code." << ::std::endl; + + os << "--output-dir Write generated files to instead of the" << ::std::endl + << " current directory." << ::std::endl; + + os << "--generate-inline Generate simple functions inline." << ::std::endl; + + os << "--generate-xml-schema Generate a C++ header file as if the schema being" << ::std::endl + << " compiled defines the XML Schema namespace." << ::std::endl; + + os << "--extern-xml-schema Include a header file derived from instead" << ::std::endl + << " of generating the XML Schema namespace mapping" << ::std::endl + << " inline." << ::std::endl; + + os << "--namespace-map = Map XML Schema namespace to C++ namespace" << ::std::endl + << " ." << ::std::endl; + + os << "--namespace-regex Add to the list of regular expressions" << ::std::endl + << " used to translate XML Schema namespace names to" << ::std::endl + << " C++ namespace names." << ::std::endl; + + os << "--namespace-regex-trace Trace the process of applying regular expressions" << ::std::endl + << " specified with the --namespace-regex option." << ::std::endl; + + os << "--reserved-name [=] Add name to the list of names that should not" << ::std::endl + << " be used as identifiers." << ::std::endl; + + os << "--include-with-brackets Use angle brackets (<>) instead of quotes (\"\") in" << ::std::endl + << " generated #include directives." << ::std::endl; + + os << "--include-prefix Add to generated #include directive" << ::std::endl + << " paths." << ::std::endl; + + os << "--include-regex Add to the list of regular expressions" << ::std::endl + << " used to transform #include directive paths." << ::std::endl; + + os << "--include-regex-trace Trace the process of applying regular expressions" << ::std::endl + << " specified with the --include-regex option." << ::std::endl; + + os << "--guard-prefix Add to generated header inclusion guards." << ::std::endl; + + os << "--hxx-suffix Use the provided instead of the default" << ::std::endl + << " .hxx to construct the name of the header file." << ::std::endl; + + os << "--ixx-suffix Use the provided instead of the default" << ::std::endl + << " .ixx to construct the name of the inline file." << ::std::endl; + + os << "--cxx-suffix Use the provided instead of the default" << ::std::endl + << " .cxx to construct the name of the source file." << ::std::endl; + + os << "--fwd-suffix Use the provided instead of the default" << ::std::endl + << " -fwd.hxx to construct the name of the forward" << ::std::endl + << " declaration file." << ::std::endl; + + os << "--hxx-regex Use the provided expression to construct the name" << ::std::endl + << " of the header file." << ::std::endl; + + os << "--ixx-regex Use the provided expression to construct the name" << ::std::endl + << " of the inline file." << ::std::endl; + + os << "--cxx-regex Use the provided expression to construct the name" << ::std::endl + << " of the source file." << ::std::endl; + + os << "--fwd-regex Use the provided expression to construct the name" << ::std::endl + << " of the forward declaration file." << ::std::endl; + + os << "--hxx-prologue Insert at the beginning of the header file." << ::std::endl; + + os << "--ixx-prologue Insert at the beginning of the inline file." << ::std::endl; + + os << "--cxx-prologue Insert at the beginning of the source file." << ::std::endl; + + os << "--fwd-prologue Insert at the beginning of the forward" << ::std::endl + << " declaration file." << ::std::endl; + + os << "--prologue Insert at the beginning of each generated" << ::std::endl + << " file for which there is no file-specific prologue." << ::std::endl; + + os << "--hxx-epilogue Insert at the end of the header file." << ::std::endl; + + os << "--ixx-epilogue Insert at the end of the inline file." << ::std::endl; + + os << "--cxx-epilogue Insert at the end of the source file." << ::std::endl; + + os << "--fwd-epilogue Insert at the end of the forward" << ::std::endl + << " declaration file." << ::std::endl; + + os << "--epilogue Insert at the end of each generated file" << ::std::endl + << " for which there is no file-specific epilogue." << ::std::endl; + + os << "--hxx-prologue-file Insert the content of the at the beginning" << ::std::endl + << " of the header file." << ::std::endl; + + os << "--ixx-prologue-file Insert the content of the at the beginning" << ::std::endl + << " of the inline file." << ::std::endl; + + os << "--cxx-prologue-file Insert the content of the at the beginning" << ::std::endl + << " of the source file." << ::std::endl; + + os << "--fwd-prologue-file Insert the content of the at the beginning" << ::std::endl + << " of the forward declaration file." << ::std::endl; + + os << "--prologue-file Insert the content of the at the beginning" << ::std::endl + << " of each generated file for which there is no" << ::std::endl + << " file-specific prologue file." << ::std::endl; + + os << "--hxx-epilogue-file Insert the content of the at the end of the" << ::std::endl + << " header file." << ::std::endl; + + os << "--ixx-epilogue-file Insert the content of the at the end of the" << ::std::endl + << " inline file." << ::std::endl; + + os << "--cxx-epilogue-file Insert the content of the at the end of the" << ::std::endl + << " source file." << ::std::endl; + + os << "--fwd-epilogue-file Insert the content of the at the end of the" << ::std::endl + << " forward declaration file." << ::std::endl; + + os << "--epilogue-file Insert the content of the at the end of" << ::std::endl + << " each generated file for which there is no" << ::std::endl + << " file-specific epilogue file." << ::std::endl; + + os << "--export-symbol Insert in places where DLL export/import" << ::std::endl + << " control statements" << ::std::endl + << " (__declspec(dllexport/dllimport)) are necessary." << ::std::endl; + + os << "--export-xml-schema Export/import types in the XML Schema namespace" << ::std::endl + << " using the export symbol provided with the" << ::std::endl + << " --export-symbol option." << ::std::endl; + + os << "--export-maps Export polymorphism support maps from a Win32 DLL" << ::std::endl + << " into which this generated code is placed." << ::std::endl; + + os << "--import-maps Import polymorphism support maps to a Win32 DLL or" << ::std::endl + << " executable into which this generated code is" << ::std::endl + << " linked." << ::std::endl; + + os << "--generate-dep Generate make dependency information." << ::std::endl; + + os << "--generate-dep-only Generate make dependency information only." << ::std::endl; + + os << "--dep-phony Generate phony targets for included/imported" << ::std::endl + << " schema files, causing each to depend on nothing." << ::std::endl; + + os << "--dep-target Change the target of the dependency rule." << ::std::endl; + + os << "--dep-suffix Use the provided instead of the default" << ::std::endl + << " .d to construct the name of the dependency file." << ::std::endl; + + os << "--dep-regex Use the provided expression to construct the name" << ::std::endl + << " of the dependency file." << ::std::endl; + + p = ::cli::usage_para::option; + + return p; + } + + typedef + std::map + _cli_options_map; + + static _cli_options_map _cli_options_map_; + + struct _cli_options_map_init + { + _cli_options_map_init () + { + _cli_options_map_["--std"] = + &::cli::thunk< options, cxx_version, &options::std_, + &options::std_specified_ >; + _cli_options_map_["--char-type"] = + &::cli::thunk< options, NarrowString, &options::char_type_, + &options::char_type_specified_ >; + _cli_options_map_["--char-encoding"] = + &::cli::thunk< options, NarrowString, &options::char_encoding_, + &options::char_encoding_specified_ >; + _cli_options_map_["--output-dir"] = + &::cli::thunk< options, NarrowString, &options::output_dir_, + &options::output_dir_specified_ >; + _cli_options_map_["--generate-inline"] = + &::cli::thunk< options, &options::generate_inline_ >; + _cli_options_map_["--generate-xml-schema"] = + &::cli::thunk< options, &options::generate_xml_schema_ >; + _cli_options_map_["--extern-xml-schema"] = + &::cli::thunk< options, NarrowString, &options::extern_xml_schema_, + &options::extern_xml_schema_specified_ >; + _cli_options_map_["--namespace-map"] = + &::cli::thunk< options, NarrowStrings, &options::namespace_map_, + &options::namespace_map_specified_ >; + _cli_options_map_["--namespace-regex"] = + &::cli::thunk< options, NarrowStrings, &options::namespace_regex_, + &options::namespace_regex_specified_ >; + _cli_options_map_["--namespace-regex-trace"] = + &::cli::thunk< options, &options::namespace_regex_trace_ >; + _cli_options_map_["--reserved-name"] = + &::cli::thunk< options, NarrowStrings, &options::reserved_name_, + &options::reserved_name_specified_ >; + _cli_options_map_["--include-with-brackets"] = + &::cli::thunk< options, &options::include_with_brackets_ >; + _cli_options_map_["--include-prefix"] = + &::cli::thunk< options, NarrowString, &options::include_prefix_, + &options::include_prefix_specified_ >; + _cli_options_map_["--include-regex"] = + &::cli::thunk< options, NarrowStrings, &options::include_regex_, + &options::include_regex_specified_ >; + _cli_options_map_["--include-regex-trace"] = + &::cli::thunk< options, &options::include_regex_trace_ >; + _cli_options_map_["--guard-prefix"] = + &::cli::thunk< options, NarrowString, &options::guard_prefix_, + &options::guard_prefix_specified_ >; + _cli_options_map_["--hxx-suffix"] = + &::cli::thunk< options, NarrowString, &options::hxx_suffix_, + &options::hxx_suffix_specified_ >; + _cli_options_map_["--ixx-suffix"] = + &::cli::thunk< options, NarrowString, &options::ixx_suffix_, + &options::ixx_suffix_specified_ >; + _cli_options_map_["--cxx-suffix"] = + &::cli::thunk< options, NarrowString, &options::cxx_suffix_, + &options::cxx_suffix_specified_ >; + _cli_options_map_["--fwd-suffix"] = + &::cli::thunk< options, NarrowString, &options::fwd_suffix_, + &options::fwd_suffix_specified_ >; + _cli_options_map_["--hxx-regex"] = + &::cli::thunk< options, NarrowString, &options::hxx_regex_, + &options::hxx_regex_specified_ >; + _cli_options_map_["--ixx-regex"] = + &::cli::thunk< options, NarrowString, &options::ixx_regex_, + &options::ixx_regex_specified_ >; + _cli_options_map_["--cxx-regex"] = + &::cli::thunk< options, NarrowString, &options::cxx_regex_, + &options::cxx_regex_specified_ >; + _cli_options_map_["--fwd-regex"] = + &::cli::thunk< options, NarrowString, &options::fwd_regex_, + &options::fwd_regex_specified_ >; + _cli_options_map_["--hxx-prologue"] = + &::cli::thunk< options, NarrowStrings, &options::hxx_prologue_, + &options::hxx_prologue_specified_ >; + _cli_options_map_["--ixx-prologue"] = + &::cli::thunk< options, NarrowStrings, &options::ixx_prologue_, + &options::ixx_prologue_specified_ >; + _cli_options_map_["--cxx-prologue"] = + &::cli::thunk< options, NarrowStrings, &options::cxx_prologue_, + &options::cxx_prologue_specified_ >; + _cli_options_map_["--fwd-prologue"] = + &::cli::thunk< options, NarrowStrings, &options::fwd_prologue_, + &options::fwd_prologue_specified_ >; + _cli_options_map_["--prologue"] = + &::cli::thunk< options, NarrowStrings, &options::prologue_, + &options::prologue_specified_ >; + _cli_options_map_["--hxx-epilogue"] = + &::cli::thunk< options, NarrowStrings, &options::hxx_epilogue_, + &options::hxx_epilogue_specified_ >; + _cli_options_map_["--ixx-epilogue"] = + &::cli::thunk< options, NarrowStrings, &options::ixx_epilogue_, + &options::ixx_epilogue_specified_ >; + _cli_options_map_["--cxx-epilogue"] = + &::cli::thunk< options, NarrowStrings, &options::cxx_epilogue_, + &options::cxx_epilogue_specified_ >; + _cli_options_map_["--fwd-epilogue"] = + &::cli::thunk< options, NarrowStrings, &options::fwd_epilogue_, + &options::fwd_epilogue_specified_ >; + _cli_options_map_["--epilogue"] = + &::cli::thunk< options, NarrowStrings, &options::epilogue_, + &options::epilogue_specified_ >; + _cli_options_map_["--hxx-prologue-file"] = + &::cli::thunk< options, NarrowString, &options::hxx_prologue_file_, + &options::hxx_prologue_file_specified_ >; + _cli_options_map_["--ixx-prologue-file"] = + &::cli::thunk< options, NarrowString, &options::ixx_prologue_file_, + &options::ixx_prologue_file_specified_ >; + _cli_options_map_["--cxx-prologue-file"] = + &::cli::thunk< options, NarrowString, &options::cxx_prologue_file_, + &options::cxx_prologue_file_specified_ >; + _cli_options_map_["--fwd-prologue-file"] = + &::cli::thunk< options, NarrowString, &options::fwd_prologue_file_, + &options::fwd_prologue_file_specified_ >; + _cli_options_map_["--prologue-file"] = + &::cli::thunk< options, NarrowString, &options::prologue_file_, + &options::prologue_file_specified_ >; + _cli_options_map_["--hxx-epilogue-file"] = + &::cli::thunk< options, NarrowString, &options::hxx_epilogue_file_, + &options::hxx_epilogue_file_specified_ >; + _cli_options_map_["--ixx-epilogue-file"] = + &::cli::thunk< options, NarrowString, &options::ixx_epilogue_file_, + &options::ixx_epilogue_file_specified_ >; + _cli_options_map_["--cxx-epilogue-file"] = + &::cli::thunk< options, NarrowString, &options::cxx_epilogue_file_, + &options::cxx_epilogue_file_specified_ >; + _cli_options_map_["--fwd-epilogue-file"] = + &::cli::thunk< options, NarrowString, &options::fwd_epilogue_file_, + &options::fwd_epilogue_file_specified_ >; + _cli_options_map_["--epilogue-file"] = + &::cli::thunk< options, NarrowString, &options::epilogue_file_, + &options::epilogue_file_specified_ >; + _cli_options_map_["--export-symbol"] = + &::cli::thunk< options, NarrowString, &options::export_symbol_, + &options::export_symbol_specified_ >; + _cli_options_map_["--export-xml-schema"] = + &::cli::thunk< options, &options::export_xml_schema_ >; + _cli_options_map_["--export-maps"] = + &::cli::thunk< options, &options::export_maps_ >; + _cli_options_map_["--import-maps"] = + &::cli::thunk< options, &options::import_maps_ >; + _cli_options_map_["--generate-dep"] = + &::cli::thunk< options, &options::generate_dep_ >; + _cli_options_map_["--generate-dep-only"] = + &::cli::thunk< options, &options::generate_dep_only_ >; + _cli_options_map_["--dep-phony"] = + &::cli::thunk< options, &options::dep_phony_ >; + _cli_options_map_["--dep-target"] = + &::cli::thunk< options, NarrowStrings, &options::dep_target_, + &options::dep_target_specified_ >; + _cli_options_map_["--dep-suffix"] = + &::cli::thunk< options, NarrowString, &options::dep_suffix_, + &options::dep_suffix_specified_ >; + _cli_options_map_["--dep-regex"] = + &::cli::thunk< options, NarrowString, &options::dep_regex_, + &options::dep_regex_specified_ >; + } + }; + + static _cli_options_map_init _cli_options_map_init_; + + bool options:: + _parse (const char* o, ::cli::scanner& s) + { + _cli_options_map::const_iterator i (_cli_options_map_.find (o)); + + if (i != _cli_options_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // options base + // + if (::options::_parse (o, s)) + return true; + + return false; + } +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/xsd/xsd/pregenerated/xsd/cxx/options.hxx b/xsd/xsd/pregenerated/xsd/cxx/options.hxx new file mode 100644 index 0000000..b01027a --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/options.hxx @@ -0,0 +1,443 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef XSD_CXX_OPTIONS_HXX +#define XSD_CXX_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include + +#include + +#include + +#include + +namespace CXX +{ + class options: public ::options + { + public: + // Option accessors. + // + const cxx_version& + std () const; + + bool + std_specified () const; + + const NarrowString& + char_type () const; + + bool + char_type_specified () const; + + const NarrowString& + char_encoding () const; + + bool + char_encoding_specified () const; + + const NarrowString& + output_dir () const; + + bool + output_dir_specified () const; + + const bool& + generate_inline () const; + + const bool& + generate_xml_schema () const; + + const NarrowString& + extern_xml_schema () const; + + bool + extern_xml_schema_specified () const; + + const NarrowStrings& + namespace_map () const; + + bool + namespace_map_specified () const; + + const NarrowStrings& + namespace_regex () const; + + bool + namespace_regex_specified () const; + + const bool& + namespace_regex_trace () const; + + const NarrowStrings& + reserved_name () const; + + bool + reserved_name_specified () const; + + const bool& + include_with_brackets () const; + + const NarrowString& + include_prefix () const; + + bool + include_prefix_specified () const; + + const NarrowStrings& + include_regex () const; + + bool + include_regex_specified () const; + + const bool& + include_regex_trace () const; + + const NarrowString& + guard_prefix () const; + + bool + guard_prefix_specified () const; + + const NarrowString& + hxx_suffix () const; + + bool + hxx_suffix_specified () const; + + const NarrowString& + ixx_suffix () const; + + bool + ixx_suffix_specified () const; + + const NarrowString& + cxx_suffix () const; + + bool + cxx_suffix_specified () const; + + const NarrowString& + fwd_suffix () const; + + bool + fwd_suffix_specified () const; + + const NarrowString& + hxx_regex () const; + + bool + hxx_regex_specified () const; + + const NarrowString& + ixx_regex () const; + + bool + ixx_regex_specified () const; + + const NarrowString& + cxx_regex () const; + + bool + cxx_regex_specified () const; + + const NarrowString& + fwd_regex () const; + + bool + fwd_regex_specified () const; + + const NarrowStrings& + hxx_prologue () const; + + bool + hxx_prologue_specified () const; + + const NarrowStrings& + ixx_prologue () const; + + bool + ixx_prologue_specified () const; + + const NarrowStrings& + cxx_prologue () const; + + bool + cxx_prologue_specified () const; + + const NarrowStrings& + fwd_prologue () const; + + bool + fwd_prologue_specified () const; + + const NarrowStrings& + prologue () const; + + bool + prologue_specified () const; + + const NarrowStrings& + hxx_epilogue () const; + + bool + hxx_epilogue_specified () const; + + const NarrowStrings& + ixx_epilogue () const; + + bool + ixx_epilogue_specified () const; + + const NarrowStrings& + cxx_epilogue () const; + + bool + cxx_epilogue_specified () const; + + const NarrowStrings& + fwd_epilogue () const; + + bool + fwd_epilogue_specified () const; + + const NarrowStrings& + epilogue () const; + + bool + epilogue_specified () const; + + const NarrowString& + hxx_prologue_file () const; + + bool + hxx_prologue_file_specified () const; + + const NarrowString& + ixx_prologue_file () const; + + bool + ixx_prologue_file_specified () const; + + const NarrowString& + cxx_prologue_file () const; + + bool + cxx_prologue_file_specified () const; + + const NarrowString& + fwd_prologue_file () const; + + bool + fwd_prologue_file_specified () const; + + const NarrowString& + prologue_file () const; + + bool + prologue_file_specified () const; + + const NarrowString& + hxx_epilogue_file () const; + + bool + hxx_epilogue_file_specified () const; + + const NarrowString& + ixx_epilogue_file () const; + + bool + ixx_epilogue_file_specified () const; + + const NarrowString& + cxx_epilogue_file () const; + + bool + cxx_epilogue_file_specified () const; + + const NarrowString& + fwd_epilogue_file () const; + + bool + fwd_epilogue_file_specified () const; + + const NarrowString& + epilogue_file () const; + + bool + epilogue_file_specified () const; + + const NarrowString& + export_symbol () const; + + bool + export_symbol_specified () const; + + const bool& + export_xml_schema () const; + + const bool& + export_maps () const; + + const bool& + import_maps () const; + + const bool& + generate_dep () const; + + const bool& + generate_dep_only () const; + + const bool& + dep_phony () const; + + const NarrowStrings& + dep_target () const; + + bool + dep_target_specified () const; + + const NarrowString& + dep_suffix () const; + + bool + dep_suffix_specified () const; + + const NarrowString& + dep_regex () const; + + bool + dep_regex_specified () const; + + // Print usage information. + // + static ::cli::usage_para + print_usage (::std::wostream&, + ::cli::usage_para = ::cli::usage_para::none); + + // Implementation details. + // + protected: + options (); + + bool + _parse (const char*, ::cli::scanner&); + + public: + cxx_version std_; + bool std_specified_; + NarrowString char_type_; + bool char_type_specified_; + NarrowString char_encoding_; + bool char_encoding_specified_; + NarrowString output_dir_; + bool output_dir_specified_; + bool generate_inline_; + bool generate_xml_schema_; + NarrowString extern_xml_schema_; + bool extern_xml_schema_specified_; + NarrowStrings namespace_map_; + bool namespace_map_specified_; + NarrowStrings namespace_regex_; + bool namespace_regex_specified_; + bool namespace_regex_trace_; + NarrowStrings reserved_name_; + bool reserved_name_specified_; + bool include_with_brackets_; + NarrowString include_prefix_; + bool include_prefix_specified_; + NarrowStrings include_regex_; + bool include_regex_specified_; + bool include_regex_trace_; + NarrowString guard_prefix_; + bool guard_prefix_specified_; + NarrowString hxx_suffix_; + bool hxx_suffix_specified_; + NarrowString ixx_suffix_; + bool ixx_suffix_specified_; + NarrowString cxx_suffix_; + bool cxx_suffix_specified_; + NarrowString fwd_suffix_; + bool fwd_suffix_specified_; + NarrowString hxx_regex_; + bool hxx_regex_specified_; + NarrowString ixx_regex_; + bool ixx_regex_specified_; + NarrowString cxx_regex_; + bool cxx_regex_specified_; + NarrowString fwd_regex_; + bool fwd_regex_specified_; + NarrowStrings hxx_prologue_; + bool hxx_prologue_specified_; + NarrowStrings ixx_prologue_; + bool ixx_prologue_specified_; + NarrowStrings cxx_prologue_; + bool cxx_prologue_specified_; + NarrowStrings fwd_prologue_; + bool fwd_prologue_specified_; + NarrowStrings prologue_; + bool prologue_specified_; + NarrowStrings hxx_epilogue_; + bool hxx_epilogue_specified_; + NarrowStrings ixx_epilogue_; + bool ixx_epilogue_specified_; + NarrowStrings cxx_epilogue_; + bool cxx_epilogue_specified_; + NarrowStrings fwd_epilogue_; + bool fwd_epilogue_specified_; + NarrowStrings epilogue_; + bool epilogue_specified_; + NarrowString hxx_prologue_file_; + bool hxx_prologue_file_specified_; + NarrowString ixx_prologue_file_; + bool ixx_prologue_file_specified_; + NarrowString cxx_prologue_file_; + bool cxx_prologue_file_specified_; + NarrowString fwd_prologue_file_; + bool fwd_prologue_file_specified_; + NarrowString prologue_file_; + bool prologue_file_specified_; + NarrowString hxx_epilogue_file_; + bool hxx_epilogue_file_specified_; + NarrowString ixx_epilogue_file_; + bool ixx_epilogue_file_specified_; + NarrowString cxx_epilogue_file_; + bool cxx_epilogue_file_specified_; + NarrowString fwd_epilogue_file_; + bool fwd_epilogue_file_specified_; + NarrowString epilogue_file_; + bool epilogue_file_specified_; + NarrowString export_symbol_; + bool export_symbol_specified_; + bool export_xml_schema_; + bool export_maps_; + bool import_maps_; + bool generate_dep_; + bool generate_dep_only_; + bool dep_phony_; + NarrowStrings dep_target_; + bool dep_target_specified_; + NarrowString dep_suffix_; + bool dep_suffix_specified_; + NarrowString dep_regex_; + bool dep_regex_specified_; + }; +} + +#include + +// Begin epilogue. +// +// +// End epilogue. + +#endif // XSD_CXX_OPTIONS_HXX diff --git a/xsd/xsd/pregenerated/xsd/cxx/options.ixx b/xsd/xsd/pregenerated/xsd/cxx/options.ixx new file mode 100644 index 0000000..e8ba2fb --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/options.ixx @@ -0,0 +1,603 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +namespace CXX +{ + // options + // + + inline const cxx_version& options:: + std () const + { + return this->std_; + } + + inline bool options:: + std_specified () const + { + return this->std_specified_; + } + + inline const NarrowString& options:: + char_type () const + { + return this->char_type_; + } + + inline bool options:: + char_type_specified () const + { + return this->char_type_specified_; + } + + inline const NarrowString& options:: + char_encoding () const + { + return this->char_encoding_; + } + + inline bool options:: + char_encoding_specified () const + { + return this->char_encoding_specified_; + } + + inline const NarrowString& options:: + output_dir () const + { + return this->output_dir_; + } + + inline bool options:: + output_dir_specified () const + { + return this->output_dir_specified_; + } + + inline const bool& options:: + generate_inline () const + { + return this->generate_inline_; + } + + inline const bool& options:: + generate_xml_schema () const + { + return this->generate_xml_schema_; + } + + inline const NarrowString& options:: + extern_xml_schema () const + { + return this->extern_xml_schema_; + } + + inline bool options:: + extern_xml_schema_specified () const + { + return this->extern_xml_schema_specified_; + } + + inline const NarrowStrings& options:: + namespace_map () const + { + return this->namespace_map_; + } + + inline bool options:: + namespace_map_specified () const + { + return this->namespace_map_specified_; + } + + inline const NarrowStrings& options:: + namespace_regex () const + { + return this->namespace_regex_; + } + + inline bool options:: + namespace_regex_specified () const + { + return this->namespace_regex_specified_; + } + + inline const bool& options:: + namespace_regex_trace () const + { + return this->namespace_regex_trace_; + } + + inline const NarrowStrings& options:: + reserved_name () const + { + return this->reserved_name_; + } + + inline bool options:: + reserved_name_specified () const + { + return this->reserved_name_specified_; + } + + inline const bool& options:: + include_with_brackets () const + { + return this->include_with_brackets_; + } + + inline const NarrowString& options:: + include_prefix () const + { + return this->include_prefix_; + } + + inline bool options:: + include_prefix_specified () const + { + return this->include_prefix_specified_; + } + + inline const NarrowStrings& options:: + include_regex () const + { + return this->include_regex_; + } + + inline bool options:: + include_regex_specified () const + { + return this->include_regex_specified_; + } + + inline const bool& options:: + include_regex_trace () const + { + return this->include_regex_trace_; + } + + inline const NarrowString& options:: + guard_prefix () const + { + return this->guard_prefix_; + } + + inline bool options:: + guard_prefix_specified () const + { + return this->guard_prefix_specified_; + } + + inline const NarrowString& options:: + hxx_suffix () const + { + return this->hxx_suffix_; + } + + inline bool options:: + hxx_suffix_specified () const + { + return this->hxx_suffix_specified_; + } + + inline const NarrowString& options:: + ixx_suffix () const + { + return this->ixx_suffix_; + } + + inline bool options:: + ixx_suffix_specified () const + { + return this->ixx_suffix_specified_; + } + + inline const NarrowString& options:: + cxx_suffix () const + { + return this->cxx_suffix_; + } + + inline bool options:: + cxx_suffix_specified () const + { + return this->cxx_suffix_specified_; + } + + inline const NarrowString& options:: + fwd_suffix () const + { + return this->fwd_suffix_; + } + + inline bool options:: + fwd_suffix_specified () const + { + return this->fwd_suffix_specified_; + } + + inline const NarrowString& options:: + hxx_regex () const + { + return this->hxx_regex_; + } + + inline bool options:: + hxx_regex_specified () const + { + return this->hxx_regex_specified_; + } + + inline const NarrowString& options:: + ixx_regex () const + { + return this->ixx_regex_; + } + + inline bool options:: + ixx_regex_specified () const + { + return this->ixx_regex_specified_; + } + + inline const NarrowString& options:: + cxx_regex () const + { + return this->cxx_regex_; + } + + inline bool options:: + cxx_regex_specified () const + { + return this->cxx_regex_specified_; + } + + inline const NarrowString& options:: + fwd_regex () const + { + return this->fwd_regex_; + } + + inline bool options:: + fwd_regex_specified () const + { + return this->fwd_regex_specified_; + } + + inline const NarrowStrings& options:: + hxx_prologue () const + { + return this->hxx_prologue_; + } + + inline bool options:: + hxx_prologue_specified () const + { + return this->hxx_prologue_specified_; + } + + inline const NarrowStrings& options:: + ixx_prologue () const + { + return this->ixx_prologue_; + } + + inline bool options:: + ixx_prologue_specified () const + { + return this->ixx_prologue_specified_; + } + + inline const NarrowStrings& options:: + cxx_prologue () const + { + return this->cxx_prologue_; + } + + inline bool options:: + cxx_prologue_specified () const + { + return this->cxx_prologue_specified_; + } + + inline const NarrowStrings& options:: + fwd_prologue () const + { + return this->fwd_prologue_; + } + + inline bool options:: + fwd_prologue_specified () const + { + return this->fwd_prologue_specified_; + } + + inline const NarrowStrings& options:: + prologue () const + { + return this->prologue_; + } + + inline bool options:: + prologue_specified () const + { + return this->prologue_specified_; + } + + inline const NarrowStrings& options:: + hxx_epilogue () const + { + return this->hxx_epilogue_; + } + + inline bool options:: + hxx_epilogue_specified () const + { + return this->hxx_epilogue_specified_; + } + + inline const NarrowStrings& options:: + ixx_epilogue () const + { + return this->ixx_epilogue_; + } + + inline bool options:: + ixx_epilogue_specified () const + { + return this->ixx_epilogue_specified_; + } + + inline const NarrowStrings& options:: + cxx_epilogue () const + { + return this->cxx_epilogue_; + } + + inline bool options:: + cxx_epilogue_specified () const + { + return this->cxx_epilogue_specified_; + } + + inline const NarrowStrings& options:: + fwd_epilogue () const + { + return this->fwd_epilogue_; + } + + inline bool options:: + fwd_epilogue_specified () const + { + return this->fwd_epilogue_specified_; + } + + inline const NarrowStrings& options:: + epilogue () const + { + return this->epilogue_; + } + + inline bool options:: + epilogue_specified () const + { + return this->epilogue_specified_; + } + + inline const NarrowString& options:: + hxx_prologue_file () const + { + return this->hxx_prologue_file_; + } + + inline bool options:: + hxx_prologue_file_specified () const + { + return this->hxx_prologue_file_specified_; + } + + inline const NarrowString& options:: + ixx_prologue_file () const + { + return this->ixx_prologue_file_; + } + + inline bool options:: + ixx_prologue_file_specified () const + { + return this->ixx_prologue_file_specified_; + } + + inline const NarrowString& options:: + cxx_prologue_file () const + { + return this->cxx_prologue_file_; + } + + inline bool options:: + cxx_prologue_file_specified () const + { + return this->cxx_prologue_file_specified_; + } + + inline const NarrowString& options:: + fwd_prologue_file () const + { + return this->fwd_prologue_file_; + } + + inline bool options:: + fwd_prologue_file_specified () const + { + return this->fwd_prologue_file_specified_; + } + + inline const NarrowString& options:: + prologue_file () const + { + return this->prologue_file_; + } + + inline bool options:: + prologue_file_specified () const + { + return this->prologue_file_specified_; + } + + inline const NarrowString& options:: + hxx_epilogue_file () const + { + return this->hxx_epilogue_file_; + } + + inline bool options:: + hxx_epilogue_file_specified () const + { + return this->hxx_epilogue_file_specified_; + } + + inline const NarrowString& options:: + ixx_epilogue_file () const + { + return this->ixx_epilogue_file_; + } + + inline bool options:: + ixx_epilogue_file_specified () const + { + return this->ixx_epilogue_file_specified_; + } + + inline const NarrowString& options:: + cxx_epilogue_file () const + { + return this->cxx_epilogue_file_; + } + + inline bool options:: + cxx_epilogue_file_specified () const + { + return this->cxx_epilogue_file_specified_; + } + + inline const NarrowString& options:: + fwd_epilogue_file () const + { + return this->fwd_epilogue_file_; + } + + inline bool options:: + fwd_epilogue_file_specified () const + { + return this->fwd_epilogue_file_specified_; + } + + inline const NarrowString& options:: + epilogue_file () const + { + return this->epilogue_file_; + } + + inline bool options:: + epilogue_file_specified () const + { + return this->epilogue_file_specified_; + } + + inline const NarrowString& options:: + export_symbol () const + { + return this->export_symbol_; + } + + inline bool options:: + export_symbol_specified () const + { + return this->export_symbol_specified_; + } + + inline const bool& options:: + export_xml_schema () const + { + return this->export_xml_schema_; + } + + inline const bool& options:: + export_maps () const + { + return this->export_maps_; + } + + inline const bool& options:: + import_maps () const + { + return this->import_maps_; + } + + inline const bool& options:: + generate_dep () const + { + return this->generate_dep_; + } + + inline const bool& options:: + generate_dep_only () const + { + return this->generate_dep_only_; + } + + inline const bool& options:: + dep_phony () const + { + return this->dep_phony_; + } + + inline const NarrowStrings& options:: + dep_target () const + { + return this->dep_target_; + } + + inline bool options:: + dep_target_specified () const + { + return this->dep_target_specified_; + } + + inline const NarrowString& options:: + dep_suffix () const + { + return this->dep_suffix_; + } + + inline bool options:: + dep_suffix_specified () const + { + return this->dep_suffix_specified_; + } + + inline const NarrowString& options:: + dep_regex () const + { + return this->dep_regex_; + } + + inline bool options:: + dep_regex_specified () const + { + return this->dep_regex_specified_; + } +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/xsd/xsd/pregenerated/xsd/cxx/parser/options.cxx b/xsd/xsd/pregenerated/xsd/cxx/parser/options.cxx new file mode 100644 index 0000000..04cb7ae --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/parser/options.cxx @@ -0,0 +1,726 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include +// +// End prologue. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cli +{ + template + struct parser + { + static void + parse (X& x, bool& xs, scanner& s) + { + using namespace std; + + const char* o (s.next ()); + if (s.more ()) + { + string v (s.next ()); + istringstream is (v); + if (!(is >> x && is.peek () == istringstream::traits_type::eof ())) + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (bool& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (std::string& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + x = s.next (); + else + throw missing_value (o); + + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::pair& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser::parse (x.first, xs, s); + } + }; + + template + struct parser > + { + static void + parse (std::vector& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.push_back (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::set& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.insert (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::map& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, s); + } + + template + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, x.*S, s); + } +} + +#include + +namespace CXX +{ + namespace Parser + { + // options + // + + options:: + options () + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + } + + options:: + options (int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int start, + int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (::cli::scanner& s, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : type_map_ (), + type_map_specified_ (false), + xml_parser_ ("xerces"), + xml_parser_specified_ (false), + generate_validation_ (), + suppress_validation_ (), + generate_polymorphic_ (), + generate_noop_impl_ (), + generate_print_impl_ (), + generate_test_driver_ (), + force_overwrite_ (), + root_element_first_ (), + root_element_last_ (), + root_element_ (), + root_element_specified_ (false), + skel_type_suffix_ ("_pskel"), + skel_type_suffix_specified_ (false), + skel_file_suffix_ ("-pskel"), + skel_file_suffix_specified_ (false), + impl_type_suffix_ ("_pimpl"), + impl_type_suffix_specified_ (false), + impl_file_suffix_ ("-pimpl"), + impl_file_suffix_specified_ (false) + { + _parse (s, opt, arg); + } + + ::cli::usage_para options:: + print_usage (::std::wostream& os, ::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::cli::usage_para::text) + os << ::std::endl; + + os << "--type-map Read XML Schema to C++ type mapping information" << ::std::endl + << " from ." << ::std::endl; + + os << "--xml-parser Use as the underlying XML parser." << ::std::endl; + + os << "--generate-validation Generate validation code." << ::std::endl; + + os << "--suppress-validation Suppress the generation of validation code." << ::std::endl; + + os << "--generate-polymorphic Generate polymorphism-aware code." << ::std::endl; + + os << "--generate-noop-impl Generate a sample parser implementation that does" << ::std::endl + << " nothing (no operation)." << ::std::endl; + + os << "--generate-print-impl Generate a sample parser implementation that" << ::std::endl + << " prints the XML data to STDOUT." << ::std::endl; + + os << "--generate-test-driver Generate a test driver for the sample parser" << ::std::endl + << " implementation." << ::std::endl; + + os << "--force-overwrite Force overwriting of the existing implementation" << ::std::endl + << " and test driver files." << ::std::endl; + + os << "--root-element-first Indicate that the first global element is the" << ::std::endl + << " document root." << ::std::endl; + + os << "--root-element-last Indicate that the last global element is the" << ::std::endl + << " document root." << ::std::endl; + + os << "--root-element Indicate that is the document root." << ::std::endl; + + os << "--skel-type-suffix Use the provided instead of the default" << ::std::endl + << " _pskel to construct the names of the generated" << ::std::endl + << " parser skeletons." << ::std::endl; + + os << "--skel-file-suffix Use the provided instead of the default" << ::std::endl + << " -pskel to construct the names of the generated" << ::std::endl + << " parser skeleton files." << ::std::endl; + + os << "--impl-type-suffix Use the provided instead of the default" << ::std::endl + << " _pimpl to construct the names of the parser" << ::std::endl + << " implementations for the built-in XML Schema types" << ::std::endl + << " as well as sample parser implementations." << ::std::endl; + + os << "--impl-file-suffix Use the provided instead of the default" << ::std::endl + << " -pimpl to construct the names of the generated" << ::std::endl + << " sample parser implementation files." << ::std::endl; + + p = ::cli::usage_para::option; + + return p; + } + + typedef + std::map + _cli_options_map; + + static _cli_options_map _cli_options_map_; + + struct _cli_options_map_init + { + _cli_options_map_init () + { + _cli_options_map_["--type-map"] = + &::cli::thunk< options, NarrowStrings, &options::type_map_, + &options::type_map_specified_ >; + _cli_options_map_["--xml-parser"] = + &::cli::thunk< options, NarrowString, &options::xml_parser_, + &options::xml_parser_specified_ >; + _cli_options_map_["--generate-validation"] = + &::cli::thunk< options, &options::generate_validation_ >; + _cli_options_map_["--suppress-validation"] = + &::cli::thunk< options, &options::suppress_validation_ >; + _cli_options_map_["--generate-polymorphic"] = + &::cli::thunk< options, &options::generate_polymorphic_ >; + _cli_options_map_["--generate-noop-impl"] = + &::cli::thunk< options, &options::generate_noop_impl_ >; + _cli_options_map_["--generate-print-impl"] = + &::cli::thunk< options, &options::generate_print_impl_ >; + _cli_options_map_["--generate-test-driver"] = + &::cli::thunk< options, &options::generate_test_driver_ >; + _cli_options_map_["--force-overwrite"] = + &::cli::thunk< options, &options::force_overwrite_ >; + _cli_options_map_["--root-element-first"] = + &::cli::thunk< options, &options::root_element_first_ >; + _cli_options_map_["--root-element-last"] = + &::cli::thunk< options, &options::root_element_last_ >; + _cli_options_map_["--root-element"] = + &::cli::thunk< options, NarrowString, &options::root_element_, + &options::root_element_specified_ >; + _cli_options_map_["--skel-type-suffix"] = + &::cli::thunk< options, NarrowString, &options::skel_type_suffix_, + &options::skel_type_suffix_specified_ >; + _cli_options_map_["--skel-file-suffix"] = + &::cli::thunk< options, NarrowString, &options::skel_file_suffix_, + &options::skel_file_suffix_specified_ >; + _cli_options_map_["--impl-type-suffix"] = + &::cli::thunk< options, NarrowString, &options::impl_type_suffix_, + &options::impl_type_suffix_specified_ >; + _cli_options_map_["--impl-file-suffix"] = + &::cli::thunk< options, NarrowString, &options::impl_file_suffix_, + &options::impl_file_suffix_specified_ >; + } + }; + + static _cli_options_map_init _cli_options_map_init_; + + bool options:: + _parse (const char* o, ::cli::scanner& s) + { + _cli_options_map::const_iterator i (_cli_options_map_.find (o)); + + if (i != _cli_options_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // options base + // + if (::CXX::options::_parse (o, s)) + return true; + + return false; + } + + bool options:: + _parse (::cli::scanner& s, + ::cli::unknown_mode opt_mode, + ::cli::unknown_mode arg_mode) + { + // Can't skip combined flags (--no-combined-flags). + // + assert (opt_mode != ::cli::unknown_mode::skip); + + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + + if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0') + { + // Handle combined option values. + // + std::string co; + if (const char* v = std::strchr (o, '=')) + { + co.assign (o, 0, v - o); + ++v; + + int ac (2); + char* av[] = + { + const_cast (co.c_str ()), + const_cast (v) + }; + + ::cli::argv_scanner ns (0, ac, av); + + if (_parse (co.c_str (), ns)) + { + // Parsed the option but not its value? + // + if (ns.end () != 2) + throw ::cli::invalid_value (co, v); + + s.next (); + r = true; + continue; + } + else + { + // Set the unknown option and fall through. + // + o = co.c_str (); + } + } + + // Handle combined flags. + // + char cf[3]; + { + const char* p = o + 1; + for (; *p != '\0'; ++p) + { + if (!((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9'))) + break; + } + + if (*p == '\0') + { + for (p = o + 1; *p != '\0'; ++p) + { + std::strcpy (cf, "-"); + cf[1] = *p; + cf[2] = '\0'; + + int ac (1); + char* av[] = + { + cf + }; + + ::cli::argv_scanner ns (0, ac, av); + + if (!_parse (cf, ns)) + break; + } + + if (*p == '\0') + { + // All handled. + // + s.next (); + r = true; + continue; + } + else + { + // Set the unknown option and fall through. + // + o = cf; + } + } + } + + switch (opt_mode) + { + case ::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::cli::unknown_mode::stop: + { + break; + } + case ::cli::unknown_mode::fail: + { + throw ::cli::unknown_option (o); + } + } + + break; + } + } + + switch (arg_mode) + { + case ::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::cli::unknown_mode::stop: + { + break; + } + case ::cli::unknown_mode::fail: + { + throw ::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/xsd/xsd/pregenerated/xsd/cxx/parser/options.hxx b/xsd/xsd/pregenerated/xsd/cxx/parser/options.hxx new file mode 100644 index 0000000..03b67fd --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/parser/options.hxx @@ -0,0 +1,186 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef XSD_CXX_PARSER_OPTIONS_HXX +#define XSD_CXX_PARSER_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include + +#include + +#include + +namespace CXX +{ + namespace Parser + { + class options: public ::CXX::options + { + public: + options (); + + options (int& argc, + char** argv, + bool erase = false, + ::cli::unknown_mode option = ::cli::unknown_mode::fail, + ::cli::unknown_mode argument = ::cli::unknown_mode::stop); + + options (int start, + int& argc, + char** argv, + bool erase = false, + ::cli::unknown_mode option = ::cli::unknown_mode::fail, + ::cli::unknown_mode argument = ::cli::unknown_mode::stop); + + options (int& argc, + char** argv, + int& end, + bool erase = false, + ::cli::unknown_mode option = ::cli::unknown_mode::fail, + ::cli::unknown_mode argument = ::cli::unknown_mode::stop); + + options (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::cli::unknown_mode option = ::cli::unknown_mode::fail, + ::cli::unknown_mode argument = ::cli::unknown_mode::stop); + + options (::cli::scanner&, + ::cli::unknown_mode option = ::cli::unknown_mode::fail, + ::cli::unknown_mode argument = ::cli::unknown_mode::stop); + + // Option accessors. + // + const NarrowStrings& + type_map () const; + + bool + type_map_specified () const; + + const NarrowString& + xml_parser () const; + + bool + xml_parser_specified () const; + + const bool& + generate_validation () const; + + const bool& + suppress_validation () const; + + const bool& + generate_polymorphic () const; + + const bool& + generate_noop_impl () const; + + const bool& + generate_print_impl () const; + + const bool& + generate_test_driver () const; + + const bool& + force_overwrite () const; + + const bool& + root_element_first () const; + + const bool& + root_element_last () const; + + const NarrowString& + root_element () const; + + bool + root_element_specified () const; + + const NarrowString& + skel_type_suffix () const; + + bool + skel_type_suffix_specified () const; + + const NarrowString& + skel_file_suffix () const; + + bool + skel_file_suffix_specified () const; + + const NarrowString& + impl_type_suffix () const; + + bool + impl_type_suffix_specified () const; + + const NarrowString& + impl_file_suffix () const; + + bool + impl_file_suffix_specified () const; + + // Print usage information. + // + static ::cli::usage_para + print_usage (::std::wostream&, + ::cli::usage_para = ::cli::usage_para::none); + + // Implementation details. + // + protected: + bool + _parse (const char*, ::cli::scanner&); + + private: + bool + _parse (::cli::scanner&, + ::cli::unknown_mode option, + ::cli::unknown_mode argument); + + public: + NarrowStrings type_map_; + bool type_map_specified_; + NarrowString xml_parser_; + bool xml_parser_specified_; + bool generate_validation_; + bool suppress_validation_; + bool generate_polymorphic_; + bool generate_noop_impl_; + bool generate_print_impl_; + bool generate_test_driver_; + bool force_overwrite_; + bool root_element_first_; + bool root_element_last_; + NarrowString root_element_; + bool root_element_specified_; + NarrowString skel_type_suffix_; + bool skel_type_suffix_specified_; + NarrowString skel_file_suffix_; + bool skel_file_suffix_specified_; + NarrowString impl_type_suffix_; + bool impl_type_suffix_specified_; + NarrowString impl_file_suffix_; + bool impl_file_suffix_specified_; + }; + } +} + +#include + +// Begin epilogue. +// +// +// End epilogue. + +#endif // XSD_CXX_PARSER_OPTIONS_HXX diff --git a/xsd/xsd/pregenerated/xsd/cxx/parser/options.ixx b/xsd/xsd/pregenerated/xsd/cxx/parser/options.ixx new file mode 100644 index 0000000..64c00c5 --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/parser/options.ixx @@ -0,0 +1,162 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +namespace CXX +{ + namespace Parser + { + // options + // + + inline const NarrowStrings& options:: + type_map () const + { + return this->type_map_; + } + + inline bool options:: + type_map_specified () const + { + return this->type_map_specified_; + } + + inline const NarrowString& options:: + xml_parser () const + { + return this->xml_parser_; + } + + inline bool options:: + xml_parser_specified () const + { + return this->xml_parser_specified_; + } + + inline const bool& options:: + generate_validation () const + { + return this->generate_validation_; + } + + inline const bool& options:: + suppress_validation () const + { + return this->suppress_validation_; + } + + inline const bool& options:: + generate_polymorphic () const + { + return this->generate_polymorphic_; + } + + inline const bool& options:: + generate_noop_impl () const + { + return this->generate_noop_impl_; + } + + inline const bool& options:: + generate_print_impl () const + { + return this->generate_print_impl_; + } + + inline const bool& options:: + generate_test_driver () const + { + return this->generate_test_driver_; + } + + inline const bool& options:: + force_overwrite () const + { + return this->force_overwrite_; + } + + inline const bool& options:: + root_element_first () const + { + return this->root_element_first_; + } + + inline const bool& options:: + root_element_last () const + { + return this->root_element_last_; + } + + inline const NarrowString& options:: + root_element () const + { + return this->root_element_; + } + + inline bool options:: + root_element_specified () const + { + return this->root_element_specified_; + } + + inline const NarrowString& options:: + skel_type_suffix () const + { + return this->skel_type_suffix_; + } + + inline bool options:: + skel_type_suffix_specified () const + { + return this->skel_type_suffix_specified_; + } + + inline const NarrowString& options:: + skel_file_suffix () const + { + return this->skel_file_suffix_; + } + + inline bool options:: + skel_file_suffix_specified () const + { + return this->skel_file_suffix_specified_; + } + + inline const NarrowString& options:: + impl_type_suffix () const + { + return this->impl_type_suffix_; + } + + inline bool options:: + impl_type_suffix_specified () const + { + return this->impl_type_suffix_specified_; + } + + inline const NarrowString& options:: + impl_file_suffix () const + { + return this->impl_file_suffix_; + } + + inline bool options:: + impl_file_suffix_specified () const + { + return this->impl_file_suffix_specified_; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/xsd/xsd/pregenerated/xsd/cxx/tree/options.cxx b/xsd/xsd/pregenerated/xsd/cxx/tree/options.cxx new file mode 100644 index 0000000..60ddeb0 --- /dev/null +++ b/xsd/xsd/pregenerated/xsd/cxx/tree/options.cxx @@ -0,0 +1,1293 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include +// +// End prologue. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cli +{ + template + struct parser + { + static void + parse (X& x, bool& xs, scanner& s) + { + using namespace std; + + const char* o (s.next ()); + if (s.more ()) + { + string v (s.next ()); + istringstream is (v); + if (!(is >> x && is.peek () == istringstream::traits_type::eof ())) + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (bool& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (std::string& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + x = s.next (); + else + throw missing_value (o); + + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::pair& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser::parse (x.first, xs, s); + } + }; + + template + struct parser > + { + static void + parse (std::vector& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.push_back (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::set& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.insert (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::map& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, s); + } + + template + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, x.*S, s); + } +} + +#include + +namespace CXX +{ + namespace Tree + { + // options + // + + options:: + options () + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + } + + options:: + options (int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int start, + int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (::cli::scanner& s, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + _parse (s, opt, arg); + } + + ::cli::usage_para options:: + print_usage (::std::wostream& os, ::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::cli::usage_para::text) + os << ::std::endl; + + os << "--generate-polymorphic Generate polymorphism-aware code." << ::std::endl; + + os << "--polymorphic-type Indicate that is a root of a polymorphic" << ::std::endl + << " type hierarchy." << ::std::endl; + + os << "--polymorphic-type-all Indicate that all types should be treated as" << ::std::endl + << " polymorphic." << ::std::endl; + + os << "--polymorphic-plate Specify the polymorphic map plate the generated" << ::std::endl + << " code should register on." << ::std::endl; + + os << "--ordered-type Indicate that element order in is" << ::std::endl + << " significant." << ::std::endl; + + os << "--ordered-type-derived Automatically treat types derived from ordered" << ::std::endl + << " bases as also ordered." << ::std::endl; + + os << "--ordered-type-mixed Automatically treat complex types with mixed" << ::std::endl + << " content as ordered." << ::std::endl; + + os << "--ordered-type-all Indicate that element order in all types is" << ::std::endl + << " significant." << ::std::endl; + + os << "--order-container Specify a custom class template that should be" << ::std::endl + << " used as a container for the content order in" << ::std::endl + << " ordered types instead of the default std::vector." << ::std::endl; + + os << "--generate-serialization Generate serialization functions." << ::std::endl; + + os << "--generate-ostream Generate ostream insertion operators (operator<<)" << ::std::endl + << " for generated types." << ::std::endl; + + os << "--generate-doxygen Generate documentation comments suitable for" << ::std::endl + << " extraction by the Doxygen documentation system." << ::std::endl; + + os << "--generate-comparison Generate comparison operators (operator== and" << ::std::endl + << " operator!=) for complex types." << ::std::endl; + + os << "--generate-default-ctor Generate default constructors even for types that" << ::std::endl + << " have required members." << ::std::endl; + + os << "--generate-from-base-ctor Generate constructors that expect an instance of a" << ::std::endl + << " base type followed by all required members." << ::std::endl; + + os << "--suppress-assignment Suppress the generation of copy assignment" << ::std::endl + << " operators for complex types." << ::std::endl; + + os << "--generate-detach Generate detach functions for required elements" << ::std::endl + << " and attributes." << ::std::endl; + + os << "--generate-wildcard Generate accessors and modifiers as well as" << ::std::endl + << " parsing and serialization code for XML Schema" << ::std::endl + << " wildcards (any and anyAttribute)." << ::std::endl; + + os << "--generate-any-type Extract and store content of the XML Schema" << ::std::endl + << " anyType type as a DOM fragment." << ::std::endl; + + os << "--generate-insertion Generate data representation stream insertion" << ::std::endl + << " operators for the output stream type." << ::std::endl; + + os << "--generate-extraction Generate data representation stream extraction" << ::std::endl + << " constructors for the input stream type." << ::std::endl; + + os << "--generate-forward Generate a separate header file with forward" << ::std::endl + << " declarations for the types being generated." << ::std::endl; + + os << "--suppress-parsing Suppress the generation of the parsing functions" << ::std::endl + << " and constructors." << ::std::endl; + + os << "--generate-element-type Generate types instead of parsing and" << ::std::endl + << " serialization functions for root elements." << ::std::endl; + + os << "--generate-element-map Generate a root element map that allows uniform" << ::std::endl + << " parsing and serialization of multiple root" << ::std::endl + << " elements." << ::std::endl; + + os << "--generate-intellisense Generate workarounds for IntelliSense bugs in" << ::std::endl + << " Visual Studio 2005 (8.0)." << ::std::endl; + + os << "--omit-default-attributes Omit attributes with default and fixed values from" << ::std::endl + << " serialized XML documents." << ::std::endl; + + os << "--type-naming