aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-06-21 10:20:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-06-21 10:20:42 +0200
commitc34158508eafb020fbb7bbb7c0b2479982c426cd (patch)
tree49e7fcbde369f01ecc5524853dddbbf4a109c603
parentef4efbab2664232aa35b0111a6d430d2c67ababd (diff)
Completion of the CLI port
-rw-r--r--documentation/makefile20
-rw-r--r--xsde/cxx/elements.cxx76
-rw-r--r--xsde/cxx/elements.hxx43
-rw-r--r--xsde/cxx/hybrid/cli.hxx216
-rw-r--r--xsde/cxx/hybrid/elements.cxx48
-rw-r--r--xsde/cxx/hybrid/elements.hxx19
-rw-r--r--xsde/cxx/hybrid/extraction-header.cxx14
-rw-r--r--xsde/cxx/hybrid/extraction-source.cxx14
-rw-r--r--xsde/cxx/hybrid/generator.cxx728
-rw-r--r--xsde/cxx/hybrid/generator.hxx36
-rw-r--r--xsde/cxx/hybrid/insertion-header.cxx14
-rw-r--r--xsde/cxx/hybrid/insertion-source.cxx14
-rw-r--r--xsde/cxx/hybrid/options.cli22
-rw-r--r--xsde/cxx/hybrid/parser-header.cxx4
-rw-r--r--xsde/cxx/hybrid/parser-name-processor.cxx69
-rw-r--r--xsde/cxx/hybrid/parser-name-processor.hxx4
-rw-r--r--xsde/cxx/hybrid/parser-source.cxx12
-rw-r--r--xsde/cxx/hybrid/serializer-name-processor.cxx72
-rw-r--r--xsde/cxx/hybrid/serializer-name-processor.hxx4
-rw-r--r--xsde/cxx/hybrid/serializer-source.cxx14
-rw-r--r--xsde/cxx/hybrid/tree-forward.cxx12
-rw-r--r--xsde/cxx/hybrid/tree-header.cxx6
-rw-r--r--xsde/cxx/hybrid/tree-inline.cxx2
-rw-r--r--xsde/cxx/hybrid/tree-name-processor.cxx44
-rw-r--r--xsde/cxx/hybrid/tree-name-processor.hxx4
-rw-r--r--xsde/cxx/hybrid/tree-size-processor.cxx27
-rw-r--r--xsde/cxx/hybrid/tree-size-processor.hxx4
-rw-r--r--xsde/cxx/hybrid/tree-type-map.cxx31
-rw-r--r--xsde/cxx/hybrid/tree-type-map.hxx4
-rw-r--r--xsde/cxx/hybrid/validator.cxx37
-rw-r--r--xsde/cxx/hybrid/validator.hxx4
-rw-r--r--xsde/cxx/parser/cli.hxx160
-rw-r--r--xsde/cxx/parser/driver-source.cxx64
-rw-r--r--xsde/cxx/parser/elements.cxx35
-rw-r--r--xsde/cxx/parser/elements.hxx19
-rw-r--r--xsde/cxx/parser/generator.cxx224
-rw-r--r--xsde/cxx/parser/generator.hxx14
-rw-r--r--xsde/cxx/parser/impl-source.cxx34
-rw-r--r--xsde/cxx/parser/name-processor.cxx42
-rw-r--r--xsde/cxx/parser/name-processor.hxx4
-rw-r--r--xsde/cxx/parser/parser-header.cxx10
-rw-r--r--xsde/cxx/parser/parser-inline.cxx2
-rw-r--r--xsde/cxx/parser/parser-source.cxx2
-rw-r--r--xsde/cxx/parser/print-impl-common.hxx88
-rw-r--r--xsde/cxx/parser/type-processor.cxx12
-rw-r--r--xsde/cxx/parser/type-processor.hxx4
-rw-r--r--xsde/cxx/parser/validator.cxx40
-rw-r--r--xsde/cxx/parser/validator.hxx4
-rw-r--r--xsde/cxx/serializer/cli.hxx158
-rw-r--r--xsde/cxx/serializer/driver-source.cxx44
-rw-r--r--xsde/cxx/serializer/elements.cxx37
-rw-r--r--xsde/cxx/serializer/elements.hxx19
-rw-r--r--xsde/cxx/serializer/generator.cxx223
-rw-r--r--xsde/cxx/serializer/generator.hxx14
-rw-r--r--xsde/cxx/serializer/name-processor.cxx39
-rw-r--r--xsde/cxx/serializer/name-processor.hxx4
-rw-r--r--xsde/cxx/serializer/serializer-header.cxx10
-rw-r--r--xsde/cxx/serializer/serializer-inline.cxx2
-rw-r--r--xsde/cxx/serializer/serializer-source.cxx2
-rw-r--r--xsde/cxx/serializer/type-processor.cxx12
-rw-r--r--xsde/cxx/serializer/type-processor.hxx4
-rw-r--r--xsde/cxx/serializer/validator.cxx37
-rw-r--r--xsde/cxx/serializer/validator.hxx4
-rw-r--r--xsde/makefile7
-rw-r--r--xsde/options-parser.hxx31
-rw-r--r--xsde/types.hxx15
-rw-r--r--xsde/xsde.cxx417
67 files changed, 1043 insertions, 2412 deletions
diff --git a/documentation/makefile b/documentation/makefile
index 1a72794..1b49042 100644
--- a/documentation/makefile
+++ b/documentation/makefile
@@ -51,29 +51,29 @@ $(out_base)/xsde.xhtml: $(src_base)/xsde-prologue.xhtml \
#
$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base --class CXX::options \
---class options --html-prologue $(src_base)/xsde-prologue.xhtml \
+--class options --html-prologue-file $(src_base)/xsde-prologue.xhtml \
$$1 >$@, $(src_root)/xsde/cxx/options.cli)
# C++/Hybrid options.
#
$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base \
---html-prologue $(src_base)/xsde-hybrid-header.xhtml \
+--html-prologue-file $(src_base)/xsde-hybrid-header.xhtml \
$$1 >>$@, $(src_root)/xsde/cxx/hybrid/options.cli)
# C++/Parser options.
#
$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base \
---html-prologue $(src_base)/xsde-parser-header.xhtml \
+--html-prologue-file $(src_base)/xsde-parser-header.xhtml \
$$1 >>$@, $(src_root)/xsde/cxx/parser/options.cli)
# C++/Serializer options.
#
$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base \
---html-prologue $(src_base)/xsde-serializer-header.xhtml \
---html-epilogue $(src_base)/xsde-epilogue.xhtml \
+--html-prologue-file $(src_base)/xsde-serializer-header.xhtml \
+--html-epilogue-file $(src_base)/xsde-epilogue.xhtml \
$$1 >>$@, $(src_root)/xsde/cxx/serializer/options.cli)
@@ -89,29 +89,29 @@ $(out_base)/xsde.1: $(src_base)/xsde-prologue.1 \
#
$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base --class CXX::options \
---class options --man-prologue $(src_base)/xsde-prologue.1 \
+--class options --man-prologue-file $(src_base)/xsde-prologue.1 \
$$1 >$@, $(src_root)/xsde/cxx/options.cli)
# C++/Hybrid options.
#
$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base \
---man-prologue $(src_base)/xsde-hybrid-header.1 \
+--man-prologue-file $(src_base)/xsde-hybrid-header.1 \
$$1 >>$@, $(src_root)/xsde/cxx/hybrid/options.cli)
# C++/Parser options.
#
$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base \
---man-prologue $(src_base)/xsde-parser-header.1 \
+--man-prologue-file $(src_base)/xsde-parser-header.1 \
$$1 >>$@, $(src_root)/xsde/cxx/parser/options.cli)
# C++/Serializer options.
#
$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base \
---man-prologue $(src_base)/xsde-serializer-header.1 \
---man-epilogue $(src_base)/xsde-epilogue.1 \
+--man-prologue-file $(src_base)/xsde-serializer-header.1 \
+--man-epilogue-file $(src_base)/xsde-epilogue.1 \
$$1 >>$@, $(src_root)/xsde/cxx/serializer/options.cli)
diff --git a/xsde/cxx/elements.cxx b/xsde/cxx/elements.cxx
index cc41e08..e466ff1 100644
--- a/xsde/cxx/elements.cxx
+++ b/xsde/cxx/elements.cxx
@@ -110,57 +110,40 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
+ options_type const& ops,
Char const* name_key,
- NarrowString const& char_type__,
- NarrowString const& char_encoding__,
- Boolean include_with_brackets__,
- NarrowString const& include_prefix__,
- NarrowString const& esymbol,
- Containers::Vector<NarrowString> const& nsm,
- Containers::Vector<NarrowString> const& nsr,
- Boolean trace_namespace_regex_,
- Containers::Vector<NarrowString> const& ir,
- Boolean trace_include_regex_,
- Boolean inline_,
- Boolean custom_allocator,
- Boolean ll,
- Containers::Vector<NarrowString> const& reserved_name)
+ NarrowString const& char_type__)
: os (o),
schema_root (root),
schema_path (schema_path_),
+ options (ops),
ename_key (ename_key_),
char_type (char_type_),
char_encoding (char_encoding_),
L (L_),
string_type (string_type_),
- include_with_brackets (include_with_brackets_),
- include_prefix (include_prefix_),
type_exp (type_exp_),
inst_exp (inst_exp_),
inl (inl_),
- custom_alloc (custom_allocator),
- long_long (ll),
+ custom_alloc (ops.custom_allocator ()),
+ long_long (!ops.no_long_long ()),
ns_mapping_cache (ns_mapping_cache_),
schema_path_ (path),
xs_ns_ (0),
ename_key_ (name_key),
char_type_ (char_type__),
- char_encoding_ (char_encoding__),
+ char_encoding_ (ops.char_encoding ()),
L_ (char_type == L"wchar_t" ? L"L" : L""),
- include_with_brackets_ (include_with_brackets__),
- include_prefix_ (include_prefix__),
- type_exp_ (esymbol ? esymbol + " " : esymbol),
- inst_exp_ (esymbol ? esymbol + "\n" : esymbol),
- inl_ (inline_ ? L"inline\n" : L""),
+ type_exp_ (/*esymbol ? esymbol + " " : esymbol*/),
+ inst_exp_ (/*esymbol ? esymbol + "\n" : esymbol*/),
+ inl_ (ops.generate_inline () ? L"inline\n" : L""),
cxx_id_expr_ (L"^(::)?([a-zA-Z_]\\w*)(::[a-zA-Z_]\\w*)*$"),
cxx_id_expr (cxx_id_expr_),
- trace_namespace_regex (trace_namespace_regex_),
urn_mapping_ (L"#^urn.*:([a-zA-Z_].*)$#$1#"),
urn_mapping (urn_mapping_),
nsr_mapping (nsr_mapping_),
nsm_mapping (nsm_mapping_),
include_mapping (include_mapping_),
- trace_include_regex (trace_include_regex_),
reserved_name_map (reserved_name_map_),
keyword_set (keyword_set_)
{
@@ -206,16 +189,16 @@ namespace CXX
// Custom regex mapping.
//
- for (Containers::Vector<NarrowString>::ConstIterator
- i (nsr.begin ()), e (nsr.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (ops.namespace_regex ().begin ()),
+ e (ops.namespace_regex ().end ()); i != e; ++i)
{
nsr_mapping_.push_back (Regex (String (*i)));
}
// Custom direct mapping.
//
- for (Containers::Vector<NarrowString>::ConstIterator
- i (nsm.begin ()), e (nsm.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (ops.namespace_map ().begin ()),
+ e (ops.namespace_map ().end ()); i != e; ++i)
{
String s (*i);
@@ -239,16 +222,16 @@ namespace CXX
// Include path regex
//
- for (Containers::Vector<NarrowString>::ConstIterator
- i (ir.begin ()), e (ir.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (ops.include_regex ().begin ()),
+ e (ops.include_regex ().end ()); i != e; ++i)
{
include_mapping_.push_back (Regex (String (*i)));
}
// Reserved names.
//
- for (Containers::Vector<NarrowString>::ConstIterator
- i (reserved_name.begin ()), e (reserved_name.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (ops.reserved_name ().begin ()),
+ e (ops.reserved_name ().end ()); i != e; ++i)
{
String s (*i);
@@ -333,7 +316,9 @@ namespace CXX
}
else
{
- if (trace_namespace_regex)
+ bool trace (options.namespace_regex_trace ());
+
+ if (trace)
wcerr << "namespace: '" << pair << "'" << endl;
Boolean found (false);
@@ -342,7 +327,7 @@ namespace CXX
for (RegexMapping::ConstReverseIterator e (nsr_mapping.rbegin ());
e != nsr_mapping.rend (); ++e)
{
- if (trace_namespace_regex)
+ if (trace)
wcerr << "try: '" << e->regex () << "' : ";
if (e->match (pair))
@@ -354,11 +339,11 @@ namespace CXX
//
found = cxx_id_expr.match (tmp);
- if (trace_namespace_regex)
+ if (trace)
wcerr << "'" << tmp << "' : ";
}
- if (trace_namespace_regex)
+ if (trace)
wcerr << (found ? '+' : '-') << endl;
if (found)
@@ -1106,9 +1091,10 @@ namespace CXX
String Context::
process_include_path (String const& name) const
{
- String path (include_prefix + name);
+ String path (String (options.include_prefix ()) + name);
+ bool trace (options.include_regex_trace ());
- if (trace_include_regex)
+ if (trace)
wcerr << "include: '" << path << "'" << endl;
String r;
@@ -1117,7 +1103,7 @@ namespace CXX
for (RegexMapping::ConstReverseIterator e (include_mapping.rbegin ());
e != include_mapping.rend (); ++e)
{
- if (trace_include_regex)
+ if (trace)
wcerr << "try: '" << e->regex () << "' : ";
if (e->match (path))
@@ -1125,11 +1111,11 @@ namespace CXX
r = e->replace (path);
found = true;
- if (trace_include_regex)
+ if (trace)
wcerr << "'" << r << "' : ";
}
- if (trace_include_regex)
+ if (trace)
wcerr << (found ? '+' : '-') << endl;
if (found)
@@ -1141,8 +1127,8 @@ namespace CXX
if (!r.empty () && r[0] != L'"' && r[0] != L'<')
{
- WideChar op (include_with_brackets ? L'<' : L'"');
- WideChar cl (include_with_brackets ? L'>' : L'"');
+ WideChar op (options.include_with_brackets () ? L'<' : L'"');
+ WideChar cl (options.include_with_brackets () ? L'>' : L'"');
r = op + r + cl;
}
diff --git a/xsde/cxx/elements.hxx b/xsde/cxx/elements.hxx
index 02b72eb..5dbb1cd 100644
--- a/xsde/cxx/elements.hxx
+++ b/xsde/cxx/elements.hxx
@@ -6,6 +6,8 @@
#ifndef CXX_ELEMENTS_HXX
#define CXX_ELEMENTS_HXX
+#include <ostream>
+
#include <cutl/re.hxx>
#include <cult/types.hxx>
@@ -16,9 +18,10 @@
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
+#include <types.hxx>
#include <elements.hxx>
-#include <ostream>
+#include <cxx/options.hxx>
namespace CXX
{
@@ -144,38 +147,27 @@ namespace CXX
typedef Cult::Containers::Map<String, String> ReservedNameMap;
typedef Cult::Containers::Set<String> KeywordSet;
+ typedef CXX::options options_type;
+
public:
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
+ options_type const&,
Char const* name_key,
- NarrowString const& char_type__,
- NarrowString const& char_encoding__,
- Boolean include_with_brackets__,
- NarrowString const& include_prefix__,
- NarrowString const& esymbol,
- Containers::Vector<NarrowString> const& nsm,
- Containers::Vector<NarrowString> const& nsr,
- Boolean trace_namespace_regex_,
- Containers::Vector<NarrowString> const& include_regex,
- Boolean trace_include_regex_,
- Boolean inline_,
- Boolean custom_allocator,
- Boolean long_long,
- Containers::Vector<NarrowString> const& reserved_name);
+ NarrowString const& char_type);
protected:
Context (Context& c)
: os (c.os),
schema_root (c.schema_root),
schema_path (c.schema_path),
+ options (c.options),
ename_key (c.ename_key),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
string_type (c.string_type),
- include_with_brackets (c.include_with_brackets),
- include_prefix (c.include_prefix),
type_exp (c.type_exp),
inst_exp (c.inst_exp),
inl (c.inl),
@@ -184,12 +176,10 @@ namespace CXX
ns_mapping_cache (c.ns_mapping_cache),
xs_ns_ (c.xs_ns_),
cxx_id_expr (c.cxx_id_expr),
- trace_namespace_regex (c.trace_namespace_regex),
urn_mapping (c.urn_mapping),
nsr_mapping (c.nsr_mapping),
nsm_mapping (c.nsm_mapping),
include_mapping (c.include_mapping),
- trace_include_regex (c.trace_include_regex),
reserved_name_map (c.reserved_name_map),
keyword_set (c.keyword_set)
{
@@ -199,13 +189,12 @@ namespace CXX
: os (o),
schema_root (c.schema_root),
schema_path (c.schema_path),
+ options (c.options),
ename_key (c.ename_key),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
string_type (c.string_type),
- include_with_brackets (c.include_with_brackets),
- include_prefix (c.include_prefix),
type_exp (c.type_exp),
inst_exp (c.inst_exp),
inl (c.inl),
@@ -214,12 +203,10 @@ namespace CXX
ns_mapping_cache (c.ns_mapping_cache),
xs_ns_ (c.xs_ns_),
cxx_id_expr (c.cxx_id_expr),
- trace_namespace_regex (c.trace_namespace_regex),
urn_mapping (c.urn_mapping),
nsr_mapping (c.nsr_mapping),
nsm_mapping (c.nsm_mapping),
include_mapping (c.include_mapping),
- trace_include_regex (c.trace_include_regex),
reserved_name_map (c.reserved_name_map),
keyword_set (c.keyword_set)
{
@@ -331,6 +318,8 @@ namespace CXX
SemanticGraph::Schema& schema_root;
SemanticGraph::Path const& schema_path;
+ options_type const& options;
+
NarrowString const& ename_key;
String& char_type;
@@ -338,9 +327,6 @@ namespace CXX
String& L; // string literal prefix
String& string_type;
- Boolean& include_with_brackets;
- String& include_prefix;
-
String& type_exp;
String& inst_exp;
String& inl;
@@ -363,9 +349,6 @@ namespace CXX
String L_;
String string_type_;
- Boolean include_with_brackets_;
- String include_prefix_;
-
String type_exp_;
String inst_exp_;
String inl_;
@@ -373,7 +356,6 @@ namespace CXX
private:
RegexPat const cxx_id_expr_;
RegexPat const& cxx_id_expr;
- Boolean trace_namespace_regex;
Regex urn_mapping_;
RegexMapping nsr_mapping_;
MapMapping nsm_mapping_;
@@ -384,7 +366,6 @@ namespace CXX
RegexMapping include_mapping_;
RegexMapping const& include_mapping;
- Boolean trace_include_regex;
ReservedNameMap const& reserved_name_map;
ReservedNameMap reserved_name_map_;
diff --git a/xsde/cxx/hybrid/cli.hxx b/xsde/cxx/hybrid/cli.hxx
deleted file mode 100644
index f697247..0000000
--- a/xsde/cxx/hybrid/cli.hxx
+++ /dev/null
@@ -1,216 +0,0 @@
-// file : xsde/cxx/hybrid/cli.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef CXX_HYBRID_CLI_HXX
-#define CXX_HYBRID_CLI_HXX
-
-#include <cult/types.hxx>
-
-#include <cult/containers/vector.hxx>
-
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
-namespace CXX
-{
- namespace Hybrid
- {
- namespace CLI
- {
- using namespace Cult::Types;
-
- typedef Char const Key[];
-
- extern Key char_encoding;
- extern Key no_stl;
- extern Key no_iostream;
- extern Key no_exceptions;
- extern Key no_long_long;
- extern Key generate_parser;
- extern Key generate_serializer;
- extern Key generate_aggregate;
- extern Key suppress_validation;
- extern Key suppress_parser_val;
- extern Key suppress_serializer_val;
- extern Key omit_default_attributes;
- extern Key suppress_enum;
- extern Key generate_clone;
- extern Key generate_detach;
- extern Key generate_insertion;
- extern Key generate_extraction;
- extern Key generate_inline;
- extern Key generate_forward;
- extern Key generate_xml_schema;
- extern Key extern_xml_schema;
- extern Key suppress_reset;
- extern Key custom_allocator;
- extern Key generate_polymorphic;
- extern Key runtime_polymorphic;
- extern Key polymorphic_type;
- extern Key generate_typeinfo;
- extern Key polymorphic_schema;
- extern Key reuse_style_mixin;
- extern Key custom_data;
- extern Key custom_type;
- extern Key custom_parser;
- extern Key custom_serializer;
- extern Key root_element_first;
- extern Key root_element_last;
- extern Key root_element_all;
- extern Key root_element_none;
- extern Key root_element;
- extern Key root_type;
- extern Key output_dir;
- extern Key pskel_type_suffix;
- extern Key sskel_type_suffix;
- extern Key pskel_file_suffix;
- extern Key sskel_file_suffix;
- extern Key pimpl_type_suffix;
- extern Key simpl_type_suffix;
- extern Key pimpl_file_suffix;
- extern Key simpl_file_suffix;
- extern Key paggr_type_suffix;
- extern Key saggr_type_suffix;
- extern Key namespace_map;
- extern Key namespace_regex;
- extern Key namespace_regex_trace;
- extern Key reserved_name;
- extern Key include_with_brackets;
- extern Key include_prefix;
- extern Key include_regex;
- extern Key include_regex_trace;
- extern Key guard_prefix;
- extern Key hxx_suffix;
- extern Key ixx_suffix;
- extern Key cxx_suffix;
- extern Key fwd_suffix;
- extern Key hxx_regex;
- extern Key ixx_regex;
- extern Key cxx_regex;
- extern Key fwd_regex;
- extern Key hxx_prologue;
- extern Key ixx_prologue;
- extern Key cxx_prologue;
- extern Key fwd_prologue;
- extern Key prologue;
- extern Key hxx_epilogue;
- extern Key ixx_epilogue;
- extern Key cxx_epilogue;
- extern Key fwd_epilogue;
- extern Key epilogue;
- extern Key hxx_prologue_file;
- extern Key ixx_prologue_file;
- extern Key cxx_prologue_file;
- extern Key fwd_prologue_file;
- extern Key prologue_file;
- extern Key hxx_epilogue_file;
- extern Key ixx_epilogue_file;
- extern Key cxx_epilogue_file;
- extern Key fwd_epilogue_file;
- extern Key epilogue_file;
- extern Key show_anonymous;
- extern Key show_sloc;
- extern Key proprietary_license;
-
- typedef Cult::CLI::Options<
- char_encoding, NarrowString,
- no_stl, Boolean,
- no_iostream, Boolean,
- no_exceptions, Boolean,
- no_long_long, Boolean,
- generate_parser, Boolean,
- generate_serializer, Boolean,
- generate_aggregate, Boolean,
- suppress_validation, Boolean,
- suppress_parser_val, Boolean,
- suppress_serializer_val, Boolean,
- omit_default_attributes, Boolean,
- suppress_enum, Boolean,
- generate_clone, Boolean,
- generate_detach, Boolean,
- generate_insertion, Cult::Containers::Vector<NarrowString>,
- generate_extraction, Cult::Containers::Vector<NarrowString>,
- generate_inline, Boolean,
- generate_forward, Boolean,
- generate_xml_schema, Boolean,
- extern_xml_schema, NarrowString,
- suppress_reset, Boolean,
- custom_allocator, Boolean,
- generate_polymorphic, Boolean,
- runtime_polymorphic, Boolean,
- polymorphic_type, Cult::Containers::Vector<NarrowString>,
- generate_typeinfo, Boolean,
- polymorphic_schema, Cult::Containers::Vector<NarrowString>,
- reuse_style_mixin, Boolean,
- custom_data, Cult::Containers::Vector<NarrowString>,
- custom_type, Cult::Containers::Vector<NarrowString>,
- custom_parser, Cult::Containers::Vector<NarrowString>,
- custom_serializer, Cult::Containers::Vector<NarrowString>,
- root_element_first, Boolean,
- root_element_last, Boolean,
- root_element_all, Boolean,
- root_element_none, Boolean,
- root_element, Cult::Containers::Vector<NarrowString>,
- root_type, Cult::Containers::Vector<NarrowString>,
- output_dir, NarrowString,
- pskel_type_suffix, NarrowString,
- sskel_type_suffix, NarrowString,
- pskel_file_suffix, NarrowString,
- sskel_file_suffix, NarrowString,
- pimpl_type_suffix, NarrowString,
- simpl_type_suffix, NarrowString,
- pimpl_file_suffix, NarrowString,
- simpl_file_suffix, NarrowString,
- paggr_type_suffix, NarrowString,
- saggr_type_suffix, NarrowString,
- namespace_map, Cult::Containers::Vector<NarrowString>,
- namespace_regex, Cult::Containers::Vector<NarrowString>,
- namespace_regex_trace, Boolean,
- reserved_name, Cult::Containers::Vector<NarrowString>,
- include_with_brackets, Boolean,
- include_prefix, NarrowString,
- include_regex, Cult::Containers::Vector<NarrowString>,
- include_regex_trace, Boolean,
- guard_prefix, NarrowString,
- hxx_suffix, NarrowString,
- ixx_suffix, NarrowString,
- cxx_suffix, NarrowString,
- fwd_suffix, NarrowString,
- hxx_regex, Cult::Containers::Vector<NarrowString>,
- ixx_regex, Cult::Containers::Vector<NarrowString>,
- cxx_regex, Cult::Containers::Vector<NarrowString>,
- fwd_regex, NarrowString,
- hxx_prologue, Cult::Containers::Vector<NarrowString>,
- ixx_prologue, Cult::Containers::Vector<NarrowString>,
- cxx_prologue, Cult::Containers::Vector<NarrowString>,
- fwd_prologue, Cult::Containers::Vector<NarrowString>,
- prologue, Cult::Containers::Vector<NarrowString>,
- hxx_epilogue, Cult::Containers::Vector<NarrowString>,
- ixx_epilogue, Cult::Containers::Vector<NarrowString>,
- cxx_epilogue, Cult::Containers::Vector<NarrowString>,
- fwd_epilogue, Cult::Containers::Vector<NarrowString>,
- epilogue, Cult::Containers::Vector<NarrowString>,
- hxx_prologue_file, Cult::Containers::Vector<NarrowString>,
- ixx_prologue_file, Cult::Containers::Vector<NarrowString>,
- cxx_prologue_file, Cult::Containers::Vector<NarrowString>,
- fwd_prologue_file, NarrowString,
- prologue_file, Cult::Containers::Vector<NarrowString>,
- hxx_epilogue_file, Cult::Containers::Vector<NarrowString>,
- ixx_epilogue_file, Cult::Containers::Vector<NarrowString>,
- cxx_epilogue_file, Cult::Containers::Vector<NarrowString>,
- fwd_epilogue_file, NarrowString,
- epilogue_file, Cult::Containers::Vector<NarrowString>,
- show_anonymous, Boolean,
- show_sloc, Boolean,
- proprietary_license, Boolean
-
- > Options;
-
- struct OptionsSpec: Cult::CLI::OptionsSpec<Options> {};
- }
- }
-}
-
-#endif // CXX_HYBRID_CLI_HXX
diff --git a/xsde/cxx/hybrid/elements.cxx b/xsde/cxx/hybrid/elements.cxx
index 337e15f..9356b66 100644
--- a/xsde/cxx/hybrid/elements.cxx
+++ b/xsde/cxx/hybrid/elements.cxx
@@ -13,39 +13,22 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
Regex const* fe,
Regex const* he,
Regex const* ie)
- : CXX::Context (o,
- root,
- path,
- "name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
+ : CXX::Context (o, root, path, ops, "name", "char"),
options (ops),
- exceptions (!ops.value<CLI::no_exceptions> ()),
- stl (!ops.value<CLI::no_stl> ()),
- poly_code (ops.value<CLI::generate_polymorphic> ()),
- poly_runtime (poly_code || ops.value<CLI::runtime_polymorphic> ()),
- reset (!ops.value<CLI::suppress_reset> ()),
- clone (ops.value<CLI::generate_clone> ()),
- detach (ops.value<CLI::generate_detach> ()),
- mixin (ops.value<CLI::reuse_style_mixin> ()),
+ exceptions (!ops.no_exceptions ()),
+ stl (!ops.no_stl ()),
+ poly_code (ops.generate_polymorphic ()),
+ poly_runtime (poly_code || ops.runtime_polymorphic ()),
+ reset (!ops.suppress_reset ()),
+ clone (ops.generate_clone ()),
+ detach (ops.generate_detach ()),
+ mixin (ops.reuse_style_mixin ()),
tiein (!mixin),
- enum_ (!ops.value<CLI::suppress_enum> ()),
+ enum_ (!ops.suppress_enum ()),
fwd_expr (fe),
hxx_expr (he),
ixx_expr (ie),
@@ -55,16 +38,15 @@ namespace CXX
var_seq (var_seq_),
str_seq (str_seq_),
data_seq (data_seq_),
- istreams (ops.value<CLI::generate_extraction> ()),
- ostreams (ops.value<CLI::generate_insertion> ()),
+ istreams (ops.generate_extraction ()),
+ ostreams (ops.generate_insertion ()),
icdrstream (icdrstream_),
ocdrstream (ocdrstream_),
ixdrstream (ixdrstream_),
oxdrstream (oxdrstream_)
{
- typeinfo = poly_code &&
- (ops.value<CLI::generate_typeinfo> () ||
- ops.value<CLI::generate_serializer> ());
+ typeinfo =
+ poly_code && (ops.generate_typeinfo () || ops.generate_serializer ());
String xs_ns (xs_ns_name ());
diff --git a/xsde/cxx/hybrid/elements.hxx b/xsde/cxx/hybrid/elements.hxx
index 45fe671..f4b00e8 100644
--- a/xsde/cxx/hybrid/elements.hxx
+++ b/xsde/cxx/hybrid/elements.hxx
@@ -14,7 +14,7 @@
#include <cxx/elements.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -29,11 +29,13 @@ namespace CXX
public:
typedef Hybrid::Regex Regex;
+ typedef Hybrid::options options_type;
+
public:
Context (std::wostream&,
SemanticGraph::Schema&,
SemanticGraph::Path const&,
- CLI::Options const&,
+ options_type const&,
Regex const* fwd_expr,
Regex const* hxx_expr,
Regex const* ixx_expr);
@@ -591,7 +593,7 @@ namespace CXX
NamespaceStack;
public:
- CLI::Options const& options;
+ options_type const& options;
Boolean exceptions;
Boolean stl;
@@ -617,9 +619,8 @@ namespace CXX
String const& str_seq;
String const& data_seq;
- typedef Containers::Vector<NarrowString> Streams;
- Streams const& istreams;
- Streams const& ostreams;
+ NarrowStrings const& istreams;
+ NarrowStrings const& ostreams;
String const& icdrstream;
String const& ocdrstream;
@@ -1191,7 +1192,7 @@ namespace CXX
{
if (use_ != base)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
fund_type ("long");
else
fund_type ("long long");
@@ -1205,7 +1206,7 @@ namespace CXX
{
if (use_ != base)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
fund_type ("unsigned long");
else
fund_type ("unsigned long long");
@@ -2172,7 +2173,7 @@ namespace CXX
Includes (Context& c, Type type, Regex const* r = 0)
: ctx_ (c),
type_ (type),
- forward_ (c.options.value<CLI::generate_forward> ()),
+ forward_ (c.options.generate_forward ()),
regex_ (r),
namespace_ (c),
type_forward_ (c)
diff --git a/xsde/cxx/hybrid/extraction-header.cxx b/xsde/cxx/hybrid/extraction-header.cxx
index 3240f54..25b4b43 100644
--- a/xsde/cxx/hybrid/extraction-header.cxx
+++ b/xsde/cxx/hybrid/extraction-header.cxx
@@ -41,7 +41,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -73,7 +73,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -102,7 +102,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -135,7 +135,7 @@ namespace CXX
String const& type (etype (a));
String const& scope (Context::scope (a));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -165,7 +165,7 @@ namespace CXX
String const& type (etype (c));
String const& scope (Context::scope (c));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -201,7 +201,7 @@ namespace CXX
String const& type (etype (s));
String const& scope (Context::scope (s));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -256,7 +256,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
diff --git a/xsde/cxx/hybrid/extraction-source.cxx b/xsde/cxx/hybrid/extraction-source.cxx
index 8b314f5..413ffdc 100644
--- a/xsde/cxx/hybrid/extraction-source.cxx
+++ b/xsde/cxx/hybrid/extraction-source.cxx
@@ -41,7 +41,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -86,7 +86,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -126,7 +126,7 @@ namespace CXX
String const& value (u.context ().get<String> ("value"));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -980,7 +980,7 @@ namespace CXX
String const& type (etype (a));
String const& scope (Context::scope (a));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -1023,7 +1023,7 @@ namespace CXX
String const& type (etype (c));
String const& scope (Context::scope (c));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -1089,7 +1089,7 @@ namespace CXX
String const& type (etype (s));
String const& scope (Context::scope (s));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -1188,7 +1188,7 @@ namespace CXX
Boolean restriction (restriction_p (c));
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx
index 3a61c95..c2289ae 100644
--- a/xsde/cxx/hybrid/generator.cxx
+++ b/xsde/cxx/hybrid/generator.cxx
@@ -54,10 +54,7 @@
#include "../../../libxsde/xsde/cxx/version.hxx"
-using std::endl;
-using std::wcerr;
-using std::wcout;
-
+using namespace std;
using namespace XSDFrontend::SemanticGraph;
//
@@ -110,103 +107,6 @@ namespace CXX
"//\n\n";
}
- namespace Hybrid
- {
- namespace CLI
- {
- extern Key char_encoding = "char-encoding";
- extern Key no_stl = "no-stl";
- extern Key no_iostream = "no-iostream";
- extern Key no_exceptions = "no-exceptions";
- extern Key no_long_long = "no-long-long";
- extern Key generate_parser = "generate-parser";
- extern Key generate_serializer = "generate-serializer";
- extern Key generate_aggregate = "generate-aggregate";
- extern Key suppress_validation = "suppress-validation";
- extern Key suppress_parser_val = "suppress-parser-val";
- extern Key suppress_serializer_val = "suppress-serializer-val";
- extern Key omit_default_attributes = "omit-default-attributes";
- extern Key suppress_enum = "suppress-enum";
- extern Key generate_clone = "generate-clone";
- extern Key generate_detach = "generate-detach";
- extern Key generate_insertion = "generate-insertion";
- extern Key generate_extraction = "generate-extraction";
- extern Key generate_inline = "generate-inline";
- extern Key generate_forward = "generate-forward";
- extern Key generate_xml_schema = "generate-xml-schema";
- extern Key extern_xml_schema = "extern-xml-schema";
- extern Key suppress_reset = "suppress-reset";
- extern Key custom_allocator = "custom-allocator";
- extern Key generate_polymorphic = "generate-polymorphic";
- extern Key runtime_polymorphic = "runtime-polymorphic";
- extern Key polymorphic_type = "polymorphic-type";
- extern Key generate_typeinfo = "generate-typeinfo";
- extern Key polymorphic_schema = "polymorphic-schema";
- extern Key reuse_style_mixin = "reuse-style-mixin";
- extern Key custom_data = "custom-data";
- extern Key custom_type = "custom-type";
- extern Key custom_parser = "custom-parser";
- extern Key custom_serializer = "custom-serializer";
- extern Key root_element_first = "root-element-first";
- extern Key root_element_last = "root-element-last";
- extern Key root_element_all = "root-element-all";
- extern Key root_element_none = "root-element-none";
- extern Key root_element = "root-element";
- extern Key root_type = "root-type";
- extern Key output_dir = "output-dir";
- extern Key pskel_type_suffix = "pskel-type-suffix";
- extern Key sskel_type_suffix = "sskel-type-suffix";
- extern Key pskel_file_suffix = "pskel-file-suffix";
- extern Key sskel_file_suffix = "sskel-file-suffix";
- extern Key pimpl_type_suffix = "pimpl-type-suffix";
- extern Key simpl_type_suffix = "simpl-type-suffix";
- extern Key pimpl_file_suffix = "pimpl-file-suffix";
- extern Key simpl_file_suffix = "simpl-file-suffix";
- extern Key paggr_type_suffix = "paggr-type-suffix";
- extern Key saggr_type_suffix = "saggr-type-suffix";
- extern Key namespace_map = "namespace-map";
- extern Key namespace_regex = "namespace-regex";
- extern Key namespace_regex_trace = "namespace-regex-trace";
- extern Key reserved_name = "reserved-name";
- extern Key include_with_brackets = "include-with-brackets";
- extern Key include_prefix = "include-prefix";
- extern Key include_regex = "include-regex";
- extern Key include_regex_trace = "include-regex-trace";
- extern Key guard_prefix = "guard-prefix";
- extern Key hxx_suffix = "hxx-suffix";
- extern Key ixx_suffix = "ixx-suffix";
- extern Key cxx_suffix = "cxx-suffix";
- extern Key fwd_suffix = "fwd-suffix";
- extern Key hxx_regex = "hxx-regex";
- extern Key ixx_regex = "ixx-regex";
- extern Key cxx_regex = "cxx-regex";
- extern Key fwd_regex = "fwd-regex";
- extern Key hxx_prologue = "hxx-prologue";
- extern Key ixx_prologue = "ixx-prologue";
- extern Key cxx_prologue = "cxx-prologue";
- extern Key fwd_prologue = "fwd-prologue";
- extern Key prologue = "prologue";
- extern Key hxx_epilogue = "hxx-epilogue";
- extern Key ixx_epilogue = "ixx-epilogue";
- extern Key cxx_epilogue = "cxx-epilogue";
- extern Key fwd_epilogue = "fwd-epilogue";
- extern Key epilogue = "epilogue";
- extern Key hxx_prologue_file = "hxx-prologue-file";
- extern Key ixx_prologue_file = "ixx-prologue-file";
- extern Key cxx_prologue_file = "cxx-prologue-file";
- extern Key fwd_prologue_file = "fwd-prologue-file";
- extern Key prologue_file = "prologue-file";
- extern Key hxx_epilogue_file = "hxx-epilogue-file";
- extern Key ixx_epilogue_file = "ixx-epilogue-file";
- extern Key cxx_epilogue_file = "cxx-epilogue-file";
- extern Key fwd_epilogue_file = "fwd-epilogue-file";
- extern Key epilogue_file = "epilogue-file";
- extern Key show_anonymous = "show-anonymous";
- extern Key show_sloc = "show-sloc";
- extern Key proprietary_license = "proprietary-license";
- }
- }
-
Void Hybrid::Generator::
usage ()
{
@@ -214,34 +114,6 @@ namespace CXX
CXX::options::print_usage (wcout);
}
- Hybrid::CLI::OptionsSpec Hybrid::Generator::
- options_spec ()
- {
- CLI::OptionsSpec spec;
-
- spec.option<CLI::char_encoding> ().default_value ("utf8");
-
- spec.option<CLI::pskel_file_suffix> ().default_value ("-pskel");
- spec.option<CLI::sskel_file_suffix> ().default_value ("-sskel");
- spec.option<CLI::pskel_type_suffix> ().default_value ("_pskel");
- spec.option<CLI::sskel_type_suffix> ().default_value ("_sskel");
-
- spec.option<CLI::pimpl_file_suffix> ().default_value ("-pimpl");
- spec.option<CLI::simpl_file_suffix> ().default_value ("-simpl");
- spec.option<CLI::pimpl_type_suffix> ().default_value ("_pimpl");
- spec.option<CLI::simpl_type_suffix> ().default_value ("_simpl");
-
- spec.option<CLI::paggr_type_suffix> ().default_value ("_paggr");
- spec.option<CLI::saggr_type_suffix> ().default_value ("_saggr");
-
- spec.option<CLI::hxx_suffix> ().default_value (".hxx");
- spec.option<CLI::ixx_suffix> ().default_value (".ixx");
- spec.option<CLI::cxx_suffix> ().default_value (".cxx");
- spec.option<CLI::fwd_suffix> ().default_value ("-fwd.hxx");
-
- return spec;
- }
-
namespace
{
typedef
@@ -253,12 +125,10 @@ namespace CXX
sloc_filter;
NarrowString
- find_value (Cult::Containers::Vector<NarrowString> const& v,
- Char const* key)
+ find_value (NarrowStrings const& v, Char const* key)
{
- typedef Cult::Containers::Vector<NarrowString> Values;
-
- for (Values::ConstIterator i (v.begin ()), e (v.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
+ i != e; ++i)
{
Size p (i->find ('='));
@@ -292,13 +162,12 @@ namespace CXX
}
Void
- copy_values (Cult::Containers::Vector<NarrowString>& dst,
- Cult::Containers::Vector<NarrowString> const& src,
- Char const* key)
+ copy_values (NarrowStrings& dst, NarrowStrings const& src, Char const* key)
{
- typedef Cult::Containers::Vector<NarrowString> Values;
+ dst.clear ();
- for (Values::ConstIterator i (src.begin ()), e (src.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (src.begin ()), e (src.end ());
+ i != e; ++i)
{
Size p (i->find ('='));
@@ -340,8 +209,6 @@ namespace CXX
void
traverse (Type& ns)
{
- namespace CLI = Hybrid::CLI;
-
pre (ns);
os << "using ::xsde::cxx::hybrid::any_type;"
@@ -352,16 +219,16 @@ namespace CXX
if (type_ == 'p')
{
- skel = options.value<CLI::pskel_type_suffix> ();
- impl = options.value<CLI::pimpl_type_suffix> ();
+ skel = options.pskel_type_suffix ();
+ impl = options.pimpl_type_suffix ();
us = skel == L"_pskel";
ui = impl == L"_pimpl";
}
else
{
- skel = options.value<CLI::sskel_type_suffix> ();
- impl = options.value<CLI::simpl_type_suffix> ();
+ skel = options.sskel_type_suffix ();
+ impl = options.simpl_type_suffix ();
us = skel == L"_sskel";
ui = impl == L"_simpl";
@@ -387,85 +254,46 @@ namespace CXX
};
}
- Parser::CLI::Options* Hybrid::Generator::
- parser_options (CLI::Options const& h, Schema& schema, Path const& path)
+ auto_ptr<Parser::options> Hybrid::Generator::
+ parser_options (options const& h, Schema& schema, Path const& path)
{
- namespace H = CLI;
- namespace P = Parser::CLI;
-
- Evptr<P::Options> r (new P::Options);
-
- r->value<P::char_encoding> () = h.value<H::char_encoding> ();
- r->value<P::no_stl> () = h.value<H::no_stl> ();
- r->value<P::no_iostream> () = h.value<H::no_iostream> ();
- r->value<P::no_exceptions> () = h.value<H::no_exceptions> ();
- r->value<P::no_long_long> () = h.value<H::no_long_long> ();
- r->value<P::reuse_style_mixin> () = h.value<H::reuse_style_mixin> ();
- r->value<P::reuse_style_none> () = false;
- r->value<P::generate_inline> () = h.value<H::generate_inline> ();
- r->value<P::suppress_validation> () = h.value<H::suppress_validation> ()
- || h.value<H::suppress_parser_val> ();
- r->value<P::generate_xml_schema> () = h.value<H::generate_xml_schema> ();
- r->value<P::extern_xml_schema> () = h.value<H::extern_xml_schema> ();
- r->value<P::suppress_reset> () = h.value<H::suppress_reset> ();
- r->value<P::custom_allocator> () = h.value<H::custom_allocator> ();
- r->value<P::generate_polymorphic> () = h.value<H::generate_polymorphic> ();
- r->value<P::runtime_polymorphic> () = h.value<H::runtime_polymorphic> ();
- r->value<P::output_dir> () = h.value<H::output_dir> ();
- r->value<P::skel_file_suffix> () = h.value<H::pskel_file_suffix> ();
- r->value<P::skel_type_suffix> () = h.value<H::pskel_type_suffix> ();
- r->value<P::impl_type_suffix> () = h.value<H::pimpl_type_suffix> ();
- r->value<P::namespace_map> () = h.value<H::namespace_map> ();
- r->value<P::namespace_regex> () = h.value<H::namespace_regex> ();
- r->value<P::namespace_regex_trace> () = h.value<H::namespace_regex_trace> ();
- r->value<P::reserved_name> () = h.value<H::reserved_name> ();
- r->value<P::include_with_brackets> () = h.value<H::include_with_brackets> ();
- r->value<P::include_prefix> () = h.value<H::include_prefix> ();
- r->value<P::include_regex> () = h.value<H::include_regex> ();
- r->value<P::include_regex_trace> () = h.value<H::include_regex_trace> ();
- r->value<P::guard_prefix> () = h.value<H::guard_prefix> ();
-
- r->value<P::hxx_suffix> () = h.value<H::hxx_suffix> ();
- r->value<P::ixx_suffix> () = h.value<H::ixx_suffix> ();
- r->value<P::cxx_suffix> () = h.value<H::cxx_suffix> ();
+ auto_ptr<Parser::options> r (new Parser::options);
+
+ static_cast<CXX::options&> (*r) = h; // Assign common options.
+
+ r->reuse_style_mixin (h.reuse_style_mixin ());
+ r->suppress_validation (h.suppress_validation () ||
+ h.suppress_parser_val ());
+ r->generate_polymorphic (h.generate_polymorphic ());
+ r->runtime_polymorphic (h.runtime_polymorphic ());
+
+ r->skel_file_suffix (h.pskel_file_suffix ());
+ r->skel_type_suffix (h.pskel_type_suffix ());
+ r->impl_type_suffix (h.pimpl_type_suffix ());
Char const* k = "pskel";
- r->value<P::hxx_regex> () =
- find_value (h.value<H::hxx_regex> (), k);
- r->value<P::ixx_regex> () =
- find_value (h.value<H::ixx_regex> (), k);
- r->value<P::cxx_regex> () =
- find_value (h.value<H::cxx_regex> (), k);
-
- r->value<P::hxx_prologue_file> () = find_value (
- h.value<H::hxx_prologue_file> (), k);
- r->value<P::ixx_prologue_file> () = find_value (
- h.value<H::ixx_prologue_file> (), k);
- r->value<P::cxx_prologue_file> () = find_value (
- h.value<H::cxx_prologue_file> (), k);
- r->value<P::prologue_file> () = find_value (
- h.value<H::prologue_file> (), k);
- r->value<P::hxx_epilogue_file> () = find_value (
- h.value<H::hxx_epilogue_file> (), k);
- r->value<P::ixx_epilogue_file> () = find_value (
- h.value<H::ixx_epilogue_file> (), k);
- r->value<P::cxx_epilogue_file> () = find_value (
- h.value<H::cxx_epilogue_file> (), k);
- r->value<P::epilogue_file> () = find_value (
- h.value<H::epilogue_file> (), k);
-
- copy_values (r->value<P::hxx_prologue> (), h.value<H::hxx_prologue> (), k);
- copy_values (r->value<P::ixx_prologue> (), h.value<H::ixx_prologue> (), k);
- copy_values (r->value<P::cxx_prologue> (), h.value<H::cxx_prologue> (), k);
- copy_values (r->value<P::prologue> (), h.value<H::prologue> (), k);
- copy_values (r->value<P::hxx_epilogue> (), h.value<H::hxx_epilogue> (), k);
- copy_values (r->value<P::ixx_epilogue> (), h.value<H::ixx_epilogue> (), k);
- copy_values (r->value<P::cxx_epilogue> (), h.value<H::cxx_epilogue> (), k);
- copy_values (r->value<P::epilogue> (), h.value<H::epilogue> (), k);
-
- r->value<P::show_sloc> () = h.value<H::show_sloc> ();
- r->value<P::proprietary_license> () = h.value<H::proprietary_license> ();
+ r->hxx_regex (find_value (h.hxx_regex (), k));
+ r->ixx_regex (find_value (h.ixx_regex (), k));
+ r->cxx_regex (find_value (h.cxx_regex (), k));
+
+ r->prologue_file (find_value (h.prologue_file (), k));
+ r->epilogue_file (find_value (h.epilogue_file (), k));
+ r->hxx_prologue_file (find_value (h.hxx_prologue_file (), k));
+ r->ixx_prologue_file (find_value (h.ixx_prologue_file (), k));
+ r->cxx_prologue_file (find_value (h.cxx_prologue_file (), k));
+ r->hxx_epilogue_file (find_value (h.hxx_epilogue_file (), k));
+ r->ixx_epilogue_file (find_value (h.ixx_epilogue_file (), k));
+ r->cxx_epilogue_file (find_value (h.cxx_epilogue_file (), k));
+
+ copy_values (r->prologue (), h.prologue (), k);
+ copy_values (r->epilogue (), h.epilogue (), k);
+ copy_values (r->hxx_prologue (), h.hxx_prologue (), k);
+ copy_values (r->ixx_prologue (), h.ixx_prologue (), k);
+ copy_values (r->cxx_prologue (), h.cxx_prologue (), k);
+ copy_values (r->hxx_epilogue (), h.hxx_epilogue (), k);
+ copy_values (r->ixx_epilogue (), h.ixx_epilogue (), k);
+ copy_values (r->cxx_epilogue (), h.cxx_epilogue (), k);
// Add the anyType parser.
//
@@ -486,91 +314,52 @@ namespace CXX
ns.dispatch (ctx.xs_ns ());
}
- r->value<P::hxx_prologue> ().push_back (String (os.str ()).to_narrow ());
+ r->hxx_prologue ().push_back (String (os.str ()).to_narrow ());
}
- return r.release ();
+ return r;
}
- Serializer::CLI::Options* Hybrid::Generator::
- serializer_options (CLI::Options const& h, Schema& schema, Path const& path)
+ auto_ptr<Serializer::options> Hybrid::Generator::
+ serializer_options (options const& h, Schema& schema, Path const& path)
{
- namespace H = CLI;
- namespace S = Serializer::CLI;
-
- Evptr<S::Options> r (new S::Options);
-
- r->value<S::char_encoding> () = h.value<H::char_encoding> ();
- r->value<S::no_stl> () = h.value<H::no_stl> ();
- r->value<S::no_iostream> () = h.value<H::no_iostream> ();
- r->value<S::no_exceptions> () = h.value<H::no_exceptions> ();
- r->value<S::no_long_long> () = h.value<H::no_long_long> ();
- r->value<S::reuse_style_mixin> () = h.value<H::reuse_style_mixin> ();
- r->value<S::reuse_style_none> () = false;
- r->value<S::generate_inline> () = h.value<H::generate_inline> ();
- r->value<S::suppress_validation> () = h.value<H::suppress_validation> ()
- || h.value<H::suppress_serializer_val> ();
- r->value<S::generate_xml_schema> () = h.value<H::generate_xml_schema> ();
- r->value<S::extern_xml_schema> () = h.value<H::extern_xml_schema> ();
- r->value<S::suppress_reset> () = h.value<H::suppress_reset> ();
- r->value<S::custom_allocator> () = h.value<H::custom_allocator> ();
- r->value<S::generate_polymorphic> () = h.value<H::generate_polymorphic> ();
- r->value<S::runtime_polymorphic> () = h.value<H::runtime_polymorphic> ();
- r->value<S::output_dir> () = h.value<H::output_dir> ();
- r->value<S::skel_file_suffix> () = h.value<H::sskel_file_suffix> ();
- r->value<S::skel_type_suffix> () = h.value<H::sskel_type_suffix> ();
- r->value<S::impl_type_suffix> () = h.value<H::simpl_type_suffix> ();
- r->value<S::namespace_map> () = h.value<H::namespace_map> ();
- r->value<S::namespace_regex> () = h.value<H::namespace_regex> ();
- r->value<S::namespace_regex_trace> () = h.value<H::namespace_regex_trace> ();
- r->value<S::reserved_name> () = h.value<H::reserved_name> ();
- r->value<S::include_with_brackets> () = h.value<H::include_with_brackets> ();
- r->value<S::include_prefix> () = h.value<H::include_prefix> ();
- r->value<S::include_regex> () = h.value<H::include_regex> ();
- r->value<S::include_regex_trace> () = h.value<H::include_regex_trace> ();
- r->value<S::guard_prefix> () = h.value<H::guard_prefix> ();
-
- r->value<S::hxx_suffix> () = h.value<H::hxx_suffix> ();
- r->value<S::ixx_suffix> () = h.value<H::ixx_suffix> ();
- r->value<S::cxx_suffix> () = h.value<H::cxx_suffix> ();
-
- Char const* k = "sskel";
-
- r->value<S::hxx_regex> () =
- find_value (h.value<H::hxx_regex> (), k);
- r->value<S::ixx_regex> () =
- find_value (h.value<H::ixx_regex> (), k);
- r->value<S::cxx_regex> () =
- find_value (h.value<H::cxx_regex> (), k);
-
- r->value<S::hxx_prologue_file> () = find_value (
- h.value<H::hxx_prologue_file> (), k);
- r->value<S::ixx_prologue_file> () = find_value (
- h.value<H::ixx_prologue_file> (), k);
- r->value<S::cxx_prologue_file> () = find_value (
- h.value<H::cxx_prologue_file> (), k);
- r->value<S::prologue_file> () = find_value (
- h.value<H::prologue_file> (), k);
- r->value<S::hxx_epilogue_file> () = find_value (
- h.value<H::hxx_epilogue_file> (), k);
- r->value<S::ixx_epilogue_file> () = find_value (
- h.value<H::ixx_epilogue_file> (), k);
- r->value<S::cxx_epilogue_file> () = find_value (
- h.value<H::cxx_epilogue_file> (), k);
- r->value<S::epilogue_file> () = find_value (
- h.value<H::epilogue_file> (), k);
-
- copy_values (r->value<S::hxx_prologue> (), h.value<H::hxx_prologue> (), k);
- copy_values (r->value<S::ixx_prologue> (), h.value<H::ixx_prologue> (), k);
- copy_values (r->value<S::cxx_prologue> (), h.value<H::cxx_prologue> (), k);
- copy_values (r->value<S::prologue> (), h.value<H::prologue> (), k);
- copy_values (r->value<S::hxx_epilogue> (), h.value<H::hxx_epilogue> (), k);
- copy_values (r->value<S::ixx_epilogue> (), h.value<H::ixx_epilogue> (), k);
- copy_values (r->value<S::cxx_epilogue> (), h.value<H::cxx_epilogue> (), k);
- copy_values (r->value<S::epilogue> (), h.value<H::epilogue> (), k);
-
- r->value<S::show_sloc> () = h.value<H::show_sloc> ();
- r->value<S::proprietary_license> () = h.value<H::proprietary_license> ();
+ auto_ptr<Serializer::options> r (new Serializer::options);
+
+ static_cast<CXX::options&> (*r) = h; // Assign common options.
+
+ r->reuse_style_mixin (h.reuse_style_mixin ());
+ r->suppress_validation (h.suppress_validation () ||
+ h.suppress_serializer_val ());
+ r->generate_polymorphic (h.generate_polymorphic ());
+ r->runtime_polymorphic (h.runtime_polymorphic ());
+
+ r->skel_file_suffix (h.sskel_file_suffix ());
+ r->skel_type_suffix (h.sskel_type_suffix ());
+ r->impl_type_suffix (h.simpl_type_suffix ());
+
+ Char const* k = "pskel";
+
+ r->hxx_regex (find_value (h.hxx_regex (), k));
+ r->ixx_regex (find_value (h.ixx_regex (), k));
+ r->cxx_regex (find_value (h.cxx_regex (), k));
+
+ r->prologue_file (find_value (h.prologue_file (), k));
+ r->epilogue_file (find_value (h.epilogue_file (), k));
+ r->hxx_prologue_file (find_value (h.hxx_prologue_file (), k));
+ r->ixx_prologue_file (find_value (h.ixx_prologue_file (), k));
+ r->cxx_prologue_file (find_value (h.cxx_prologue_file (), k));
+ r->hxx_epilogue_file (find_value (h.hxx_epilogue_file (), k));
+ r->ixx_epilogue_file (find_value (h.ixx_epilogue_file (), k));
+ r->cxx_epilogue_file (find_value (h.cxx_epilogue_file (), k));
+
+ copy_values (r->prologue (), h.prologue (), k);
+ copy_values (r->epilogue (), h.epilogue (), k);
+ copy_values (r->hxx_prologue (), h.hxx_prologue (), k);
+ copy_values (r->ixx_prologue (), h.ixx_prologue (), k);
+ copy_values (r->cxx_prologue (), h.cxx_prologue (), k);
+ copy_values (r->hxx_epilogue (), h.hxx_epilogue (), k);
+ copy_values (r->ixx_epilogue (), h.ixx_epilogue (), k);
+ copy_values (r->cxx_epilogue (), h.cxx_epilogue (), k);
// Add the anyType parser.
//
@@ -591,14 +380,14 @@ namespace CXX
ns.dispatch (ctx.xs_ns ());
}
- r->value<S::hxx_prologue> ().push_back (String (os.str ()).to_narrow ());
+ r->hxx_prologue ().push_back (String (os.str ()).to_narrow ());
}
- return r.release ();
+ return r;
}
Void Hybrid::Generator::
- calculate_size (CLI::Options const& ops,
+ calculate_size (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file,
const WarningSet& disabled_warnings)
@@ -612,7 +401,7 @@ namespace CXX
}
Void Hybrid::Generator::
- process_tree_names (CLI::Options const& ops,
+ process_tree_names (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file)
{
@@ -621,7 +410,7 @@ namespace CXX
}
Void Hybrid::Generator::
- process_parser_names (CLI::Options const& ops,
+ process_parser_names (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file)
{
@@ -631,7 +420,7 @@ namespace CXX
}
Void Hybrid::Generator::
- process_serializer_names (CLI::Options const& ops,
+ process_serializer_names (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file)
{
@@ -690,19 +479,20 @@ namespace CXX
Void
append (WideOutputFileStream& os,
- Cult::Containers::Vector<NarrowString> const& primary,
- Cult::Containers::Vector<NarrowString> const& def,
+ NarrowStrings const& primary,
+ NarrowStrings const& def,
Char const* primary_key,
Char const* def_key)
{
- typedef Cult::Containers::Vector<NarrowString> Values;
-
- for (Values const* v = &primary; v != 0; v = (v == &def ? 0 : &def))
+ for (NarrowStrings const* v = &primary;
+ v != 0;
+ v = (v == &def ? 0 : &def))
{
Boolean found (false);
Char const* key (v == &primary ? primary_key : def_key);
- for (Values::ConstIterator i (v->begin ()), e (v->end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v->begin ()), e (v->end ());
+ i != e; ++i)
{
if (key == 0)
os << i->c_str () << endl;
@@ -747,8 +537,8 @@ namespace CXX
Void
append (WideOutputFileStream& os,
- Cult::Containers::Vector<NarrowString> const& primary,
- Cult::Containers::Vector<NarrowString> const& def,
+ NarrowStrings const& primary,
+ NarrowStrings const& def,
Char const* key)
{
append (os, primary, def, key, key);
@@ -757,7 +547,7 @@ namespace CXX
UnsignedLong Hybrid::Generator::
- generate_tree (Hybrid::CLI::Options const& ops,
+ generate_tree (Hybrid::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -772,7 +562,7 @@ namespace CXX
try
{
- Boolean generate_xml_schema (ops.value<CLI::generate_xml_schema> ());
+ Boolean generate_xml_schema (ops.generate_xml_schema ());
// We could be compiling several schemas at once in which case
// handling of the --generate-xml-schema option gets tricky: we
@@ -781,7 +571,7 @@ namespace CXX
//
if (generate_xml_schema)
{
- if (NarrowString name = ops.value<CLI::extern_xml_schema> ())
+ if (NarrowString name = ops.extern_xml_schema ())
{
if (file_path.native_file_string () != name)
generate_xml_schema = false;
@@ -805,24 +595,20 @@ namespace CXX
// Generate code.
//
- Boolean inline_ (ops.value<CLI::generate_inline> () &&
- !generate_xml_schema);
-
- Boolean forward (ops.value<CLI::generate_forward> () &&
- !generate_xml_schema);
-
+ Boolean inline_ (ops.generate_inline () && !generate_xml_schema);
+ Boolean forward (ops.generate_forward () && !generate_xml_schema);
Boolean source (!generate_xml_schema);
NarrowString name (file_path.leaf ());
- NarrowString hxx_suffix (ops.value <CLI::hxx_suffix> ());
- NarrowString ixx_suffix (ops.value <CLI::ixx_suffix> ());
- NarrowString cxx_suffix (ops.value <CLI::cxx_suffix> ());
- NarrowString fwd_suffix (ops.value <CLI::fwd_suffix> ());
+ NarrowString hxx_suffix (ops.hxx_suffix ());
+ NarrowString ixx_suffix (ops.ixx_suffix ());
+ NarrowString cxx_suffix (ops.cxx_suffix ());
+ NarrowString fwd_suffix (ops.fwd_suffix ());
- NarrowString hxx_regex (find_value (ops.value <CLI::hxx_regex> (), ""));
- NarrowString ixx_regex (find_value (ops.value <CLI::ixx_regex> (), ""));
- NarrowString cxx_regex (find_value (ops.value <CLI::cxx_regex> (), ""));
+ NarrowString hxx_regex (find_value (ops.hxx_regex (), ""));
+ NarrowString ixx_regex (find_value (ops.ixx_regex (), ""));
+ NarrowString cxx_regex (find_value (ops.cxx_regex (), ""));
Regex hxx_expr (
hxx_regex.empty ()
@@ -840,9 +626,9 @@ namespace CXX
: cxx_regex);
Regex fwd_expr (
- ops.value <CLI::fwd_regex> ().empty ()
+ ops.fwd_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + fwd_suffix + "#"
- : ops.value <CLI::fwd_regex> ());
+ : ops.fwd_regex ());
if (!hxx_expr.match (name))
{
@@ -888,7 +674,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -984,9 +770,7 @@ namespace CXX
// Print copyright and license.
//
Char const* copyright (
- ops.value<CLI::proprietary_license> ()
- ? copyright_proprietary
- : copyright_gpl);
+ ops.proprietary_license () ? copyright_proprietary : copyright_gpl);
if (forward)
fwd << copyright;
@@ -1003,8 +787,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (
- find_value (ops.value<CLI::prologue_file> (), ""));
+ NarrowString name (find_value (ops.prologue_file (), ""));
if (name)
open (prologue, name);
@@ -1014,8 +797,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (
- find_value (ops.value<CLI::epilogue_file> (), ""));
+ NarrowString name (find_value (ops.epilogue_file (), ""));
if (name)
open (epilogue, name);
@@ -1023,14 +805,14 @@ namespace CXX
// SLOC counter.
//
- UnsignedLong sloc_total (0);
- Boolean show_sloc (ops.value<CLI::show_sloc> ());
+ size_t sloc_total (0);
+ Boolean show_sloc (ops.show_sloc ());
//
//
Regex guard_expr ("/([a-z])([A-Z])/$1_$2/"); // Split words.
- NarrowString guard_prefix (ops.value<CLI::guard_prefix> ());
+ NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
guard_prefix = file_path.branch_path ().native_directory_string ();
@@ -1073,12 +855,8 @@ namespace CXX
fwd << "// Begin prologue." << endl
<< "//" << endl;
- append (fwd,
- ops.value<CLI::fwd_prologue> (),
- ops.value<CLI::prologue> (),
- 0,
- "");
- append (fwd, ops.value<CLI::fwd_prologue_file> (), prologue);
+ append (fwd, ops.fwd_prologue (), ops.prologue (), 0, "");
+ append (fwd, ops.fwd_prologue_file (), prologue);
fwd << "//" << endl
<< "// End prologue." << endl
@@ -1096,12 +874,8 @@ namespace CXX
fwd << "// Begin epilogue." << endl
<< "//" << endl;
- append (fwd, ops.value<CLI::fwd_epilogue_file> (), epilogue);
- append (fwd,
- ops.value<CLI::fwd_epilogue> (),
- ops.value<CLI::epilogue> (),
- 0,
- "");
+ append (fwd, ops.fwd_epilogue_file (), epilogue);
+ append (fwd, ops.fwd_epilogue (), ops.epilogue (), 0, "");
fwd << "//" << endl
<< "// End epilogue." << endl
@@ -1155,7 +929,7 @@ namespace CXX
hxx << "#include <xsde/cxx/config.hxx>" << endl
<< endl;
- if (ops.value<CLI::char_encoding> () == "iso8859-1")
+ if (ops.char_encoding () == "iso8859-1")
{
hxx << "#ifndef XSDE_ENCODING_ISO8859_1" << endl
<< "#error the generated code uses the ISO-8859-1 encoding" <<
@@ -1174,7 +948,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_stl> ())
+ if (ops.no_stl ())
{
hxx << "#ifdef XSDE_STL" << endl
<< "#error the XSD/e runtime uses STL while the " <<
@@ -1193,7 +967,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_exceptions> ())
+ if (ops.no_exceptions ())
{
hxx << "#ifdef XSDE_EXCEPTIONS" << endl
<< "#error the XSD/e runtime uses exceptions while the " <<
@@ -1212,7 +986,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_long_long> ())
+ if (ops.no_long_long ())
{
hxx << "#ifdef XSDE_LONGLONG" << endl
<< "#error the XSD/e runtime uses long long while the " <<
@@ -1231,7 +1005,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::custom_allocator> ())
+ if (ops.custom_allocator ())
{
hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl
<< "#error the generated code uses custom allocator while " <<
@@ -1261,13 +1035,8 @@ namespace CXX
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (hxx,
- ops.value<CLI::hxx_prologue> (),
- ops.value<CLI::prologue> (),
- "");
- append (hxx,
- find_value (ops.value<CLI::hxx_prologue_file> (), ""),
- prologue);
+ append (hxx, ops.hxx_prologue (), ops.prologue (), "");
+ append (hxx, find_value (ops.hxx_prologue_file (), ""), prologue);
hxx << "//" << endl
<< "// End prologue." << endl
@@ -1288,10 +1057,10 @@ namespace CXX
generate_tree_header (ctx);
- if (!ops.value<CLI::generate_insertion> ().empty ())
+ if (!ops.generate_insertion ().empty ())
generate_insertion_header (ctx);
- if (!ops.value<CLI::generate_extraction> ().empty ())
+ if (!ops.generate_extraction ().empty ())
generate_extraction_header (ctx);
}
else
@@ -1311,13 +1080,8 @@ namespace CXX
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (hxx,
- find_value (ops.value<CLI::hxx_epilogue_file> (), ""),
- epilogue);
- append (hxx,
- ops.value<CLI::hxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "");
+ append (hxx, find_value (ops.hxx_epilogue_file (), ""), epilogue);
+ append (hxx, ops.hxx_epilogue (), ops.epilogue (), "");
hxx << "//" << endl
<< "// End epilogue." << endl
@@ -1358,13 +1122,8 @@ namespace CXX
ixx << "// Begin prologue." << endl
<< "//" << endl;
- append (ixx,
- ops.value<CLI::ixx_prologue> (),
- ops.value<CLI::prologue> (),
- "");
- append (ixx,
- find_value (ops.value<CLI::ixx_prologue_file> (), ""),
- prologue);
+ append (ixx, ops.ixx_prologue (), ops.prologue (), "");
+ append (ixx, find_value (ops.ixx_prologue_file (), ""), prologue);
ixx << "//" << endl
<< "// End prologue." << endl
@@ -1382,13 +1141,8 @@ namespace CXX
ixx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ixx,
- find_value (ops.value<CLI::ixx_epilogue_file> (), ""),
- epilogue);
- append (ixx,
- ops.value<CLI::ixx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "");
+ append (ixx, find_value (ops.ixx_epilogue_file (), ""), epilogue);
+ append (ixx, ops.ixx_epilogue (), ops.epilogue (), "");
ixx << "//" << endl
<< "// End epilogue." << endl
@@ -1419,13 +1173,8 @@ namespace CXX
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (cxx,
- ops.value<CLI::cxx_prologue> (),
- ops.value<CLI::prologue> (),
- "");
- append (cxx,
- find_value (ops.value<CLI::cxx_prologue_file> (), ""),
- prologue);
+ append (cxx, ops.cxx_prologue (), ops.prologue (), "");
+ append (cxx, find_value (ops.cxx_prologue_file (), ""), prologue);
cxx << "//" << endl
<< "// End prologue." << endl
@@ -1444,10 +1193,10 @@ namespace CXX
generate_tree_source (ctx);
- if (!ops.value<CLI::generate_insertion> ().empty ())
+ if (!ops.generate_insertion ().empty ())
generate_insertion_source (ctx);
- if (!ops.value<CLI::generate_extraction> ().empty ())
+ if (!ops.generate_extraction ().empty ())
generate_extraction_source (ctx);
}
@@ -1456,13 +1205,8 @@ namespace CXX
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (cxx,
- find_value (ops.value<CLI::cxx_epilogue_file> (), ""),
- epilogue);
- append (cxx,
- ops.value<CLI::cxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "");
+ append (cxx, find_value (ops.cxx_epilogue_file (), ""), epilogue);
+ append (cxx, ops.cxx_epilogue (), ops.epilogue (), "");
cxx << "//" << endl
<< "// End epilogue." << endl
@@ -1480,15 +1224,14 @@ namespace CXX
// Populate the type maps if we are generating parsing or
// serialization code.
//
- if (ops.value<CLI::generate_parser> () ||
- ops.value<CLI::generate_serializer> ())
+ if (ops.generate_parser () || ops.generate_serializer ())
{
generate_tree_type_map (ops, schema, file_path, hxx_name,
parser_type_map, serializer_type_map);
// Re-map anyType.
//
- if (ops.value<CLI::generate_parser> ())
+ if (ops.generate_parser ())
{
parser_type_map.push_back (
TypeMap::Namespace ("http://www.w3.org/2001/XMLSchema"));
@@ -1497,7 +1240,7 @@ namespace CXX
xs.types_push_back ("anyType", xs_ns + L"::any_type*");
}
- if (ops.value<CLI::generate_serializer> ())
+ if (ops.generate_serializer ())
{
serializer_type_map.push_back (
TypeMap::Namespace ("http://www.w3.org/2001/XMLSchema"));
@@ -1546,7 +1289,7 @@ namespace CXX
}
UnsignedLong Hybrid::Generator::
- generate_parser (Hybrid::CLI::Options const& ops,
+ generate_parser (Hybrid::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -1560,7 +1303,7 @@ namespace CXX
try
{
{
- Boolean gen_xml_schema (ops.value<CLI::generate_xml_schema> ());
+ Boolean gen_xml_schema (ops.generate_xml_schema ());
// We could be compiling several schemas at once in which case
// handling of the --generate-xml-schema option gets tricky: we
@@ -1569,7 +1312,7 @@ namespace CXX
//
if (gen_xml_schema)
{
- if (NarrowString name = ops.value<CLI::extern_xml_schema> ())
+ if (NarrowString name = ops.extern_xml_schema ())
{
if (file_path.native_file_string () != name)
gen_xml_schema = false;
@@ -1590,22 +1333,17 @@ namespace CXX
}
NarrowString name (file_path.leaf ());
- NarrowString skel_suffix (ops.value <CLI::pskel_file_suffix> ());
- NarrowString impl_suffix (ops.value <CLI::pimpl_file_suffix> ());
-
- NarrowString hxx_suffix (ops.value <CLI::hxx_suffix> ());
- NarrowString cxx_suffix (ops.value <CLI::cxx_suffix> ());
+ NarrowString skel_suffix (ops.pskel_file_suffix ());
+ NarrowString impl_suffix (ops.pimpl_file_suffix ());
- NarrowString hxx_obj_regex (
- find_value (ops.value <CLI::hxx_regex> (), ""));
+ NarrowString hxx_suffix (ops.hxx_suffix ());
+ NarrowString cxx_suffix (ops.cxx_suffix ());
- NarrowString hxx_skel_regex (
- find_value (ops.value <CLI::hxx_regex> (), "pskel"));
+ NarrowString hxx_obj_regex (find_value (ops.hxx_regex (), ""));
+ NarrowString hxx_skel_regex (find_value (ops.hxx_regex (), "pskel"));
- NarrowString hxx_regex (
- find_value (ops.value <CLI::hxx_regex> (), "pimpl"));
- NarrowString cxx_regex (
- find_value (ops.value <CLI::cxx_regex> (), "pimpl"));
+ NarrowString hxx_regex (find_value (ops.hxx_regex (), "pimpl"));
+ NarrowString cxx_regex (find_value (ops.cxx_regex (), "pimpl"));
// Here we need to make sure that hxx_obj_expr is the same
// as in generate().
@@ -1658,7 +1396,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -1713,9 +1451,7 @@ namespace CXX
// Print copyright and license.
//
Char const* copyright (
- ops.value<CLI::proprietary_license> ()
- ? copyright_proprietary
- : copyright_gpl);
+ ops.proprietary_license () ? copyright_proprietary : copyright_gpl);
hxx << copyright;
cxx << copyright;
@@ -1724,8 +1460,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (
- find_value (ops.value<CLI::prologue_file> (), "pimpl"));
+ NarrowString name (find_value (ops.prologue_file (), "pimpl"));
if (name)
open (prologue, name);
@@ -1735,8 +1470,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (
- find_value (ops.value<CLI::epilogue_file> (), "pimpl"));
+ NarrowString name (find_value (ops.epilogue_file (), "pimpl"));
if (name)
open (epilogue, name);
@@ -1744,14 +1478,14 @@ namespace CXX
// SLOC counter.
//
- UnsignedLong sloc_total (0);
- Boolean show_sloc (ops.value<CLI::show_sloc> ());
+ size_t sloc_total (0);
+ Boolean show_sloc (ops.show_sloc ());
//
//
Regex guard_expr ("/([a-z])([A-Z])/$1_$2/"); // Split words.
- NarrowString guard_prefix (ops.value<CLI::guard_prefix> ());
+ NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
guard_prefix = file_path.branch_path ().native_directory_string ();
@@ -1759,7 +1493,7 @@ namespace CXX
if (guard_prefix)
guard_prefix += '_';
- Boolean aggr (ops.value<CLI::generate_aggregate> ());
+ Boolean aggr (ops.generate_aggregate ());
// HXX
//
@@ -1784,13 +1518,8 @@ namespace CXX
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (hxx,
- ops.value<CLI::hxx_prologue> (),
- ops.value<CLI::prologue> (),
- "pimpl");
- append (hxx,
- find_value (ops.value<CLI::hxx_prologue_file> (), "pimpl"),
- prologue);
+ append (hxx, ops.hxx_prologue (), ops.prologue (), "pimpl");
+ append (hxx, find_value (ops.hxx_prologue_file (), "pimpl"), prologue);
hxx << "//" << endl
<< "// End prologue." << endl
@@ -1838,13 +1567,8 @@ namespace CXX
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (hxx,
- find_value (ops.value<CLI::hxx_epilogue_file> (), "pimpl"),
- epilogue);
- append (hxx,
- ops.value<CLI::hxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "pimpl");
+ append (hxx, find_value (ops.hxx_epilogue_file (), "pimpl"), epilogue);
+ append (hxx, ops.hxx_epilogue (), ops.epilogue (), "pimpl");
hxx << "//" << endl
<< "// End epilogue." << endl
@@ -1873,13 +1597,8 @@ namespace CXX
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (cxx,
- ops.value<CLI::cxx_prologue> (),
- ops.value<CLI::prologue> (),
- "pimpl");
- append (cxx,
- find_value (ops.value<CLI::cxx_prologue_file> (), "pimpl"),
- prologue);
+ append (cxx, ops.cxx_prologue (), ops.prologue (), "pimpl");
+ append (cxx, find_value (ops.cxx_prologue_file (), "pimpl"), prologue);
cxx << "//" << endl
<< "// End prologue." << endl
@@ -1904,13 +1623,8 @@ namespace CXX
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (cxx,
- find_value (ops.value<CLI::cxx_epilogue_file> (), "pimpl"),
- epilogue);
- append (cxx,
- ops.value<CLI::cxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "pimpl");
+ append (cxx, find_value (ops.cxx_epilogue_file (), "pimpl"), epilogue);
+ append (cxx, ops.cxx_epilogue (), ops.epilogue (), "pimpl");
cxx << "//" << endl
<< "// End epilogue." << endl
@@ -1961,7 +1675,7 @@ namespace CXX
}
UnsignedLong Hybrid::Generator::
- generate_serializer (Hybrid::CLI::Options const& ops,
+ generate_serializer (Hybrid::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -1975,7 +1689,7 @@ namespace CXX
try
{
{
- Boolean gen_xml_schema (ops.value<CLI::generate_xml_schema> ());
+ Boolean gen_xml_schema (ops.generate_xml_schema ());
// We could be compiling several schemas at once in which case
// handling of the --generate-xml-schema option gets tricky: we
@@ -1984,7 +1698,7 @@ namespace CXX
//
if (gen_xml_schema)
{
- if (NarrowString name = ops.value<CLI::extern_xml_schema> ())
+ if (NarrowString name = ops.extern_xml_schema ())
{
if (file_path.native_file_string () != name)
gen_xml_schema = false;
@@ -2005,21 +1719,17 @@ namespace CXX
}
NarrowString name (file_path.leaf ());
- NarrowString skel_suffix (ops.value <CLI::sskel_file_suffix> ());
- NarrowString impl_suffix (ops.value <CLI::simpl_file_suffix> ());
+ NarrowString skel_suffix (ops.sskel_file_suffix ());
+ NarrowString impl_suffix (ops.simpl_file_suffix ());
- NarrowString hxx_suffix (ops.value <CLI::hxx_suffix> ());
- NarrowString cxx_suffix (ops.value <CLI::cxx_suffix> ());
+ NarrowString hxx_suffix (ops.hxx_suffix ());
+ NarrowString cxx_suffix (ops.cxx_suffix ());
- NarrowString hxx_obj_regex (
- find_value (ops.value <CLI::hxx_regex> (), ""));
+ NarrowString hxx_obj_regex (find_value (ops.hxx_regex (), ""));
- NarrowString hxx_skel_regex (
- find_value (ops.value <CLI::hxx_regex> (), "sskel"));
- NarrowString hxx_regex (
- find_value (ops.value <CLI::hxx_regex> (), "simpl"));
- NarrowString cxx_regex (
- find_value (ops.value <CLI::cxx_regex> (), "simpl"));
+ NarrowString hxx_skel_regex (find_value (ops.hxx_regex (), "sskel"));
+ NarrowString hxx_regex (find_value (ops.hxx_regex (), "simpl"));
+ NarrowString cxx_regex (find_value (ops.cxx_regex (), "simpl"));
// Here we need to make sure that hxx_obj_expr is the same
// as in generate().
@@ -2072,7 +1782,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -2127,9 +1837,7 @@ namespace CXX
// Print copyright and license.
//
Char const* copyright (
- ops.value<CLI::proprietary_license> ()
- ? copyright_proprietary
- : copyright_gpl);
+ ops.proprietary_license () ? copyright_proprietary : copyright_gpl);
hxx << copyright;
cxx << copyright;
@@ -2138,8 +1846,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (
- find_value (ops.value<CLI::prologue_file> (), "simpl"));
+ NarrowString name (find_value (ops.prologue_file (), "simpl"));
if (name)
open (prologue, name);
@@ -2149,8 +1856,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (
- find_value (ops.value<CLI::epilogue_file> (), "simpl"));
+ NarrowString name (find_value (ops.epilogue_file (), "simpl"));
if (name)
open (epilogue, name);
@@ -2158,14 +1864,14 @@ namespace CXX
// SLOC counter.
//
- UnsignedLong sloc_total (0);
- Boolean show_sloc (ops.value<CLI::show_sloc> ());
+ size_t sloc_total (0);
+ Boolean show_sloc (ops.show_sloc ());
//
//
Regex guard_expr ("/([a-z])([A-Z])/$1_$2/"); // Split words.
- NarrowString guard_prefix (ops.value<CLI::guard_prefix> ());
+ NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
guard_prefix = file_path.branch_path ().native_directory_string ();
@@ -2173,7 +1879,7 @@ namespace CXX
if (guard_prefix)
guard_prefix += '_';
- Boolean aggr (ops.value<CLI::generate_aggregate> ());
+ Boolean aggr (ops.generate_aggregate ());
// HXX
//
@@ -2198,13 +1904,8 @@ namespace CXX
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (hxx,
- ops.value<CLI::hxx_prologue> (),
- ops.value<CLI::prologue> (),
- "simpl");
- append (hxx,
- find_value (ops.value<CLI::hxx_prologue_file> (), "simpl"),
- prologue);
+ append (hxx, ops.hxx_prologue (), ops.prologue (), "simpl");
+ append (hxx, find_value (ops.hxx_prologue_file (), "simpl"), prologue);
hxx << "//" << endl
<< "// End prologue." << endl
@@ -2252,13 +1953,8 @@ namespace CXX
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (hxx,
- find_value (ops.value<CLI::hxx_epilogue_file> (), "simpl"),
- epilogue);
- append (hxx,
- ops.value<CLI::hxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "simpl");
+ append (hxx, find_value (ops.hxx_epilogue_file (), "simpl"), epilogue);
+ append (hxx, ops.hxx_epilogue (), ops.epilogue (), "simpl");
hxx << "//" << endl
<< "// End epilogue." << endl
@@ -2287,13 +1983,8 @@ namespace CXX
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (cxx,
- ops.value<CLI::cxx_prologue> (),
- ops.value<CLI::prologue> (),
- "simpl");
- append (cxx,
- find_value (ops.value<CLI::cxx_prologue_file> (), "simpl"),
- prologue);
+ append (cxx, ops.cxx_prologue (), ops.prologue (), "simpl");
+ append (cxx, find_value (ops.cxx_prologue_file (), "simpl"), prologue);
cxx << "//" << endl
<< "// End prologue." << endl
@@ -2318,13 +2009,8 @@ namespace CXX
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (cxx,
- find_value (ops.value<CLI::cxx_epilogue_file> (), "simpl"),
- epilogue);
- append (cxx,
- ops.value<CLI::cxx_epilogue> (),
- ops.value<CLI::epilogue> (),
- "simpl");
+ append (cxx, find_value (ops.cxx_epilogue_file (), "simpl"), epilogue);
+ append (cxx, ops.cxx_epilogue (), ops.epilogue (), "simpl");
cxx << "//" << endl
<< "// End epilogue." << endl
diff --git a/xsde/cxx/hybrid/generator.hxx b/xsde/cxx/hybrid/generator.hxx
index 0b87007..cbef109 100644
--- a/xsde/cxx/hybrid/generator.hxx
+++ b/xsde/cxx/hybrid/generator.hxx
@@ -6,22 +6,21 @@
#ifndef CXX_HYBRID_GENERATOR_HXX
#define CXX_HYBRID_GENERATOR_HXX
+#include <memory> // std::auto_ptr
+
#include <cult/types.hxx>
#include <cult/containers/vector.hxx>
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
#include <xsde.hxx>
#include <type-map/type-map.hxx>
-#include <cxx/hybrid/cli.hxx>
-#include <cxx/parser/cli.hxx>
-#include <cxx/serializer/cli.hxx>
+#include <cxx/parser/options.hxx>
+#include <cxx/serializer/options.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -37,16 +36,13 @@ namespace CXX
static Void
usage ();
- static CLI::OptionsSpec
- options_spec ();
-
- static Parser::CLI::Options*
- parser_options (CLI::Options const&,
+ static std::auto_ptr<Parser::options>
+ parser_options (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
- static Serializer::CLI::Options*
- serializer_options (CLI::Options const&,
+ static std::auto_ptr<Serializer::options>
+ serializer_options (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
@@ -54,7 +50,7 @@ namespace CXX
//
static Void
calculate_size (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
WarningSet const& disabled_warnings);
@@ -63,19 +59,19 @@ namespace CXX
//
static Void
process_tree_names (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
static Void
process_parser_names (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
static Void
process_serializer_names (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
@@ -83,7 +79,7 @@ namespace CXX
//
static UnsignedLong
generate_tree (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean file_per_type,
@@ -95,7 +91,7 @@ namespace CXX
static UnsignedLong
generate_parser (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean file_per_type,
@@ -105,7 +101,7 @@ namespace CXX
static UnsignedLong
generate_serializer (
- CLI::Options const&,
+ options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean file_per_type,
diff --git a/xsde/cxx/hybrid/insertion-header.cxx b/xsde/cxx/hybrid/insertion-header.cxx
index 887b948..a054d9e 100644
--- a/xsde/cxx/hybrid/insertion-header.cxx
+++ b/xsde/cxx/hybrid/insertion-header.cxx
@@ -41,7 +41,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -73,7 +73,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -102,7 +102,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -135,7 +135,7 @@ namespace CXX
String const& type (etype (a));
String const& scope (Context::scope (a));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -165,7 +165,7 @@ namespace CXX
String const& type (etype (c));
String const& scope (Context::scope (c));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -201,7 +201,7 @@ namespace CXX
String const& type (etype (s));
String const& scope (Context::scope (s));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -256,7 +256,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
diff --git a/xsde/cxx/hybrid/insertion-source.cxx b/xsde/cxx/hybrid/insertion-source.cxx
index 0c034dc..d579964 100644
--- a/xsde/cxx/hybrid/insertion-source.cxx
+++ b/xsde/cxx/hybrid/insertion-source.cxx
@@ -41,7 +41,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -77,7 +77,7 @@ namespace CXX
if (!name)
return;
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -118,7 +118,7 @@ namespace CXX
String const& value (u.context ().get<String> ("value"));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -475,7 +475,7 @@ namespace CXX
String const& type (etype (a));
String const& scope (Context::scope (a));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -518,7 +518,7 @@ namespace CXX
String const& type (etype (c));
String const& scope (Context::scope (c));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -581,7 +581,7 @@ namespace CXX
String const& type (etype (s));
String const& scope (Context::scope (s));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
@@ -680,7 +680,7 @@ namespace CXX
Boolean restriction (restriction_p (c));
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
os << (exceptions ? "void" : "bool") << endl
diff --git a/xsde/cxx/hybrid/options.cli b/xsde/cxx/hybrid/options.cli
index 40df945..33b05b0 100644
--- a/xsde/cxx/hybrid/options.cli
+++ b/xsde/cxx/hybrid/options.cli
@@ -335,10 +335,10 @@ namespace CXX
names of generated serializer implementation files."
};
- Cult::Types::NarrowString --paggr-type-suffix = "_paggs"
+ Cult::Types::NarrowString --paggr-type-suffix = "_paggr"
{
"<suffix>",
- "Use <suffix> instead of the default \cb{_paggs} to construct the
+ "Use <suffix> instead of the default \cb{_paggr} to construct the
names of generated parser aggregates."
};
@@ -348,6 +348,24 @@ namespace CXX
"Use <suffix> instead of the default \cb{_saggr} to construct the
names of generated serializer aggregates."
};
+
+ // In C++/Hybrid these common options can be specified multiple
+ // times with keys that identify which files they apply to. So
+ // "override" them here. Note that the documentation is still
+ // specified in the common version.
+ //
+ std::vector<Cult::Types::NarrowString> --hxx-regex;
+ std::vector<Cult::Types::NarrowString> --ixx-regex;
+ std::vector<Cult::Types::NarrowString> --cxx-regex;
+
+ std::vector<Cult::Types::NarrowString> --hxx-prologue-file;
+ std::vector<Cult::Types::NarrowString> --ixx-prologue-file;
+ std::vector<Cult::Types::NarrowString> --cxx-prologue-file;
+ std::vector<Cult::Types::NarrowString> --prologue-file;
+ std::vector<Cult::Types::NarrowString> --hxx-epilogue-file;
+ std::vector<Cult::Types::NarrowString> --ixx-epilogue-file;
+ std::vector<Cult::Types::NarrowString> --cxx-epilogue-file;
+ std::vector<Cult::Types::NarrowString> --epilogue-file;
};
}
}
diff --git a/xsde/cxx/hybrid/parser-header.cxx b/xsde/cxx/hybrid/parser-header.cxx
index 1e96dac..64a7f55 100644
--- a/xsde/cxx/hybrid/parser-header.cxx
+++ b/xsde/cxx/hybrid/parser-header.cxx
@@ -74,8 +74,8 @@ namespace CXX
if (name)
{
Boolean fl (fixed_length (e));
- Boolean val (!options.value<CLI::suppress_validation> () &&
- !options.value<CLI::suppress_parser_val> ());
+ Boolean val (!options.suppress_validation () &&
+ !options.suppress_parser_val ());
SemanticGraph::Type& b (e.inherits ().base ());
diff --git a/xsde/cxx/hybrid/parser-name-processor.cxx b/xsde/cxx/hybrid/parser-name-processor.cxx
index 99d11fa..d5f7edd 100644
--- a/xsde/cxx/hybrid/parser-name-processor.cxx
+++ b/xsde/cxx/hybrid/parser-name-processor.cxx
@@ -31,31 +31,17 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ typedef Hybrid::options options_type;
+
+ public:
+ Context (options_type const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
- impl_suffix_ (ops.value<CLI::pimpl_type_suffix> ()),
- aggr_suffix_ (ops.value<CLI::paggr_type_suffix> ()),
+ : CXX::Context (std::wcerr, root, path, ops, "name", "char"),
+ impl_suffix_ (ops.pimpl_type_suffix ()),
+ aggr_suffix_ (ops.paggr_type_suffix ()),
options (ops),
- aggregate (ops.value<CLI::generate_aggregate> ()),
+ aggregate (ops.generate_aggregate ()),
impl_suffix (impl_suffix_),
aggr_suffix (aggr_suffix_),
custom_parser_map (custom_parser_map_),
@@ -63,10 +49,9 @@ namespace CXX
{
// Custom parser mapping.
//
- typedef Containers::Vector<NarrowString> Vector;
- Vector const& v (ops.value<CLI::custom_parser> ());
+ NarrowStrings const& v (ops.custom_parser ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ());
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
i != e; ++i)
{
String s (*i);
@@ -239,7 +224,7 @@ namespace CXX
Cult::Containers::Map<String, NameSet*> global_type_names_;
public:
- CLI::Options const& options;
+ options_type const& options;
Boolean aggregate;
String const& impl_suffix;
String const& aggr_suffix;
@@ -265,7 +250,7 @@ namespace CXX
//
Type* base_enum (0);
- if (options.value<CLI::suppress_enum> () ||
+ if (options.suppress_enum () ||
!Hybrid::Context::enum_mapping (e, &base_enum))
{
complex_.traverse (e);
@@ -530,12 +515,11 @@ namespace CXX
if (aggregate)
{
- typedef Cult::Containers::Vector<NarrowString> Names;
- Names const& names (options.value<CLI::root_type> ());
+ NarrowStrings const& names (options.root_type ());
// Hopefully nobody will specify more than a handful of names.
//
- for (Names::ConstIterator i (names.begin ());
+ for (NarrowStrings::const_iterator i (names.begin ());
i != names.end (); ++i)
{
if (name == String (*i))
@@ -562,7 +546,7 @@ namespace CXX
~GlobalElement ()
{
- if (last_ != 0 && options.value<CLI::root_element_last> ())
+ if (last_ != 0 && options.root_element_last ())
process (*last_);
}
@@ -571,34 +555,33 @@ namespace CXX
{
Boolean p (false);
- if (last_ == 0 && options.value<CLI::root_element_first> ())
+ if (last_ == 0 && options.root_element_first ())
p = true;
last_ = &e;
if (!p &&
- !options.value<CLI::root_element_first> () &&
- !options.value<CLI::root_element_last> () &&
- !options.value<CLI::root_element_all> () &&
- !options.value<CLI::root_element_none> () &&
- options.value<CLI::root_element> ().empty ())
+ !options.root_element_first () &&
+ !options.root_element_last () &&
+ !options.root_element_all () &&
+ !options.root_element_none () &&
+ options.root_element ().empty ())
{
// By default process them all.
//
p = true;
}
- if (!p && options.value<CLI::root_element_all> ())
+ if (!p && options.root_element_all ())
p = true;
if (!p)
{
- typedef Cult::Containers::Vector<NarrowString> Names;
- Names const& names (options.value<CLI::root_element> ());
+ NarrowStrings const& names (options.root_element ());
// Hopefully nobody will specify more than a handful of names.
//
- for (Names::ConstIterator i (names.begin ());
+ for (NarrowStrings::const_iterator i (names.begin ());
!p && i != names.end ();
++i)
{
@@ -728,7 +711,7 @@ namespace CXX
Char const* Uses::seen_key = "cxx-hybrid-parser-name-processor-seen";
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
@@ -794,7 +777,7 @@ namespace CXX
}
Boolean ParserNameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
diff --git a/xsde/cxx/hybrid/parser-name-processor.hxx b/xsde/cxx/hybrid/parser-name-processor.hxx
index 1a1ab58..20721ee 100644
--- a/xsde/cxx/hybrid/parser-name-processor.hxx
+++ b/xsde/cxx/hybrid/parser-name-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -22,7 +22,7 @@ namespace CXX
{
public:
Boolean
- process (CLI::Options const& options,
+ process (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
Boolean deep);
diff --git a/xsde/cxx/hybrid/parser-source.cxx b/xsde/cxx/hybrid/parser-source.cxx
index 63afd43..3b6ed31 100644
--- a/xsde/cxx/hybrid/parser-source.cxx
+++ b/xsde/cxx/hybrid/parser-source.cxx
@@ -121,8 +121,8 @@ namespace CXX
Boolean fl (fixed_length (e));
- Boolean val (!options.value<CLI::suppress_validation> () &&
- !options.value<CLI::suppress_parser_val> ());
+ Boolean val (!options.suppress_validation () &&
+ !options.suppress_parser_val ());
SemanticGraph::Context& ec (e.context ());
SemanticGraph::Type& b (e.inherits ().base ());
@@ -1611,8 +1611,8 @@ namespace CXX
Boolean fixed (fixed_length (c));
Boolean rec (recursive (c));
- Boolean validation (!options.value<CLI::suppress_validation> () &&
- !options.value<CLI::suppress_parser_val> ());
+ Boolean validation (!options.suppress_validation () &&
+ !options.suppress_parser_val ());
Boolean c_string_base (false);
if (!stl && hb)
@@ -2093,8 +2093,8 @@ namespace CXX
{
// We need this functionality for enum mapping.
//
- if (!ctx.options.value<CLI::suppress_validation> () &&
- !ctx.options.value<CLI::suppress_parser_val> ())
+ if (!ctx.options.suppress_validation () &&
+ !ctx.options.suppress_parser_val ())
ctx.os << "#include <xsde/cxx/parser/validating/string-common.hxx>" << endl
<< endl;
else
diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx
index b8cec72..4071ecb 100644
--- a/xsde/cxx/hybrid/serializer-name-processor.cxx
+++ b/xsde/cxx/hybrid/serializer-name-processor.cxx
@@ -30,31 +30,17 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ typedef Hybrid::options options_type;
+
+ public:
+ Context (options_type const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
- impl_suffix_ (ops.value<CLI::simpl_type_suffix> ()),
- aggr_suffix_ (ops.value<CLI::saggr_type_suffix> ()),
+ : CXX::Context (std::wcerr, root, path, ops, "name", "char"),
+ impl_suffix_ (ops.simpl_type_suffix ()),
+ aggr_suffix_ (ops.saggr_type_suffix ()),
options (ops),
- aggregate (ops.value<CLI::generate_aggregate> ()),
+ aggregate (ops.generate_aggregate ()),
impl_suffix (impl_suffix_),
aggr_suffix (aggr_suffix_),
custom_serializer_map (custom_serializer_map_),
@@ -62,10 +48,9 @@ namespace CXX
{
// Custom serializer mapping.
//
- typedef Containers::Vector<NarrowString> Vector;
- Vector const& v (ops.value<CLI::custom_serializer> ());
+ NarrowStrings const& v (ops.custom_serializer ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ());
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
i != e; ++i)
{
String s (*i);
@@ -232,7 +217,7 @@ namespace CXX
Cult::Containers::Map<String, NameSet*> global_type_names_;
public:
- CLI::Options const& options;
+ options_type const& options;
Boolean aggregate;
String const& impl_suffix;
String const& aggr_suffix;
@@ -258,7 +243,7 @@ namespace CXX
//
Type* base_enum (0);
- if (options.value<CLI::suppress_enum> () ||
+ if (options.suppress_enum () ||
!Hybrid::Context::enum_mapping (e, &base_enum))
{
complex_.traverse (e);
@@ -538,12 +523,11 @@ namespace CXX
if (aggregate)
{
- typedef Cult::Containers::Vector<NarrowString> Names;
- Names const& names (options.value<CLI::root_type> ());
+ NarrowStrings const& names (options.root_type ());
// Hopefully nobody will specify more than a handful of names.
//
- for (Names::ConstIterator i (names.begin ());
+ for (NarrowStrings::const_iterator i (names.begin ());
i != names.end (); ++i)
{
if (name == String (*i))
@@ -570,7 +554,7 @@ namespace CXX
~GlobalElement ()
{
- if (last_ != 0 && options.value<CLI::root_element_last> ())
+ if (last_ != 0 && options.root_element_last ())
process (*last_);
}
@@ -579,36 +563,34 @@ namespace CXX
{
Boolean p (false);
- if (last_ == 0 && options.value<CLI::root_element_first> ())
+ if (last_ == 0 && options.root_element_first ())
p = true;
last_ = &e;
if (!p &&
- !options.value<CLI::root_element_first> () &&
- !options.value<CLI::root_element_last> () &&
- !options.value<CLI::root_element_all> () &&
- !options.value<CLI::root_element_none> () &&
- options.value<CLI::root_element> ().empty ())
+ !options.root_element_first () &&
+ !options.root_element_last () &&
+ !options.root_element_all () &&
+ !options.root_element_none () &&
+ options.root_element ().empty ())
{
// By default process them all.
//
p = true;
}
- if (!p && options.value<CLI::root_element_all> ())
+ if (!p && options.root_element_all ())
p = true;
if (!p)
{
- typedef Cult::Containers::Vector<NarrowString> Names;
- Names const& names (options.value<CLI::root_element> ());
+ NarrowStrings const& names (options.root_element ());
// Hopefully nobody will specify more than a handful of names.
//
- for (Names::ConstIterator i (names.begin ());
- !p && i != names.end ();
- ++i)
+ for (NarrowStrings::const_iterator i (names.begin ());
+ !p && i != names.end (); ++i)
{
if (e.name () == String (*i))
p = true;
@@ -736,7 +718,7 @@ namespace CXX
Char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen";
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
@@ -802,7 +784,7 @@ namespace CXX
}
Boolean SerializerNameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
diff --git a/xsde/cxx/hybrid/serializer-name-processor.hxx b/xsde/cxx/hybrid/serializer-name-processor.hxx
index 83f1ea9..0840f52 100644
--- a/xsde/cxx/hybrid/serializer-name-processor.hxx
+++ b/xsde/cxx/hybrid/serializer-name-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -22,7 +22,7 @@ namespace CXX
{
public:
Boolean
- process (CLI::Options const& options,
+ process (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
Boolean deep);
diff --git a/xsde/cxx/hybrid/serializer-source.cxx b/xsde/cxx/hybrid/serializer-source.cxx
index e267407..d99d167 100644
--- a/xsde/cxx/hybrid/serializer-source.cxx
+++ b/xsde/cxx/hybrid/serializer-source.cxx
@@ -206,8 +206,8 @@ namespace CXX
<< "_serialize_content ()"
<< "{";
- if (!options.value<CLI::suppress_validation> () &&
- !options.value<CLI::suppress_serializer_val> ())
+ if (!options.suppress_validation () &&
+ !options.suppress_serializer_val ())
{
// Do facet validation.
//
@@ -1056,7 +1056,7 @@ namespace CXX
if (a.default_p ())
{
- Boolean omit (options.value<CLI::omit_default_attributes> ());
+ Boolean omit (options.omit_default_attributes ());
if (a.fixed_p ())
os << "return " << (omit ? "false" : "true") << ";";
@@ -1144,8 +1144,8 @@ namespace CXX
Boolean rec (recursive (c));
Boolean restriction (restriction_p (c));
- Boolean validation (!options.value<CLI::suppress_validation> () &&
- !options.value<CLI::suppress_serializer_val> ());
+ Boolean validation (!options.suppress_validation () &&
+ !options.suppress_serializer_val ());
String state;
String member;
@@ -1400,8 +1400,8 @@ namespace CXX
<< endl;
if (ctx.enum_ &&
- !ctx.options.value<CLI::suppress_validation> () &&
- !ctx.options.value<CLI::suppress_serializer_val> ())
+ !ctx.options.suppress_validation () &&
+ !ctx.options.suppress_serializer_val ())
{
// We need this functionality for enum mapping.
//
diff --git a/xsde/cxx/hybrid/tree-forward.cxx b/xsde/cxx/hybrid/tree-forward.cxx
index b220847..6fbd424 100644
--- a/xsde/cxx/hybrid/tree-forward.cxx
+++ b/xsde/cxx/hybrid/tree-forward.cxx
@@ -220,7 +220,7 @@ namespace CXX
else
string_type_ = L"char*";
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
{
long_type_ = L"long";
unsigned_long_type_ = L"unsigned long";
@@ -670,7 +670,7 @@ namespace CXX
Boolean icdr (false), ocdr (false);
Boolean ixdr (false), oxdr (false);
- for (Streams::ConstIterator i (istreams.begin ());
+ for (NarrowStrings::const_iterator i (istreams.begin ());
i != istreams.end (); ++i)
{
if (*i == "CDR")
@@ -679,7 +679,7 @@ namespace CXX
ixdr = true;
}
- for (Streams::ConstIterator i (ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ostreams.begin ());
i != ostreams.end (); ++i)
{
if (*i == "CDR")
@@ -724,7 +724,7 @@ namespace CXX
Void
generate_tree_forward (Context& ctx, Boolean generate_xml_schema)
{
- NarrowString xml_schema (ctx.options.value<CLI::extern_xml_schema> ());
+ NarrowString xml_schema (ctx.options.extern_xml_schema ());
// Inlcude or Emit fundamental types.
//
@@ -752,7 +752,7 @@ namespace CXX
// Data representation stream includes.
//
- for (Context::Streams::ConstIterator i (ctx.istreams.begin ());
+ for (NarrowStrings::const_iterator i (ctx.istreams.begin ());
i != ctx.istreams.end (); ++i)
{
if (*i == "CDR")
@@ -763,7 +763,7 @@ namespace CXX
<< endl;
}
- for (Context::Streams::ConstIterator i (ctx.ostreams.begin ());
+ for (NarrowStrings::const_iterator i (ctx.ostreams.begin ());
i != ctx.ostreams.end (); ++i)
{
if (*i == "CDR")
diff --git a/xsde/cxx/hybrid/tree-header.cxx b/xsde/cxx/hybrid/tree-header.cxx
index 123b235..ae24feb 100644
--- a/xsde/cxx/hybrid/tree-header.cxx
+++ b/xsde/cxx/hybrid/tree-header.cxx
@@ -787,7 +787,7 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::Long&)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
align_type ("long", 5);
else
align_type ("long long", 8);
@@ -796,7 +796,7 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::UnsignedLong&)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
align_type ("unsigned long", 5);
else
align_type ("unsigned long long", 8);
@@ -2946,7 +2946,7 @@ namespace CXX
Void
generate_tree_header (Context& ctx)
{
- Boolean inline_ (ctx.options.value<CLI::generate_inline> ());
+ Boolean inline_ (ctx.options.generate_inline ());
// Emit header includes.
//
diff --git a/xsde/cxx/hybrid/tree-inline.cxx b/xsde/cxx/hybrid/tree-inline.cxx
index 748184c..2f6815e 100644
--- a/xsde/cxx/hybrid/tree-inline.cxx
+++ b/xsde/cxx/hybrid/tree-inline.cxx
@@ -2067,7 +2067,7 @@ namespace CXX
{
// Generate includes.
//
- if (ctx.options.value<CLI::generate_inline> ())
+ if (ctx.options.generate_inline ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::inline_);
diff --git a/xsde/cxx/hybrid/tree-name-processor.cxx b/xsde/cxx/hybrid/tree-name-processor.cxx
index a2d630d..0558907 100644
--- a/xsde/cxx/hybrid/tree-name-processor.cxx
+++ b/xsde/cxx/hybrid/tree-name-processor.cxx
@@ -31,30 +31,16 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ typedef Hybrid::options options_type;
+
+ public:
+ Context (options_type const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
- stl (!ops.value<CLI::no_stl> ()),
- detach (ops.value<CLI::generate_detach> ()),
- enum_ (!ops.value<CLI::suppress_enum> ()),
+ : CXX::Context (std::wcerr, root, path, ops, "name", "char"),
+ stl (!ops.no_stl ()),
+ detach (ops.generate_detach ()),
+ enum_ (!ops.suppress_enum ()),
custom_data_map (custom_data_map_),
custom_type_map (custom_type_map_),
global_type_names (global_type_names_)
@@ -62,10 +48,9 @@ namespace CXX
// Translate the type names with custom data.
//
{
- typedef Cult::Containers::Vector<NarrowString> CustomData;
- CustomData const& cd (ops.value<CLI::custom_data> ());
+ NarrowStrings const& cd (ops.custom_data ());
- for (CustomData::ConstIterator i (cd.begin ());
+ for (NarrowStrings::const_iterator i (cd.begin ());
i != cd.end (); ++i)
{
String name (*i);
@@ -102,10 +87,9 @@ namespace CXX
// Custom type mapping.
//
{
- typedef Containers::Vector<NarrowString> Vector;
- Vector const& v (ops.value<CLI::custom_type> ());
+ NarrowStrings const& v (ops.custom_type ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ());
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
i != e; ++i)
{
String s (*i);
@@ -2197,7 +2181,7 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
@@ -2311,7 +2295,7 @@ namespace CXX
}
Void TreeNameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
diff --git a/xsde/cxx/hybrid/tree-name-processor.hxx b/xsde/cxx/hybrid/tree-name-processor.hxx
index d1c6dba..fff1fb8 100644
--- a/xsde/cxx/hybrid/tree-name-processor.hxx
+++ b/xsde/cxx/hybrid/tree-name-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -22,7 +22,7 @@ namespace CXX
{
public:
Void
- process (CLI::Options const& options,
+ process (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
Boolean deep);
diff --git a/xsde/cxx/hybrid/tree-size-processor.cxx b/xsde/cxx/hybrid/tree-size-processor.cxx
index 6b3b978..0d734ca 100644
--- a/xsde/cxx/hybrid/tree-size-processor.cxx
+++ b/xsde/cxx/hybrid/tree-size-processor.cxx
@@ -1026,25 +1026,22 @@ namespace CXX
Char const* pass_two_key = "cxx-hybrid-size-processor-seen-two";
Boolean
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const&,
const WarningSet& disabled_warnings)
{
Boolean valid (true);
- Boolean stl (!ops.value<CLI::no_stl> ());
- Boolean poly (ops.value<CLI::generate_polymorphic> ());
+ Boolean stl (!ops.no_stl ());
+ Boolean poly (ops.generate_polymorphic ());
// Prepare a set of polymorphic types.
//
TypeSet poly_types;
if (poly)
- {
- poly_types.insert (
- ops.value<CLI::polymorphic_type> ().begin (),
- ops.value<CLI::polymorphic_type> ().end ());
- }
+ poly_types.insert (ops.polymorphic_type ().begin (),
+ ops.polymorphic_type ().end ());
// Root schema in the file-per-type mode is just a bunch
// of includes without a namespace.
@@ -1103,10 +1100,9 @@ namespace CXX
TypeSet custom_data_types;
{
- typedef Cult::Containers::Vector<NarrowString> CustomData;
- CustomData const& cd (ops.value<CLI::custom_data> ());
+ NarrowStrings const& cd (ops.custom_data ());
- for (CustomData::ConstIterator i (cd.begin ());
+ for (NarrowStrings::const_iterator i (cd.begin ());
i != cd.end (); ++i)
{
String n (*i);
@@ -1119,10 +1115,9 @@ namespace CXX
CustomTypeMap custom_type_map;
{
- typedef Containers::Vector<NarrowString> Vector;
- Vector const& v (ops.value<CLI::custom_type> ());
+ NarrowStrings const& v (ops.custom_type ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ());
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
i != e; ++i)
{
String s (*i);
@@ -1226,7 +1221,7 @@ namespace CXX
poly_types,
stl,
poly,
- !ops.value<CLI::suppress_enum> ());
+ !ops.suppress_enum ());
schema >> schema_names >> ns >> ns_names >> type;
@@ -1244,7 +1239,7 @@ namespace CXX
}
Boolean TreeSizeProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
const WarningSet& disabled_warnings)
diff --git a/xsde/cxx/hybrid/tree-size-processor.hxx b/xsde/cxx/hybrid/tree-size-processor.hxx
index 05bdb65..6f13401 100644
--- a/xsde/cxx/hybrid/tree-size-processor.hxx
+++ b/xsde/cxx/hybrid/tree-size-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
#include <xsde.hxx>
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Boolean
- process (CLI::Options const& options,
+ process (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
const WarningSet& disabled_warnings);
diff --git a/xsde/cxx/hybrid/tree-type-map.cxx b/xsde/cxx/hybrid/tree-type-map.cxx
index f2806c3..7825725 100644
--- a/xsde/cxx/hybrid/tree-type-map.cxx
+++ b/xsde/cxx/hybrid/tree-type-map.cxx
@@ -22,27 +22,10 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ Context (Hybrid::options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ())
+ : CXX::Context (std::wcerr, root, path, ops, "name", "char")
{
}
@@ -205,7 +188,7 @@ namespace CXX
}
Void
- generate_tree_type_map (CLI::Options const& ops,
+ generate_tree_type_map (options const& ops,
XSDFrontend::SemanticGraph::Schema& tu,
XSDFrontend::SemanticGraph::Path const& path,
String const& hxx_name,
@@ -229,16 +212,16 @@ namespace CXX
Traversal::Names schema_names;
Namespace ns (
ctx, &hxx_name,
- (ops.value<CLI::generate_parser> () ? &parser_map : 0),
- (ops.value<CLI::generate_serializer> () ? &serializer_map : 0));
+ (ops.generate_parser () ? &parser_map : 0),
+ (ops.generate_serializer () ? &serializer_map : 0));
schema >> schema_names >> ns;
Traversal::Names used_schema_names;
Namespace used_ns (
ctx, 0,
- (ops.value<CLI::generate_parser> () ? &parser_map : 0),
- (ops.value<CLI::generate_serializer> () ? &serializer_map : 0));
+ (ops.generate_parser () ? &parser_map : 0),
+ (ops.generate_serializer () ? &serializer_map : 0));
used_schema >> used_schema_names >> used_ns;
diff --git a/xsde/cxx/hybrid/tree-type-map.hxx b/xsde/cxx/hybrid/tree-type-map.hxx
index 2b75564..0f677cd 100644
--- a/xsde/cxx/hybrid/tree-type-map.hxx
+++ b/xsde/cxx/hybrid/tree-type-map.hxx
@@ -12,7 +12,7 @@
#include <type-map/type-map.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
namespace CXX
{
@@ -21,7 +21,7 @@ namespace CXX
using namespace Cult::Types;
Void
- generate_tree_type_map (CLI::Options const& options,
+ generate_tree_type_map (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
String const& hxx_name,
diff --git a/xsde/cxx/hybrid/validator.cxx b/xsde/cxx/hybrid/validator.cxx
index 70d8b1c..2b13097 100644
--- a/xsde/cxx/hybrid/validator.cxx
+++ b/xsde/cxx/hybrid/validator.cxx
@@ -28,10 +28,10 @@ namespace CXX
public:
ValidationContext (SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& options,
+ Hybrid::options const& ops,
const WarningSet& disabled_warnings,
Boolean& valid_)
- : Context (std::wcerr, root, path, options, 0, 0, 0),
+ : Context (std::wcerr, root, path, ops, 0, 0, 0),
disabled_warnings_ (disabled_warnings),
disabled_warnings_all_ (false),
valid (valid_),
@@ -160,7 +160,7 @@ namespace CXX
return;
if (e.substitutes_p () &&
- !options.value<CLI::generate_polymorphic> () &&
+ !options.generate_polymorphic () &&
!subst_group_warning_issued)
{
subst_group_warning_issued = true;
@@ -245,7 +245,7 @@ namespace CXX
<< "automatically name them"
<< endl;
- if (!options.value<CLI::show_anonymous> ())
+ if (!options.show_anonymous ())
wcerr << t.file ()
<< ": info: use --show-anonymous option to see these "
<< "types" << endl;
@@ -274,7 +274,7 @@ namespace CXX
{
if (traverse_common (e))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << e.file () << ":" << e.line () << ":" << e.column ()
<< ": error: element '" << xpath (e) << "' "
@@ -299,7 +299,7 @@ namespace CXX
{
if (traverse_common (a))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << a.file () << ":" << a.line () << ":" << a.column ()
<< ": error: attribute '" << xpath (a) << "' "
@@ -482,17 +482,17 @@ namespace CXX
}
Boolean Validator::
- validate (CLI::Options const& options,
+ validate (options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
const WarningSet& disabled_warnings)
{
Boolean valid (true);
- ValidationContext ctx (root, path, options, disabled_warnings, valid);
+ ValidationContext ctx (root, path, ops, disabled_warnings, valid);
//
//
- NarrowString enc (options.value<CLI::char_encoding> ());
+ NarrowString enc (ops.char_encoding ());
if (enc != "utf8" && enc != "iso8859-1")
{
@@ -502,9 +502,9 @@ namespace CXX
//
//
- Boolean par (options.value<CLI::generate_parser> ());
- Boolean ser (options.value<CLI::generate_serializer> ());
- Boolean agg (options.value<CLI::generate_aggregate> ());
+ Boolean par (ops.generate_parser ());
+ Boolean ser (ops.generate_serializer ());
+ Boolean agg (ops.generate_aggregate ());
if (agg && !par && !ser && !ctx.is_disabled ("H002"))
{
@@ -517,11 +517,11 @@ namespace CXX
// are generating aggregate types.
//
if (agg &&
- !options.value<CLI::root_element_first> () &&
- !options.value<CLI::root_element_last> () &&
- !options.value<CLI::root_element_all> () &&
- !options.value<CLI::root_element_none> () &&
- options.value<CLI::root_element> ().empty () &&
+ !ops.root_element_first () &&
+ !ops.root_element_last () &&
+ !ops.root_element_all () &&
+ !ops.root_element_none () &&
+ ops.root_element ().empty () &&
!ctx.is_disabled ("H003"))
{
UnsignedLong count (0);
@@ -565,8 +565,7 @@ namespace CXX
// Test for constructs that require validation in parser.
//
if (valid && par &&
- (options.value<CLI::suppress_validation> () ||
- options.value<CLI::suppress_parser_val> ()))
+ (ops.suppress_validation () || ops.suppress_parser_val ()))
{
Traversal::Schema schema;
Sources sources;
diff --git a/xsde/cxx/hybrid/validator.hxx b/xsde/cxx/hybrid/validator.hxx
index cbc80ac..ba4cc80 100644
--- a/xsde/cxx/hybrid/validator.hxx
+++ b/xsde/cxx/hybrid/validator.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph/schema.hxx>
-#include <cxx/hybrid/cli.hxx>
+#include <cxx/hybrid/options.hxx>
#include <xsde.hxx>
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Boolean
- validate (CLI::Options const& options,
+ validate (options const& options,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& tu,
const WarningSet& disabled_warnings);
diff --git a/xsde/cxx/parser/cli.hxx b/xsde/cxx/parser/cli.hxx
deleted file mode 100644
index 7f41936..0000000
--- a/xsde/cxx/parser/cli.hxx
+++ /dev/null
@@ -1,160 +0,0 @@
-// file : xsde/cxx/parser/cli.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef CXX_PARSER_CLI_HXX
-#define CXX_PARSER_CLI_HXX
-
-#include <cult/types.hxx>
-
-#include <cult/containers/vector.hxx>
-
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
-namespace CXX
-{
- namespace Parser
- {
- namespace CLI
- {
- using namespace Cult::Types;
-
- typedef Char const Key[];
-
- extern Key type_map;
- extern Key char_encoding;
- extern Key no_stl;
- extern Key no_iostream;
- extern Key no_exceptions;
- extern Key no_long_long;
- extern Key reuse_style_mixin;
- extern Key reuse_style_none;
- extern Key generate_inline;
- extern Key suppress_validation;
- extern Key generate_polymorphic;
- extern Key runtime_polymorphic;
- extern Key suppress_reset;
- extern Key custom_allocator;
- extern Key generate_noop_impl;
- extern Key generate_print_impl;
- extern Key generate_test_driver;
- extern Key force_overwrite;
- extern Key root_element_first;
- extern Key root_element_last;
- extern Key root_element;
- extern Key generate_xml_schema;
- extern Key extern_xml_schema;
- extern Key output_dir;
- extern Key skel_type_suffix;
- extern Key skel_file_suffix;
- extern Key impl_type_suffix;
- extern Key impl_file_suffix;
- extern Key namespace_map;
- extern Key namespace_regex;
- extern Key namespace_regex_trace;
- extern Key reserved_name;
- extern Key include_with_brackets;
- extern Key include_prefix;
- extern Key include_regex;
- extern Key include_regex_trace;
- extern Key guard_prefix;
- extern Key hxx_suffix;
- extern Key ixx_suffix;
- extern Key cxx_suffix;
- extern Key hxx_regex;
- extern Key ixx_regex;
- extern Key cxx_regex;
- extern Key hxx_prologue;
- extern Key ixx_prologue;
- extern Key cxx_prologue;
- extern Key prologue;
- extern Key hxx_epilogue;
- extern Key ixx_epilogue;
- extern Key cxx_epilogue;
- extern Key epilogue;
- extern Key hxx_prologue_file;
- extern Key ixx_prologue_file;
- extern Key cxx_prologue_file;
- extern Key prologue_file;
- extern Key hxx_epilogue_file;
- extern Key ixx_epilogue_file;
- extern Key cxx_epilogue_file;
- extern Key epilogue_file;
- extern Key show_anonymous;
- extern Key show_sloc;
- extern Key proprietary_license;
-
- typedef Cult::CLI::Options<
- type_map, Cult::Containers::Vector<NarrowString>,
- char_encoding, NarrowString,
- no_stl, Boolean,
- no_iostream, Boolean,
- no_exceptions, Boolean,
- no_long_long, Boolean,
- reuse_style_mixin, Boolean,
- reuse_style_none, Boolean,
- generate_inline, Boolean,
- suppress_validation, Boolean,
- generate_polymorphic, Boolean,
- runtime_polymorphic, Boolean,
- suppress_reset, Boolean,
- custom_allocator, Boolean,
- generate_noop_impl, Boolean,
- generate_print_impl, Boolean,
- generate_test_driver, Boolean,
- force_overwrite, Boolean,
- root_element_first, Boolean,
- root_element_last, Boolean,
- root_element, NarrowString,
- generate_xml_schema, Boolean,
- extern_xml_schema, NarrowString,
- output_dir, NarrowString,
- skel_type_suffix, NarrowString,
- skel_file_suffix, NarrowString,
- impl_type_suffix, NarrowString,
- impl_file_suffix, NarrowString,
- namespace_map, Cult::Containers::Vector<NarrowString>,
- namespace_regex, Cult::Containers::Vector<NarrowString>,
- namespace_regex_trace, Boolean,
- reserved_name, Cult::Containers::Vector<NarrowString>,
- include_with_brackets, Boolean,
- include_prefix, NarrowString,
- include_regex, Cult::Containers::Vector<NarrowString>,
- include_regex_trace, Boolean,
- guard_prefix, NarrowString,
- hxx_suffix, NarrowString,
- ixx_suffix, NarrowString,
- cxx_suffix, NarrowString,
- hxx_regex, NarrowString,
- ixx_regex, NarrowString,
- cxx_regex, NarrowString,
- hxx_prologue, Cult::Containers::Vector<NarrowString>,
- ixx_prologue, Cult::Containers::Vector<NarrowString>,
- cxx_prologue, Cult::Containers::Vector<NarrowString>,
- prologue, Cult::Containers::Vector<NarrowString>,
- hxx_epilogue, Cult::Containers::Vector<NarrowString>,
- ixx_epilogue, Cult::Containers::Vector<NarrowString>,
- cxx_epilogue, Cult::Containers::Vector<NarrowString>,
- epilogue, Cult::Containers::Vector<NarrowString>,
- hxx_prologue_file, NarrowString,
- ixx_prologue_file, NarrowString,
- cxx_prologue_file, NarrowString,
- prologue_file, NarrowString,
- hxx_epilogue_file, NarrowString,
- ixx_epilogue_file, NarrowString,
- cxx_epilogue_file, NarrowString,
- epilogue_file, NarrowString,
- show_anonymous, Boolean,
- show_sloc, Boolean,
- proprietary_license, Boolean
-
- > Options;
-
- struct OptionsSpec: Cult::CLI::OptionsSpec<Options> {};
- }
- }
-}
-
-#endif // CXX_PARSER_CLI_HXX
diff --git a/xsde/cxx/parser/driver-source.cxx b/xsde/cxx/parser/driver-source.cxx
index 6c85cd1..2e8db21 100644
--- a/xsde/cxx/parser/driver-source.cxx
+++ b/xsde/cxx/parser/driver-source.cxx
@@ -765,12 +765,12 @@ namespace CXX
virtual Void
traverse (Type& e)
{
- if (options.value<CLI::root_element_first> ())
+ if (options.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (String name = options.value<CLI::root_element> ())
+ else if (String name = options.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -816,7 +816,7 @@ namespace CXX
set.insert ("doc_p");
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "#include <stdio.h>" << endl;
else
os << "#include <iostream>" << endl;
@@ -831,7 +831,7 @@ namespace CXX
<< "{"
<< "input = \"STDIN\";";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"XML file not specified, reading " <<
"from STDIN\\n\");";
else
@@ -843,7 +843,7 @@ namespace CXX
<< "input = argv[1];"
<< endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
{
os << "FILE* f = argc > 1 ? fopen (argv[1], \"rb\") : stdin;"
<< endl
@@ -854,12 +854,11 @@ namespace CXX
<< "}";
}
- if (ctx.options.value<CLI::no_iostream> () ||
- ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_iostream () || ctx.options.no_exceptions ())
os << "int r = 0;"
<< endl;
- if (!ctx.options.value<CLI::no_exceptions> ())
+ if (!ctx.options.no_exceptions ())
os << "try"
<< "{";
@@ -888,10 +887,10 @@ namespace CXX
os << "// Parse the XML document." << endl
<< "//" << endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "bool io_error = false;";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << xs << "::parser_error e;"
<< endl
<< "do"
@@ -908,20 +907,20 @@ namespace CXX
ctx.strlit (root->name ()) << ");"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "if (e = doc_p._error ())" << endl
<< "break;"
<< endl;
os << root_p << ".pre ();";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << endl
<< "if (e = " << root_p << "._error ())" << endl
<< "break;";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
{
os << endl
<< "char buf[4096];"
@@ -936,7 +935,7 @@ namespace CXX
<< "break;"
<< "}";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "doc_p.parse (buf, s, feof (f) != 0);"
<< "e = doc_p._error ();"
<< "}"
@@ -962,7 +961,7 @@ namespace CXX
<< "doc_p.parse (argv[1]);"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "if (e = doc_p._error ())" << endl
<< "break;"
<< endl;
@@ -975,7 +974,7 @@ namespace CXX
{
os << root_p << "." << post << " ();";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "e = " << root_p << "._error ();";
}
else
@@ -984,12 +983,12 @@ namespace CXX
root_p << "." << post << " ());"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "if (e = " << root_p << "._error ())" << endl
<< "break;"
<< endl;
- if (ctx.options.value<CLI::generate_print_impl> ())
+ if (ctx.options.generate_print_impl ())
{
PrintCall t (ctx, root->name (), "v");
t.dispatch (root_type);
@@ -1006,11 +1005,11 @@ namespace CXX
}
}
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "}"
<< "while (false);"
<< endl;
- else if (ctx.options.value<CLI::no_iostream> ())
+ else if (ctx.options.no_iostream ())
os << "}" // if (!io_error)
<< "else"
<< "{"
@@ -1021,17 +1020,17 @@ namespace CXX
// Error handling.
//
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
{
os << "// Handle errors." << endl
<< "//" << endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
{
os << "if (io_error)"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s: read failure\\n\", input);";
else
os << "std::cerr << input << \": read failure\" << std::endl;";
@@ -1048,7 +1047,7 @@ namespace CXX
<< "case " << xs << "::parser_error::sys:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s: %s\\n\", input, e.sys_text ());";
else
os << "std::cerr << input << \": \" << e.sys_text () << std::endl;";
@@ -1058,7 +1057,7 @@ namespace CXX
<< "case " << xs << "::parser_error::xml:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s:%lu:%lu: %s\\n\"," << endl
<< "input, e.line (), e.column (), e.xml_text ());";
else
@@ -1068,12 +1067,12 @@ namespace CXX
os << "break;"
<< "}";
- if (!ctx.options.value<CLI::suppress_validation> ())
+ if (!ctx.options.suppress_validation ())
{
os << "case " << xs << "::parser_error::schema:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s:%lu:%lu: %s\\n\"," << endl
<< "input, e.line (), e.column (), e.schema_text ());";
else
@@ -1087,7 +1086,7 @@ namespace CXX
os << "case " << xs << "::parser_error::app:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s:%lu:%lu: application error %d\\n\"," << endl
<< "input, e.line (), e.column (), e.app_code ());";
else
@@ -1111,7 +1110,7 @@ namespace CXX
<< "catch (const " << xs << "::parser_exception& e)"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s:%lu:%lu: %s\\n\"," << endl
<< "input, e.line (), e.column (), e.text ());"
<< "r = 1;";
@@ -1122,7 +1121,7 @@ namespace CXX
os << "}";
- if (!ctx.options.value<CLI::no_iostream> ())
+ if (!ctx.options.no_iostream ())
{
os << "catch (const std::ios_base::failure&)"
<< "{"
@@ -1133,13 +1132,12 @@ namespace CXX
}
}
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "if (argc > 1)" << endl
<< "fclose (f);"
<< endl;
- if (ctx.options.value<CLI::no_iostream> () ||
- ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_iostream () || ctx.options.no_exceptions ())
os << "return r;";
else
os << "return 0;";
diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx
index bd5b09a..2f0c7e3 100644
--- a/xsde/cxx/parser/elements.cxx
+++ b/xsde/cxx/parser/elements.cxx
@@ -13,41 +13,24 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
Regex const* he,
Regex const* ie,
Regex const* hie)
- : CXX::Context (o,
- root,
- path,
- "p:name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
+ : CXX::Context (o, root, path, ops, "p:name", "char"),
options (ops),
xml_parser (xml_parser_),
simple_base (simple_base_),
complex_base (complex_base_),
list_base (list_base_),
parser_map (parser_map_),
- validation (!ops.value<CLI::suppress_validation> ()),
- exceptions (!ops.value<CLI::no_exceptions> ()),
- poly_code (ops.value<CLI::generate_polymorphic> ()),
- poly_runtime (poly_code || ops.value<CLI::runtime_polymorphic> ()),
- reset (!ops.value<CLI::suppress_reset> ()),
- mixin (ops.value<CLI::reuse_style_mixin> ()),
- tiein (!mixin && !ops.value<CLI::reuse_style_none> ()),
+ validation (!ops.suppress_validation ()),
+ exceptions (!ops.no_exceptions ()),
+ poly_code (ops.generate_polymorphic ()),
+ poly_runtime (poly_code || ops.runtime_polymorphic ()),
+ reset (!ops.suppress_reset ()),
+ mixin (ops.reuse_style_mixin ()),
+ tiein (!mixin && !ops.reuse_style_none ()),
hxx_expr (he),
ixx_expr (ie),
hxx_impl_expr (hie),
diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx
index 6ce5593..179eaec 100644
--- a/xsde/cxx/parser/elements.hxx
+++ b/xsde/cxx/parser/elements.hxx
@@ -12,7 +12,7 @@
#include <cxx/elements.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -35,11 +35,13 @@ namespace CXX
public:
typedef cutl::re::regexsub Regex;
+ typedef Parser::options options_type;
+
public:
Context (std::wostream&,
SemanticGraph::Schema&,
SemanticGraph::Path const&,
- CLI::Options const&,
+ options_type const&,
Regex const* hxx_expr,
Regex const* ixx_expr,
Regex const* hxx_impl_expr);
@@ -166,7 +168,7 @@ namespace CXX
has_facets (SemanticGraph::Complex& c);
public:
- CLI::Options const& options;
+ options_type const& options;
String& xml_parser;
String& simple_base;
String& complex_base;
@@ -592,21 +594,20 @@ namespace CXX
//
struct RootElement: Traversal::Element
{
- RootElement (CLI::Options const& options,
- SemanticGraph::Element*& element)
- : options_ (options), element_ (element)
+ RootElement (options const& o, SemanticGraph::Element*& e)
+ : options_ (o), element_ (e)
{
}
virtual Void
traverse (Type& e)
{
- if (options_.value<CLI::root_element_first> ())
+ if (options_.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (String name = options_.value<CLI::root_element> ())
+ else if (String name = options_.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -616,7 +617,7 @@ namespace CXX
}
private:
- CLI::Options const& options_;
+ options const& options_;
SemanticGraph::Element*& element_;
};
}
diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx
index 828368a..b226cb9 100644
--- a/xsde/cxx/parser/generator.cxx
+++ b/xsde/cxx/parser/generator.cxx
@@ -110,75 +110,6 @@ namespace CXX
"//\n\n";
}
- namespace Parser
- {
- namespace CLI
- {
- extern Key type_map = "type-map";
- extern Key char_encoding = "char-encoding";
- extern Key no_stl = "no-stl";
- extern Key no_iostream = "no-iostream";
- extern Key no_exceptions = "no-exceptions";
- extern Key no_long_long = "no-long-long";
- extern Key reuse_style_mixin = "reuse-style-mixin";
- extern Key reuse_style_none = "reuse-style-none";
- extern Key generate_inline = "generate-inline";
- extern Key suppress_validation = "suppress-validation";
- extern Key generate_polymorphic = "generate-polymorphic";
- extern Key runtime_polymorphic = "runtime-polymorphic";
- extern Key suppress_reset = "suppress-reset";
- extern Key custom_allocator = "custom-allocator";
- extern Key generate_noop_impl = "generate-noop-impl";
- extern Key generate_print_impl = "generate-print-impl";
- extern Key generate_test_driver = "generate-test-driver";
- extern Key force_overwrite = "force-overwrite";
- extern Key root_element_first = "root-element-first";
- extern Key root_element_last = "root-element-last";
- extern Key root_element = "root-element";
- extern Key generate_xml_schema = "generate-xml-schema";
- extern Key extern_xml_schema = "extern-xml-schema";
- extern Key output_dir = "output-dir";
- extern Key skel_type_suffix = "skel-type-suffix";
- extern Key skel_file_suffix = "skel-file-suffix";
- extern Key impl_type_suffix = "impl-type-suffix";
- extern Key impl_file_suffix = "impl-file-suffix";
- extern Key namespace_map = "namespace-map";
- extern Key namespace_regex = "namespace-regex";
- extern Key namespace_regex_trace = "namespace-regex-trace";
- extern Key reserved_name = "reserved-name";
- extern Key include_with_brackets = "include-with-brackets";
- extern Key include_prefix = "include-prefix";
- extern Key include_regex = "include-regex";
- extern Key include_regex_trace = "include-regex-trace";
- extern Key guard_prefix = "guard-prefix";
- extern Key hxx_suffix = "hxx-suffix";
- extern Key ixx_suffix = "ixx-suffix";
- extern Key cxx_suffix = "cxx-suffix";
- extern Key hxx_regex = "hxx-regex";
- extern Key ixx_regex = "ixx-regex";
- extern Key cxx_regex = "cxx-regex";
- extern Key hxx_prologue = "hxx-prologue";
- extern Key ixx_prologue = "ixx-prologue";
- extern Key cxx_prologue = "cxx-prologue";
- extern Key prologue = "prologue";
- extern Key hxx_epilogue = "hxx-epilogue";
- extern Key ixx_epilogue = "ixx-epilogue";
- extern Key cxx_epilogue = "cxx-epilogue";
- extern Key epilogue = "epilogue";
- extern Key hxx_prologue_file = "hxx-prologue-file";
- extern Key ixx_prologue_file = "ixx-prologue-file";
- extern Key cxx_prologue_file = "cxx-prologue-file";
- extern Key prologue_file = "prologue-file";
- extern Key hxx_epilogue_file = "hxx-epilogue-file";
- extern Key ixx_epilogue_file = "ixx-epilogue-file";
- extern Key cxx_epilogue_file = "cxx-epilogue-file";
- extern Key epilogue_file = "epilogue-file";
- extern Key show_anonymous = "show-anonymous";
- extern Key show_sloc = "show-sloc";
- extern Key proprietary_license = "proprietary-license";
- }
- }
-
Void Parser::Generator::
usage ()
{
@@ -186,27 +117,8 @@ namespace CXX
CXX::options::print_usage (wcout);
}
- Parser::CLI::OptionsSpec Parser::Generator::
- options_spec ()
- {
- CLI::OptionsSpec spec;
-
- spec.option<CLI::char_encoding> ().default_value ("utf8");
-
- spec.option<CLI::skel_file_suffix> ().default_value ("-pskel");
- spec.option<CLI::skel_type_suffix> ().default_value ("_pskel");
- spec.option<CLI::impl_file_suffix> ().default_value ("-pimpl");
- spec.option<CLI::impl_type_suffix> ().default_value ("_pimpl");
-
- spec.option<CLI::hxx_suffix> ().default_value (".hxx");
- spec.option<CLI::ixx_suffix> ().default_value (".ixx");
- spec.option<CLI::cxx_suffix> ().default_value (".cxx");
-
- return spec;
- }
-
Void Parser::Generator::
- process_names (CLI::Options const& ops,
+ process_names (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file)
{
@@ -264,14 +176,13 @@ namespace CXX
Void
append (WideOutputFileStream& os,
- Cult::Containers::Vector<NarrowString> const& primary,
- Cult::Containers::Vector<NarrowString> const& def)
+ NarrowStrings const& primary,
+ NarrowStrings const& def)
{
- Cult::Containers::Vector<NarrowString> const& v (
- primary.empty () ? def : primary);
+ NarrowStrings const& v (primary.empty () ? def : primary);
- for (Containers::Vector<NarrowString>::ConstIterator
- i (v.begin ()), e (v.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
+ i != e; ++i)
{
os << i->c_str () << endl;
}
@@ -280,7 +191,7 @@ namespace CXX
UnsignedLong Parser::Generator::
- generate (Parser::CLI::Options const& ops,
+ generate (Parser::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -296,7 +207,7 @@ namespace CXX
try
{
- Boolean generate_xml_schema (ops.value<CLI::generate_xml_schema> ());
+ Boolean generate_xml_schema (ops.generate_xml_schema ());
// We could be compiling several schemas at once in which case
// handling of the --generate-xml-schema option gets tricky: we
@@ -305,7 +216,7 @@ namespace CXX
//
if (generate_xml_schema)
{
- if (NarrowString name = ops.value<CLI::extern_xml_schema> ())
+ if (NarrowString name = ops.extern_xml_schema ())
{
if (file_path.native_file_string () != name)
generate_xml_schema = false;
@@ -313,11 +224,11 @@ namespace CXX
}
Boolean impl (!generate_xml_schema &&
- (ops.value<CLI::generate_noop_impl> () ||
- ops.value<CLI::generate_print_impl> ()));
+ (ops.generate_noop_impl () ||
+ ops.generate_print_impl ()));
Boolean driver (gen_driver && !generate_xml_schema &&
- ops.value<CLI::generate_test_driver> ());
+ ops.generate_test_driver ());
// Evaluate the graph for possibility of generating something useful.
@@ -336,7 +247,7 @@ namespace CXX
proc.process (ops, schema, file_path, true);
}
- Boolean validation (!ops.value<CLI::suppress_validation> ());
+ Boolean validation (!ops.suppress_validation ());
// Compute state machine info.
//
@@ -350,11 +261,11 @@ namespace CXX
//
{
using namespace TypeMap;
- typedef Containers::Vector<NarrowString> Files;
- Files const& files (ops.value<CLI::type_map> ());
+ NarrowStrings const& files (ops.type_map ());
- for (Files::ConstIterator f (files.begin ()); f != files.end (); ++f )
+ for (NarrowStrings::const_iterator f (files.begin ());
+ f != files.end (); ++f )
{
NarrowInputFileStream ifs;
open (ifs, *f);
@@ -374,7 +285,7 @@ namespace CXX
xns = ctx.xs_ns_name ();
}
- if (ops.value<CLI::no_stl> ())
+ if (ops.no_stl ())
{
TypeMap::Namespace xsd_std ("http://www\\.w3\\.org/2001/XMLSchema");
@@ -444,7 +355,7 @@ namespace CXX
xsd.types_push_back ("int", "int", "int");
xsd.types_push_back ("unsignedInt", "unsigned int", "unsigned int");
- if (ops.value<CLI::no_long_long> ())
+ if (ops.no_long_long ())
{
xsd.types_push_back ("long", "long", "long");
xsd.types_push_back ("unsignedLong", "unsigned long", "unsigned long");
@@ -498,33 +409,31 @@ namespace CXX
// Generate code.
//
- Boolean inline_ (ops.value<CLI::generate_inline> () &&
- !generate_xml_schema);
-
+ Boolean inline_ (ops.generate_inline () && !generate_xml_schema);
Boolean source (!generate_xml_schema);
NarrowString name (file_path.leaf ());
- NarrowString skel_suffix (ops.value <CLI::skel_file_suffix> ());
- NarrowString impl_suffix (ops.value <CLI::impl_file_suffix> ());
+ NarrowString skel_suffix (ops.skel_file_suffix ());
+ NarrowString impl_suffix (ops.impl_file_suffix ());
- NarrowString hxx_suffix (ops.value <CLI::hxx_suffix> ());
- NarrowString ixx_suffix (ops.value <CLI::ixx_suffix> ());
- NarrowString cxx_suffix (ops.value <CLI::cxx_suffix> ());
+ NarrowString hxx_suffix (ops.hxx_suffix ());
+ NarrowString ixx_suffix (ops.ixx_suffix ());
+ NarrowString cxx_suffix (ops.cxx_suffix ());
Regex hxx_expr (
- ops.value <CLI::hxx_regex> ().empty ()
+ ops.hxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + hxx_suffix + "#"
- : ops.value <CLI::hxx_regex> ());
+ : ops.hxx_regex ());
Regex ixx_expr (
- ops.value <CLI::ixx_regex> ().empty ()
+ ops.ixx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + ixx_suffix + "#"
- : ops.value <CLI::ixx_regex> ());
+ : ops.ixx_regex ());
Regex cxx_expr (
- ops.value <CLI::cxx_regex> ().empty ()
+ ops.cxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + cxx_suffix + "#"
- : ops.value <CLI::cxx_regex> ());
+ : ops.cxx_regex ());
Regex hxx_impl_expr;
Regex cxx_impl_expr;
@@ -625,7 +534,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -673,7 +582,7 @@ namespace CXX
if (impl)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (hxx_impl_path, ios_base::in);
@@ -699,7 +608,7 @@ namespace CXX
unlinks.add (hxx_impl_path);
file_list.push_back (hxx_impl_path.native_file_string ());
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (cxx_impl_path, ios_base::in);
@@ -728,7 +637,7 @@ namespace CXX
if (driver)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (cxx_driver_path, ios_base::in);
@@ -801,9 +710,7 @@ namespace CXX
// Print copyright and license.
//
Char const* copyright (
- ops.value<CLI::proprietary_license> ()
- ? copyright_proprietary
- : copyright_gpl);
+ ops.proprietary_license () ? copyright_proprietary : copyright_gpl);
hxx << copyright;
@@ -826,7 +733,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (ops.value<CLI::prologue_file> ());
+ NarrowString name (ops.prologue_file ());
if (name)
open (prologue, name);
@@ -836,7 +743,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (ops.value<CLI::epilogue_file> ());
+ NarrowString name (ops.epilogue_file ());
if (name)
open (epilogue, name);
@@ -844,8 +751,8 @@ namespace CXX
// SLOC counter.
//
- UnsignedLong sloc_total (0);
- Boolean show_sloc (ops.value<CLI::show_sloc> ());
+ size_t sloc_total (0);
+ Boolean show_sloc (ops.show_sloc ());
typedef
compiler::ostream_filter<compiler::cxx_indenter, wchar_t>
@@ -859,7 +766,7 @@ namespace CXX
//
Regex guard_expr ("/([a-z])([A-Z])/$1_$2/"); // Split words.
- NarrowString guard_prefix (ops.value<CLI::guard_prefix> ());
+ NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
guard_prefix = file_path.branch_path ().native_directory_string ();
@@ -898,7 +805,7 @@ namespace CXX
hxx << "#include <xsde/cxx/config.hxx>" << endl
<< endl;
- if (ops.value<CLI::char_encoding> () == "iso8859-1")
+ if (ops.char_encoding () == "iso8859-1")
{
hxx << "#ifndef XSDE_ENCODING_ISO8859_1" << endl
<< "#error the generated code uses the ISO-8859-1 encoding" <<
@@ -917,7 +824,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_stl> ())
+ if (ops.no_stl ())
{
hxx << "#ifdef XSDE_STL" << endl
<< "#error the XSD/e runtime uses STL while the " <<
@@ -936,7 +843,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_iostream> ())
+ if (ops.no_iostream ())
{
hxx << "#ifdef XSDE_IOSTREAM" << endl
<< "#error the XSD/e runtime uses iostream while the " <<
@@ -955,7 +862,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_exceptions> ())
+ if (ops.no_exceptions ())
{
hxx << "#ifdef XSDE_EXCEPTIONS" << endl
<< "#error the XSD/e runtime uses exceptions while the " <<
@@ -974,7 +881,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_long_long> ())
+ if (ops.no_long_long ())
{
hxx << "#ifdef XSDE_LONGLONG" << endl
<< "#error the XSD/e runtime uses long long while the " <<
@@ -993,7 +900,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::suppress_validation> ())
+ if (ops.suppress_validation ())
{
hxx << "#ifdef XSDE_PARSER_VALIDATION" << endl
<< "#error the XSD/e runtime uses validation while the " <<
@@ -1012,8 +919,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::generate_polymorphic> () ||
- ops.value<CLI::runtime_polymorphic> ())
+ if (ops.generate_polymorphic () || ops.runtime_polymorphic ())
{
hxx << "#ifndef XSDE_POLYMORPHIC" << endl
<< "#error the generated code expects XSD/e runtime with " <<
@@ -1032,7 +938,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::reuse_style_mixin> ())
+ if (ops.reuse_style_mixin ())
{
hxx << "#ifndef XSDE_REUSE_STYLE_MIXIN" << endl
<< "#error the generated code uses the mixin reuse style " <<
@@ -1041,7 +947,7 @@ namespace CXX
<< "#endif" << endl
<< endl;
}
- else if (ops.value<CLI::reuse_style_none> ())
+ else if (ops.reuse_style_none ())
{
hxx << "#ifndef XSDE_REUSE_STYLE_NONE" << endl
<< "#error the generated code does not provide support " <<
@@ -1060,7 +966,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::custom_allocator> ())
+ if (ops.custom_allocator ())
{
hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl
<< "#error the generated code uses custom allocator while " <<
@@ -1090,9 +996,8 @@ namespace CXX
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- hxx, ops.value<CLI::hxx_prologue> (), ops.value<CLI::prologue> ());
- append (hxx, ops.value<CLI::hxx_prologue_file> (), prologue);
+ append (hxx, ops.hxx_prologue (), ops.prologue ());
+ append (hxx, ops.hxx_prologue_file (), prologue);
hxx << "//" << endl
<< "// End prologue." << endl
@@ -1118,9 +1023,8 @@ namespace CXX
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (hxx, ops.value<CLI::hxx_epilogue_file> (), epilogue);
- append (
- hxx, ops.value<CLI::hxx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (hxx, ops.hxx_epilogue_file (), epilogue);
+ append (hxx, ops.hxx_epilogue (), ops.epilogue ());
hxx << "//" << endl
<< "// End epilogue." << endl
@@ -1151,9 +1055,8 @@ namespace CXX
ixx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- ixx, ops.value<CLI::ixx_prologue> (), ops.value<CLI::prologue> ());
- append (ixx, ops.value<CLI::ixx_prologue_file> (), prologue);
+ append (ixx, ops.ixx_prologue (), ops.prologue ());
+ append (ixx, ops.ixx_prologue_file (), prologue);
ixx << "//" << endl
<< "// End prologue." << endl
@@ -1171,9 +1074,8 @@ namespace CXX
ixx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ixx, ops.value<CLI::ixx_epilogue_file> (), epilogue);
- append (
- ixx, ops.value<CLI::ixx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (ixx, ops.ixx_epilogue_file (), epilogue);
+ append (ixx, ops.ixx_epilogue (), ops.epilogue ());
ixx << "//" << endl
<< "// End epilogue." << endl
@@ -1200,9 +1102,8 @@ namespace CXX
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- cxx, ops.value<CLI::cxx_prologue> (), ops.value<CLI::prologue> ());
- append (cxx, ops.value<CLI::cxx_prologue_file> (), prologue);
+ append (cxx, ops.cxx_prologue (), ops.prologue ());
+ append (cxx, ops.cxx_prologue_file (), prologue);
cxx << "//" << endl
<< "// End prologue." << endl
@@ -1234,9 +1135,8 @@ namespace CXX
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (cxx, ops.value<CLI::cxx_epilogue_file> (), epilogue);
- append (
- cxx, ops.value<CLI::cxx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (cxx, ops.cxx_epilogue_file (), epilogue);
+ append (cxx, ops.cxx_epilogue (), ops.epilogue ());
cxx << "//" << endl
<< "// End epilogue." << endl
diff --git a/xsde/cxx/parser/generator.hxx b/xsde/cxx/parser/generator.hxx
index a594816..c2a0177 100644
--- a/xsde/cxx/parser/generator.hxx
+++ b/xsde/cxx/parser/generator.hxx
@@ -10,15 +10,14 @@
#include <cult/containers/vector.hxx>
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
#include <xsde.hxx>
+
#include <type-map/type-map.hxx>
-#include <cxx/parser/cli.hxx>
+
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -32,13 +31,10 @@ namespace CXX
static Void
usage ();
- static CLI::OptionsSpec
- options_spec ();
-
// Assign names to global declarations.
//
static Void
- process_names (CLI::Options const&,
+ process_names (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
@@ -47,7 +43,7 @@ namespace CXX
struct Failed {};
static UnsignedLong
- generate (CLI::Options const&,
+ generate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean file_per_type,
diff --git a/xsde/cxx/parser/impl-source.cxx b/xsde/cxx/parser/impl-source.cxx
index e9b87ca..5ad9a02 100644
--- a/xsde/cxx/parser/impl-source.cxx
+++ b/xsde/cxx/parser/impl-source.cxx
@@ -66,11 +66,11 @@ namespace CXX
os << arg_type (base) << " v = " << post_name (base) << " ();"
<< endl;
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "if (!_error ())"
<< "{";
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, e.name (), "v");
t.dispatch (base);
@@ -84,7 +84,7 @@ namespace CXX
t.dispatch (base);
}
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "}";
}
else
@@ -96,7 +96,7 @@ namespace CXX
os << arg_type (base) << " v = " << post_name (base) << " ();"
<< endl;
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "if (!_error ())"
<< "{";
@@ -109,7 +109,7 @@ namespace CXX
t.dispatch (base);
}
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "}";
}
}
@@ -162,7 +162,7 @@ namespace CXX
if (arg != L"void")
{
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, type.name (), item);
t.dispatch (type);
@@ -227,9 +227,9 @@ namespace CXX
<< "_characters (const " << string_type << "& s)"
<< "{";
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "if (s.size () != 0)"
<< "{"
<< "printf (" << strlit (u.name () + L": ") << ");"
@@ -293,7 +293,7 @@ namespace CXX
if (arg != L"void")
{
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, e.name (), name);
t.dispatch (e.type ());
@@ -340,7 +340,7 @@ namespace CXX
if (arg != L"void")
{
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, a.name (), name);
t.dispatch (a.type ());
@@ -433,11 +433,11 @@ namespace CXX
os << arg_type (base) << " v = " << post_name (base) << " ();"
<< endl;
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "if (!_error ())"
<< "{";
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, c.name (), "v");
t.dispatch (base);
@@ -451,7 +451,7 @@ namespace CXX
t.dispatch (base);
}
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "}";
}
else
@@ -463,7 +463,7 @@ namespace CXX
os << arg_type (base) << " v = " << post_name (base) << " ();"
<< endl;
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "if (!_error ())"
<< "{";
@@ -476,7 +476,7 @@ namespace CXX
t.dispatch (base);
}
- if (options.value<CLI::no_exceptions> ())
+ if (options.no_exceptions ())
os << "}";
}
}
@@ -506,9 +506,9 @@ namespace CXX
Void
generate_impl_source (Context& ctx)
{
- if (ctx.options.value<CLI::generate_print_impl> ())
+ if (ctx.options.generate_print_impl ())
{
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
ctx.os << "#include <stdio.h>" << endl
<< endl;
else
diff --git a/xsde/cxx/parser/name-processor.cxx b/xsde/cxx/parser/name-processor.cxx
index ab8f318..2483889 100644
--- a/xsde/cxx/parser/name-processor.cxx
+++ b/xsde/cxx/parser/name-processor.cxx
@@ -27,39 +27,21 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ Context (Parser::options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "p:name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
- skel_suffix_ (ops.value<CLI::skel_type_suffix> ()),
- impl_suffix_ (ops.value<CLI::impl_type_suffix> ()),
- impl (ops.value<CLI::generate_noop_impl> () ||
- ops.value<CLI::generate_print_impl> () ||
- ops.value<CLI::generate_test_driver> ()),
- tiein (!ops.value<CLI::reuse_style_mixin> () &&
- !ops.value<CLI::reuse_style_none> ()),
+ : CXX::Context (std::wcerr, root, path, ops, "p:name", "char"),
+ skel_suffix_ (ops.skel_type_suffix ()),
+ impl_suffix_ (ops.impl_type_suffix ()),
+ impl (ops.generate_noop_impl () ||
+ ops.generate_print_impl () ||
+ ops.generate_test_driver ()),
+ tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()),
skel_suffix (skel_suffix_),
impl_suffix (impl_suffix_),
global_type_names (global_type_names_),
- validation (!ops.value<CLI::suppress_validation> ()),
- polymorphic (ops.value<CLI::generate_polymorphic> ())
+ validation (!ops.suppress_validation ()),
+ polymorphic (ops.generate_polymorphic ())
{
}
@@ -1210,7 +1192,7 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
@@ -1308,7 +1290,7 @@ namespace CXX
}
Void NameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
diff --git a/xsde/cxx/parser/name-processor.hxx b/xsde/cxx/parser/name-processor.hxx
index 576b984..25aceaa 100644
--- a/xsde/cxx/parser/name-processor.hxx
+++ b/xsde/cxx/parser/name-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -22,7 +22,7 @@ namespace CXX
{
public:
Void
- process (CLI::Options const&,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean deep);
diff --git a/xsde/cxx/parser/parser-header.cxx b/xsde/cxx/parser/parser-header.cxx
index 2cdc297..f9abf09 100644
--- a/xsde/cxx/parser/parser-header.cxx
+++ b/xsde/cxx/parser/parser-header.cxx
@@ -1217,7 +1217,7 @@ namespace CXX
impl_ns_ = "::xsde::cxx::parser::";
impl_ns_ += (validation ? L"validating" : L"non_validating");
- if (options.value<CLI::no_stl> ())
+ if (options.no_stl ())
{
qname_type_ = xs_ns_ + L"::qname*";
string_type_ = L"char*";
@@ -1231,7 +1231,7 @@ namespace CXX
string_seq_type_ = xs_ns_ + L"::string_sequence*";
buffer_type_ = xs_ns_ + L"::buffer*";
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
{
long_type_ = L"long";
unsigned_long_type_ = L"unsigned long";
@@ -1558,12 +1558,12 @@ namespace CXX
String const& real_impl (c.get<String> ("p:real-impl"));
String const& impl (c.get<String> ("p:impl"));
- if (options.value<CLI::skel_type_suffix> () == "_pskel")
+ if (options.skel_type_suffix () == "_pskel")
os << "using " << real_name << ";";
else
os << "typedef " << real_name << " " << name << ";";
- if (options.value<CLI::impl_type_suffix> () == "_pimpl")
+ if (options.impl_type_suffix () == "_pimpl")
os << "using " << real_impl << ";";
else
os << "typedef " << real_impl << " " << impl << ";";
@@ -1746,7 +1746,7 @@ namespace CXX
NarrowString extern_xml_schema;
if (!generate_xml_schema)
- extern_xml_schema = ctx.options.value<CLI::extern_xml_schema> ();
+ extern_xml_schema = ctx.options.extern_xml_schema ();
if (extern_xml_schema)
{
diff --git a/xsde/cxx/parser/parser-inline.cxx b/xsde/cxx/parser/parser-inline.cxx
index ac8ae2a..557a81e 100644
--- a/xsde/cxx/parser/parser-inline.cxx
+++ b/xsde/cxx/parser/parser-inline.cxx
@@ -908,7 +908,7 @@ namespace CXX
// Emit "weak" header includes that are used in the file-per-type
// compilation model.
//
- if (!ctx.options.value<CLI::generate_inline> ())
+ if (!ctx.options.generate_inline ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::source);
diff --git a/xsde/cxx/parser/parser-source.cxx b/xsde/cxx/parser/parser-source.cxx
index e7a4fe3..868998f 100644
--- a/xsde/cxx/parser/parser-source.cxx
+++ b/xsde/cxx/parser/parser-source.cxx
@@ -1631,7 +1631,7 @@ namespace CXX
// Emit "weak" header includes that are used in the file-per-type
// compilation model.
//
- if (ctx.options.value<CLI::generate_inline> ())
+ if (ctx.options.generate_inline ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::source);
diff --git a/xsde/cxx/parser/print-impl-common.hxx b/xsde/cxx/parser/print-impl-common.hxx
index 674e639..df379fa 100644
--- a/xsde/cxx/parser/print-impl-common.hxx
+++ b/xsde/cxx/parser/print-impl-common.hxx
@@ -95,7 +95,7 @@ namespace CXX
{
if (default_type (t, "bool"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %u\n") << ", " <<
arg_ << ");";
else
@@ -113,7 +113,7 @@ namespace CXX
{
if (default_type (t, "signed char"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d\n") << ", " <<
arg_ << ");";
else
@@ -129,7 +129,7 @@ namespace CXX
{
if (default_type (t, "unsigned char"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %u\n") << ", " <<
arg_ << ");";
else
@@ -145,7 +145,7 @@ namespace CXX
{
if (default_type (t, "short"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d\n") << ", " <<
arg_ << ");";
else
@@ -161,7 +161,7 @@ namespace CXX
{
if (default_type (t, "unsigned short"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %u\n") << ", " <<
arg_ << ");";
else
@@ -177,7 +177,7 @@ namespace CXX
{
if (default_type (t, "int"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d\n") << ", " <<
arg_ << ");";
else
@@ -193,7 +193,7 @@ namespace CXX
{
if (default_type (t, "unsigned int"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %u\n") << ", " <<
arg_ << ");";
else
@@ -207,11 +207,11 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::Long& t)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
{
if (default_type (t, "long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %ld\n") << ", " <<
arg_ << ");";
else
@@ -225,7 +225,7 @@ namespace CXX
{
if (default_type (t, "long long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %lld\n") << ", " <<
arg_ << ");";
else
@@ -240,11 +240,11 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::UnsignedLong& t)
{
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
{
if (default_type (t, "unsigned long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %lu\n") << ", " <<
arg_ << ");";
else
@@ -258,7 +258,7 @@ namespace CXX
{
if (default_type (t, "unsigned long long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %llu\n") << ", " <<
arg_ << ");";
else
@@ -275,7 +275,7 @@ namespace CXX
{
if (default_type (t, "long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %ld\n") << ", " <<
arg_ << ");";
else
@@ -291,7 +291,7 @@ namespace CXX
{
if (default_type (t, "long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %ld\n") << ", " <<
arg_ << ");";
else
@@ -307,7 +307,7 @@ namespace CXX
{
if (default_type (t, "long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %ld\n") << ", " <<
arg_ << ");";
else
@@ -323,7 +323,7 @@ namespace CXX
{
if (default_type (t, "unsigned long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %lu\n") << ", " <<
arg_ << ");";
else
@@ -339,7 +339,7 @@ namespace CXX
{
if (default_type (t, "unsigned long"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %lu\n") << ", " <<
arg_ << ");";
else
@@ -357,7 +357,7 @@ namespace CXX
{
if (default_type (t, "float"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %g\n") << ", " <<
arg_ << ");";
else
@@ -373,7 +373,7 @@ namespace CXX
{
if (default_type (t, "double"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %g\n") << ", " <<
arg_ << ");";
else
@@ -389,7 +389,7 @@ namespace CXX
{
if (default_type (t, "double"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %g\n") << ", " <<
arg_ << ");";
else
@@ -483,11 +483,11 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::QName& t)
{
- if (options.value<CLI::no_stl> ())
+ if (options.no_stl ())
{
if (default_type (t, xs_ns_name () + L"::qname*"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "if (" << arg_ << "->prefix ()[0] == '\\0')" << endl
<< "printf (" << strlit (tag_ + L": %s\n") << ", " <<
arg_ << "->name ());"
@@ -511,7 +511,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::qname"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "if (" << arg_ << ".prefix ().empty ())" << endl
<< "printf (" << strlit (tag_ + L": %s\n") << ", " <<
arg_ << ".name ().c_str ());"
@@ -554,7 +554,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::date"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d-%u-%u") << "," << endl
<< arg_ << ".year ()," << endl
<< arg_ << ".month ()," << endl
@@ -576,7 +576,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::date_time"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d-%u-%uT%u:%u:%g") <<
"," << endl
<< arg_ << ".year ()," << endl
@@ -605,7 +605,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::duration"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": ") << ");"
<< endl
<< "if (" << arg_ << ".negative ())" << endl
@@ -642,7 +642,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::gday"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": ---%u") << ", " <<
arg_ << ".day ());";
else
@@ -660,7 +660,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::gmonth"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": --%u") << ", " <<
arg_ << ".month ());";
else
@@ -678,7 +678,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::gmonth_day"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": --%u-%u") << "," << endl
<< arg_ << ".month ()," << endl
<< arg_ << ".day ());";
@@ -698,7 +698,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::gyear"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d") << ", " <<
arg_ << ".year ());";
else
@@ -716,7 +716,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::gyear_month"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %d-%u") << "," << endl
<< arg_ << ".year ()," << endl
<< arg_ << ".month ());";
@@ -736,7 +736,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::time"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %u:%u:%g") << "," << endl
<< arg_ << ".hours ()," << endl
<< arg_ << ".minutes ()," << endl
@@ -770,11 +770,11 @@ namespace CXX
void
gen_string (SemanticGraph::Type& t)
{
- if (options.value<CLI::no_stl> ())
+ if (options.no_stl ())
{
if (default_type (t, "char*"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %s\n") << ", " <<
arg_ << ");";
else
@@ -788,7 +788,7 @@ namespace CXX
{
if (default_type (t, "::std::string"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %s\n") << ", " <<
arg_ << ".c_str ());";
else
@@ -807,7 +807,7 @@ namespace CXX
if (default_type (t, type + L"*"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": ") << ");"
<< endl;
else
@@ -819,9 +819,9 @@ namespace CXX
<< "i != e;)"
<< "{";
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
{
- if (options.value<CLI::no_stl> ())
+ if (options.no_stl ())
os << "printf (\"%s\", *i++);";
else
os << "printf (\"%s\", (i++)->c_str ());";
@@ -847,7 +847,7 @@ namespace CXX
{
if (default_type (t, xs_ns_name () + L"::buffer*"))
{
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (" << strlit (tag_ + L": %zu bytes\n") << ", " <<
arg_ << "->size ());";
else
@@ -865,7 +865,7 @@ namespace CXX
<< "if (" << arg_ << ".zone_present ())"
<< "{";
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "if (" << arg_ << ".zone_hours () < 0)" << endl
<< "printf (\"%d:%d\", " << arg_ << ".zone_hours (), -" <<
arg_ << ".zone_minutes ());"
@@ -882,7 +882,7 @@ namespace CXX
os << "}";
- if (options.value<CLI::no_iostream> ())
+ if (options.no_iostream ())
os << "printf (\"\\n\");";
else
os << "std::cout << std::endl;";
@@ -1011,7 +1011,7 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Fundamental::QName& t)
{
- if (options.value<CLI::no_stl> () &&
+ if (options.no_stl () &&
default_type (t, xs_ns_name () + L"::qname*"))
{
os << endl;
@@ -1048,7 +1048,7 @@ namespace CXX
void
gen_string (SemanticGraph::Type& t)
{
- if (options.value<CLI::no_stl> () && default_type (t, "char*"))
+ if (options.no_stl () && default_type (t, "char*"))
{
os << endl;
diff --git a/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx
index 3e0abbe..eacede8 100644
--- a/xsde/cxx/parser/type-processor.cxx
+++ b/xsde/cxx/parser/type-processor.cxx
@@ -273,12 +273,11 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& options,
+ process_impl (options const& ops,
XSDFrontend::SemanticGraph::Schema& tu,
TypeMap::Namespaces& type_map)
{
- Boolean tiein (!options.value<CLI::reuse_style_mixin> () &&
- !options.value<CLI::reuse_style_none> ());
+ Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ());
if (tu.names_begin ()->named ().name () ==
L"http://www.w3.org/2001/XMLSchema")
@@ -301,8 +300,7 @@ namespace CXX
// If --extern-xml-schema is specified, then we don't want
// includes from the XML Schema type map.
//
- Boolean extern_xml_schema (
- options.value<CLI::extern_xml_schema> ());
+ Boolean extern_xml_schema (ops.extern_xml_schema ());
// Besides types defined in this schema, also process those
// referenced by global elements in case we are generating
@@ -344,11 +342,11 @@ namespace CXX
}
Void TypeProcessor::
- process (CLI::Options const& options,
+ process (options const& ops,
XSDFrontend::SemanticGraph::Schema& s,
TypeMap::Namespaces& tm)
{
- process_impl (options, s, tm);
+ process_impl (ops, s, tm);
}
}
}
diff --git a/xsde/cxx/parser/type-processor.hxx b/xsde/cxx/parser/type-processor.hxx
index 83a1563..de16a82 100644
--- a/xsde/cxx/parser/type-processor.hxx
+++ b/xsde/cxx/parser/type-processor.hxx
@@ -12,7 +12,7 @@
#include <type-map/type-map.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Void
- process (CLI::Options const& options,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
TypeMap::Namespaces&);
};
diff --git a/xsde/cxx/parser/validator.cxx b/xsde/cxx/parser/validator.cxx
index 08029e1..bf5dffb 100644
--- a/xsde/cxx/parser/validator.cxx
+++ b/xsde/cxx/parser/validator.cxx
@@ -25,7 +25,7 @@ namespace CXX
public:
ValidationContext (SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& options,
+ Parser::options const& options,
const WarningSet& disabled_warnings,
Boolean& valid_)
: Context (std::wcerr, root, path, options, 0, 0, 0),
@@ -341,7 +341,7 @@ namespace CXX
return;
if (e.substitutes_p () &&
- !options.value<CLI::generate_polymorphic> () &&
+ !options.generate_polymorphic () &&
!subst_group_warning_issued)
{
subst_group_warning_issued = true;
@@ -433,7 +433,7 @@ namespace CXX
<< "automatically name them"
<< endl;
- if (!options.value<CLI::show_anonymous> ())
+ if (!options.show_anonymous ())
wcerr << t.file ()
<< ": info: use --show-anonymous option to see these "
<< "types" << endl;
@@ -462,7 +462,7 @@ namespace CXX
{
if (traverse_common (e))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << e.file () << ":" << e.line () << ":" << e.column ()
<< ": error: element '" << xpath (e) << "' "
@@ -487,7 +487,7 @@ namespace CXX
{
if (traverse_common (a))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << a.file () << ":" << a.line () << ":" << a.column ()
<< ": error: attribute '" << xpath (a) << "' "
@@ -553,16 +553,16 @@ namespace CXX
if (!valid)
return;
- if (options.value<CLI::root_element_first> ())
+ if (options.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (options.value<CLI::root_element_last> ())
+ else if (options.root_element_last ())
{
element_ = &e;
}
- else if (String name = options.value<CLI::root_element> ())
+ else if (String name = options.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -591,18 +591,18 @@ namespace CXX
}
Boolean Validator::
- validate (CLI::Options const& options,
+ validate (options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
Boolean gen_driver,
const WarningSet& disabled_warnings)
{
Boolean valid (true);
- ValidationContext ctx (root, path, options, disabled_warnings, valid);
+ ValidationContext ctx (root, path, ops, disabled_warnings, valid);
//
//
- NarrowString enc (options.value<CLI::char_encoding> ());
+ NarrowString enc (ops.char_encoding ());
if (enc != "utf8" && enc != "iso8859-1")
{
@@ -612,8 +612,7 @@ namespace CXX
//
//
- if (options.value<CLI::generate_noop_impl> () &&
- options.value<CLI::generate_print_impl> ())
+ if (ops.generate_noop_impl () && ops.generate_print_impl ())
{
wcerr << "error: mutually exclusive options specified: "
<< "--generate-noop-impl and --generate-print-impl"
@@ -625,9 +624,9 @@ namespace CXX
//
//
{
- Boolean ref (options.value<CLI::root_element_first> ());
- Boolean rel (options.value<CLI::root_element_last> ());
- Boolean re (options.value<CLI::root_element> ());
+ Boolean ref (ops.root_element_first ());
+ Boolean rel (ops.root_element_last ());
+ Boolean re (ops.root_element ());
if ((ref && rel) || (ref && re) || (rel && re))
{
@@ -642,8 +641,7 @@ namespace CXX
//
//
- if (options.value<CLI::reuse_style_mixin> () &&
- options.value<CLI::reuse_style_none> ())
+ if (ops.reuse_style_mixin () && ops.reuse_style_none ())
{
wcerr << "error: mutually exclusive options specified: "
<< "--reuse-style-mixin and --reuse-style-none"
@@ -654,9 +652,9 @@ namespace CXX
//
//
- if (options.value<CLI::reuse_style_none> () &&
- (options.value<CLI::generate_noop_impl> () ||
- options.value<CLI::generate_print_impl> ()) &&
+ if (ops.reuse_style_none () &&
+ (ops.generate_noop_impl () ||
+ ops.generate_print_impl ()) &&
!ctx.is_disabled ("P003"))
{
wcerr << "warning P003: generating sample implementation without "
diff --git a/xsde/cxx/parser/validator.hxx b/xsde/cxx/parser/validator.hxx
index f845ccc..2cd7931 100644
--- a/xsde/cxx/parser/validator.hxx
+++ b/xsde/cxx/parser/validator.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph/schema.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
#include <xsde.hxx>
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Boolean
- validate (CLI::Options const& options,
+ validate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& tu,
Boolean gen_driver,
diff --git a/xsde/cxx/serializer/cli.hxx b/xsde/cxx/serializer/cli.hxx
deleted file mode 100644
index 888b273..0000000
--- a/xsde/cxx/serializer/cli.hxx
+++ /dev/null
@@ -1,158 +0,0 @@
-// file : xsde/cxx/serializer/cli.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef CXX_SERIALIZER_CLI_HXX
-#define CXX_SERIALIZER_CLI_HXX
-
-#include <cult/types.hxx>
-
-#include <cult/containers/vector.hxx>
-
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
-namespace CXX
-{
- namespace Serializer
- {
- namespace CLI
- {
- using namespace Cult::Types;
-
- typedef Char const Key[];
-
- extern Key type_map;
- extern Key char_encoding;
- extern Key no_stl;
- extern Key no_iostream;
- extern Key no_exceptions;
- extern Key no_long_long;
- extern Key reuse_style_mixin;
- extern Key reuse_style_none;
- extern Key generate_inline;
- extern Key suppress_validation;
- extern Key generate_polymorphic;
- extern Key runtime_polymorphic;
- extern Key suppress_reset;
- extern Key custom_allocator;
- extern Key generate_empty_impl;
- extern Key generate_test_driver;
- extern Key force_overwrite;
- extern Key root_element_first;
- extern Key root_element_last;
- extern Key root_element;
- extern Key generate_xml_schema;
- extern Key extern_xml_schema;
- extern Key output_dir;
- extern Key skel_type_suffix;
- extern Key skel_file_suffix;
- extern Key impl_type_suffix;
- extern Key impl_file_suffix;
- extern Key namespace_map;
- extern Key namespace_regex;
- extern Key namespace_regex_trace;
- extern Key reserved_name;
- extern Key include_with_brackets;
- extern Key include_prefix;
- extern Key include_regex;
- extern Key include_regex_trace;
- extern Key guard_prefix;
- extern Key hxx_suffix;
- extern Key ixx_suffix;
- extern Key cxx_suffix;
- extern Key hxx_regex;
- extern Key ixx_regex;
- extern Key cxx_regex;
- extern Key hxx_prologue;
- extern Key ixx_prologue;
- extern Key cxx_prologue;
- extern Key prologue;
- extern Key hxx_epilogue;
- extern Key ixx_epilogue;
- extern Key cxx_epilogue;
- extern Key epilogue;
- extern Key hxx_prologue_file;
- extern Key ixx_prologue_file;
- extern Key cxx_prologue_file;
- extern Key prologue_file;
- extern Key hxx_epilogue_file;
- extern Key ixx_epilogue_file;
- extern Key cxx_epilogue_file;
- extern Key epilogue_file;
- extern Key show_anonymous;
- extern Key show_sloc;
- extern Key proprietary_license;
-
- typedef Cult::CLI::Options<
- type_map, Cult::Containers::Vector<NarrowString>,
- char_encoding, NarrowString,
- no_stl, Boolean,
- no_iostream, Boolean,
- no_exceptions, Boolean,
- no_long_long, Boolean,
- reuse_style_mixin, Boolean,
- reuse_style_none, Boolean,
- generate_inline, Boolean,
- suppress_validation, Boolean,
- generate_polymorphic, Boolean,
- runtime_polymorphic, Boolean,
- suppress_reset, Boolean,
- custom_allocator, Boolean,
- generate_empty_impl, Boolean,
- generate_test_driver, Boolean,
- force_overwrite, Boolean,
- root_element_first, Boolean,
- root_element_last, Boolean,
- root_element, NarrowString,
- generate_xml_schema, Boolean,
- extern_xml_schema, NarrowString,
- output_dir, NarrowString,
- skel_type_suffix, NarrowString,
- skel_file_suffix, NarrowString,
- impl_type_suffix, NarrowString,
- impl_file_suffix, NarrowString,
- namespace_map, Cult::Containers::Vector<NarrowString>,
- namespace_regex, Cult::Containers::Vector<NarrowString>,
- namespace_regex_trace, Boolean,
- reserved_name, Cult::Containers::Vector<NarrowString>,
- include_with_brackets, Boolean,
- include_prefix, NarrowString,
- include_regex, Cult::Containers::Vector<NarrowString>,
- include_regex_trace, Boolean,
- guard_prefix, NarrowString,
- hxx_suffix, NarrowString,
- ixx_suffix, NarrowString,
- cxx_suffix, NarrowString,
- hxx_regex, NarrowString,
- ixx_regex, NarrowString,
- cxx_regex, NarrowString,
- hxx_prologue, Cult::Containers::Vector<NarrowString>,
- ixx_prologue, Cult::Containers::Vector<NarrowString>,
- cxx_prologue, Cult::Containers::Vector<NarrowString>,
- prologue, Cult::Containers::Vector<NarrowString>,
- hxx_epilogue, Cult::Containers::Vector<NarrowString>,
- ixx_epilogue, Cult::Containers::Vector<NarrowString>,
- cxx_epilogue, Cult::Containers::Vector<NarrowString>,
- epilogue, Cult::Containers::Vector<NarrowString>,
- hxx_prologue_file, NarrowString,
- ixx_prologue_file, NarrowString,
- cxx_prologue_file, NarrowString,
- prologue_file, NarrowString,
- hxx_epilogue_file, NarrowString,
- ixx_epilogue_file, NarrowString,
- cxx_epilogue_file, NarrowString,
- epilogue_file, NarrowString,
- show_anonymous, Boolean,
- show_sloc, Boolean,
- proprietary_license, Boolean
-
- > Options;
-
- struct OptionsSpec: Cult::CLI::OptionsSpec<Options> {};
- }
- }
-}
-
-#endif // CXX_SERIALIZER_CLI_HXX
diff --git a/xsde/cxx/serializer/driver-source.cxx b/xsde/cxx/serializer/driver-source.cxx
index 9a46364..3ec2207 100644
--- a/xsde/cxx/serializer/driver-source.cxx
+++ b/xsde/cxx/serializer/driver-source.cxx
@@ -764,12 +764,12 @@ namespace CXX
virtual Void
traverse (Type& e)
{
- if (options.value<CLI::root_element_first> ())
+ if (options.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (String name = options.value<CLI::root_element> ())
+ else if (String name = options.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -815,16 +815,16 @@ namespace CXX
set.insert ("doc_s");
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "#include <stdio.h>" << endl
<< endl;
else
os << "#include <iostream>" << endl
<< endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
{
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
{
os << "struct writer: " << xs << "::writer"
<< "{"
@@ -868,7 +868,7 @@ namespace CXX
<< "main ()"
<< "{";
- if (!ctx.options.value<CLI::no_exceptions> ())
+ if (!ctx.options.no_exceptions ())
os << "try"
<< "{";
@@ -897,10 +897,10 @@ namespace CXX
os << "// Serialize the XML document." << endl
<< "//" << endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "writer w;";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << xs << "::serializer_error e;"
<< endl
<< "do"
@@ -917,7 +917,7 @@ namespace CXX
ctx.strlit (root->name ()) << ");"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "e = doc_s._error ();"
<< "if (e)" << endl
<< "break;"
@@ -931,20 +931,20 @@ namespace CXX
os << root_s << ".pre ();"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "e = " << root_s << "._error ();"
<< "if (e)" << endl
<< "break;"
<< endl;
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "doc_s.serialize (w);"
<< endl;
else
os << "doc_s.serialize (std::cout);"
<< endl;
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "e = doc_s._error ();"
<< "if (e)" << endl
<< "break;"
@@ -952,11 +952,11 @@ namespace CXX
os << root_s << ".post ();";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << endl
<< "e = " << root_s << "._error ();";
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
os << "}"
<< "while (false);"
<< endl;
@@ -964,7 +964,7 @@ namespace CXX
// Error handling.
//
- if (ctx.options.value<CLI::no_exceptions> ())
+ if (ctx.options.no_exceptions ())
{
os << "// Handle errors." << endl
<< "//" << endl
@@ -975,7 +975,7 @@ namespace CXX
<< "case " << xs << "::serializer_error::sys:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s\\n\", e.sys_text ());";
else
os << "std::cerr << e.sys_text () << std::endl;";
@@ -985,7 +985,7 @@ namespace CXX
<< "case " << xs << "::serializer_error::xml:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s\\n\", e.xml_text ());";
else
os << "std::cerr << e.xml_text () << std::endl;";
@@ -993,12 +993,12 @@ namespace CXX
os << "break;"
<< "}";
- if (!ctx.options.value<CLI::suppress_validation> ())
+ if (!ctx.options.suppress_validation ())
{
os << "case " << xs << "::serializer_error::schema:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"%s\\n\", e.schema_text ());";
else
os << "std::cerr << e.schema_text () << std::endl;";
@@ -1010,7 +1010,7 @@ namespace CXX
os << "case " << xs << "::serializer_error::app:"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"application error %d\\n\", e.app_code ());";
else
os << "std::cerr << \"application error \" << e.app_code () " <<
@@ -1032,7 +1032,7 @@ namespace CXX
<< "catch (const " << xs << "::serializer_exception& e)"
<< "{";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "fprintf (stderr, \"error: %s\\n\", e.text ());";
else
os << "std::cerr << \"error: \" << e.text () << std::endl;";
@@ -1040,7 +1040,7 @@ namespace CXX
os << "return 1;"
<< "}";
- if (ctx.options.value<CLI::no_iostream> ())
+ if (ctx.options.no_iostream ())
os << "catch (const io_failure&)"
<< "{"
<< "fprintf (stderr, \"error: write failure\\n\");"
diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx
index 7802e5d..7cbdbcf 100644
--- a/xsde/cxx/serializer/elements.cxx
+++ b/xsde/cxx/serializer/elements.cxx
@@ -13,42 +13,25 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
Regex const* he,
Regex const* ie,
Regex const* hie)
- : CXX::Context (o,
- root,
- path,
- "s:name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
+ : CXX::Context (o, root, path, ops, "s:name", "char"),
options (ops),
xml_serializer (xml_serializer_),
serializer_base (serializer_base_),
simple_base (simple_base_),
complex_base (complex_base_),
serializer_map (serializer_map_),
- validation (!ops.value<CLI::suppress_validation> ()),
- exceptions (!ops.value<CLI::no_exceptions> ()),
- stl (!ops.value<CLI::no_stl> ()),
- poly_code (ops.value<CLI::generate_polymorphic> ()),
- poly_runtime (poly_code || ops.value<CLI::runtime_polymorphic> ()),
- reset (!ops.value<CLI::suppress_reset> ()),
- mixin (ops.value<CLI::reuse_style_mixin> ()),
- tiein (!mixin && !ops.value<CLI::reuse_style_none> ()),
+ validation (!ops.suppress_validation ()),
+ exceptions (!ops.no_exceptions ()),
+ stl (!ops.no_stl ()),
+ poly_code (ops.generate_polymorphic ()),
+ poly_runtime (poly_code || ops.runtime_polymorphic ()),
+ reset (!ops.suppress_reset ()),
+ mixin (ops.reuse_style_mixin ()),
+ tiein (!mixin && !ops.reuse_style_none ()),
hxx_expr (he),
ixx_expr (ie),
hxx_impl_expr (hie),
diff --git a/xsde/cxx/serializer/elements.hxx b/xsde/cxx/serializer/elements.hxx
index ada9371..694abd8 100644
--- a/xsde/cxx/serializer/elements.hxx
+++ b/xsde/cxx/serializer/elements.hxx
@@ -12,7 +12,7 @@
#include <cxx/elements.hxx>
-#include <cxx/serializer/cli.hxx>
+#include <cxx/serializer/options.hxx>
namespace CXX
{
@@ -35,11 +35,13 @@ namespace CXX
public:
typedef cutl::re::regexsub Regex;
+ typedef Serializer::options options_type;
+
public:
Context (std::wostream&,
SemanticGraph::Schema&,
SemanticGraph::Path const&,
- CLI::Options const&,
+ options_type const&,
Regex const* hxx_expr,
Regex const* ixx_expr,
Regex const* hxx_impl_expr);
@@ -179,7 +181,7 @@ namespace CXX
has_facets (SemanticGraph::Complex& c);
public:
- CLI::Options const& options;
+ options_type const& options;
String& xml_serializer;
String& serializer_base;
String& simple_base;
@@ -608,21 +610,20 @@ namespace CXX
//
struct RootElement: Traversal::Element
{
- RootElement (CLI::Options const& options,
- SemanticGraph::Element*& element)
- : options_ (options), element_ (element)
+ RootElement (options const& o, SemanticGraph::Element*& e)
+ : options_ (o), element_ (e)
{
}
virtual Void
traverse (Type& e)
{
- if (options_.value<CLI::root_element_first> ())
+ if (options_.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (String name = options_.value<CLI::root_element> ())
+ else if (String name = options_.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -632,7 +633,7 @@ namespace CXX
}
private:
- CLI::Options const& options_;
+ options const& options_;
SemanticGraph::Element*& element_;
};
}
diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx
index 98e1cae..479293c 100644
--- a/xsde/cxx/serializer/generator.cxx
+++ b/xsde/cxx/serializer/generator.cxx
@@ -108,74 +108,6 @@ namespace CXX
"//\n\n";
}
- namespace Serializer
- {
- namespace CLI
- {
- extern Key type_map = "type-map";
- extern Key char_encoding = "char-encoding";
- extern Key no_stl = "no-stl";
- extern Key no_iostream = "no-iostream";
- extern Key no_exceptions = "no-exceptions";
- extern Key no_long_long = "no-long-long";
- extern Key reuse_style_mixin = "reuse-style-mixin";
- extern Key reuse_style_none = "reuse-style-none";
- extern Key generate_inline = "generate-inline";
- extern Key suppress_validation = "suppress-validation";
- extern Key generate_polymorphic = "generate-polymorphic";
- extern Key runtime_polymorphic = "runtime-polymorphic";
- extern Key suppress_reset = "suppress-reset";
- extern Key custom_allocator = "custom-allocator";
- extern Key generate_empty_impl = "generate-empty-impl";
- extern Key generate_test_driver = "generate-test-driver";
- extern Key force_overwrite = "force-overwrite";
- extern Key root_element_first = "root-element-first";
- extern Key root_element_last = "root-element-last";
- extern Key root_element = "root-element";
- extern Key generate_xml_schema = "generate-xml-schema";
- extern Key extern_xml_schema = "extern-xml-schema";
- extern Key output_dir = "output-dir";
- extern Key skel_type_suffix = "skel-type-suffix";
- extern Key skel_file_suffix = "skel-file-suffix";
- extern Key impl_type_suffix = "impl-type-suffix";
- extern Key impl_file_suffix = "impl-file-suffix";
- extern Key namespace_map = "namespace-map";
- extern Key namespace_regex = "namespace-regex";
- extern Key namespace_regex_trace = "namespace-regex-trace";
- extern Key reserved_name = "reserved-name";
- extern Key include_with_brackets = "include-with-brackets";
- extern Key include_prefix = "include-prefix";
- extern Key include_regex = "include-regex";
- extern Key include_regex_trace = "include-regex-trace";
- extern Key guard_prefix = "guard-prefix";
- extern Key hxx_suffix = "hxx-suffix";
- extern Key ixx_suffix = "ixx-suffix";
- extern Key cxx_suffix = "cxx-suffix";
- extern Key hxx_regex = "hxx-regex";
- extern Key ixx_regex = "ixx-regex";
- extern Key cxx_regex = "cxx-regex";
- extern Key hxx_prologue = "hxx-prologue";
- extern Key ixx_prologue = "ixx-prologue";
- extern Key cxx_prologue = "cxx-prologue";
- extern Key prologue = "prologue";
- extern Key hxx_epilogue = "hxx-epilogue";
- extern Key ixx_epilogue = "ixx-epilogue";
- extern Key cxx_epilogue = "cxx-epilogue";
- extern Key epilogue = "epilogue";
- extern Key hxx_prologue_file = "hxx-prologue-file";
- extern Key ixx_prologue_file = "ixx-prologue-file";
- extern Key cxx_prologue_file = "cxx-prologue-file";
- extern Key prologue_file = "prologue-file";
- extern Key hxx_epilogue_file = "hxx-epilogue-file";
- extern Key ixx_epilogue_file = "ixx-epilogue-file";
- extern Key cxx_epilogue_file = "cxx-epilogue-file";
- extern Key epilogue_file = "epilogue-file";
- extern Key show_anonymous = "show-anonymous";
- extern Key show_sloc = "show-sloc";
- extern Key proprietary_license = "proprietary-license";
- }
- }
-
Void Serializer::Generator::
usage ()
{
@@ -183,27 +115,8 @@ namespace CXX
CXX::options::print_usage (wcout);
}
- Serializer::CLI::OptionsSpec Serializer::Generator::
- options_spec ()
- {
- CLI::OptionsSpec spec;
-
- spec.option<CLI::char_encoding> ().default_value ("utf8");
-
- spec.option<CLI::skel_file_suffix> ().default_value ("-sskel");
- spec.option<CLI::skel_type_suffix> ().default_value ("_sskel");
- spec.option<CLI::impl_file_suffix> ().default_value ("-simpl");
- spec.option<CLI::impl_type_suffix> ().default_value ("_simpl");
-
- spec.option<CLI::hxx_suffix> ().default_value (".hxx");
- spec.option<CLI::ixx_suffix> ().default_value (".ixx");
- spec.option<CLI::cxx_suffix> ().default_value (".cxx");
-
- return spec;
- }
-
Void Serializer::Generator::
- process_names (CLI::Options const& ops,
+ process_names (options const& ops,
XSDFrontend::SemanticGraph::Schema& schema,
XSDFrontend::SemanticGraph::Path const& file)
{
@@ -261,14 +174,13 @@ namespace CXX
Void
append (WideOutputFileStream& os,
- Cult::Containers::Vector<NarrowString> const& primary,
- Cult::Containers::Vector<NarrowString> const& def)
+ NarrowStrings const& primary,
+ NarrowStrings const& def)
{
- Cult::Containers::Vector<NarrowString> const& v (
- primary.empty () ? def : primary);
+ NarrowStrings const& v (primary.empty () ? def : primary);
- for (Containers::Vector<NarrowString>::ConstIterator
- i (v.begin ()), e (v.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ());
+ i != e; ++i)
{
os << i->c_str () << endl;
}
@@ -277,7 +189,7 @@ namespace CXX
UnsignedLong Serializer::Generator::
- generate (Serializer::CLI::Options const& ops,
+ generate (Serializer::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -293,7 +205,7 @@ namespace CXX
try
{
- Boolean generate_xml_schema (ops.value<CLI::generate_xml_schema> ());
+ Boolean generate_xml_schema (ops.generate_xml_schema ());
// We could be compiling several schemas at once in which case
// handling of the --generate-xml-schema option gets tricky: we
@@ -302,18 +214,16 @@ namespace CXX
//
if (generate_xml_schema)
{
- if (NarrowString name = ops.value<CLI::extern_xml_schema> ())
+ if (NarrowString name = ops.extern_xml_schema ())
{
if (file_path.native_file_string () != name)
generate_xml_schema = false;
}
}
- Boolean impl (!generate_xml_schema &&
- ops.value<CLI::generate_empty_impl> ());
-
+ Boolean impl (!generate_xml_schema && ops.generate_empty_impl ());
Boolean driver (gen_driver && !generate_xml_schema &&
- ops.value<CLI::generate_test_driver> ());
+ ops.generate_test_driver ());
// Evaluate the graph for possibility of generating something useful.
//
@@ -333,17 +243,17 @@ namespace CXX
//
//
- Boolean validation (!ops.value<CLI::suppress_validation> ());
+ Boolean validation (!ops.suppress_validation ());
// Read-in type maps.
//
{
using namespace TypeMap;
- typedef Containers::Vector<NarrowString> Files;
- Files const& files (ops.value<CLI::type_map> ());
+ NarrowStrings const& files (ops.type_map ());
- for (Files::ConstIterator f (files.begin ()); f != files.end (); ++f )
+ for (NarrowStrings::const_iterator f (files.begin ());
+ f != files.end (); ++f )
{
NarrowInputFileStream ifs;
open (ifs, *f);
@@ -363,7 +273,7 @@ namespace CXX
xns = ctx.xs_ns_name ();
}
- if (ops.value<CLI::no_stl> ())
+ if (ops.no_stl ())
{
TypeMap::Namespace xsd_std ("http://www\\.w3\\.org/2001/XMLSchema");
@@ -433,7 +343,7 @@ namespace CXX
xsd.types_push_back ("int", "int", "int");
xsd.types_push_back ("unsignedInt", "unsigned int", "unsigned int");
- if (ops.value<CLI::no_long_long> ())
+ if (ops.no_long_long ())
{
xsd.types_push_back ("long", "long", "long");
xsd.types_push_back ("unsignedLong", "unsigned long", "unsigned long");
@@ -487,34 +397,32 @@ namespace CXX
// Generate code.
//
- Boolean inline_ (ops.value<CLI::generate_inline> () &&
- !generate_xml_schema);
-
+ Boolean inline_ (ops.generate_inline () && !generate_xml_schema);
Boolean source (!generate_xml_schema);
NarrowString name (file_path.leaf ());
- NarrowString skel_suffix (ops.value <CLI::skel_file_suffix> ());
- NarrowString impl_suffix (ops.value <CLI::impl_file_suffix> ());
+ NarrowString skel_suffix (ops.skel_file_suffix ());
+ NarrowString impl_suffix (ops.impl_file_suffix ());
- NarrowString hxx_suffix (ops.value <CLI::hxx_suffix> ());
- NarrowString ixx_suffix (ops.value <CLI::ixx_suffix> ());
- NarrowString cxx_suffix (ops.value <CLI::cxx_suffix> ());
+ NarrowString hxx_suffix (ops.hxx_suffix ());
+ NarrowString ixx_suffix (ops.ixx_suffix ());
+ NarrowString cxx_suffix (ops.cxx_suffix ());
Regex hxx_expr (
- ops.value <CLI::hxx_regex> ().empty ()
+ ops.hxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + hxx_suffix + "#"
- : ops.value <CLI::hxx_regex> ());
+ : ops.hxx_regex ());
Regex ixx_expr (
- ops.value <CLI::ixx_regex> ().empty ()
+ ops.ixx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + ixx_suffix + "#"
- : ops.value <CLI::ixx_regex> ());
+ : ops.ixx_regex ());
Regex cxx_expr (
- ops.value <CLI::cxx_regex> ().empty ()
+ ops.cxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + skel_suffix + cxx_suffix + "#"
- : ops.value <CLI::cxx_regex> ());
+ : ops.cxx_regex ());
Regex hxx_impl_expr;
Regex cxx_impl_expr;
@@ -615,7 +523,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -663,7 +571,7 @@ namespace CXX
if (impl)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (hxx_impl_path, ios_base::in);
@@ -689,7 +597,7 @@ namespace CXX
unlinks.add (hxx_impl_path);
file_list.push_back (hxx_impl_path.native_file_string ());
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (cxx_impl_path, ios_base::in);
@@ -718,7 +626,7 @@ namespace CXX
if (driver)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (cxx_driver_path, ios_base::in);
@@ -791,9 +699,7 @@ namespace CXX
// Print copyright and license.
//
Char const* copyright (
- ops.value<CLI::proprietary_license> ()
- ? copyright_proprietary
- : copyright_gpl);
+ ops.proprietary_license () ? copyright_proprietary : copyright_gpl);
hxx << copyright;
@@ -816,7 +722,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (ops.value<CLI::prologue_file> ());
+ NarrowString name (ops.prologue_file ());
if (name)
open (prologue, name);
@@ -826,7 +732,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (ops.value<CLI::epilogue_file> ());
+ NarrowString name (ops.epilogue_file ());
if (name)
open (epilogue, name);
@@ -834,8 +740,8 @@ namespace CXX
// SLOC counter.
//
- UnsignedLong sloc_total (0);
- Boolean show_sloc (ops.value<CLI::show_sloc> ());
+ size_t sloc_total (0);
+ Boolean show_sloc (ops.show_sloc ());
typedef
compiler::ostream_filter<compiler::cxx_indenter, wchar_t>
@@ -849,7 +755,7 @@ namespace CXX
//
Regex guard_expr ("/([a-z])([A-Z])/$1_$2/"); // Split words.
- NarrowString guard_prefix (ops.value<CLI::guard_prefix> ());
+ NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
guard_prefix = file_path.branch_path ().native_directory_string ();
@@ -889,7 +795,7 @@ namespace CXX
hxx << "#include <xsde/cxx/config.hxx>" << endl
<< endl;
- if (ops.value<CLI::char_encoding> () == "iso8859-1")
+ if (ops.char_encoding () == "iso8859-1")
{
hxx << "#ifndef XSDE_ENCODING_ISO8859_1" << endl
<< "#error the generated code uses the ISO-8859-1 encoding" <<
@@ -908,7 +814,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_stl> ())
+ if (ops.no_stl ())
{
hxx << "#ifdef XSDE_STL" << endl
<< "#error the XSD/e runtime uses STL while the " <<
@@ -927,7 +833,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_iostream> ())
+ if (ops.no_iostream ())
{
hxx << "#ifdef XSDE_IOSTREAM" << endl
<< "#error the XSD/e runtime uses iostream while the " <<
@@ -946,7 +852,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_exceptions> ())
+ if (ops.no_exceptions ())
{
hxx << "#ifdef XSDE_EXCEPTIONS" << endl
<< "#error the XSD/e runtime uses exceptions while the " <<
@@ -965,7 +871,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::no_long_long> ())
+ if (ops.no_long_long ())
{
hxx << "#ifdef XSDE_LONGLONG" << endl
<< "#error the XSD/e runtime uses long long while the " <<
@@ -984,7 +890,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::suppress_validation> ())
+ if (ops.suppress_validation ())
{
hxx << "#ifdef XSDE_SERIALIZER_VALIDATION" << endl
<< "#error the XSD/e runtime uses validation while the " <<
@@ -1003,8 +909,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::generate_polymorphic> () ||
- ops.value<CLI::runtime_polymorphic> ())
+ if (ops.generate_polymorphic () || ops.runtime_polymorphic ())
{
hxx << "#ifndef XSDE_POLYMORPHIC" << endl
<< "#error the generated code expects XSD/e runtime with " <<
@@ -1023,7 +928,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::reuse_style_mixin> ())
+ if (ops.reuse_style_mixin ())
{
hxx << "#ifndef XSDE_REUSE_STYLE_MIXIN" << endl
<< "#error the generated code uses the mixin reuse style " <<
@@ -1032,7 +937,7 @@ namespace CXX
<< "#endif" << endl
<< endl;
}
- else if (ops.value<CLI::reuse_style_none> ())
+ else if (ops.reuse_style_none ())
{
hxx << "#ifndef XSDE_REUSE_STYLE_NONE" << endl
<< "#error the generated code does not provide support " <<
@@ -1051,7 +956,7 @@ namespace CXX
<< endl;
}
- if (ops.value<CLI::custom_allocator> ())
+ if (ops.custom_allocator ())
{
hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl
<< "#error the generated code uses custom allocator while " <<
@@ -1081,9 +986,8 @@ namespace CXX
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- hxx, ops.value<CLI::hxx_prologue> (), ops.value<CLI::prologue> ());
- append (hxx, ops.value<CLI::hxx_prologue_file> (), prologue);
+ append (hxx, ops.hxx_prologue (), ops.prologue ());
+ append (hxx, ops.hxx_prologue_file (), prologue);
hxx << "//" << endl
<< "// End prologue." << endl
@@ -1109,9 +1013,8 @@ namespace CXX
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (hxx, ops.value<CLI::hxx_epilogue_file> (), epilogue);
- append (
- hxx, ops.value<CLI::hxx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (hxx, ops.hxx_epilogue_file (), epilogue);
+ append (hxx, ops.hxx_epilogue (), ops.epilogue ());
hxx << "//" << endl
<< "// End epilogue." << endl
@@ -1143,9 +1046,8 @@ namespace CXX
ixx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- ixx, ops.value<CLI::ixx_prologue> (), ops.value<CLI::prologue> ());
- append (ixx, ops.value<CLI::ixx_prologue_file> (), prologue);
+ append (ixx, ops.ixx_prologue (), ops.prologue ());
+ append (ixx, ops.ixx_prologue_file (), prologue);
ixx << "//" << endl
<< "// End prologue." << endl
@@ -1163,9 +1065,8 @@ namespace CXX
ixx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ixx, ops.value<CLI::ixx_epilogue_file> (), epilogue);
- append (
- ixx, ops.value<CLI::ixx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (ixx, ops.ixx_epilogue_file (), epilogue);
+ append (ixx, ops.ixx_epilogue (), ops.epilogue ());
ixx << "//" << endl
<< "// End epilogue." << endl
@@ -1192,9 +1093,8 @@ namespace CXX
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (
- cxx, ops.value<CLI::cxx_prologue> (), ops.value<CLI::prologue> ());
- append (cxx, ops.value<CLI::cxx_prologue_file> (), prologue);
+ append (cxx, ops.cxx_prologue (), ops.prologue ());
+ append (cxx, ops.cxx_prologue_file (), prologue);
cxx << "//" << endl
<< "// End prologue." << endl
@@ -1225,9 +1125,8 @@ namespace CXX
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (cxx, ops.value<CLI::cxx_epilogue_file> (), epilogue);
- append (
- cxx, ops.value<CLI::cxx_epilogue> (), ops.value<CLI::epilogue> ());
+ append (cxx, ops.cxx_epilogue_file (), epilogue);
+ append (cxx, ops.cxx_epilogue (), ops.epilogue ());
cxx << "//" << endl
<< "// End epilogue." << endl
diff --git a/xsde/cxx/serializer/generator.hxx b/xsde/cxx/serializer/generator.hxx
index 353fef0..e9601be 100644
--- a/xsde/cxx/serializer/generator.hxx
+++ b/xsde/cxx/serializer/generator.hxx
@@ -10,15 +10,14 @@
#include <cult/containers/vector.hxx>
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
#include <xsde.hxx>
+
#include <type-map/type-map.hxx>
-#include <cxx/serializer/cli.hxx>
+
+#include <cxx/serializer/options.hxx>
namespace CXX
{
@@ -32,13 +31,10 @@ namespace CXX
static Void
usage ();
- static CLI::OptionsSpec
- options_spec ();
-
// Assign names to global declarations.
//
static Void
- process_names (CLI::Options const&,
+ process_names (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&);
@@ -47,7 +43,7 @@ namespace CXX
struct Failed {};
static UnsignedLong
- generate (CLI::Options const&,
+ generate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean file_per_type,
diff --git a/xsde/cxx/serializer/name-processor.cxx b/xsde/cxx/serializer/name-processor.cxx
index cfe7a16..6d60c37 100644
--- a/xsde/cxx/serializer/name-processor.cxx
+++ b/xsde/cxx/serializer/name-processor.cxx
@@ -27,38 +27,19 @@ namespace CXX
class Context: public CXX::Context
{
public:
- Context (CLI::Options const& ops,
+ Context (Serializer::options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path)
- : CXX::Context (std::wcerr,
- root,
- path,
- "s:name",
- "char",
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- "", // export symbol
- ops.value<CLI::namespace_map> (),
- ops.value<CLI::namespace_regex> (),
- ops.value<CLI::namespace_regex_trace> (),
- ops.value<CLI::include_regex> (),
- ops.value<CLI::include_regex_trace> (),
- ops.value<CLI::generate_inline> (),
- ops.value<CLI::custom_allocator> (),
- !ops.value<CLI::no_long_long> (),
- ops.value<CLI::reserved_name> ()),
- skel_suffix_ (ops.value<CLI::skel_type_suffix> ()),
- impl_suffix_ (ops.value<CLI::impl_type_suffix> ()),
- impl (ops.value<CLI::generate_empty_impl> () ||
- ops.value<CLI::generate_test_driver> ()),
- tiein (!ops.value<CLI::reuse_style_mixin> () &&
- !ops.value<CLI::reuse_style_none> ()),
+ : CXX::Context (std::wcerr, root, path, ops, "s:name", "char"),
+ skel_suffix_ (ops.skel_type_suffix ()),
+ impl_suffix_ (ops.impl_type_suffix ()),
+ impl (ops.generate_empty_impl () || ops.generate_test_driver ()),
+ tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()),
skel_suffix (skel_suffix_),
impl_suffix (impl_suffix_),
global_type_names (global_type_names_),
- validation (!ops.value<CLI::suppress_validation> ()),
- polymorphic (ops.value<CLI::generate_polymorphic> ())
+ validation (!ops.suppress_validation ()),
+ polymorphic (ops.generate_polymorphic ())
{
}
@@ -1301,7 +1282,7 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
@@ -1399,7 +1380,7 @@ namespace CXX
}
Void NameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
Boolean deep)
diff --git a/xsde/cxx/serializer/name-processor.hxx b/xsde/cxx/serializer/name-processor.hxx
index 26a9dd2..b170705 100644
--- a/xsde/cxx/serializer/name-processor.hxx
+++ b/xsde/cxx/serializer/name-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/serializer/cli.hxx>
+#include <cxx/serializer/options.hxx>
namespace CXX
{
@@ -22,7 +22,7 @@ namespace CXX
{
public:
Void
- process (CLI::Options const&,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const&,
Boolean deep);
diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx
index 939a052..930ce72 100644
--- a/xsde/cxx/serializer/serializer-header.cxx
+++ b/xsde/cxx/serializer/serializer-header.cxx
@@ -1380,7 +1380,7 @@ namespace CXX
impl_ns_ = "::xsde::cxx::serializer::";
impl_ns_ += (validation ? L"validating" : L"non_validating");
- if (options.value<CLI::no_stl> ())
+ if (options.no_stl ())
{
qname_type_ = L"const " + xs_ns_ + L"::qname*";
string_type_ = L"const char*";
@@ -1394,7 +1394,7 @@ namespace CXX
string_seq_type_ = L"const " + xs_ns_ + L"::string_sequence*";
buffer_type_ = L"const " + xs_ns_ + L"::buffer*";
- if (options.value<CLI::no_long_long> ())
+ if (options.no_long_long ())
{
long_type_ = L"long";
unsigned_long_type_ = L"unsigned long";
@@ -1722,12 +1722,12 @@ namespace CXX
String const& real_impl (c.get<String> ("s:real-impl"));
String const& impl (c.get<String> ("s:impl"));
- if (options.value<CLI::skel_type_suffix> () == "_sskel")
+ if (options.skel_type_suffix () == "_sskel")
os << "using " << real_name << ";";
else
os << "typedef " << real_name << " " << name << ";";
- if (options.value<CLI::impl_type_suffix> () == "_simpl")
+ if (options.impl_type_suffix () == "_simpl")
os << "using " << real_impl << ";";
else
os << "typedef " << real_impl << " " << impl << ";";
@@ -1902,7 +1902,7 @@ namespace CXX
NarrowString extern_xml_schema;
if (!generate_xml_schema)
- extern_xml_schema = ctx.options.value<CLI::extern_xml_schema> ();
+ extern_xml_schema = ctx.options.extern_xml_schema ();
if (extern_xml_schema)
{
diff --git a/xsde/cxx/serializer/serializer-inline.cxx b/xsde/cxx/serializer/serializer-inline.cxx
index ed3ec93..9ef7fc0 100644
--- a/xsde/cxx/serializer/serializer-inline.cxx
+++ b/xsde/cxx/serializer/serializer-inline.cxx
@@ -800,7 +800,7 @@ namespace CXX
// Emit "weak" header includes that are used in the file-per-type
// compilation model.
//
- if (!ctx.options.value<CLI::generate_inline> ())
+ if (!ctx.options.generate_inline ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::source);
diff --git a/xsde/cxx/serializer/serializer-source.cxx b/xsde/cxx/serializer/serializer-source.cxx
index 39c4677..227005d 100644
--- a/xsde/cxx/serializer/serializer-source.cxx
+++ b/xsde/cxx/serializer/serializer-source.cxx
@@ -2716,7 +2716,7 @@ namespace CXX
// Emit "weak" header includes that are used in the file-per-type
// compilation model.
//
- if (ctx.options.value<CLI::generate_inline> ())
+ if (ctx.options.generate_inline ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::source);
diff --git a/xsde/cxx/serializer/type-processor.cxx b/xsde/cxx/serializer/type-processor.cxx
index 3c3a025..c331309 100644
--- a/xsde/cxx/serializer/type-processor.cxx
+++ b/xsde/cxx/serializer/type-processor.cxx
@@ -302,12 +302,11 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& options,
+ process_impl (options const& ops,
XSDFrontend::SemanticGraph::Schema& tu,
TypeMap::Namespaces& type_map)
{
- Boolean tiein (!options.value<CLI::reuse_style_mixin> () &&
- !options.value<CLI::reuse_style_none> ());
+ Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ());
if (tu.names_begin ()->named ().name () ==
L"http://www.w3.org/2001/XMLSchema")
@@ -330,8 +329,7 @@ namespace CXX
// If --extern-xml-schema is specified, then we don't want
// includes from the XML Schema type map.
//
- Boolean extern_xml_schema (
- options.value<CLI::extern_xml_schema> ());
+ Boolean extern_xml_schema (ops.extern_xml_schema ());
// Besides types defined in this schema, also process those
// referenced by global elements in case we are generating
@@ -373,11 +371,11 @@ namespace CXX
}
Void TypeProcessor::
- process (CLI::Options const& options,
+ process (options const& ops,
XSDFrontend::SemanticGraph::Schema& s,
TypeMap::Namespaces& tm)
{
- process_impl (options, s, tm);
+ process_impl (ops, s, tm);
}
}
}
diff --git a/xsde/cxx/serializer/type-processor.hxx b/xsde/cxx/serializer/type-processor.hxx
index c3355b1..f0fceed 100644
--- a/xsde/cxx/serializer/type-processor.hxx
+++ b/xsde/cxx/serializer/type-processor.hxx
@@ -12,7 +12,7 @@
#include <type-map/type-map.hxx>
-#include <cxx/serializer/cli.hxx>
+#include <cxx/serializer/options.hxx>
namespace CXX
{
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Void
- process (CLI::Options const& options,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
TypeMap::Namespaces&);
};
diff --git a/xsde/cxx/serializer/validator.cxx b/xsde/cxx/serializer/validator.cxx
index 9403437..af4dfd1 100644
--- a/xsde/cxx/serializer/validator.cxx
+++ b/xsde/cxx/serializer/validator.cxx
@@ -25,10 +25,10 @@ namespace CXX
public:
ValidationContext (SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& options,
+ Serializer::options const& ops,
const WarningSet& disabled_warnings,
Boolean& valid_)
- : Context (std::wcerr, root, path, options, 0, 0, 0),
+ : Context (std::wcerr, root, path, ops, 0, 0, 0),
disabled_warnings_ (disabled_warnings),
disabled_warnings_all_ (false),
valid (valid_),
@@ -157,7 +157,7 @@ namespace CXX
return;
if (e.substitutes_p () &&
- !options.value<CLI::generate_polymorphic> () &&
+ !options.generate_polymorphic () &&
!subst_group_warning_issued)
{
subst_group_warning_issued = true;
@@ -242,7 +242,7 @@ namespace CXX
<< "automatically name them"
<< endl;
- if (!options.value<CLI::show_anonymous> ())
+ if (!options.show_anonymous ())
wcerr << t.file ()
<< ": info: use --show-anonymous option to see these "
<< "types" << endl;
@@ -271,7 +271,7 @@ namespace CXX
{
if (traverse_common (e))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << e.file () << ":" << e.line () << ":" << e.column ()
<< ": error: element '" << xpath (e) << "' "
@@ -296,7 +296,7 @@ namespace CXX
{
if (traverse_common (a))
{
- if (options.value<CLI::show_anonymous> ())
+ if (options.show_anonymous ())
{
wcerr << a.file () << ":" << a.line () << ":" << a.column ()
<< ": error: attribute '" << xpath (a) << "' "
@@ -362,16 +362,16 @@ namespace CXX
if (!valid)
return;
- if (options.value<CLI::root_element_first> ())
+ if (options.root_element_first ())
{
if (element_ == 0)
element_ = &e;
}
- else if (options.value<CLI::root_element_last> ())
+ else if (options.root_element_last ())
{
element_ = &e;
}
- else if (String name = options.value<CLI::root_element> ())
+ else if (String name = options.root_element ())
{
if (e.name () == name)
element_ = &e;
@@ -400,18 +400,18 @@ namespace CXX
}
Boolean Validator::
- validate (CLI::Options const& options,
+ validate (options const& ops,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
Boolean gen_driver,
const WarningSet& disabled_warnings)
{
Boolean valid (true);
- ValidationContext ctx (root, path, options, disabled_warnings, valid);
+ ValidationContext ctx (root, path, ops, disabled_warnings, valid);
//
//
- NarrowString enc (options.value<CLI::char_encoding> ());
+ NarrowString enc (ops.char_encoding ());
if (enc != "utf8" && enc != "iso8859-1")
{
@@ -422,9 +422,9 @@ namespace CXX
//
//
{
- Boolean ref (options.value<CLI::root_element_first> ());
- Boolean rel (options.value<CLI::root_element_last> ());
- Boolean re (options.value<CLI::root_element> ());
+ Boolean ref (ops.root_element_first ());
+ Boolean rel (ops.root_element_last ());
+ Boolean re (ops.root_element ());
if ((ref && rel) || (ref && re) || (rel && re))
{
@@ -439,8 +439,7 @@ namespace CXX
//
//
- if (options.value<CLI::reuse_style_mixin> () &&
- options.value<CLI::reuse_style_none> ())
+ if (ops.reuse_style_mixin () && ops.reuse_style_none ())
{
wcerr << "error: mutually exclusive options specified: "
<< "--reuse-style-mixin and --reuse-style-none"
@@ -451,8 +450,8 @@ namespace CXX
//
//
- if (options.value<CLI::reuse_style_none> () &&
- options.value<CLI::generate_empty_impl> () &&
+ if (ops.reuse_style_none () &&
+ ops.generate_empty_impl () &&
!ctx.is_disabled ("S002"))
{
wcerr << "warning S002: generating sample implementation without "
diff --git a/xsde/cxx/serializer/validator.hxx b/xsde/cxx/serializer/validator.hxx
index f275cf4..601ada3 100644
--- a/xsde/cxx/serializer/validator.hxx
+++ b/xsde/cxx/serializer/validator.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph/schema.hxx>
-#include <cxx/serializer/cli.hxx>
+#include <cxx/serializer/options.hxx>
#include <xsde.hxx>
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Boolean
- validate (CLI::Options const& options,
+ validate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& tu,
Boolean gen_driver,
diff --git a/xsde/makefile b/xsde/makefile
index 9df2438..1878209 100644
--- a/xsde/makefile
+++ b/xsde/makefile
@@ -141,14 +141,19 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(cli)
$(gen): cli := $(cli)
+# Watch out: if I add --generate-specifier, then I will need to fix
+# code that relies on modifiers to also modify the "specified" flag.
+#
$(gen): cli_options += \
-I $(src_base) \
+--generate-modifier \
--ostream-type ::std::wostream \
--exclude-base \
--suppress-undocumented \
--generate-file-scanner \
--include-with-brackets \
---option-length 28
+--option-length 28 \
+--cxx-prologue '\#include <options-parser.hxx>'
#--include-prefix xsde
#--guard-prefix XSDE
diff --git a/xsde/options-parser.hxx b/xsde/options-parser.hxx
new file mode 100644
index 0000000..a16cd67
--- /dev/null
+++ b/xsde/options-parser.hxx
@@ -0,0 +1,31 @@
+// file : xsde/options-parser.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef OPTIONS_PARSER_HXX
+#define OPTIONS_PARSER_HXX
+
+#include <cult/types.hxx>
+
+#include <options.hxx>
+
+namespace cli
+{
+ template <>
+ struct parser<Cult::Types::NarrowString>
+ {
+ static void
+ parse (Cult::Types::NarrowString& x, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+ }
+ };
+}
+
+#endif // OPTIONS_PARSER_HXX
diff --git a/xsde/types.hxx b/xsde/types.hxx
new file mode 100644
index 0000000..75bd0e2
--- /dev/null
+++ b/xsde/types.hxx
@@ -0,0 +1,15 @@
+// file : xsde/types.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef TYPES_HXX
+#define TYPES_HXX
+
+#include <vector>
+
+#include <cult/types.hxx>
+
+typedef std::vector<Cult::Types::NarrowString> NarrowStrings;
+
+#endif // TYPES_HXX
diff --git a/xsde/xsde.cxx b/xsde/xsde.cxx
index eb3f9f3..9d05a70 100644
--- a/xsde/xsde.cxx
+++ b/xsde/xsde.cxx
@@ -4,7 +4,8 @@
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <vector>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr
+#include <cstddef> // std::size_t
#include <iostream>
#include <boost/filesystem/fstream.hpp>
@@ -18,12 +19,6 @@
#include <cult/containers/map.hxx>
#include <cult/containers/vector.hxx>
-#include <cult/cli/exceptions.hxx>
-#include <cult/cli/file-arguments.hxx>
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-#include <cult/cli/options-parser.hxx>
-
#include <xsd-frontend/parser.hxx>
#include <xsd-frontend/transformations/anonymous.hxx>
#include <xsd-frontend/transformations/enum-synthesis.hxx>
@@ -33,8 +28,9 @@
#include <type-map/type-map.hxx>
-#include <xsde.hxx>
-#include <options.hxx>
+#include <cxx/parser/options.hxx>
+#include <cxx/serializer/options.hxx>
+#include <cxx/hybrid/options.hxx>
#include <cxx/parser/generator.hxx>
#include <cxx/serializer/generator.hxx>
@@ -42,87 +38,19 @@
#include <processing/inheritance/processor.hxx>
+#include <xsde.hxx>
+#include <types.hxx>
+#include <options.hxx>
+
#include "../libxsde/xsde/cxx/version.hxx"
using namespace Cult::Types;
-typedef Cult::Containers::Vector<NarrowString> NarrowStrings;
-
namespace SemanticGraph = XSDFrontend::SemanticGraph;
namespace Transformations = XSDFrontend::Transformations;
using namespace std;
-namespace CLI
-{
- using namespace Cult::CLI;
-
- typedef Char const Key[];
-
- extern Key help = "help";
- extern Key version = "version";
- extern Key proprietary_license = "proprietary-license";
-
- typedef Cult::CLI::Options
- <
- help, Boolean,
- version, Boolean,
- proprietary_license, Boolean
- >
- HelpOptions;
-
- struct HelpOptionsSpec: Cult::CLI::OptionsSpec<HelpOptions> {};
-
-
- extern Key disable_warning = "disable-warning";
- extern Key sloc_limit = "sloc-limit";
- extern Key preserve_anonymous = "preserve-anonymous";
- extern Key anonymous_regex = "anonymous-regex";
- extern Key anonymous_regex_trace = "anonymous-regex-trace";
- extern Key location_map = "location-map";
- extern Key location_regex = "location-regex";
- extern Key location_regex_trace = "location-regex-trace";
- extern Key file_per_type = "file-per-type";
- extern Key type_file_regex = "type-file-regex";
- extern Key type_file_regex_trace = "type-file-regex-trace";
- extern Key schema_file_regex = "schema-file-regex";
- extern Key schema_file_regex_trace = "schema-file-regex-trace";
- extern Key fat_type_file = "fat-type-file";
- extern Key file_list = "file-list";
- extern Key file_list_prologue = "file-list-prologue";
- extern Key file_list_epilogue = "file-list-epilogue";
- extern Key file_list_delim = "file-list-delim";
- extern Key disable_multi_import = "disable-multi-import"; // Undocumented.
- extern Key disable_full_check = "disable-full-check"; // Undocumented.
-
- typedef Cult::CLI::Options
- <
- disable_warning, Cult::Containers::Vector<NarrowString>,
- sloc_limit, UnsignedLong,
- preserve_anonymous, Boolean,
- anonymous_regex, NarrowStrings,
- anonymous_regex_trace, Boolean,
- location_map, NarrowStrings,
- location_regex, NarrowStrings,
- location_regex_trace, Boolean,
- file_per_type, Boolean,
- type_file_regex, NarrowStrings,
- type_file_regex_trace, Boolean,
- schema_file_regex, NarrowStrings,
- schema_file_regex_trace, Boolean,
- fat_type_file, Boolean,
- file_list, NarrowString,
- file_list_prologue, NarrowString,
- file_list_epilogue, NarrowString,
- file_list_delim, NarrowString,
- disable_multi_import, Boolean,
- disable_full_check, Boolean
- >
- CommonOptions;
-
- struct CommonOptionsSpec: Cult::CLI::OptionsSpec<CommonOptions> {};
-}
-
//
//
struct LocationTranslator: XSDFrontend::LocationTranslator
@@ -222,20 +150,14 @@ main (Int argc, Char* argv[])
try
{
- CLI::FileArguments args (argc, argv, "--options-file");
-
- CLI::HelpOptions help_ops (
- CLI::parse (CLI::HelpOptionsSpec (), args, CLI::UnknownMode::stop));
+ cli::argv_file_scanner args (argc, argv, "--options-file");
+ help_options help_ops (args, cli::unknown_mode::stop);
NarrowString cmd;
+ if (args.more ())
+ cmd = args.next ();
- if (args.size () > 1)
- {
- cmd = args[1];
- args.erase (1);
- }
-
- if (help_ops.value<CLI::version> () || cmd == "version")
+ if (help_ops.version () || cmd == "version")
{
std::wostream& o (wcout);
@@ -243,17 +165,15 @@ main (Int argc, Char* argv[])
"for embedded systems " << XSDE_STR_VERSION << endl
<< "Copyright (c) 2005-2011 Code Synthesis Tools CC" << endl;
- if (!help_ops.value<CLI::proprietary_license> () &&
- cmd == "version")
+ if (!help_ops.proprietary_license () && cmd == "version")
{
// Parse the options after the command to detect trailing
// --proprietary-license.
//
- help_ops = CLI::parse (
- CLI::HelpOptionsSpec (), args, CLI::UnknownMode::stop);
+ help_ops = help_options (args, cli::unknown_mode::stop);
}
- if (help_ops.value<CLI::proprietary_license> ())
+ if (help_ops.proprietary_license ())
{
o << "The compiler was invoked in the Proprietary License mode. You "
<< "should have\nreceived a proprietary license from Code Synthesis "
@@ -269,17 +189,17 @@ main (Int argc, Char* argv[])
return 0;
}
- if (help_ops.value<CLI::help> () || cmd == "help")
+ if (help_ops.help () || cmd == "help")
{
std::wostream& o (wcout);
- if (cmd == "help" && args.size () > 1)
+ if (cmd == "help" && args.more ())
{
- NarrowString arg (args[1]);
+ NarrowString arg (args.next ());
if (arg == "cxx-parser")
{
- o << "Usage: " << args[0] << " cxx-parser [options] file [file ...]"
+ o << "Usage: " << argv[0] << " cxx-parser [options] file [file ...]"
<< endl
<< "Options:" << endl;
@@ -287,7 +207,7 @@ main (Int argc, Char* argv[])
}
else if (arg == "cxx-serializer")
{
- o << "Usage: " << args[0] << " cxx-serializer [options] file " <<
+ o << "Usage: " << argv[0] << " cxx-serializer [options] file " <<
"[file ...]" << endl
<< "Options:" << endl;
@@ -295,7 +215,7 @@ main (Int argc, Char* argv[])
}
else if (arg == "cxx-hybrid")
{
- o << "Usage: " << args[0] << " cxx-hybrid [options] file " <<
+ o << "Usage: " << argv[0] << " cxx-hybrid [options] file " <<
"[file ...]" << endl
<< "Options:" << endl;
@@ -304,7 +224,7 @@ main (Int argc, Char* argv[])
else
{
e << "error: unknown command '" << arg.c_str () << "'" << endl
- << "info: try '" << args[0] << " help' for the list of commands"
+ << "info: try '" << argv[0] << " help' for the list of commands"
<< endl;
return 1;
@@ -316,7 +236,7 @@ main (Int argc, Char* argv[])
}
else
{
- o << "Usage: " << args[0] << " <cmd> ..." << endl
+ o << "Usage: " << argv[0] << " <cmd> ..." << endl
<< "Commands:" << endl;
o << " help Print usage information and exit. Use\n"
@@ -342,7 +262,7 @@ main (Int argc, Char* argv[])
if (cmd.empty ())
{
e << "error: no command specified" << endl
- << "info: try '" << args[0] << " help' for usage information" << endl;
+ << "info: try '" << argv[0] << " help' for usage information" << endl;
return 1;
}
@@ -350,7 +270,7 @@ main (Int argc, Char* argv[])
if (cmd != "cxx-parser" && cmd != "cxx-serializer" && cmd != "cxx-hybrid")
{
e << "error: unknown command '" << cmd.c_str () << "'" << endl
- << "info: try '" << args[0] << " help' for the list of commands"
+ << "info: try '" << argv[0] << " help' for the list of commands"
<< endl;
return 1;
@@ -359,84 +279,55 @@ main (Int argc, Char* argv[])
// We need to parse command line options before we can get to
// the arguments.
//
- CLI::CommonOptionsSpec common_spec;
- common_spec.option<CLI::file_list_delim> ().default_value ("\n");
+ auto_ptr<CXX::Parser::options> p_ops (
+ cmd == "cxx-parser" ? new CXX::Parser::options (args) : 0);
+
+ auto_ptr<CXX::Serializer::options> s_ops (
+ cmd == "cxx-serializer" ? new CXX::Serializer::options (args) : 0);
- CLI::CommonOptions common_ops (
- CLI::parse (
- common_spec,
- args,
- CLI::UnknownMode::skip,
- CLI::UnknownMode::skip));
+ auto_ptr<CXX::Hybrid::options> h_ops (
+ cmd == "cxx-hybrid" ? new CXX::Hybrid::options (args) : 0);
+ CXX::options& common_ops (
+ cmd == "cxx-parser"
+ ? static_cast<CXX::options&> (*p_ops)
+ : cmd == "cxx-serializer"
+ ? static_cast<CXX::options&> (*s_ops)
+ : static_cast<CXX::options&> (*h_ops));
+
+ // Disabled warnings.
+ //
WarningSet disabled_w;
{
- typedef Cult::Containers::Vector<NarrowString> Warnings;
- Warnings const& w (common_ops.value<CLI::disable_warning> ());
+ NarrowStrings const& w (common_ops.disable_warning ());
- for (Warnings::ConstIterator i (w.begin ()); i != w.end (); ++i)
+ for (NarrowStrings::const_iterator i (w.begin ()); i != w.end (); ++i)
disabled_w.insert (*i);
}
Boolean disabled_w_all (disabled_w.find ("all") != disabled_w.end ());
- Evptr<CXX::Parser::CLI::Options> p_ops;
- Evptr<CXX::Serializer::CLI::Options> s_ops;
- Evptr<CXX::Hybrid::CLI::Options> h_ops;
-
- Boolean show_sloc (false);
-
- if (cmd == "cxx-parser")
- {
- p_ops = new CXX::Parser::CLI::Options (
- CLI::parse (CXX::Parser::Generator::options_spec (), args));
-
- show_sloc = p_ops->value<CXX::Parser::CLI::show_sloc> ();
- }
- else if (cmd == "cxx-serializer")
- {
- s_ops = new CXX::Serializer::CLI::Options (
- CLI::parse (CXX::Serializer::Generator::options_spec (), args));
+ // Collect all the files to compile in a vector.
+ //
+ NarrowStrings files;
- show_sloc = s_ops->value<CXX::Serializer::CLI::show_sloc> ();
- }
- else if (cmd == "cxx-hybrid")
- {
- h_ops = new CXX::Hybrid::CLI::Options (
- CLI::parse (CXX::Hybrid::Generator::options_spec (), args));
+ while (args.more ())
+ files.push_back (args.next ());
- show_sloc = h_ops->value<CXX::Hybrid::CLI::show_sloc> ();
- }
-
- if (args.size () < 2)
+ if (files.empty ())
{
e << "error: no input file specified" << endl;
return 1;
}
- Boolean fpt (common_ops.value<CLI::file_per_type> ());
+ Boolean fpt (common_ops.file_per_type ());
// Generate/extern XML Schema checks.
//
if (cmd == "cxx-parser" || cmd == "cxx-serializer" || cmd == "cxx-hybrid")
{
- Boolean gen (false), use (false);
-
- if (cmd == "cxx-parser")
- {
- gen = p_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
- use = p_ops->value<CXX::Parser::CLI::extern_xml_schema> ();
- }
- else if (cmd == "cxx-serializer")
- {
- gen = s_ops->value<CXX::Serializer::CLI::generate_xml_schema> ();
- use = s_ops->value<CXX::Serializer::CLI::extern_xml_schema> ();
- }
- else if (cmd == "cxx-hybrid")
- {
- gen = h_ops->value<CXX::Hybrid::CLI::generate_xml_schema> ();
- use = h_ops->value<CXX::Hybrid::CLI::extern_xml_schema> ();
- }
+ bool gen (common_ops.generate_xml_schema ());
+ bool use (common_ops.extern_xml_schema ());
// Things get complicated when we are compiling several schemas at
// once (non-file-per-type mode) and use the --generate-xml-schema/
@@ -447,7 +338,7 @@ main (Int argc, Char* argv[])
//
if (!fpt)
{
- if (args.size () > 2 && gen && !use)
+ if (files.size () > 1 && gen && !use)
{
e << "error: --extern-xml-schema is required when compiling more "
<< "than one schema and --generate-xml-schema is specified"
@@ -456,7 +347,7 @@ main (Int argc, Char* argv[])
return 1;
}
- if (args.size () == 2 && gen && use)
+ if (files.size () == 1 && gen && use)
{
e << "error: --generate-xml-schema and --extern-xml-schema are "
<< "mutually exclusive when compiling a single schema" << endl;
@@ -494,37 +385,37 @@ main (Int argc, Char* argv[])
//
FileList file_list;
AutoUnlinks unlinks;
- UnsignedLong sloc (0);
+ size_t sloc (0);
LocationTranslator loc_translator (
- common_ops.value<CLI::location_map> (),
- common_ops.value<CLI::location_regex> (),
- common_ops.value<CLI::location_regex_trace> ());
+ common_ops.location_map (),
+ common_ops.location_regex (),
+ common_ops.location_regex_trace ());
AnonymousNameTranslator anon_translator (
- common_ops.value<CLI::anonymous_regex> (),
- common_ops.value<CLI::anonymous_regex_trace> ());
+ common_ops.anonymous_regex (),
+ common_ops.anonymous_regex_trace ());
Boolean gen_hybrid (cmd == "cxx-hybrid");
Boolean gen_parser (
cmd == "cxx-parser" ||
- (gen_hybrid && h_ops->value<CXX::Hybrid::CLI::generate_parser> ()));
+ (gen_hybrid && h_ops->generate_parser ()));
Boolean gen_serializer (
cmd == "cxx-serializer" ||
- (gen_hybrid && h_ops->value<CXX::Hybrid::CLI::generate_serializer> ()));
+ (gen_hybrid && h_ops->generate_serializer ()));
Boolean poly_aggr (
gen_hybrid &&
- h_ops->value<CXX::Hybrid::CLI::generate_polymorphic> () &&
- h_ops->value<CXX::Hybrid::CLI::generate_aggregate> ());
+ h_ops->generate_polymorphic () &&
+ h_ops->generate_aggregate ());
if (!fpt)
{
// File-per-schema compilation mode.
//
- for (Size i (1); i < args.size (); ++i)
+ for (size_t i (0); i < files.size (); ++i)
{
// Parse schema.
//
@@ -533,8 +424,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
true,
- !common_ops.value<CLI::disable_multi_import> (),
- !common_ops.value<CLI::disable_full_check> (),
+ !common_ops.disable_multi_import (),
+ !common_ops.disable_full_check (),
loc_translator,
disabled_w);
@@ -542,11 +433,11 @@ main (Int argc, Char* argv[])
try
{
- tu = SemanticGraph::Path (args[i], boost::filesystem::native);
+ tu = SemanticGraph::Path (files[i], boost::filesystem::native);
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[i] << "' is not a valid "
+ e << "error: '" << files[i].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
}
@@ -557,57 +448,15 @@ main (Int argc, Char* argv[])
// will need to rely on the presence of the --extern-xml-schema
// to tell us which (fake) schema file corresponds to XML Schema.
//
- Boolean gen_xml_schema (false);
+ bool gen_xml_schema (common_ops.generate_xml_schema ());
NarrowString xml_schema_file;
- if (cmd == "cxx-parser" ||
- cmd == "cxx-serializer" ||
- cmd == "cxx-hybrid")
+ if (gen_xml_schema)
{
- if (cmd == "cxx-parser")
- {
- gen_xml_schema =
- p_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- p_ops->value<CXX::Parser::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
- }
- else if (cmd == "cxx-serializer")
- {
- gen_xml_schema =
- s_ops->value<CXX::Serializer::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- s_ops->value<CXX::Serializer::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
- }
- else if (cmd == "cxx-hybrid")
+ if (xml_schema_file = common_ops.extern_xml_schema ())
{
- gen_xml_schema =
- h_ops->value<CXX::Hybrid::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- h_ops->value<CXX::Hybrid::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
+ if (tu.native_file_string () != xml_schema_file)
+ gen_xml_schema = false;
}
}
@@ -620,21 +469,21 @@ main (Int argc, Char* argv[])
if (multi)
{
- Size ai (1);
paths.push_back (tu);
+ Size ai (0);
try
{
- for (; ai < args.size (); ++ai)
+ for (; ai < files.size (); ++ai)
{
- if (ai != i && args[ai] != xml_schema_file)
+ if (ai != i && files[ai] != xml_schema_file)
paths.push_back (
- SemanticGraph::Path (args[ai], boost::filesystem::native));
+ SemanticGraph::Path (files[ai], boost::filesystem::native));
}
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[ai] << "' is not a valid "
+ e << "error: '" << files[ai].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
}
@@ -642,10 +491,8 @@ main (Int argc, Char* argv[])
// Also include additional schemas that may be specified with
// the --polymorphic-schema option.
//
- NarrowStrings const& extra_files (
- h_ops->value<CXX::Hybrid::CLI::polymorphic_schema> ());
-
- NarrowStrings::ConstIterator i (extra_files.begin ());
+ NarrowStrings const& extra_files (h_ops->polymorphic_schema ());
+ NarrowStrings::const_iterator i (extra_files.begin ());
try
{
@@ -662,8 +509,7 @@ main (Int argc, Char* argv[])
return 1;
}
-
- if (args.size () <= 1)
+ if (paths.size () == 1)
multi = false;
}
@@ -679,7 +525,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -789,11 +635,11 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
+ if (gen_parser && !p_ops.get ())
p_ops = CXX::Hybrid::Generator::parser_options (
*h_ops, *root, b->path ());
- if (gen_serializer && !s_ops)
+ if (gen_serializer && !s_ops.get ())
s_ops = CXX::Hybrid::Generator::serializer_options (
*h_ops, *root, b->path ());
@@ -836,11 +682,10 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
- p_ops = CXX::Hybrid::Generator::parser_options (
- *h_ops, *root, tu);
+ if (gen_parser && !p_ops.get ())
+ p_ops = CXX::Hybrid::Generator::parser_options (*h_ops, *root, tu);
- if (gen_serializer && !s_ops)
+ if (gen_serializer && !s_ops.get ())
s_ops = CXX::Hybrid::Generator::serializer_options (
*h_ops, *root, tu);
}
@@ -970,16 +815,16 @@ main (Int argc, Char* argv[])
//
SemanticGraph::Paths paths;
- for (Size i (1); i < args.size (); ++i)
+ for (Size i (0); i < files.size (); ++i)
{
try
{
paths.push_back (
- SemanticGraph::Path (args[i], boost::filesystem::native));
+ SemanticGraph::Path (files[i], boost::filesystem::native));
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[i] << "' is not a valid "
+ e << "error: '" << files[i].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
@@ -987,10 +832,8 @@ main (Int argc, Char* argv[])
}
if (paths.size () > 1 &&
- ((cmd == "cxx-parser" &&
- p_ops->value<CXX::Parser::CLI::generate_test_driver> ()) ||
- (cmd == "cxx-serializer" &&
- s_ops->value<CXX::Serializer::CLI::generate_test_driver> ())))
+ ((cmd == "cxx-parser" && p_ops->generate_test_driver ()) ||
+ (cmd == "cxx-serializer" && s_ops->generate_test_driver ())))
{
e << "info: generating test driver for the first schema only: '" <<
paths[0] << "'" << endl;
@@ -998,8 +841,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
cmd != "cxx-hybrid",
- !common_ops.value<CLI::disable_multi_import> (),
- !common_ops.value<CLI::disable_full_check> (),
+ !common_ops.disable_multi_import (),
+ !common_ops.disable_full_check (),
loc_translator,
disabled_w);
@@ -1007,7 +850,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -1071,14 +914,14 @@ main (Int argc, Char* argv[])
typedef std::vector<SemanticGraph::Schema*> Schemas;
SchemaPerTypeTranslator type_translator (
- common_ops.value<CLI::type_file_regex> (),
- common_ops.value<CLI::type_file_regex_trace> (),
- common_ops.value<CLI::schema_file_regex> (),
- common_ops.value<CLI::schema_file_regex_trace> ());
+ common_ops.type_file_regex (),
+ common_ops.type_file_regex_trace (),
+ common_ops.schema_file_regex (),
+ common_ops.schema_file_regex_trace ());
Transformations::SchemaPerType trans (
type_translator,
- common_ops.value<CLI::fat_type_file> (),
+ common_ops.fat_type_file (),
gen_hybrid ? "fixed" : 0);
Schemas schemas (trans.transform (*schema));
@@ -1097,13 +940,11 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
- p_ops = CXX::Hybrid::Generator::parser_options (
- *h_ops, s, path);
+ if (gen_parser && !p_ops.get ())
+ p_ops = CXX::Hybrid::Generator::parser_options (*h_ops, s, path);
- if (gen_serializer && !s_ops)
- s_ops = CXX::Hybrid::Generator::serializer_options (
- *h_ops, s, path);
+ if (gen_serializer && !s_ops.get ())
+ s_ops = CXX::Hybrid::Generator::serializer_options (*h_ops, s, path);
TypeMap::Namespaces parser_type_map, serializer_type_map;
@@ -1229,7 +1070,7 @@ main (Int argc, Char* argv[])
// See if we need to produce the file list.
//
- if (NarrowString fl = common_ops.value<CLI::file_list> ())
+ if (NarrowString fl = common_ops.file_list ())
{
typedef boost::filesystem::ofstream OutputFileStream;
@@ -1246,10 +1087,10 @@ main (Int argc, Char* argv[])
return 1;
}
- NarrowString d (common_ops.value<CLI::file_list_delim> ());
+ NarrowString d (common_ops.file_list_delim ());
expand_nl (d);
- if (NarrowString p = common_ops.value<CLI::file_list_prologue> ())
+ if (NarrowString p = common_ops.file_list_prologue ())
{
expand_nl (p);
ofs << p;
@@ -1264,7 +1105,7 @@ main (Int argc, Char* argv[])
ofs << d;
}
- if (NarrowString e = common_ops.value<CLI::file_list_epilogue> ())
+ if (NarrowString e = common_ops.file_list_epilogue ())
{
expand_nl (e);
ofs << e;
@@ -1278,10 +1119,10 @@ main (Int argc, Char* argv[])
}
}
- if (show_sloc)
+ if (common_ops.show_sloc ())
e << "total: " << sloc << endl;
- if (UnsignedLong sloc_limit = common_ops.value<CLI::sloc_limit> ())
+ if (size_t sloc_limit = common_ops.sloc_limit ())
{
if (sloc_limit < sloc)
{
@@ -1316,26 +1157,10 @@ main (Int argc, Char* argv[])
{
// Diagnostic has already been issued.
}
- catch (CLI::UnexpectedOption const& e)
+ catch (cli::exception const& ex)
{
- wcerr << "error: unknown option '" << e.option ().c_str () << "'" << endl
- << "info: try '" << argv[0] << " help' for usage information"
- << endl;
- }
- catch (CLI::OptionFormat const& e)
- {
- wcerr << "error: value for option '" << e.option ().c_str ()
- << "' is invalid or missing" << endl
- << "info: try '" << argv[0] << " help' for usage information"
- << endl;
- }
- catch (CLI::OptionFile const& e)
- {
- if (e.value ())
- wcerr << "error: " << e.value ().c_str () << ": "
- << e.description ().c_str () << endl;
- else
- wcerr << "error: missing --options-file argument" << endl;
+ wcerr << ex << endl;
+ wcerr << "try '" << argv[0] << " help' for usage information" << endl;
}
return 1;
@@ -1352,7 +1177,7 @@ LocationTranslator (NarrowStrings const& map,
{
// Map.
//
- for (NarrowStrings::ConstIterator i (map.begin ()); i != map.end (); ++i)
+ for (NarrowStrings::const_iterator i (map.begin ()); i != map.end (); ++i)
{
// Split the string in two parts at the last '='.
//
@@ -1371,7 +1196,7 @@ LocationTranslator (NarrowStrings const& map,
// Regex.
//
- for (NarrowStrings::ConstIterator i (regex.begin ()); i != regex.end (); ++i)
+ for (NarrowStrings::const_iterator i (regex.begin ()); i != regex.end (); ++i)
{
try
{
@@ -1447,7 +1272,7 @@ AnonymousNameTranslator::
AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace)
: trace_ (trace)
{
- for (NarrowStrings::ConstIterator i (regex.begin ()); i != regex.end (); ++i)
+ for (NarrowStrings::const_iterator i (regex.begin ()); i != regex.end (); ++i)
{
try
{
@@ -1509,7 +1334,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex,
Boolean schema_trace)
: type_trace_ (type_trace), schema_trace_ (schema_trace)
{
- for (NarrowStrings::ConstIterator i (type_regex.begin ());
+ for (NarrowStrings::const_iterator i (type_regex.begin ());
i != type_regex.end (); ++i)
{
try
@@ -1525,7 +1350,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex,
}
}
- for (NarrowStrings::ConstIterator i (schema_regex.begin ());
+ for (NarrowStrings::const_iterator i (schema_regex.begin ());
i != schema_regex.end (); ++i)
{
try