aboutsummaryrefslogtreecommitdiff
path: root/xsd
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-06-20 11:54:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-06-20 11:55:22 +0200
commitc04f7d6ed04d62efafa79a87bcde6c5f62e95327 (patch)
tree500cc93aed55b0809fe04e5a0b7020d9045c65c5 /xsd
parente14a3f91e6e51430bf9c6978f44c7f46114793fb (diff)
Completion of the CLI port
Diffstat (limited to 'xsd')
-rw-r--r--xsd/cxx/elements.cxx82
-rw-r--r--xsd/cxx/elements.hxx40
-rw-r--r--xsd/cxx/options.cli6
-rw-r--r--xsd/cxx/parser/cli.hxx154
-rw-r--r--xsd/cxx/parser/driver-source.cxx2
-rw-r--r--xsd/cxx/parser/elements.cxx29
-rw-r--r--xsd/cxx/parser/elements.hxx20
-rw-r--r--xsd/cxx/parser/generator.cxx202
-rw-r--r--xsd/cxx/parser/generator.hxx10
-rw-r--r--xsd/cxx/parser/impl-source.cxx12
-rw-r--r--xsd/cxx/parser/name-processor.cxx35
-rw-r--r--xsd/cxx/parser/name-processor.hxx4
-rw-r--r--xsd/cxx/parser/options.cli6
-rw-r--r--xsd/cxx/parser/parser-header.cxx2
-rw-r--r--xsd/cxx/parser/parser-inline.cxx2
-rw-r--r--xsd/cxx/parser/parser-source.cxx6
-rw-r--r--xsd/cxx/parser/type-processor.cxx13
-rw-r--r--xsd/cxx/parser/type-processor.hxx4
-rw-r--r--xsd/cxx/parser/validator.cxx60
-rw-r--r--xsd/cxx/parser/validator.hxx4
-rw-r--r--xsd/cxx/tree/cli.hxx230
-rw-r--r--xsd/cxx/tree/counter.cxx16
-rw-r--r--xsd/cxx/tree/counter.hxx4
-rw-r--r--xsd/cxx/tree/elements.cxx91
-rw-r--r--xsd/cxx/tree/elements.hxx13
-rw-r--r--xsd/cxx/tree/fundamental-header.hxx16
-rw-r--r--xsd/cxx/tree/generator.cxx289
-rw-r--r--xsd/cxx/tree/generator.hxx7
-rw-r--r--xsd/cxx/tree/name-processor.cxx86
-rw-r--r--xsd/cxx/tree/name-processor.hxx3
-rw-r--r--xsd/cxx/tree/options.cli7
-rw-r--r--xsd/cxx/tree/parser-source.cxx12
-rw-r--r--xsd/cxx/tree/polymorphism-processor.cxx8
-rw-r--r--xsd/cxx/tree/polymorphism-processor.hxx4
-rw-r--r--xsd/cxx/tree/serialization-header.cxx2
-rw-r--r--xsd/cxx/tree/serialization-source.cxx15
-rw-r--r--xsd/cxx/tree/stream-extraction-source.cxx36
-rw-r--r--xsd/cxx/tree/stream-insertion-header.cxx22
-rw-r--r--xsd/cxx/tree/stream-insertion-source.cxx34
-rw-r--r--xsd/cxx/tree/stream-source.cxx4
-rw-r--r--xsd/cxx/tree/tree-forward.cxx32
-rw-r--r--xsd/cxx/tree/tree-header.cxx99
-rw-r--r--xsd/cxx/tree/tree-inline.cxx10
-rw-r--r--xsd/cxx/tree/tree-source.cxx68
-rw-r--r--xsd/cxx/tree/validator.cxx46
-rw-r--r--xsd/cxx/tree/validator.hxx4
-rw-r--r--xsd/makefile3
-rw-r--r--xsd/options-parser.hxx31
-rw-r--r--xsd/options.cli2
-rw-r--r--xsd/types.hxx15
-rw-r--r--xsd/xsd.cxx336
51 files changed, 718 insertions, 1520 deletions
diff --git a/xsd/cxx/elements.cxx b/xsd/cxx/elements.cxx
index e83f661..927e74d 100644
--- a/xsd/cxx/elements.cxx
+++ b/xsd/cxx/elements.cxx
@@ -5,6 +5,7 @@
#include <cxx/elements.hxx>
+#include <vector>
#include <cctype> // std::toupper
#include <memory>
#include <sstream>
@@ -14,6 +15,8 @@
using std::wcerr;
using std::endl;
+typedef std::vector<NarrowString> NarrowStrings;
+
namespace CXX
{
//
@@ -112,55 +115,45 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- StringLiteralMap const* string_literal_map_,
- 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_,
- Containers::Vector<NarrowString> const& reserved_name)
+ options_type const& ops,
+ StringLiteralMap const* string_literal_map_)
: os (o),
schema_root (root),
schema_path (schema_path_),
+ options (ops),
char_type (char_type_),
char_encoding (char_encoding_),
L (L_),
string_type (string_type_),
string_literal_map (string_literal_map_),
- include_with_brackets (include_with_brackets_),
- include_prefix (include_prefix_),
type_exp (type_exp_),
inst_exp (inst_exp_),
inl (inl_),
ns_mapping_cache (ns_mapping_cache_),
schema_path_ (path),
xs_ns_ (0),
- char_type_ (char_type__),
- char_encoding_ (char_encoding__),
+ char_type_ (ops.char_type ()),
+ 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""),
+ 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_)
{
+ // Export symbol.
+ //
+ {
+ String es (ops.export_symbol ());
+ type_exp_ = es ? es + L" " : es;
+ inst_exp_ = es ? es + L"\n" : es;
+ }
+
// Resolve and cache XML Schema namespace.
//
{
@@ -213,16 +206,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_regex ().end ()); i != e; ++i)
{
String s (*i);
@@ -246,16 +239,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);
@@ -340,7 +333,9 @@ namespace CXX
}
else
{
- if (trace_namespace_regex)
+ bool trace (options.namespace_regex_trace ());
+
+ if (trace)
wcerr << "namespace: '" << pair << "'" << endl;
Boolean found (false);
@@ -349,7 +344,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))
@@ -361,11 +356,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)
@@ -1195,9 +1190,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;
@@ -1206,7 +1202,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))
@@ -1214,11 +1210,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)
@@ -1230,8 +1226,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/xsd/cxx/elements.hxx b/xsd/cxx/elements.hxx
index 15518fc..9ae4db8 100644
--- a/xsd/cxx/elements.hxx
+++ b/xsd/cxx/elements.hxx
@@ -18,7 +18,10 @@
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
+#include <types.hxx>
#include <elements.hxx>
+
+#include <cxx/options.hxx>
#include <cxx/literal-map.hxx>
namespace CXX
@@ -145,48 +148,36 @@ 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,
- StringLiteralMap const* custom_literals_map,
- 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_,
- Containers::Vector<NarrowString> const& reserved_name);
+ options_type const& ops,
+ StringLiteralMap const* custom_literals_map);
protected:
Context (Context& c)
: os (c.os),
schema_root (c.schema_root),
schema_path (c.schema_path),
+ options (c.options),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
string_type (c.string_type),
string_literal_map (c.string_literal_map),
- 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),
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)
{
@@ -196,25 +187,22 @@ namespace CXX
: os (o),
schema_root (c.schema_root),
schema_path (c.schema_path),
+ options (c.options),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
string_type (c.string_type),
string_literal_map (c.string_literal_map),
- 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),
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)
{
@@ -342,15 +330,14 @@ namespace CXX
SemanticGraph::Schema& schema_root;
SemanticGraph::Path const& schema_path;
+ options_type const& options;
+
String& char_type;
String& char_encoding;
String& L; // string literal prefix
String& string_type;
StringLiteralMap const* string_literal_map;
- Boolean& include_with_brackets;
- String& include_prefix;
-
String& type_exp;
String& inst_exp;
String& inl;
@@ -368,9 +355,6 @@ namespace CXX
String L_;
String string_type_;
- Boolean include_with_brackets_;
- String include_prefix_;
-
String type_exp_;
String inst_exp_;
String inl_;
@@ -378,7 +362,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_;
@@ -389,7 +372,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/xsd/cxx/options.cli b/xsd/cxx/options.cli
index fa46f96..fc73c1e 100644
--- a/xsd/cxx/options.cli
+++ b/xsd/cxx/options.cli
@@ -48,6 +48,12 @@ namespace CXX
"Write generated files to <dir> instead of the current directory."
};
+ bool --generate-inline
+ {
+ "Generate simple functions inline. This option triggers creation of
+ the inline file."
+ };
+
// Extern XML Schema.
//
bool --generate-xml-schema
diff --git a/xsd/cxx/parser/cli.hxx b/xsd/cxx/parser/cli.hxx
deleted file mode 100644
index 4b3184e..0000000
--- a/xsd/cxx/parser/cli.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-// file : xsd/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 char_type;
- extern Key output_dir;
- extern Key xml_parser;
- extern Key generate_inline;
- extern Key generate_validation;
- extern Key suppress_validation;
- extern Key generate_polymorphic;
- 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 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 export_symbol;
- extern Key export_maps;
- extern Key import_maps;
- extern Key show_anonymous;
- extern Key show_sloc;
- extern Key proprietary_license;
-
- typedef Cult::CLI::Options<
- type_map, Cult::Containers::Vector<NarrowString>,
- char_type, NarrowString,
- char_encoding, NarrowString,
- output_dir, NarrowString,
- xml_parser, NarrowString,
- generate_inline, Boolean,
- generate_validation, Boolean,
- suppress_validation, Boolean,
- generate_polymorphic, 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,
- 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,
- export_symbol, NarrowString,
- export_maps, Boolean,
- import_maps, Boolean,
- show_anonymous, Boolean,
- show_sloc, Boolean,
- proprietary_license, Boolean
-
- > Options;
-
- struct OptionsSpec: Cult::CLI::OptionsSpec<Options> {};
- }
- }
-}
-
-#endif // CXX_PARSER_CLI_HXX
diff --git a/xsd/cxx/parser/driver-source.cxx b/xsd/cxx/parser/driver-source.cxx
index 483e728..4d0294e 100644
--- a/xsd/cxx/parser/driver-source.cxx
+++ b/xsd/cxx/parser/driver-source.cxx
@@ -751,7 +751,7 @@ namespace CXX
root_p << "." << post << " ());"
<< 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);
diff --git a/xsd/cxx/parser/elements.cxx b/xsd/cxx/parser/elements.cxx
index 94baa28..556398a 100644
--- a/xsd/cxx/parser/elements.cxx
+++ b/xsd/cxx/parser/elements.cxx
@@ -42,27 +42,12 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
StringLiteralMap const* map,
Regex const* he,
Regex const* ie,
Regex const* hie)
- : CXX::Context (o,
- root,
- path,
- map,
- ops.value<CLI::char_type> (),
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- ops.value<CLI::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::reserved_name> ()),
+ : CXX::Context (o, root, path, ops, map),
options (ops),
xml_parser (xml_parser_),
simple_base (simple_base_),
@@ -77,11 +62,11 @@ namespace CXX
hxx_expr (he),
ixx_expr (ie),
hxx_impl_expr (hie),
- xml_parser_ (ops.value<CLI::xml_parser> ()),
- validation_ ((ops.value<CLI::xml_parser> () == "expat" ||
- ops.value<CLI::generate_validation> ()) &&
- !ops.value<CLI::suppress_validation> ()),
- polymorphic_ (ops.value<CLI::generate_polymorphic> ())
+ xml_parser_ (ops.xml_parser ()),
+ validation_ ((ops.xml_parser () == "expat" ||
+ ops.generate_validation ()) &&
+ !ops.suppress_validation ()),
+ polymorphic_ (ops.generate_polymorphic ())
{
if (char_type == L"char")
std_string_type = L"::std::string";
diff --git a/xsd/cxx/parser/elements.hxx b/xsd/cxx/parser/elements.hxx
index d8cedd8..8b57b61 100644
--- a/xsd/cxx/parser/elements.hxx
+++ b/xsd/cxx/parser/elements.hxx
@@ -10,9 +10,11 @@
#include <cutl/re.hxx>
+#include <types.hxx>
+
#include <cxx/elements.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -35,11 +37,13 @@ namespace CXX
public:
typedef cutl::re::regexsub Regex;
+ typedef Parser::options options_type;
+
public:
Context (std::wostream&,
SemanticGraph::Schema&,
SemanticGraph::Path const& path,
- CLI::Options const&,
+ options_type const&,
StringLiteralMap const*,
Regex const* hxx_expr,
Regex const* ixx_expr,
@@ -97,7 +101,7 @@ namespace CXX
eimpl (SemanticGraph::Type&);
public:
- CLI::Options const& options;
+ options_type const& options;
String& xml_parser;
String& simple_base;
String& complex_base;
@@ -278,7 +282,9 @@ namespace CXX
//
struct RootElement: Traversal::Element
{
- RootElement (CLI::Options const& options,
+ typedef Parser::options options_type;
+
+ RootElement (options_type const& options,
SemanticGraph::Element*& element)
: options_ (options), element_ (element)
{
@@ -287,12 +293,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;
@@ -302,7 +308,7 @@ namespace CXX
}
private:
- CLI::Options const& options_;
+ options_type const& options_;
SemanticGraph::Element*& element_;
};
}
diff --git a/xsd/cxx/parser/generator.cxx b/xsd/cxx/parser/generator.cxx
index 95a48c5..338705e 100644
--- a/xsd/cxx/parser/generator.cxx
+++ b/xsd/cxx/parser/generator.cxx
@@ -124,72 +124,6 @@ namespace CXX
"//\n\n";
}
- namespace Parser
- {
- namespace CLI
- {
- extern Key type_map = "type-map";
- extern Key char_type = "char-type";
- extern Key char_encoding = "char-encoding";
- extern Key output_dir = "output-dir";
- extern Key xml_parser = "xml-parser";
- extern Key generate_inline = "generate-inline";
- extern Key generate_validation = "generate-validation";
- extern Key suppress_validation = "suppress-validation";
- extern Key generate_polymorphic = "generate-polymorphic";
- 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 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 export_symbol = "export-symbol";
- extern Key export_maps = "export-maps";
- extern Key import_maps = "import-maps";
- extern Key show_anonymous = "show-anonymous";
- extern Key show_sloc = "show-sloc";
- extern Key proprietary_license = "proprietary-license";
- }
- }
-
Void Parser::Generator::
usage ()
{
@@ -197,27 +131,6 @@ namespace CXX
CXX::options::print_usage (wcout);
}
- Parser::CLI::OptionsSpec Parser::Generator::
- options_spec ()
- {
- CLI::OptionsSpec spec;
-
- spec.option<CLI::char_type> ().default_value ("char");
- spec.option<CLI::xml_parser> ().default_value ("xerces");
-
- 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;
- }
-
-
namespace
{
template <typename S>
@@ -268,14 +181,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;
}
@@ -284,7 +196,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,
@@ -300,7 +212,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
@@ -309,7 +221,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;
@@ -317,11 +229,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.
//
@@ -339,9 +251,9 @@ namespace CXX
proc.process (ops, schema, file_path, string_literal_map);
}
- Boolean validation ((ops.value<CLI::xml_parser> () == "expat" ||
- ops.value<CLI::generate_validation> ()) &&
- !ops.value<CLI::suppress_validation> ());
+ Boolean validation ((ops.xml_parser () == "expat" ||
+ ops.generate_validation ()) &&
+ !ops.suppress_validation ());
// Compute state machine info.
//
@@ -356,11 +268,11 @@ namespace CXX
TypeMap::Namespaces type_map;
{
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);
@@ -377,7 +289,7 @@ namespace CXX
// String-based types.
//
- String char_type (ops.value<CLI::char_type> ());
+ String char_type (ops.char_type ());
String string_type;
if (char_type == L"char")
@@ -481,35 +393,33 @@ namespace CXX
//
//
- Boolean inline_ (ops.value<CLI::generate_inline> () &&
- !generate_xml_schema);
-
+ Boolean inline_ (ops.generate_inline () && !generate_xml_schema);
Boolean source (!generate_xml_schema);
// Generate code.
//
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;
@@ -611,7 +521,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -659,7 +569,7 @@ namespace CXX
if (impl)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (hxx_impl_path, ios_base::in);
@@ -685,7 +595,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);
@@ -714,7 +624,7 @@ namespace CXX
if (driver)
{
- if (!ops.value<CLI::force_overwrite> ())
+ if (!ops.force_overwrite ())
{
WideInputFileStream tmp (cxx_driver_path, ios_base::in);
@@ -788,9 +698,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;
@@ -813,7 +721,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (ops.value<CLI::prologue_file> ());
+ NarrowString name (ops.prologue_file ());
if (name)
open (prologue, name);
@@ -823,7 +731,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (ops.value<CLI::epilogue_file> ());
+ NarrowString name (ops.epilogue_file ());
if (name)
open (epilogue, name);
@@ -831,8 +739,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>
@@ -846,7 +754,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 ();
@@ -893,9 +801,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
@@ -920,9 +827,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
@@ -960,9 +866,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
@@ -980,9 +885,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
@@ -1015,9 +919,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
@@ -1049,9 +952,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/xsd/cxx/parser/generator.hxx b/xsd/cxx/parser/generator.hxx
index 8ae683d..8391553 100644
--- a/xsd/cxx/parser/generator.hxx
+++ b/xsd/cxx/parser/generator.hxx
@@ -10,16 +10,13 @@
#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 <xsd.hxx>
#include <cxx/literal-map.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -33,13 +30,10 @@ namespace CXX
static Void
usage ();
- static CLI::OptionsSpec
- options_spec ();
-
struct Failed {};
static UnsignedLong
- generate (CLI::Options const& options,
+ generate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
Boolean file_per_type,
diff --git a/xsd/cxx/parser/impl-source.cxx b/xsd/cxx/parser/impl-source.cxx
index be30b6b..3f5aec5 100644
--- a/xsd/cxx/parser/impl-source.cxx
+++ b/xsd/cxx/parser/impl-source.cxx
@@ -57,7 +57,7 @@ namespace CXX
os << arg_type (base) << " v (" << post_name (base) << " ());"
<< endl;
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, e.name (), "v");
t.dispatch (base);
@@ -126,7 +126,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);
@@ -186,7 +186,7 @@ namespace CXX
<< "_characters (const " << string_type << "& s)"
<< "{";
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
os << cout_inst << " << " << strlit (u.name () + L": ") <<
" << s << std::endl;";
else
@@ -244,7 +244,7 @@ namespace CXX
if (arg != L"void")
{
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, m.name (), name);
t.dispatch (m.type ());
@@ -314,7 +314,7 @@ namespace CXX
os << arg_type (base) << " v (" << post_name (base) << " ());"
<< endl;
- if (options.value<CLI::generate_print_impl> ())
+ if (options.generate_print_impl ())
{
PrintCall t (*this, c.name (), "v");
t.dispatch (base);
@@ -357,7 +357,7 @@ namespace CXX
Void
generate_impl_source (Context& ctx)
{
- if (ctx.options.value<CLI::generate_print_impl> ())
+ if (ctx.options.generate_print_impl ())
ctx.os << "#include <iostream>" << endl
<< endl;
diff --git a/xsd/cxx/parser/name-processor.cxx b/xsd/cxx/parser/name-processor.cxx
index d1bbf09..2812ef4 100644
--- a/xsd/cxx/parser/name-processor.cxx
+++ b/xsd/cxx/parser/name-processor.cxx
@@ -32,35 +32,20 @@ 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,
StringLiteralMap const* map)
- : CXX::Context (std::wcerr,
- root,
- path,
- map,
- ops.value<CLI::char_type> (),
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- ops.value<CLI::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::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> ()),
+ : CXX::Context (std::wcerr, root, path, ops, map),
+ 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 ()),
skel_suffix (skel_suffix_),
impl_suffix (impl_suffix_),
global_type_names (global_type_names_),
- polymorphic (ops.value<CLI::generate_polymorphic> ())
+ polymorphic (ops.generate_polymorphic ())
{
}
@@ -1088,7 +1073,7 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
StringLiteralMap const& map)
@@ -1184,7 +1169,7 @@ namespace CXX
}
Void NameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
StringLiteralMap const& map)
diff --git a/xsd/cxx/parser/name-processor.hxx b/xsd/cxx/parser/name-processor.hxx
index e397480..558ca2a 100644
--- a/xsd/cxx/parser/name-processor.hxx
+++ b/xsd/cxx/parser/name-processor.hxx
@@ -9,7 +9,7 @@
#include <xsd-frontend/semantic-graph.hxx>
#include <cxx/elements.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
namespace CXX
{
@@ -23,7 +23,7 @@ namespace CXX
NameProcessor (); // Dummy ctor, helps with long symbols on HP-UX.
Void
- process (CLI::Options const& ops,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
StringLiteralMap const& map);
diff --git a/xsd/cxx/parser/options.cli b/xsd/cxx/parser/options.cli
index e40230b..9bbaf0f 100644
--- a/xsd/cxx/parser/options.cli
+++ b/xsd/cxx/parser/options.cli
@@ -36,12 +36,6 @@ namespace CXX
// Features.
//
- bool --generate-inline
- {
- "Generate simple functions inline. This option triggers creation
- of the inline file."
- };
-
bool --generate-validation
{
"Generate validation code. The validation code (\"perfect parser\")
diff --git a/xsd/cxx/parser/parser-header.cxx b/xsd/cxx/parser/parser-header.cxx
index 2490a26..c717fc8 100644
--- a/xsd/cxx/parser/parser-header.cxx
+++ b/xsd/cxx/parser/parser-header.cxx
@@ -1294,7 +1294,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/xsd/cxx/parser/parser-inline.cxx b/xsd/cxx/parser/parser-inline.cxx
index b3805c6..e549e24 100644
--- a/xsd/cxx/parser/parser-inline.cxx
+++ b/xsd/cxx/parser/parser-inline.cxx
@@ -370,7 +370,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/xsd/cxx/parser/parser-source.cxx b/xsd/cxx/parser/parser-source.cxx
index 547a02f..b9928bc 100644
--- a/xsd/cxx/parser/parser-source.cxx
+++ b/xsd/cxx/parser/parser-source.cxx
@@ -846,8 +846,8 @@ namespace CXX
else
ctx.os << endl;
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
@@ -920,7 +920,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/xsd/cxx/parser/type-processor.cxx b/xsd/cxx/parser/type-processor.cxx
index db3e45b..1fefeb3 100644
--- a/xsd/cxx/parser/type-processor.cxx
+++ b/xsd/cxx/parser/type-processor.cxx
@@ -255,7 +255,7 @@ namespace CXX
};
Void
- process_impl (CLI::Options const& options,
+ process_impl (options const& ops,
XSDFrontend::SemanticGraph::Schema& tu,
Boolean gen_driver,
TypeMap::Namespaces& type_map)
@@ -281,8 +281,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 ());
//
//
@@ -314,7 +313,7 @@ namespace CXX
// If we are generating the test driver, make sure the root
// element type is processed.
//
- if (gen_driver && options.value<CLI::generate_test_driver> ())
+ if (gen_driver && ops.generate_test_driver ())
{
// Figure out the root element. Validator should have made sure
// it is unique.
@@ -329,7 +328,7 @@ namespace CXX
Traversal::Names schema_names;
Traversal::Namespace ns;
Traversal::Names ns_names;
- RootElement root_element (options, root);
+ RootElement root_element (ops, root);
schema >> schema_names >> ns >> ns_names >> root_element;
@@ -343,12 +342,12 @@ namespace CXX
}
Void TypeProcessor::
- process (CLI::Options const& options,
+ process (options const& ops,
XSDFrontend::SemanticGraph::Schema& s,
Boolean gen_driver,
TypeMap::Namespaces& tm)
{
- process_impl (options, s, gen_driver, tm);
+ process_impl (ops, s, gen_driver, tm);
}
}
}
diff --git a/xsd/cxx/parser/type-processor.hxx b/xsd/cxx/parser/type-processor.hxx
index 9159752..2165846 100644
--- a/xsd/cxx/parser/type-processor.hxx
+++ b/xsd/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
{
@@ -26,7 +26,7 @@ namespace CXX
TypeProcessor (); // Dummy ctor, helps with long symbols on HP-UX.
Void
- process (CLI::Options const& options,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
Boolean gen_driver,
TypeMap::Namespaces&);
diff --git a/xsd/cxx/parser/validator.cxx b/xsd/cxx/parser/validator.cxx
index 81f1579..96110f1 100644
--- a/xsd/cxx/parser/validator.cxx
+++ b/xsd/cxx/parser/validator.cxx
@@ -25,10 +25,10 @@ namespace CXX
public:
ValidationContext (SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& options,
+ Parser::options const& ops,
const WarningSet& disabled_warnings,
Boolean& valid_)
- : Context (std::wcerr, root, path, options, 0, 0, 0, 0),
+ : Context (std::wcerr, root, path, ops, 0, 0, 0, 0),
disabled_warnings_ (disabled_warnings),
disabled_warnings_all_ (false),
valid (valid_),
@@ -335,7 +335,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;
@@ -434,7 +434,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;
@@ -453,7 +453,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) << "' "
@@ -469,7 +469,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) << "' "
@@ -506,16 +506,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;
@@ -551,39 +551,39 @@ 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);
//
//
- if (options.value<CLI::char_type> () != "char" &&
- options.value<CLI::char_type> () != "wchar_t" &&
+ if (ops.char_type () != "char" &&
+ ops.char_type () != "wchar_t" &&
!ctx.is_disabled ("P003"))
{
wcerr << "warning P003: unknown base character type '" <<
- options.value<CLI::char_type> ().c_str () << "'" << endl;
+ ops.char_type ().c_str () << "'" << endl;
}
//
//
- if (options.value<CLI::xml_parser> () != "xerces" &&
- options.value<CLI::xml_parser> () != "expat" &&
+ if (ops.xml_parser () != "xerces" &&
+ ops.xml_parser () != "expat" &&
!ctx.is_disabled ("P004"))
{
wcerr << "warning P004: unknown underlying XML parser '" <<
- options.value<CLI::xml_parser> ().c_str () << "'" << endl;
+ ops.xml_parser ().c_str () << "'" << endl;
}
//
//
- if (options.value<CLI::xml_parser> () == "expat" &&
- options.value<CLI::char_type> () == "wchar_t")
+ if (ops.xml_parser () == "expat" &&
+ ops.char_type () == "wchar_t")
{
wcerr << "error: using expat with wchar_t is not supported"
<< endl;
@@ -593,9 +593,9 @@ namespace CXX
//
//
- if (options.value<CLI::xml_parser> () == "expat" &&
- !options.value<CLI::char_encoding> ().empty () &&
- options.value<CLI::char_encoding> () != "utf8")
+ if (ops.xml_parser () == "expat" &&
+ !ops.char_encoding ().empty () &&
+ ops.char_encoding () != "utf8")
{
wcerr << "error: using expat with character encoding other than "
<< "utf8 is not supported"
@@ -606,8 +606,7 @@ namespace CXX
//
//
- if (options.value<CLI::generate_validation> () &&
- options.value<CLI::suppress_validation> ())
+ if (ops.generate_validation () && ops.suppress_validation ())
{
wcerr << "error: mutually exclusive options specified: "
<< "--generate-validation and --suppress-validation"
@@ -618,8 +617,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"
@@ -631,9 +629,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))
{
@@ -648,8 +646,8 @@ namespace CXX
//
//
- Boolean import_maps (options.value<CLI::import_maps> ());
- Boolean export_maps (options.value<CLI::export_maps> ());
+ Boolean import_maps (ops.import_maps ());
+ Boolean export_maps (ops.export_maps ());
if (import_maps && export_maps)
{
diff --git a/xsd/cxx/parser/validator.hxx b/xsd/cxx/parser/validator.hxx
index 0fb57f1..35c13fc 100644
--- a/xsd/cxx/parser/validator.hxx
+++ b/xsd/cxx/parser/validator.hxx
@@ -7,7 +7,7 @@
#define CXX_PARSER_VALIDATOR_HXX
#include <cxx/parser/elements.hxx>
-#include <cxx/parser/cli.hxx>
+#include <cxx/parser/options.hxx>
#include <xsd.hxx>
@@ -23,7 +23,7 @@ namespace CXX
Validator (); // Dummy ctor, helps with long symbols on HP-UX.
Boolean
- validate (CLI::Options const& options,
+ validate (options const&,
SemanticGraph::Schema&,
SemanticGraph::Path const& tu,
Boolean gen_driver,
diff --git a/xsd/cxx/tree/cli.hxx b/xsd/cxx/tree/cli.hxx
deleted file mode 100644
index c3356e8..0000000
--- a/xsd/cxx/tree/cli.hxx
+++ /dev/null
@@ -1,230 +0,0 @@
-// file : xsd/cxx/tree/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_TREE_CLI_HXX
-#define CXX_TREE_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 Tree
- {
- namespace CLI
- {
- using namespace Cult::Types;
-
- typedef Char const Key[];
-
- extern Key char_type;
- extern Key char_encoding;
- extern Key output_dir;
- extern Key generate_polymorphic;
- extern Key polymorphic_type;
- extern Key polymorphic_type_all;
- extern Key generate_serialization;
- extern Key generate_inline;
- extern Key generate_ostream;
- extern Key generate_doxygen;
- extern Key generate_comparison;
- extern Key generate_default_ctor;
- extern Key generate_from_base_ctor;
- extern Key suppress_assignment;
- extern Key generate_detach;
- extern Key generate_wildcard;
- extern Key generate_insertion;
- extern Key generate_extraction;
- extern Key generate_forward;
- extern Key generate_xml_schema;
- extern Key extern_xml_schema;
- extern Key suppress_parsing;
- extern Key generate_element_type;
- extern Key generate_element_map;
- extern Key generate_intellisense;
- extern Key omit_default_attributes;
- extern Key namespace_map;
- extern Key namespace_regex;
- extern Key namespace_regex_trace;
- extern Key reserved_name;
- extern Key type_naming;
- extern Key function_naming;
- extern Key type_regex;
- extern Key accessor_regex;
- extern Key one_accessor_regex;
- extern Key opt_accessor_regex;
- extern Key seq_accessor_regex;
- extern Key modifier_regex;
- extern Key one_modifier_regex;
- extern Key opt_modifier_regex;
- extern Key seq_modifier_regex;
- extern Key parser_regex;
- extern Key serializer_regex;
- extern Key enumerator_regex;
- extern Key element_type_regex;
- extern Key name_regex_trace;
- extern Key include_with_brackets;
- extern Key include_prefix;
- extern Key include_regex;
- extern Key include_regex_trace;
- extern Key guard_prefix;
- 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 custom_type;
- extern Key custom_type_regex;
- 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 parts;
- extern Key parts_suffix;
- extern Key export_symbol;
- extern Key export_xml_schema;
- extern Key export_maps;
- extern Key import_maps;
- extern Key show_anonymous;
- extern Key show_sloc;
- extern Key proprietary_license;
- extern Key disable_multi_import; // Undocumented.
-
-
- typedef Cult::CLI::Options<
-
- char_type, NarrowString,
- char_encoding, NarrowString,
- output_dir, NarrowString,
- generate_polymorphic, Boolean,
- polymorphic_type, Cult::Containers::Vector<NarrowString>,
- polymorphic_type_all, Boolean,
- generate_serialization, Boolean,
- generate_inline, Boolean,
- generate_ostream, Boolean,
- generate_doxygen, Boolean,
- generate_comparison, Boolean,
- generate_default_ctor, Boolean,
- generate_from_base_ctor, Boolean,
- suppress_assignment, Boolean,
- generate_detach, Boolean,
- generate_wildcard, Boolean,
- generate_insertion, Cult::Containers::Vector<NarrowString>,
- generate_extraction, Cult::Containers::Vector<NarrowString>,
- generate_forward, Boolean,
- generate_xml_schema, Boolean,
- extern_xml_schema, NarrowString,
- suppress_parsing, Boolean,
- generate_element_type, Boolean,
- generate_element_map, Boolean,
- generate_intellisense, Boolean,
- omit_default_attributes, Boolean,
- namespace_map, Cult::Containers::Vector<NarrowString>,
- namespace_regex, Cult::Containers::Vector<NarrowString>,
- namespace_regex_trace, Boolean,
- reserved_name, Cult::Containers::Vector<NarrowString>,
- type_naming, NarrowString,
- function_naming, NarrowString,
- type_regex, Cult::Containers::Vector<NarrowString>,
- accessor_regex, Cult::Containers::Vector<NarrowString>,
- one_accessor_regex, Cult::Containers::Vector<NarrowString>,
- opt_accessor_regex, Cult::Containers::Vector<NarrowString>,
- seq_accessor_regex, Cult::Containers::Vector<NarrowString>,
- modifier_regex, Cult::Containers::Vector<NarrowString>,
- one_modifier_regex, Cult::Containers::Vector<NarrowString>,
- opt_modifier_regex, Cult::Containers::Vector<NarrowString>,
- seq_modifier_regex, Cult::Containers::Vector<NarrowString>,
- parser_regex, Cult::Containers::Vector<NarrowString>,
- serializer_regex, Cult::Containers::Vector<NarrowString>,
- enumerator_regex, Cult::Containers::Vector<NarrowString>,
- element_type_regex, Cult::Containers::Vector<NarrowString>,
- name_regex_trace, Boolean,
- include_with_brackets, Boolean,
- include_prefix, NarrowString,
- include_regex, Cult::Containers::Vector<NarrowString>,
- include_regex_trace, Boolean,
- guard_prefix, NarrowString,
- root_element_first, Boolean,
- root_element_last, Boolean,
- root_element_all, Boolean,
- root_element_none, Boolean,
- root_element, Cult::Containers::Vector<NarrowString>,
- custom_type, Cult::Containers::Vector<NarrowString>,
- custom_type_regex, Cult::Containers::Vector<NarrowString>,
- hxx_suffix, NarrowString,
- ixx_suffix, NarrowString,
- cxx_suffix, NarrowString,
- fwd_suffix, NarrowString,
- hxx_regex, NarrowString,
- ixx_regex, NarrowString,
- cxx_regex, 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, NarrowString,
- ixx_prologue_file, NarrowString,
- cxx_prologue_file, NarrowString,
- fwd_prologue_file, NarrowString,
- prologue_file, NarrowString,
- hxx_epilogue_file, NarrowString,
- ixx_epilogue_file, NarrowString,
- cxx_epilogue_file, NarrowString,
- fwd_epilogue_file, NarrowString,
- epilogue_file, NarrowString,
- parts, UnsignedLong,
- parts_suffix, NarrowString,
- export_symbol, NarrowString,
- export_xml_schema, Boolean,
- export_maps, Boolean,
- import_maps, Boolean,
- show_anonymous, Boolean,
- show_sloc, Boolean,
- proprietary_license, Boolean,
- disable_multi_import, Boolean
-
- > Options;
-
- struct OptionsSpec: Cult::CLI::OptionsSpec<Options> {};
- }
- }
-}
-
-#endif // CXX_TREE_CLI_HXX
diff --git a/xsd/cxx/tree/counter.cxx b/xsd/cxx/tree/counter.cxx
index 6888b2a..548fc77 100644
--- a/xsd/cxx/tree/counter.cxx
+++ b/xsd/cxx/tree/counter.cxx
@@ -99,7 +99,7 @@ namespace CXX
names >> member;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names >> any;
Complex::names (c, names);
@@ -188,22 +188,22 @@ namespace CXX
if (doc_root_p (*last_))
{
- if (options.value<CLI::generate_element_type> ())
+ if (options.generate_element_type ())
{
complexity += 1; // For c-tors and d-tor.
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
complexity += 1;
- if (options.value<CLI::generate_serialization> ())
+ if (options.generate_serialization ())
complexity += 1;
}
else
{
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
complexity += 6; // 13 parsing functions.
- if (options.value<CLI::generate_serialization> ())
+ if (options.generate_serialization ())
complexity += 4; // 8 serialization functions.
}
}
@@ -236,12 +236,12 @@ namespace CXX
}
Counts Counter::
- count (CLI::Options const& options,
+ count (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& path)
{
Counts counts;
- Context ctx (std::wcerr, tu, path, options, counts, false, 0, 0, 0, 0);
+ Context ctx (std::wcerr, tu, path, ops, counts, false, 0, 0, 0, 0);
Traversal::Schema schema;
Sources sources;
diff --git a/xsd/cxx/tree/counter.hxx b/xsd/cxx/tree/counter.hxx
index b5c7c8f..7c91068 100644
--- a/xsd/cxx/tree/counter.hxx
+++ b/xsd/cxx/tree/counter.hxx
@@ -7,7 +7,7 @@
#define CXX_TREE_COUNTER_HXX
#include <cxx/tree/elements.hxx>
-#include <cxx/tree/cli.hxx>
+#include <cxx/tree/options.hxx>
namespace CXX
{
@@ -19,7 +19,7 @@ namespace CXX
Counter (); // Dummy ctor, helps with long symbols on HP-UX.
Counts
- count (CLI::Options const&,
+ count (options const&,
SemanticGraph::Schema&,
SemanticGraph::Path const&);
};
diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx
index 63f31a7..a608672 100644
--- a/xsd/cxx/tree/elements.cxx
+++ b/xsd/cxx/tree/elements.cxx
@@ -37,29 +37,14 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
Counts const& counts_,
Boolean generate_xml_schema__,
StringLiteralMap const* map,
Regex const* fe,
Regex const* he,
Regex const* ie)
- : CXX::Context (o,
- root,
- path,
- map,
- ops.value<CLI::char_type> (),
- ops.value<CLI::char_encoding> (),
- ops.value<CLI::include_with_brackets> (),
- ops.value<CLI::include_prefix> (),
- ops.value<CLI::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::reserved_name> ()),
+ : CXX::Context (o, root, path, ops, map),
options (ops),
counts (counts_),
any_type (any_type_),
@@ -84,9 +69,9 @@ namespace CXX
as_decimal_type (as_decimal_type_),
generate_xml_schema (generate_xml_schema_),
doxygen (doxygen_),
- polymorphic (ops.value<CLI::generate_polymorphic> ()),
- polymorphic_all (ops.value<CLI::polymorphic_type_all> ()),
- detach (ops.value<CLI::generate_detach> ()),
+ polymorphic (ops.generate_polymorphic ()),
+ polymorphic_all (ops.polymorphic_type_all ()),
+ detach (ops.generate_detach ()),
fwd_expr (fe),
hxx_expr (he),
ixx_expr (ie),
@@ -96,7 +81,7 @@ namespace CXX
qname_type_ (L"::xsd::cxx::xml::qualified_name< " + char_type + L" >"),
parser_type_ (L"::xsd::cxx::xml::dom::parser< " + char_type + L" >"),
generate_xml_schema_ (generate_xml_schema__),
- doxygen_ (ops.value<CLI::generate_doxygen> ()),
+ doxygen_ (ops.generate_doxygen ()),
ns_scope_stack (ns_scope_stack_),
cxx_uq_id_expr_ (L"^[a-zA-Z_]\\w*$"),
cxx_uq_id_expr (cxx_uq_id_expr_)
@@ -118,13 +103,12 @@ namespace CXX
container = xs_name + L"::" + xsc.get<String> ("container");
flags_type = xs_name + L"::" + xsc.get<String> ("flags");
- if (ops.value<CLI::generate_element_type> ())
+ if (ops.generate_element_type ())
element_type = xs_name + L"::" + xsc.get<String> ("element-type");
properties_type = xs_name + L"::" + xsc.get<String> ("properties");
- if (!ops.value<CLI::suppress_parsing> () ||
- ops.value<CLI::generate_serialization> ())
+ if (!ops.suppress_parsing () || ops.generate_serialization ())
{
error_handler_type = xs_name + L"::" +
xsc.get<String> ("error-handler");
@@ -134,7 +118,7 @@ namespace CXX
dom_node_key_ = xs_name + L"::dom::" +
xsc.get<String> ("tree-node-key");
- if (ops.value<CLI::generate_serialization> ())
+ if (ops.generate_serialization ())
{
as_double_type_ = xs_name + L"::" +
xsc.get<String> ("as-double");
@@ -152,17 +136,17 @@ namespace CXX
// istream and ostream are templates and for now use the same
// names regardless of the naming convention.
//
- if (!ops.value<CLI::generate_extraction> ().empty ())
+ if (!ops.generate_extraction ().empty ())
istream_type = xs_name + L"::istream";
- if (!ops.value<CLI::generate_insertion> ().empty ())
+ if (!ops.generate_insertion ().empty ())
ostream_type = xs_name + L"::ostream";
}
// Xerces-C++ namespace. IntelliSense for some reason does not like
// it fully-qualified (maybe because it's a namespace alias).
//
- if (ops.value<CLI::generate_intellisense> ())
+ if (ops.generate_intellisense ())
xerces_ns = "xercesc";
else
xerces_ns = "::xercesc";
@@ -178,14 +162,14 @@ namespace CXX
// Custom type mapping.
//
- typedef Containers::Vector<NarrowString> Vector;
// Direct custom type mapping.
//
{
- Vector const& v (ops.value<CLI::custom_type> ());
+ NarrowStrings const& v (ops.custom_type ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v.begin ()),
+ e (v.end ()); i != e; ++i)
{
String s (*i);
@@ -237,9 +221,10 @@ namespace CXX
// Regex custom type mapping.
//
{
- Vector const& v (ops.value<CLI::custom_type_regex> ());
+ NarrowStrings const& v (ops.custom_type_regex ());
- for (Vector::ConstIterator i (v.begin ()), e (v.end ()); i != e; ++i)
+ for (NarrowStrings::const_iterator i (v.begin ()),
+ e (v.end ()); i != e; ++i)
{
String s (*i);
@@ -701,7 +686,7 @@ namespace CXX
Void GenerateDefaultCtor::
traverse (SemanticGraph::Any& a)
{
- if (options.value<CLI::generate_wildcard> () &&
+ if (options.generate_wildcard () &&
min (a) == 1 && max (a) == 1)
generate_ = true;
}
@@ -782,7 +767,7 @@ namespace CXX
Void GenerateFromBaseCtor::Traverser::
traverse (SemanticGraph::Any& a)
{
- if (options.value<CLI::generate_wildcard> () &&
+ if (options.generate_wildcard () &&
min (a) == 1 && max (a) == 1)
generate_ = true;
}
@@ -848,7 +833,7 @@ namespace CXX
Void FromBaseCtorArg::
traverse (SemanticGraph::Any& a)
{
- if (!options.value<CLI::generate_wildcard> ())
+ if (!options.generate_wildcard ())
return;
if (min (a) == 1 && max (a) == 1)
@@ -992,7 +977,7 @@ namespace CXX
Void CtorArgs::
traverse (SemanticGraph::Any& a)
{
- if (!options.value<CLI::generate_wildcard> ())
+ if (!options.generate_wildcard ())
return;
if (min (a) == 1 && max (a) == 1)
@@ -1081,7 +1066,7 @@ namespace CXX
Void CtorArgsWithoutBase::
traverse (SemanticGraph::Any& a)
{
- if (!options.value<CLI::generate_wildcard> ())
+ if (!options.generate_wildcard ())
return;
if (min (a) == 1 && max (a) == 1)
@@ -1170,9 +1155,9 @@ namespace CXX
// If we are not generating element types nor parsing/serialization
// code then we won't generate anything from it.
//
- if (!ctx_.options.value<CLI::generate_element_type> () &&
- ctx_.options.value<CLI::suppress_parsing> () &&
- !ctx_.options.value<CLI::generate_serialization> ())
+ if (!ctx_.options.generate_element_type () &&
+ ctx_.options.suppress_parsing () &&
+ !ctx_.options.generate_serialization ())
return false;
return true;
@@ -1181,33 +1166,33 @@ namespace CXX
Boolean GlobalElementBase::
doc_root_p (SemanticGraph::Element& e)
{
- if (!ctx_.options.value<CLI::root_element_first> () &&
- !ctx_.options.value<CLI::root_element_last> () &&
- !ctx_.options.value<CLI::root_element_all> () &&
- !ctx_.options.value<CLI::root_element_none> () &&
- ctx_.options.value<CLI::root_element> ().empty ())
+ if (!ctx_.options.root_element_first () &&
+ !ctx_.options.root_element_last () &&
+ !ctx_.options.root_element_all () &&
+ !ctx_.options.root_element_none () &&
+ ctx_.options.root_element ().empty ())
return true; // By default treat them all.
- if (ctx_.options.value<CLI::root_element_none> ())
+ if (ctx_.options.root_element_none ())
return false;
- if (ctx_.options.value<CLI::root_element_all> ())
+ if (ctx_.options.root_element_all ())
return true;
- if (ctx_.options.value<CLI::root_element_first> () &&
+ if (ctx_.options.root_element_first () &&
e.context ().count ("first") != 0)
return true;
- if (ctx_.options.value<CLI::root_element_last> () &&
+ if (ctx_.options.root_element_last () &&
e.context ().count ("last") != 0)
return true;
- typedef Cult::Containers::Vector<NarrowString> Names;
- Names const& names (ctx_.options.value<CLI::root_element> ());
+ NarrowStrings const& names (ctx_.options.root_element ());
// Hopefully nobody will specify more than a handful of names ;-).
//
- for (Names::ConstIterator i (names.begin ()); i != names.end (); ++i)
+ for (NarrowStrings::const_iterator i (names.begin ());
+ i != names.end (); ++i)
{
String name (*i);
diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx
index edcb0d2..da9a182 100644
--- a/xsd/cxx/tree/elements.hxx
+++ b/xsd/cxx/tree/elements.hxx
@@ -14,10 +14,11 @@
#include <cult/containers/deque.hxx>
#include <cult/containers/vector.hxx>
-#include <cxx/elements.hxx>
+#include <types.hxx>
-#include <cxx/tree/cli.hxx>
+#include <cxx/elements.hxx>
+#include <cxx/tree/options.hxx>
namespace CXX
{
@@ -77,6 +78,8 @@ namespace CXX
typedef cutl::re::regexsub Regex;
typedef cutl::re::wregex WideRegexPat;
+ typedef Tree::options options_type;
+
struct DirectCustomTypeMapInfo
{
DirectCustomTypeMapInfo (String const& t = L"",
@@ -115,7 +118,7 @@ namespace CXX
Context (std::wostream& o,
SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& ops,
+ options_type const& ops,
Counts const& counts_,
Boolean generate_xml_schema,
StringLiteralMap const*,
@@ -400,7 +403,7 @@ namespace CXX
write_rogue_text (WideChar const* s, Size size, Boolean rogue);
public:
- CLI::Options const& options;
+ options_type const& options;
Counts const& counts;
String& any_type;
String& any_simple_type;
@@ -1847,7 +1850,7 @@ namespace CXX
Includes (Context& c, Type type)
: ctx_ (c),
type_ (type),
- forward_ (c.options.value<CLI::generate_forward> ()),
+ forward_ (c.options.generate_forward ()),
namespace_ (c),
type_forward_ (c)
{
diff --git a/xsd/cxx/tree/fundamental-header.hxx b/xsd/cxx/tree/fundamental-header.hxx
index 327aa63..424034d 100644
--- a/xsd/cxx/tree/fundamental-header.hxx
+++ b/xsd/cxx/tree/fundamental-header.hxx
@@ -80,7 +80,7 @@ namespace CXX
FundamentalNamespace (Context& c)
: DocumentedNamespace (c),
Context (c),
- export_ (c.options.value<CLI::export_xml_schema> () && type_exp)
+ export_ (c.options.export_xml_schema () && type_exp)
{
*this >> names_ >> *this;
@@ -720,11 +720,11 @@ namespace CXX
{
SemanticGraph::Context& c (xs_ns ().context());
- Boolean parsing (!options.value<CLI::suppress_parsing> ());
- Boolean serialization (options.value<CLI::generate_serialization> ());
- Boolean element_map (options.value<CLI::generate_element_map> ());
+ Boolean parsing (!options.suppress_parsing ());
+ Boolean serialization (options.generate_serialization ());
+ Boolean element_map (options.generate_element_map ());
- if (options.value<CLI::generate_element_type> ())
+ if (options.generate_element_type ())
{
if (doxygen)
os << "/**" << endl
@@ -838,7 +838,7 @@ namespace CXX
//@@ Can't change names of ostream/istream since they are
// templates.
//
- if (!options.value<CLI::generate_insertion> ().empty ())
+ if (!options.generate_insertion ().empty ())
{
if (doxygen)
os << "/**" << endl
@@ -852,7 +852,7 @@ namespace CXX
<< endl;
}
- if (!options.value<CLI::generate_extraction> ().empty ())
+ if (!options.generate_extraction ().empty ())
{
if (doxygen)
os << "/**" << endl
@@ -1050,7 +1050,7 @@ namespace CXX
L"::xsd::cxx::tree::no_prefix_mapping< " + char_type + L" >");
}
- if (options.value<CLI::generate_polymorphic> ())
+ if (options.generate_polymorphic ())
{
if (parsing || serialization)
{
diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx
index 7a6759b..4c368b8 100644
--- a/xsd/cxx/tree/generator.cxx
+++ b/xsd/cxx/tree/generator.cxx
@@ -115,109 +115,6 @@ namespace CXX
"//\n\n";
}
- namespace Tree
- {
- namespace CLI
- {
- extern Key char_type = "char-type";
- extern Key char_encoding = "char-encoding";
- extern Key output_dir = "output-dir";
- extern Key generate_polymorphic = "generate-polymorphic";
- extern Key polymorphic_type = "polymorphic-type";
- extern Key polymorphic_type_all = "polymorphic-type-all";
- extern Key generate_serialization = "generate-serialization";
- extern Key generate_inline = "generate-inline";
- extern Key generate_ostream = "generate-ostream";
- extern Key generate_doxygen = "generate-doxygen";
- extern Key generate_comparison = "generate-comparison";
- extern Key generate_default_ctor = "generate-default-ctor";
- extern Key generate_from_base_ctor = "generate-from-base-ctor";
- extern Key suppress_assignment = "suppress-assignment";
- extern Key generate_detach = "generate-detach";
- extern Key generate_wildcard = "generate-wildcard";
- extern Key generate_insertion = "generate-insertion";
- extern Key generate_extraction = "generate-extraction";
- 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_parsing = "suppress-parsing";
- extern Key generate_element_type = "generate-element-type";
- extern Key generate_element_map = "generate-element-map";
- extern Key generate_intellisense = "generate-intellisense";
- extern Key omit_default_attributes = "omit-default-attributes";
- 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 type_naming = "type-naming";
- extern Key function_naming = "function-naming";
- extern Key type_regex = "type-regex";
- extern Key accessor_regex = "accessor-regex";
- extern Key one_accessor_regex = "one-accessor-regex";
- extern Key opt_accessor_regex = "opt-accessor-regex";
- extern Key seq_accessor_regex = "seq-accessor-regex";
- extern Key modifier_regex = "modifier-regex";
- extern Key one_modifier_regex = "one-modifier-regex";
- extern Key opt_modifier_regex = "opt-modifier-regex";
- extern Key seq_modifier_regex = "seq-modifier-regex";
- extern Key parser_regex = "parser-regex";
- extern Key serializer_regex = "serializer-regex";
- extern Key enumerator_regex = "enumerator-regex";
- extern Key element_type_regex = "element-type-regex";
- extern Key name_regex_trace = "name-regex-trace";
- 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 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 custom_type = "custom-type";
- extern Key custom_type_regex = "custom-type-regex";
- 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 parts = "parts";
- extern Key parts_suffix = "parts-suffix";
- extern Key export_symbol = "export-symbol";
- extern Key export_xml_schema = "export-xml-schema";
- extern Key export_maps = "export-maps";
- extern Key import_maps = "import-maps";
- extern Key show_anonymous = "show-anonymous";
- extern Key show_sloc = "show-sloc";
- extern Key proprietary_license = "proprietary-license";
- extern Key disable_multi_import = "disable-multi-import";
- }
- }
-
Void Tree::Generator::
usage ()
{
@@ -225,28 +122,6 @@ namespace CXX
CXX::options::print_usage (wcout);
}
- Tree::CLI::OptionsSpec Tree::Generator::
- options_spec ()
- {
- CLI::OptionsSpec spec;
-
- spec.option<CLI::char_type> ().default_value ("char");
-
- 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");
-
- spec.option<CLI::type_naming> ().default_value ("knr");
- spec.option<CLI::function_naming> ().default_value ("knr");
-
- spec.option<CLI::parts> ().default_value (1);
- spec.option<CLI::parts_suffix> ().default_value ("-");
-
- return spec;
- }
-
-
namespace
{
Void
@@ -296,14 +171,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;
}
@@ -312,7 +186,7 @@ namespace CXX
UnsignedLong Tree::Generator::
- generate (Tree::CLI::Options const& ops,
+ generate (Tree::options const& ops,
Schema& schema,
Path const& file_path,
Boolean fpt,
@@ -334,10 +208,10 @@ namespace CXX
{
// Do option validation.
//
- if (ops.value<CLI::parts> () < 1)
+ if (ops.parts () < 1)
{
wcerr << "error: invalid value for option --parts: " <<
- ops.value<CLI::parts> () << endl;
+ ops.parts () << endl;
throw Failed ();
}
@@ -379,8 +253,7 @@ namespace CXX
// Process polymorphic types.
//
- if (ops.value<CLI::generate_polymorphic> () &&
- !ops.value<CLI::polymorphic_type_all> ())
+ if (ops.generate_polymorphic () && !ops.polymorphic_type_all ())
{
PolymorphismProcessor proc;
if (!proc.process (ops, schema, file_path, disabled_warnings))
@@ -389,11 +262,9 @@ namespace CXX
// Parts.
//
- UnsignedLong parts (ops.value<CLI::parts> ());
- UnsignedLong units (
- counts.global_types + counts.generated_global_elements);
-
- UnsignedLong units_per_part (units / parts);
+ size_t parts (ops.parts ());
+ size_t units (counts.global_types + counts.generated_global_elements);
+ size_t units_per_part (units / parts);
if (parts != 1 && units_per_part < 1)
{
@@ -401,14 +272,14 @@ namespace CXX
throw Failed ();
}
- UnsignedLong complexity_per_part (counts.complexity_total / parts);
+ size_t complexity_per_part (counts.complexity_total / parts);
- NarrowString parts_suffix (ops.value<CLI::parts_suffix> ());
+ NarrowString parts_suffix (ops.parts_suffix ());
//
//
- 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
@@ -417,45 +288,41 @@ 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 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);
// Generate code.
//
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 ());
- Regex hxx_expr (ops.value <CLI::hxx_regex> ().empty ()
+ Regex hxx_expr (ops.hxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + hxx_suffix + "#"
- : ops.value <CLI::hxx_regex> ());
+ : ops.hxx_regex ());
- Regex ixx_expr (ops.value <CLI::ixx_regex> ().empty ()
+ Regex ixx_expr (ops.ixx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + ixx_suffix + "#"
- : ops.value <CLI::ixx_regex> ());
+ : ops.ixx_regex ());
- Regex cxx_expr (ops.value <CLI::cxx_regex> ().empty ()
+ Regex cxx_expr (ops.cxx_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + cxx_suffix + "#"
- : ops.value <CLI::cxx_regex> ());
+ : ops.cxx_regex ());
- Regex fwd_expr (ops.value <CLI::fwd_regex> ().empty ()
+ Regex fwd_expr (ops.fwd_regex ().empty ()
? "#^(.+?)(\\.[^./\\\\]+)?$#$1" + fwd_suffix + "#"
- : ops.value <CLI::fwd_regex> ());
+ : ops.fwd_regex ());
if (!hxx_expr.match (name))
{
@@ -531,7 +398,7 @@ namespace CXX
Path out_dir;
- if (NarrowString dir = ops.value<CLI::output_dir> ())
+ if (NarrowString dir = ops.output_dir ())
{
try
{
@@ -647,16 +514,14 @@ 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;
hxx << copyright;
- if (ops.value<CLI::generate_doxygen> ())
+ if (ops.generate_doxygen ())
{
// Use native path format.
//
@@ -683,7 +548,7 @@ namespace CXX
//
WideInputFileStream prologue;
{
- NarrowString name (ops.value<CLI::prologue_file> ());
+ NarrowString name (ops.prologue_file ());
if (name)
open (prologue, name);
@@ -693,7 +558,7 @@ namespace CXX
//
WideInputFileStream epilogue;
{
- NarrowString name (ops.value<CLI::epilogue_file> ());
+ NarrowString name (ops.epilogue_file ());
if (name)
open (epilogue, name);
@@ -701,8 +566,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>
@@ -715,7 +580,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 ();
@@ -767,10 +632,8 @@ namespace CXX
fwd << "// Begin prologue." << endl
<< "//" << endl;
- append (fwd,
- ops.value<CLI::fwd_prologue> (),
- ops.value<CLI::prologue> ());
- append (fwd, ops.value<CLI::fwd_prologue_file> (), prologue);
+ append (fwd, ops.fwd_prologue (), ops.prologue ());
+ append (fwd, ops.fwd_prologue_file (), prologue);
fwd << "//" << endl
<< "// End prologue." << endl
@@ -813,10 +676,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> ());
+ append (fwd, ops.fwd_epilogue_file (), epilogue);
+ append (fwd, ops.fwd_epilogue (), ops.epilogue ());
fwd << "//" << endl
<< "// End epilogue." << endl
@@ -876,9 +737,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
@@ -932,17 +792,16 @@ namespace CXX
if (!generate_xml_schema)
{
- if (ops.value<CLI::generate_ostream> ())
+ if (ops.generate_ostream ())
generate_stream_header (ctx);
- if (!ops.value<CLI::generate_element_type> () &&
- !ops.value<CLI::suppress_parsing> ())
+ if (!ops.generate_element_type () && !ops.suppress_parsing ())
generate_parser_header (ctx);
- if (ops.value<CLI::generate_serialization> ())
+ if (ops.generate_serialization ())
generate_serialization_header (ctx);
- if (!ops.value<CLI::generate_insertion> ().empty ())
+ if (!ops.generate_insertion ().empty ())
generate_stream_insertion_header (ctx);
}
}
@@ -960,9 +819,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
@@ -1012,9 +870,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
@@ -1032,9 +889,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
@@ -1052,17 +908,17 @@ namespace CXX
//
if (source)
{
- UnsignedLong first_unit (0); // First unit in the current part.
+ size_t first_unit (0); // First unit in the current part.
- for (UnsignedLong part (0); part < parts; ++part)
+ for (size_t part (0); part < parts; ++part)
{
// Figure out the range of units for this part.
//
- UnsignedLong last_unit (first_unit);
+ size_t last_unit (first_unit);
if (units != 0)
{
- UnsignedLong complexity (counts.complexity[last_unit]);
+ size_t complexity (counts.complexity[last_unit]);
while (complexity < complexity_per_part)
{
@@ -1075,7 +931,7 @@ namespace CXX
// Check if the increase in complexity should be kept in this
// part or moved to the next.
//
- UnsignedLong new_complexity (
+ size_t new_complexity (
complexity + counts.complexity[last_unit + 1]);
if (new_complexity > complexity_per_part)
@@ -1099,8 +955,8 @@ namespace CXX
//
//
- UnsignedLong first (first_unit);
- UnsignedLong last (last_unit);
+ size_t first (first_unit);
+ size_t last (last_unit);
first_unit = last_unit + 1;
@@ -1130,10 +986,8 @@ namespace CXX
os << "// Begin prologue." << endl
<< "//" << endl;
- append (os,
- ops.value<CLI::cxx_prologue> (),
- ops.value<CLI::prologue> ());
- append (os, ops.value<CLI::cxx_prologue_file> (), prologue);
+ append (os, ops.cxx_prologue (), ops.prologue ());
+ append (os, ops.cxx_prologue_file (), prologue);
os << "//" << endl
<< "// End prologue." << endl
@@ -1154,20 +1008,19 @@ namespace CXX
generate_tree_source (ctx, first, last);
- if (ops.value<CLI::generate_ostream> ())
+ if (ops.generate_ostream ())
generate_stream_source (ctx, first, last);
- if (!ops.value<CLI::generate_element_type> () &&
- !ops.value<CLI::suppress_parsing> ())
+ if (!ops.generate_element_type () && !ops.suppress_parsing ())
generate_parser_source (ctx, first, last);
- if (ops.value<CLI::generate_serialization> ())
+ if (ops.generate_serialization ())
generate_serialization_source (ctx, first, last);
- if (!ops.value<CLI::generate_extraction> ().empty ())
+ if (!ops.generate_extraction ().empty ())
generate_stream_extraction_source (ctx);
- if (!ops.value<CLI::generate_insertion> ().empty ())
+ if (!ops.generate_insertion ().empty ())
generate_stream_insertion_source (ctx);
}
@@ -1176,10 +1029,8 @@ namespace CXX
os << "// Begin epilogue." << endl
<< "//" << endl;
- append (os, ops.value<CLI::cxx_epilogue_file> (), epilogue);
- append (os,
- ops.value<CLI::cxx_epilogue> (),
- ops.value<CLI::epilogue> ());
+ append (os, ops.cxx_epilogue_file (), epilogue);
+ append (os, ops.cxx_epilogue (), ops.epilogue ());
os << "//" << endl
<< "// End epilogue." << endl
diff --git a/xsd/cxx/tree/generator.hxx b/xsd/cxx/tree/generator.hxx
index ab88929..0e05585 100644
--- a/xsd/cxx/tree/generator.hxx
+++ b/xsd/cxx/tree/generator.hxx
@@ -14,7 +14,7 @@
#include <xsd.hxx>
#include <cxx/literal-map.hxx>
-#include <cxx/tree/cli.hxx>
+#include <cxx/tree/options.hxx>
namespace CXX
{
@@ -28,13 +28,10 @@ namespace CXX
static Void
usage ();
- static CLI::OptionsSpec
- options_spec ();
-
struct Failed {};
static UnsignedLong
- generate (CLI::Options const& options,
+ generate (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
Boolean file_per_type,
diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx
index ad1720f..5fc7876 100644
--- a/xsd/cxx/tree/name-processor.cxx
+++ b/xsd/cxx/tree/name-processor.cxx
@@ -36,7 +36,7 @@ namespace CXX
public:
struct Failed {};
- Context (CLI::Options const& options,
+ Context (Tree::options const& ops,
Counts const& counts,
Boolean generate_xml_schema,
SemanticGraph::Schema& root,
@@ -45,7 +45,7 @@ namespace CXX
: Tree::Context (std::wcerr,
root,
path,
- options,
+ ops,
counts,
generate_xml_schema,
&map,
@@ -54,7 +54,7 @@ namespace CXX
0),
global_type_names (global_type_names_),
global_element_names (global_element_names_),
- detach (options.value<CLI::generate_detach> ()),
+ detach (ops.generate_detach ()),
type_regex (type_regex_),
accessor_regex (accessor_regex_),
one_accessor_regex (one_accessor_regex_),
@@ -71,8 +71,8 @@ namespace CXX
{
typedef Containers::Vector<NarrowString> Vector;
- NarrowString tn (options.value<CLI::type_naming> ());
- NarrowString fn (options.value<CLI::function_naming> ());
+ NarrowString tn (options.type_naming ());
+ NarrowString fn (options.function_naming ());
// Type name regex.
@@ -116,9 +116,7 @@ namespace CXX
}
- compile_regex (options.value<CLI::type_regex> (),
- type_regex,
- "type");
+ compile_regex (options.type_regex (), type_regex, "type");
}
// Accessor name regex.
@@ -149,24 +147,23 @@ namespace CXX
accessor_regex.push_back ("/([^,]+)/get\\u$1/");
}
- compile_regex (options.value<CLI::accessor_regex> (),
+ compile_regex (options.accessor_regex (),
accessor_regex,
"accessor");
- compile_regex (options.value<CLI::one_accessor_regex> (),
+ compile_regex (options.one_accessor_regex (),
one_accessor_regex,
"one accessor");
- compile_regex (options.value<CLI::opt_accessor_regex> (),
+ compile_regex (options.opt_accessor_regex (),
opt_accessor_regex,
"optional accessor");
- compile_regex (options.value<CLI::seq_accessor_regex> (),
+ compile_regex (options.seq_accessor_regex (),
seq_accessor_regex,
"sequence accessor");
}
-
// Modifier name regex.
//
{
@@ -190,24 +187,23 @@ namespace CXX
modifier_regex.push_back ("/detach,([^,]+)/detach\\u$1/");
}
- compile_regex (options.value<CLI::modifier_regex> (),
+ compile_regex (options.modifier_regex (),
modifier_regex,
"modifier");
- compile_regex (options.value<CLI::one_modifier_regex> (),
+ compile_regex (options.one_modifier_regex (),
one_modifier_regex,
"one modifier");
- compile_regex (options.value<CLI::opt_modifier_regex> (),
+ compile_regex (options.opt_modifier_regex (),
opt_modifier_regex,
"optional modifier");
- compile_regex (options.value<CLI::seq_modifier_regex> (),
+ compile_regex (options.seq_modifier_regex (),
seq_modifier_regex,
"sequence modifier");
}
-
// Parser name regex.
//
{
@@ -222,9 +218,7 @@ namespace CXX
parser_regex.push_back ("/(.+)/parse\\u$1/");
}
- compile_regex (options.value<CLI::parser_regex> (),
- parser_regex,
- "parser");
+ compile_regex (options.parser_regex (), parser_regex, "parser");
}
// Serializer name regex.
@@ -241,7 +235,7 @@ namespace CXX
serializer_regex.push_back ("/(.+)/serialize\\u$1/");
}
- compile_regex (options.value<CLI::serializer_regex> (),
+ compile_regex (options.serializer_regex (),
serializer_regex,
"serializer");
}
@@ -253,14 +247,14 @@ namespace CXX
//
enumerator_regex.push_back ("/^$/empty/");
- compile_regex (options.value<CLI::enumerator_regex> (),
+ compile_regex (options.enumerator_regex (),
enumerator_regex,
"enumerator");
}
// Element type regex.
//
- compile_regex (options.value<CLI::element_type_regex> (),
+ compile_regex (options.element_type_regex (),
element_type_regex,
"element_type");
}
@@ -305,7 +299,7 @@ namespace CXX
RegexVector const& rv,
String const& id)
{
- Boolean trace (options.value<CLI::name_regex_trace> ());
+ Boolean trace (options.name_regex_trace ());
if (trace)
os << id << " name: '" << name << "'" << endl;
@@ -339,7 +333,7 @@ namespace CXX
RegexVector const& backup,
String const& id)
{
- Boolean trace (options.value<CLI::name_regex_trace> ());
+ Boolean trace (options.name_regex_trace ());
if (trace)
os << id << " name: '" << name << "'" << endl;
@@ -394,7 +388,7 @@ namespace CXX
String const& id)
{
String s (ns + L' ' + name);
- Boolean trace (options.value<CLI::name_regex_trace> ());
+ Boolean trace (options.name_regex_trace ());
if (trace)
os << id << " name: '" << s << "'" << endl;
@@ -430,7 +424,7 @@ namespace CXX
String const& id)
{
String s (ns + L' ' + name);
- Boolean trace (options.value<CLI::name_regex_trace> ());
+ Boolean trace (options.name_regex_trace ());
if (trace)
os << id << " name: '" << s << "'" << endl;
@@ -501,13 +495,12 @@ namespace CXX
private:
Void
- compile_regex (Containers::Vector<NarrowString> const& sv,
+ compile_regex (NarrowStrings const& sv,
RegexVector& rv,
String const& id)
{
- typedef Containers::Vector<NarrowString> Vector;
-
- for (Vector::ConstIterator i (sv.begin ()); i != sv.end (); ++i)
+ for (NarrowStrings::const_iterator i (sv.begin ()); i != sv.end ();
+ ++i)
{
try
{
@@ -1154,7 +1147,7 @@ namespace CXX
// Names for wildcards.
//
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
{
Boolean has_wildcard (false);
Any any (*this, member_set, stem_set, has_wildcard);
@@ -1271,7 +1264,7 @@ namespace CXX
if (!generate_p (e))
return;
- if (options.value<CLI::generate_element_type> ())
+ if (options.generate_element_type ())
{
SemanticGraph::Context& ec (e.context ());
@@ -1387,7 +1380,7 @@ namespace CXX
//
String p;
- if (!options.value<CLI::suppress_parsing> () && doc_root_p (e))
+ if (!options.suppress_parsing () && doc_root_p (e))
{
p = find_name (
escape (
@@ -1400,8 +1393,7 @@ namespace CXX
//
String s;
- if (options.value<CLI::generate_serialization> () &&
- doc_root_p (e))
+ if (options.generate_serialization () && doc_root_p (e))
{
s = find_name (
escape (
@@ -1887,13 +1879,13 @@ namespace CXX
process_name (n, "buffer", "buffer");
process_name (n, "time,zone", "time-zone");
- if (options.value<CLI::generate_element_type> ())
+ if (options.generate_element_type ())
process_name (n, "element,type", "element-type");
- if (options.value<CLI::generate_element_map> ())
+ if (options.generate_element_map ())
process_name (n, "element,map", "element-map");
- if (options.value<CLI::generate_serialization> ())
+ if (options.generate_serialization ())
{
process_name (n, "namespace,info", "namespace-info");
process_name (n, "namespace,infomap", "namespace-infomap");
@@ -1903,12 +1895,12 @@ namespace CXX
process_name (n, "facet", "facet");
}
- if (!options.value<CLI::generate_insertion> ().empty ())
+ if (!options.generate_insertion ().empty ())
{
process_name (n, "ostream", "ostream");
}
- if (!options.value<CLI::generate_extraction> ().empty ())
+ if (!options.generate_extraction ().empty ())
{
process_name (n, "istream", "istream");
}
@@ -1916,7 +1908,7 @@ namespace CXX
process_name (n, "flags", "flags");
process_name (n, "properties", "properties");
- NarrowString fn (options.value<CLI::function_naming> ());
+ NarrowString fn (options.function_naming ());
if (fn == "knr")
n.context ().set ("tree-node-key", String ("tree_node_key"));
@@ -1944,8 +1936,8 @@ namespace CXX
process_name (n, "error", "error");
process_name (n, "diagnostics", "diagnostics");
- if (!options.value<CLI::suppress_parsing> () ||
- options.value<CLI::generate_serialization> ())
+ if (!options.suppress_parsing () ||
+ options.generate_serialization ())
{
process_name (n, "error,handler", "error-handler");
}
@@ -2010,7 +2002,7 @@ namespace CXX
};
Boolean
- process_impl (CLI::Options const& ops,
+ process_impl (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
StringLiteralMap const& map)
@@ -2137,7 +2129,7 @@ namespace CXX
}
Boolean NameProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
StringLiteralMap const& map)
diff --git a/xsd/cxx/tree/name-processor.hxx b/xsd/cxx/tree/name-processor.hxx
index 09fc017..2d87388 100644
--- a/xsd/cxx/tree/name-processor.hxx
+++ b/xsd/cxx/tree/name-processor.hxx
@@ -7,6 +7,7 @@
#define CXX_TREE_NAME_PROCESSOR_HXX
#include <cxx/tree/elements.hxx>
+#include <cxx/tree/options.hxx>
namespace CXX
{
@@ -20,7 +21,7 @@ namespace CXX
NameProcessor (); // Dummy ctor, helps with long symbols on HP-UX.
Boolean
- process (CLI::Options const&,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
StringLiteralMap const&);
diff --git a/xsd/cxx/tree/options.cli b/xsd/cxx/tree/options.cli
index 58407fa..9d67653 100644
--- a/xsd/cxx/tree/options.cli
+++ b/xsd/cxx/tree/options.cli
@@ -46,7 +46,6 @@ namespace CXX
"Indicate that all types should be treated as polymorphic."
};
-
// Features.
//
bool --generate-serialization
@@ -55,12 +54,6 @@ namespace CXX
the object model back to XML."
};
- bool --generate-inline
- {
- "Generate simple functions inline. This option triggers creation of
- the inline file."
- };
-
bool --generate-ostream
{
"Generate ostream insertion operators (\cb{operator<<}) for generated
diff --git a/xsd/cxx/tree/parser-source.cxx b/xsd/cxx/tree/parser-source.cxx
index c4fcf57..ee83fd2 100644
--- a/xsd/cxx/tree/parser-source.cxx
+++ b/xsd/cxx/tree/parser-source.cxx
@@ -56,7 +56,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "u, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
@@ -86,7 +86,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "u, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
@@ -112,7 +112,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "u, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
@@ -222,7 +222,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "i, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
@@ -248,7 +248,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "i, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
@@ -275,7 +275,7 @@ namespace CXX
<< "::xsd::cxx::xml::dom::parse< " << char_type << " > (" << endl
<< "i, h, p, f";
- if (options.value<CLI::disable_multi_import> ())
+ if (options.disable_multi_import ())
os << " | ::xsd::cxx::xml::dom::no_muliple_imports";
os << "));"
diff --git a/xsd/cxx/tree/polymorphism-processor.cxx b/xsd/cxx/tree/polymorphism-processor.cxx
index b722e6b..66e7c63 100644
--- a/xsd/cxx/tree/polymorphism-processor.cxx
+++ b/xsd/cxx/tree/polymorphism-processor.cxx
@@ -666,7 +666,7 @@ namespace CXX
Char const* pass_two_key = "cxx-tree-polymorphism-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)
@@ -676,8 +676,8 @@ namespace CXX
// Prepare a set of polymorphic types.
//
- TypeSet poly_types (ops.value<CLI::polymorphic_type> ().begin (),
- ops.value<CLI::polymorphic_type> ().end ());
+ TypeSet poly_types (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.
@@ -780,7 +780,7 @@ namespace CXX
}
Boolean PolymorphismProcessor::
- process (CLI::Options const& ops,
+ process (options const& ops,
SemanticGraph::Schema& tu,
SemanticGraph::Path const& file,
const WarningSet& disabled_warnings)
diff --git a/xsd/cxx/tree/polymorphism-processor.hxx b/xsd/cxx/tree/polymorphism-processor.hxx
index 7752eb8..aebf8d4 100644
--- a/xsd/cxx/tree/polymorphism-processor.hxx
+++ b/xsd/cxx/tree/polymorphism-processor.hxx
@@ -10,7 +10,7 @@
#include <xsd-frontend/semantic-graph.hxx>
-#include <cxx/tree/cli.hxx>
+#include <cxx/tree/options.hxx>
#include <xsd.hxx>
@@ -24,7 +24,7 @@ namespace CXX
{
public:
Boolean
- process (CLI::Options const& options,
+ process (options const&,
XSDFrontend::SemanticGraph::Schema&,
XSDFrontend::SemanticGraph::Path const& file,
const WarningSet& disabled_warnings);
diff --git a/xsd/cxx/tree/serialization-header.cxx b/xsd/cxx/tree/serialization-header.cxx
index c7b9c1f..1070847 100644
--- a/xsd/cxx/tree/serialization-header.cxx
+++ b/xsd/cxx/tree/serialization-header.cxx
@@ -536,7 +536,7 @@ namespace CXX
Void
generate_serialization_header (Context& ctx)
{
- Boolean elemen_type (ctx.options.value<CLI::generate_element_type> ());
+ Boolean elemen_type (ctx.options.generate_element_type ());
if (!elemen_type)
ctx.os << "#include <iosfwd>" << endl
diff --git a/xsd/cxx/tree/serialization-source.cxx b/xsd/cxx/tree/serialization-source.cxx
index 05588bd..411a5ef 100644
--- a/xsd/cxx/tree/serialization-source.cxx
+++ b/xsd/cxx/tree/serialization-source.cxx
@@ -617,8 +617,7 @@ namespace CXX
{
// Make sure we serialize required fixed attributes.
//
- if (a.optional_p () &&
- options.value<CLI::omit_default_attributes> ())
+ if (a.optional_p () && options.omit_default_attributes ())
{
os << "if (i." << aname << " () != " << scope <<
"::" << edefault_value (a) << " ())";
@@ -735,7 +734,7 @@ namespace CXX
// Serialize anyAttribute content first so that is gets
// overriden by schema-defined attributes.
//
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
{
AnyAttribute any_attribute (*this, name);
Traversal::Names names (any_attribute);
@@ -752,7 +751,7 @@ namespace CXX
names >> element;
names >> attribute;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names >> any;
Complex::names (c, names);
@@ -889,7 +888,7 @@ namespace CXX
ElementType (Context& c)
: GlobalElementBase (c),
Context (c),
- element_map_ (c.options.value<CLI::generate_element_map> ())
+ element_map_ (c.options.generate_element_map ())
{
}
@@ -1246,7 +1245,7 @@ namespace CXX
UnsignedLong first,
UnsignedLong last)
{
- Boolean elemen_type (ctx.options.value<CLI::generate_element_type> ());
+ Boolean elemen_type (ctx.options.generate_element_type ());
if (!elemen_type)
ctx.os << "#include <ostream>" << endl
@@ -1260,8 +1259,8 @@ namespace CXX
ctx.os << "#include <xsd/cxx/tree/type-serializer-map.hxx>" << endl
<< endl;
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
diff --git a/xsd/cxx/tree/stream-extraction-source.cxx b/xsd/cxx/tree/stream-extraction-source.cxx
index 293dba5..53eaa09 100644
--- a/xsd/cxx/tree/stream-extraction-source.cxx
+++ b/xsd/cxx/tree/stream-extraction-source.cxx
@@ -14,8 +14,6 @@ namespace CXX
{
namespace
{
- typedef Containers::Vector<NarrowString> Streams;
-
struct List: Traversal::List, Context
{
List (Context& c)
@@ -46,8 +44,9 @@ namespace CXX
base += L" >";
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ());
+ i != st.end (); ++i)
{
os << name << "::" << endl
<< name << " (" << istream_type << "< " <<
@@ -117,8 +116,9 @@ namespace CXX
String const& base (xs_string_type);
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
os << name << "::" << endl
<< name << " (" << istream_type << "< " <<
@@ -194,8 +194,9 @@ namespace CXX
value = evalue (e);
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
os << name << "::" << endl
<< name << " (" << istream_type << "< " <<
@@ -560,7 +561,7 @@ namespace CXX
inherits_ >> base_;
names_ctor_member_ >> ctor_member_;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names_ctor_member_ >> ctor_any_;
}
@@ -596,8 +597,9 @@ namespace CXX
}
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
os << name << "::" << endl
@@ -699,13 +701,13 @@ namespace CXX
{
if (ctx.polymorphic)
{
- Streams const& st (ctx.options.value<CLI::generate_extraction> ());
+ NarrowStrings const& st (ctx.options.generate_extraction ());
ctx.os << "#include <xsd/cxx/tree/stream-extraction-map.hxx>" << endl
<< endl;
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
@@ -718,7 +720,8 @@ namespace CXX
<< "namespace tree"
<< "{";
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream (*i);
@@ -757,7 +760,8 @@ namespace CXX
<< "{";
UnsignedLong n (0);
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream (*i);
diff --git a/xsd/cxx/tree/stream-insertion-header.cxx b/xsd/cxx/tree/stream-insertion-header.cxx
index 8d00eb0..139bf8b 100644
--- a/xsd/cxx/tree/stream-insertion-header.cxx
+++ b/xsd/cxx/tree/stream-insertion-header.cxx
@@ -14,8 +14,6 @@ namespace CXX
{
namespace
{
- typedef Containers::Vector<NarrowString> Streams;
-
struct List: Traversal::List, Context
{
List (Context& c)
@@ -34,8 +32,9 @@ namespace CXX
if (renamed_type (l, name) && !name)
return;
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type (ostream_type + L"< " + String (*i) + L" >");
@@ -67,8 +66,9 @@ namespace CXX
if (renamed_type (u, name) && !name)
return;
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type (ostream_type + L"< " + String (*i) + L" >");
@@ -100,8 +100,9 @@ namespace CXX
if (renamed_type (e, name) && !name)
return;
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type (ostream_type + L"< " + String (*i) + L" >");
@@ -132,8 +133,9 @@ namespace CXX
if (renamed_type (c, name) && !name)
return;
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type (ostream_type + L"< " + String (*i) + L" >");
diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx
index 00d9ae2..2dbbc79 100644
--- a/xsd/cxx/tree/stream-insertion-source.cxx
+++ b/xsd/cxx/tree/stream-insertion-source.cxx
@@ -14,8 +14,6 @@ namespace CXX
{
namespace
{
- typedef Containers::Vector<NarrowString> Streams;
-
struct List: Traversal::List, Context
{
List (Context& c)
@@ -46,8 +44,9 @@ namespace CXX
base += L" >";
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type ("::xsd::cxx::tree::ostream< " + *i + " >");
@@ -116,8 +115,9 @@ namespace CXX
String const& base (xs_string_type);
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type ("::xsd::cxx::tree::ostream< " + *i + " >");
@@ -193,8 +193,9 @@ namespace CXX
value = evalue (e);
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type ("::xsd::cxx::tree::ostream< " + *i + " >");
@@ -406,8 +407,9 @@ namespace CXX
Boolean has_body (has<Traversal::Member> (c) || c.inherits_p ());
UnsignedLong n (0);
- Streams const& st (options.value<CLI::generate_insertion> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_insertion ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream_type ("::xsd::cxx::tree::ostream< " + *i + " >");
@@ -474,13 +476,13 @@ namespace CXX
{
if (ctx.polymorphic)
{
- Streams const& st (ctx.options.value<CLI::generate_insertion> ());
+ NarrowStrings const& st (ctx.options.generate_insertion ());
ctx.os << "#include <xsd/cxx/tree/stream-insertion-map.hxx>" << endl
<< endl;
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
@@ -493,7 +495,8 @@ namespace CXX
<< "namespace tree"
<< "{";
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream (*i);
@@ -531,7 +534,8 @@ namespace CXX
<< "{";
UnsignedLong n (0);
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
String stream (*i);
diff --git a/xsd/cxx/tree/stream-source.cxx b/xsd/cxx/tree/stream-source.cxx
index 1d4b5d9..e2c0ca5 100644
--- a/xsd/cxx/tree/stream-source.cxx
+++ b/xsd/cxx/tree/stream-source.cxx
@@ -423,8 +423,8 @@ namespace CXX
ctx.os << "#include <xsd/cxx/tree/std-ostream-map.hxx>" << endl
<< endl;
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
diff --git a/xsd/cxx/tree/tree-forward.cxx b/xsd/cxx/tree/tree-forward.cxx
index 7ec6155..7f8f5ea 100644
--- a/xsd/cxx/tree/tree-forward.cxx
+++ b/xsd/cxx/tree/tree-forward.cxx
@@ -139,7 +139,7 @@ namespace CXX
Void
generate_forward (Context& ctx)
{
- NarrowString xml_schema (ctx.options.value<CLI::extern_xml_schema> ());
+ NarrowString xml_schema (ctx.options.extern_xml_schema ());
// Inlcude or Emit fundamental types.
//
@@ -164,21 +164,21 @@ namespace CXX
<< "#include <xsd/cxx/tree/types.hxx>" << endl
<< endl;
- if (!ctx.options.value<CLI::suppress_parsing> () ||
- ctx.options.value<CLI::generate_serialization> ())
+ if (!ctx.options.suppress_parsing () ||
+ ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/error-handler.hxx>" << endl
<< endl;
}
- if (!ctx.options.value<CLI::suppress_parsing> () ||
- ctx.options.value<CLI::generate_serialization> ())
+ if (!ctx.options.suppress_parsing () ||
+ ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/dom/auto-ptr.hxx>" << endl
<< endl;
}
- Boolean element_map (ctx.options.value<CLI::generate_element_map> ());
+ Boolean element_map (ctx.options.generate_element_map ());
if (element_map)
ctx.os << "#include <xsd/cxx/tree/element-map.hxx>" << endl
@@ -188,7 +188,7 @@ namespace CXX
// later in the individual generators for each feature because
// those headers provide implementation for the fundamental types.
//
- if (!ctx.options.value<CLI::suppress_parsing> ())
+ if (!ctx.options.suppress_parsing ())
{
ctx.os << "#include <xsd/cxx/tree/parsing.hxx>" << endl;
@@ -210,7 +210,7 @@ namespace CXX
ctx.os << endl;
}
- if (ctx.options.value<CLI::generate_serialization> ())
+ if (ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/dom/serialization-header.hxx>" << endl
<< "#include <xsd/cxx/tree/serialization.hxx>" << endl;
@@ -233,18 +233,17 @@ namespace CXX
ctx.os << endl;
}
- if (ctx.options.value<CLI::generate_ostream> ())
+ if (ctx.options.generate_ostream ())
{
ctx.os << "#include <xsd/cxx/tree/std-ostream-operators.hxx>" << endl
<< endl;
}
- typedef Containers::Vector<NarrowString> Streams;
-
- Streams const& ist (ctx.options.value<CLI::generate_insertion> ());
+ NarrowStrings const& ist (ctx.options.generate_insertion ());
if (!ist.empty ())
{
- for (Streams::ConstIterator i (ist.begin ()); i != ist.end (); ++i)
+ for (NarrowStrings::const_iterator i (ist.begin ()); i != ist.end ();
+ ++i)
{
if (*i == "ACE_OutputCDR")
ctx.os << "#include <xsd/cxx/tree/ace-cdr-stream-insertion.hxx>"
@@ -258,10 +257,11 @@ namespace CXX
<< endl;
}
- Streams const& est (ctx.options.value<CLI::generate_extraction> ());
+ NarrowStrings const& est (ctx.options.generate_extraction ());
if (!est.empty ())
{
- for (Streams::ConstIterator i (est.begin ()); i != est.end (); ++i)
+ for (NarrowStrings::const_iterator i (est.begin ()); i != est.end ();
+ ++i)
{
if (*i == "ACE_InputCDR")
ctx.os << "#include <xsd/cxx/tree/ace-cdr-stream-extraction.hxx>"
@@ -288,7 +288,7 @@ namespace CXX
// First emit header includes.
//
- if (ctx.options.value<CLI::generate_forward> ())
+ if (ctx.options.generate_forward ())
{
Traversal::Schema schema;
Includes includes (ctx, Includes::forward);
diff --git a/xsd/cxx/tree/tree-header.cxx b/xsd/cxx/tree/tree-header.cxx
index e02e768..9d7aea5 100644
--- a/xsd/cxx/tree/tree-header.cxx
+++ b/xsd/cxx/tree/tree-header.cxx
@@ -16,8 +16,6 @@ namespace CXX
{
namespace
{
- typedef Containers::Vector<NarrowString> Streams;
-
// List mapping.
//
struct List: Traversal::List, Context
@@ -142,8 +140,9 @@ namespace CXX
// c-tor (istream&)
//
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
if (doxygen)
{
@@ -167,7 +166,7 @@ namespace CXX
<< endl;
}
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -353,7 +352,7 @@ namespace CXX
<< "public:" << endl
<< endl;
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
// c-tor ()
//
@@ -400,8 +399,9 @@ namespace CXX
// c-tor (istream&)
//
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
if (doxygen)
{
@@ -425,7 +425,7 @@ namespace CXX
<< endl;
}
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -688,7 +688,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
if (doxygen)
{
@@ -808,8 +808,9 @@ namespace CXX
// c-tor (istream&)
//
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
if (doxygen)
{
@@ -833,7 +834,7 @@ namespace CXX
<< endl;
}
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -1849,7 +1850,7 @@ namespace CXX
if (max (m) != 1)
{
String const& container (econtainer (m));
- Boolean isense (options.value<CLI::generate_intellisense> ());
+ Boolean isense (options.generate_intellisense ());
// sequence
//
@@ -2269,11 +2270,11 @@ namespace CXX
inherits_member_ >> member_name_;
names_ >> member_;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names_ >> any_;
names_data_ >> data_member_;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names_data_ >> data_any_;
}
@@ -2293,7 +2294,7 @@ namespace CXX
Boolean hae (has<Traversal::Any> (c));
Boolean haa (has<Traversal::AnyAttribute> (c));
- Boolean gen_wildcard (options.value<CLI::generate_wildcard> ());
+ Boolean gen_wildcard (options.generate_wildcard ());
Boolean simple (true);
{
@@ -2426,7 +2427,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
// c-tor (ultimate-base, all-non-optional-members) will become
// default c-tor if our inheritance hierarchy has no required
@@ -2460,7 +2461,7 @@ namespace CXX
// c-tor (base, all-non-optional-members)
//
- if (options.value<CLI::generate_from_base_ctor> ())
+ if (options.generate_from_base_ctor ())
{
// c-tor (base, all-non-optional-members) will be equivalent to
// c-tor (ultimate-base, all-non-optional-members) unless our
@@ -2826,8 +2827,9 @@ namespace CXX
// c-tor (istream&)
//
- Streams const& st (options.value<CLI::generate_extraction> ());
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ NarrowStrings const& st (options.generate_extraction ());
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
if (doxygen)
{
@@ -2852,7 +2854,7 @@ namespace CXX
}
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -2975,7 +2977,7 @@ namespace CXX
if (!simple)
{
- if (options.value<CLI::suppress_assignment> ())
+ if (options.suppress_assignment ())
{
priv = true;
os << "private:" << endl;
@@ -3049,7 +3051,7 @@ namespace CXX
<< "//@cond" << endl
<< endl;
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// parse (xercesc::DOMElement)
//
@@ -3068,7 +3070,8 @@ namespace CXX
//
if (has_members)
{
- for (Streams::ConstIterator i (st.begin ()); i != st.end (); ++i)
+ for (NarrowStrings::const_iterator i (st.begin ()); i != st.end ();
+ ++i)
{
os << "void" << endl
<< unclash (name, "parse") << " (" <<
@@ -3100,7 +3103,7 @@ namespace CXX
// Comparison operators.
//
- if (options.value<CLI::generate_comparison> () &&
+ if (options.generate_comparison () &&
(has_members || !c.inherits_p () ||
((hae || haa) && gen_wildcard)))
{
@@ -3406,7 +3409,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
if (doxygen)
{
@@ -3466,7 +3469,7 @@ namespace CXX
<< endl;
}
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -3674,21 +3677,21 @@ namespace CXX
<< "#include <xsd/cxx/tree/types.hxx>" << endl
<< endl;
- if (!ctx.options.value<CLI::suppress_parsing> () ||
- ctx.options.value<CLI::generate_serialization> ())
+ if (!ctx.options.suppress_parsing () ||
+ ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/error-handler.hxx>" << endl
<< endl;
}
- if (!ctx.options.value<CLI::suppress_parsing> () ||
- ctx.options.value<CLI::generate_serialization> ())
+ if (!ctx.options.suppress_parsing () ||
+ ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/dom/auto-ptr.hxx>" << endl
<< endl;
}
- Boolean element_map (ctx.options.value<CLI::generate_element_map> ());
+ Boolean element_map (ctx.options.generate_element_map ());
if (element_map)
ctx.os << "#include <xsd/cxx/tree/element-map.hxx>" << endl
@@ -3698,7 +3701,7 @@ namespace CXX
// later in the individual generators for each feature because
// those headers provide implementation for the fundamental types.
//
- if (!ctx.options.value<CLI::suppress_parsing> ())
+ if (!ctx.options.suppress_parsing ())
{
ctx.os << "#include <xsd/cxx/tree/parsing.hxx>" << endl;
@@ -3719,7 +3722,7 @@ namespace CXX
ctx.os << endl;
}
- if (ctx.options.value<CLI::generate_serialization> ())
+ if (ctx.options.generate_serialization ())
{
ctx.os << "#include <xsd/cxx/xml/dom/serialization-header.hxx>" << endl
<< "#include <xsd/cxx/tree/serialization.hxx>" << endl;
@@ -3741,16 +3744,17 @@ namespace CXX
ctx.os << endl;
}
- if (ctx.options.value<CLI::generate_ostream> ())
+ if (ctx.options.generate_ostream ())
{
ctx.os << "#include <xsd/cxx/tree/std-ostream-operators.hxx>" << endl
<< endl;
}
- Streams const& ist (ctx.options.value<CLI::generate_insertion> ());
+ NarrowStrings const& ist (ctx.options.generate_insertion ());
if (!ist.empty ())
{
- for (Streams::ConstIterator i (ist.begin ()); i != ist.end (); ++i)
+ for (NarrowStrings::const_iterator i (ist.begin ()); i != ist.end ();
+ ++i)
{
if (*i == "ACE_OutputCDR")
ctx.os << "#include <xsd/cxx/tree/ace-cdr-stream-insertion.hxx>"
@@ -3764,10 +3768,11 @@ namespace CXX
<< endl;
}
- Streams const& est (ctx.options.value<CLI::generate_extraction> ());
+ NarrowStrings const& est (ctx.options.generate_extraction ());
if (!est.empty ())
{
- for (Streams::ConstIterator i (est.begin ()); i != est.end (); ++i)
+ for (NarrowStrings::const_iterator i (est.begin ()); i != est.end ();
+ ++i)
{
if (*i == "ACE_InputCDR")
ctx.os << "#include <xsd/cxx/tree/ace-cdr-stream-extraction.hxx>"
@@ -3795,7 +3800,7 @@ namespace CXX
}
else
{
- Boolean inline_ (ctx.options.value<CLI::generate_inline> ());
+ Boolean inline_ (ctx.options.generate_inline ());
ctx.os << "#include <memory> // std::auto_ptr" << endl
<< "#include <limits> // std::numeric_limits" << endl
@@ -3815,23 +3820,23 @@ namespace CXX
<< "#include <xsd/cxx/tree/list.hxx>" << endl
<< endl;
- if (!ctx.options.value<CLI::suppress_parsing> ())
+ if (!ctx.options.suppress_parsing ())
{
ctx.os << "#include <xsd/cxx/xml/dom/parsing-header.hxx>" << endl
<< endl;
}
- if (ctx.options.value<CLI::generate_wildcard> ())
+ if (ctx.options.generate_wildcard ())
{
- if (ctx.options.value<CLI::suppress_parsing> () ||
- !ctx.options.value<CLI::generate_serialization> ())
+ if (ctx.options.suppress_parsing () ||
+ !ctx.options.generate_serialization ())
ctx.os << "#include <xsd/cxx/xml/dom/auto-ptr.hxx>" << endl;
ctx.os << "#include <xsd/cxx/tree/containers-wildcard.hxx>" << endl
<< endl;
}
- if (!ctx.options.value<CLI::generate_extraction> ().empty ())
+ if (!ctx.options.generate_extraction ().empty ())
ctx.os << "#include <xsd/cxx/tree/istream-fwd.hxx>" << endl
<< endl;
@@ -3888,7 +3893,7 @@ namespace CXX
names >> complex;
names >> enumeration;
- if (ctx.options.value<CLI::generate_element_type> ())
+ if (ctx.options.generate_element_type ())
names >> element;
schema.dispatch (ctx.schema_root);
diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx
index 45a62e1..9656a2d 100644
--- a/xsd/cxx/tree/tree-inline.cxx
+++ b/xsd/cxx/tree/tree-inline.cxx
@@ -123,7 +123,7 @@ namespace CXX
<< "//" << endl
<< endl;
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
// c-tor ()
//
@@ -276,7 +276,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
os << inl
<< name << "::" << endl
@@ -883,7 +883,7 @@ namespace CXX
Member member (*this, name);
Traversal::Names names;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names >> any;
names >> member;
@@ -1012,7 +1012,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_);
@@ -1053,7 +1053,7 @@ namespace CXX
names >> complex;
names >> enumeration;
- if (ctx.options.value<CLI::generate_element_type> ())
+ if (ctx.options.generate_element_type ())
names >> element;
schema.dispatch (ctx.schema_root);
diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx
index c20876b..45628cf 100644
--- a/xsd/cxx/tree/tree-source.cxx
+++ b/xsd/cxx/tree/tree-source.cxx
@@ -39,7 +39,7 @@ namespace CXX
<< "//" << endl
<< endl;
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
SemanticGraph::Type& item_type (l.argumented ().type ());
String base (L"::xsd::cxx::tree::list< " +
@@ -114,7 +114,7 @@ namespace CXX
// If this type is anonymous but substitutes, then it will
// be registered as part of the substitution registration.
//
- if (!anonymous_p (l) && !options.value<CLI::suppress_parsing> ())
+ if (!anonymous_p (l) && !options.suppress_parsing ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::type_factory_initializer< 0, " <<
@@ -126,7 +126,7 @@ namespace CXX
}
if ((!anonymous_p (l) || anonymous_substitutes_p (l)) &&
- options.value<CLI::generate_comparison> ())
+ options.generate_comparison ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::comparison_initializer< 0, " <<
@@ -175,7 +175,7 @@ namespace CXX
<< "//" << endl
<< endl;
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -229,7 +229,7 @@ namespace CXX
// If this type is anonymous but substitutes, then it will
// be registered as part of the substitution registration.
//
- if (!anonymous_p (u) && !options.value<CLI::suppress_parsing> ())
+ if (!anonymous_p (u) && !options.suppress_parsing ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::type_factory_initializer< 0, " <<
@@ -241,7 +241,7 @@ namespace CXX
}
if ((!anonymous_p (u) || anonymous_substitutes_p (u)) &&
- options.value<CLI::generate_comparison> ())
+ options.generate_comparison ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::comparison_initializer< 0, " <<
@@ -375,7 +375,7 @@ namespace CXX
<< "//" << endl
<< endl;
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -529,7 +529,7 @@ namespace CXX
// If this type is anonymous but substitutes, then it will
// be registered as part of the substitution registration.
//
- if (!anonymous_p (e) && !options.value<CLI::suppress_parsing> ())
+ if (!anonymous_p (e) && !options.suppress_parsing ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::type_factory_initializer< 0, " <<
@@ -541,7 +541,7 @@ namespace CXX
}
if ((!anonymous_p (e) || anonymous_substitutes_p (e)) &&
- options.value<CLI::generate_comparison> ())
+ options.generate_comparison ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::comparison_initializer< 0, " <<
@@ -1327,7 +1327,7 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Any& a)
{
- if (!options.value<CLI::generate_wildcard> ())
+ if (!options.generate_wildcard ())
return;
if (min (a) == 1 && max (a) == 1)
@@ -1822,14 +1822,14 @@ namespace CXX
virtual Void
traverse (SemanticGraph::Any&)
{
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
generate_ = true;
}
virtual Void
traverse (SemanticGraph::AnyAttribute&)
{
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
generate_ = true;
}
@@ -2036,7 +2036,7 @@ namespace CXX
virtual Void
traverse (SemanticGraph::AnyAttribute&)
{
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
has_at_ = true;
}
@@ -2148,7 +2148,7 @@ namespace CXX
comparison_member_ (c),
facet_array_ (c)
{
- Boolean gen_wildcard (options.value<CLI::generate_wildcard> ());
+ Boolean gen_wildcard (options.generate_wildcard ());
inherits_member_ >> member_name_;
@@ -2291,7 +2291,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
Boolean generate (false);
{
@@ -2324,7 +2324,7 @@ namespace CXX
// c-tor (base, all-non-optional-members)
//
- if (options.value<CLI::generate_from_base_ctor> ())
+ if (options.generate_from_base_ctor ())
{
Boolean generate (false);
{
@@ -2843,7 +2843,7 @@ namespace CXX
names >> copy_member;
- if (options.value<CLI::generate_wildcard> ())
+ if (options.generate_wildcard ())
names >> copy_any;
Complex::names (c, names);
@@ -2862,11 +2862,11 @@ namespace CXX
Boolean ha (has<Traversal::Attribute> (c));
Boolean haa (has<Traversal::AnyAttribute> (c));
- Boolean gen_wildcard (options.value<CLI::generate_wildcard> ());
+ Boolean gen_wildcard (options.generate_wildcard ());
//
//
- if (!options.value<CLI::suppress_parsing> ())
+ if (!options.suppress_parsing ())
{
// c-tor (xercesc::DOMElement)
//
@@ -3051,7 +3051,7 @@ namespace CXX
// operator=
//
- if (!options.value<CLI::suppress_assignment> () &&
+ if (!options.suppress_assignment () &&
(he || ha || (gen_wildcard && (hae || haa))))
{
os << name << "& " << name << "::" << endl
@@ -3090,7 +3090,7 @@ namespace CXX
// If this type is anonymous but substitutes, then it will
// be registered as part of the substitution registration.
//
- if (!anonymous_p (c) && !options.value<CLI::suppress_parsing> ())
+ if (!anonymous_p (c) && !options.suppress_parsing ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::type_factory_initializer< 0, " <<
@@ -3102,7 +3102,7 @@ namespace CXX
}
if ((!anonymous_p (c) || anonymous_substitutes_p (c)) &&
- options.value<CLI::generate_comparison> ())
+ options.generate_comparison ())
{
os << "static" << endl
<< "const ::xsd::cxx::tree::comparison_initializer< 0, " <<
@@ -3114,7 +3114,7 @@ namespace CXX
// Comparison operators.
//
- if (options.value<CLI::generate_comparison> () &&
+ if (options.generate_comparison () &&
(he || ha || !c.inherits_p () ||
((hae || haa) && gen_wildcard)))
{
@@ -3212,8 +3212,8 @@ namespace CXX
GlobalElement (Context& c)
: GlobalElementBase (c),
Context (c),
- element_type_ (c.options.value<CLI::generate_element_type> ()),
- element_map_ (c.options.value<CLI::generate_element_map> ()),
+ element_type_ (c.options.generate_element_type ()),
+ element_map_ (c.options.generate_element_map ()),
type_name_ (c)
{
belongs_ >> type_name_;
@@ -3273,7 +3273,7 @@ namespace CXX
// default c-tor
//
- if (options.value<CLI::generate_default_ctor> ())
+ if (options.generate_default_ctor ())
{
os << name << "::" << endl
<< name << " ()" << endl
@@ -3308,7 +3308,7 @@ namespace CXX
String const& name_member (ec.get<String> ("element-name-member"));
String const& ns_member (ec.get<String> ("element-ns-member"));
- Boolean parsing (!options.value<CLI::suppress_parsing> ());
+ Boolean parsing (!options.suppress_parsing ());
if (parsing)
{
String const& tr (etraits (e));
@@ -3409,7 +3409,7 @@ namespace CXX
}
if (polymorphic && e.substitutes_p () &&
- !options.value<CLI::suppress_parsing> ())
+ !options.suppress_parsing ())
{
String const& name (ename (e));
Type& r (e.substitutes ().root ());
@@ -3444,20 +3444,20 @@ namespace CXX
UnsignedLong first,
UnsignedLong last)
{
- if (ctx.options.value<CLI::generate_wildcard> ())
+ if (ctx.options.generate_wildcard ())
{
ctx.os << "#include <xsd/cxx/xml/dom/wildcard-source.hxx>" << endl
<< endl;
}
- if (!ctx.options.value<CLI::suppress_parsing> ())
+ if (!ctx.options.suppress_parsing ())
ctx.os << "#include <xsd/cxx/xml/dom/parsing-source.hxx>" << endl
<< endl;
if (ctx.polymorphic)
{
- Boolean parsing (!ctx.options.value<CLI::suppress_parsing> ());
- Boolean comparison (ctx.options.value<CLI::generate_comparison> ());
+ Boolean parsing (!ctx.options.suppress_parsing ());
+ Boolean comparison (ctx.options.generate_comparison ());
if (parsing)
ctx.os << "#include <xsd/cxx/tree/type-factory-map.hxx>" << endl
@@ -3469,8 +3469,8 @@ namespace CXX
if (parsing || comparison)
{
- Boolean import_maps (ctx.options.value<CLI::import_maps> ());
- Boolean export_maps (ctx.options.value<CLI::export_maps> ());
+ Boolean import_maps (ctx.options.import_maps ());
+ Boolean export_maps (ctx.options.export_maps ());
if (import_maps || export_maps)
{
diff --git a/xsd/cxx/tree/validator.cxx b/xsd/cxx/tree/validator.cxx
index 1fc29ca..00dfe29 100644
--- a/xsd/cxx/tree/validator.cxx
+++ b/xsd/cxx/tree/validator.cxx
@@ -27,7 +27,7 @@ namespace CXX
public:
ValidationContext (SemanticGraph::Schema& root,
SemanticGraph::Path const& path,
- CLI::Options const& options,
+ Tree::options const& ops,
const WarningSet& disabled_warnings,
Counts const& counts,
Boolean generate_xml_schema,
@@ -35,7 +35,7 @@ namespace CXX
: Context (std::wcerr,
root,
path,
- options,
+ ops,
counts,
generate_xml_schema,
0,
@@ -461,7 +461,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;
@@ -480,7 +480,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) << "' "
@@ -496,7 +496,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) << "' "
@@ -528,7 +528,7 @@ namespace CXX
}
Boolean Validator::
- validate (CLI::Options const& options,
+ validate (options const& ops,
SemanticGraph::Schema& schema,
SemanticGraph::Path const& path,
const WarningSet& disabled_warnings,
@@ -536,12 +536,12 @@ namespace CXX
{
Boolean valid (true);
ValidationContext ctx (
- schema, path, options, disabled_warnings, counts, false, valid);
+ schema, path, ops, disabled_warnings, counts, false, valid);
//
//
- Boolean import_maps (options.value<CLI::import_maps> ());
- Boolean export_maps (options.value<CLI::export_maps> ());
+ Boolean import_maps (ops.import_maps ());
+ Boolean export_maps (ops.export_maps ());
if (import_maps && export_maps)
{
@@ -569,17 +569,17 @@ namespace CXX
//
//
- if (options.value<CLI::char_type> () != "char" &&
- options.value<CLI::char_type> () != "wchar_t" &&
+ if (ops.char_type () != "char" &&
+ ops.char_type () != "wchar_t" &&
!ctx.is_disabled ("T003"))
{
wcerr << "warning T003: unknown base character type '" <<
- options.value<CLI::char_type> ().c_str () << "'" << endl;
+ ops.char_type ().c_str () << "'" << endl;
}
//
//
- NarrowString tn (options.value<CLI::type_naming> ());
+ NarrowString tn (ops.type_naming ());
if (tn != "knr" && tn != "ucc" && tn != "java")
{
@@ -589,7 +589,7 @@ namespace CXX
return false;
}
- NarrowString fn (options.value<CLI::function_naming> ());
+ NarrowString fn (ops.function_naming ());
if (fn != "knr" && fn != "lcc" && fn != "java")
{
@@ -601,11 +601,11 @@ namespace CXX
//
//
- Boolean element_type (options.value<CLI::generate_element_type> ());
- Boolean par (!options.value<CLI::suppress_parsing> ());
- Boolean ser (options.value<CLI::generate_serialization> ());
+ Boolean element_type (ops.generate_element_type ());
+ Boolean par (!ops.suppress_parsing ());
+ Boolean ser (ops.generate_serialization ());
- if (options.value<CLI::generate_element_map> ())
+ if (ops.generate_element_map ())
{
if (!element_type)
{
@@ -631,11 +631,11 @@ namespace CXX
if (counts.global_elements > 1 &&
(element_type || par || ser) &&
- !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 ("T004"))
{
wcerr << schema.file () << ": warning T004: generating ";
diff --git a/xsd/cxx/tree/validator.hxx b/xsd/cxx/tree/validator.hxx
index 62810a7..ad156ff 100644
--- a/xsd/cxx/tree/validator.hxx
+++ b/xsd/cxx/tree/validator.hxx
@@ -7,7 +7,7 @@
#define CXX_TREE_VALIDATOR_HXX
#include <cxx/tree/elements.hxx>
-#include <cxx/tree/cli.hxx>
+#include <cxx/tree/options.hxx>
#include <xsd.hxx>
@@ -21,7 +21,7 @@ namespace CXX
Validator (); // Dummy ctor, helps with long symbols on HP-UX.
Boolean
- validate (CLI::Options const& options,
+ validate (options const&,
SemanticGraph::Schema&,
SemanticGraph::Path const& tu,
const WarningSet& disabled_warnings,
diff --git a/xsd/makefile b/xsd/makefile
index 59fa51a..cbf9f21 100644
--- a/xsd/makefile
+++ b/xsd/makefile
@@ -125,7 +125,8 @@ $(gen): cli_options += \
--suppress-undocumented \
--generate-file-scanner \
--include-with-brackets \
---option-length 28
+--option-length 28 \
+--cxx-prologue '\#include <options-parser.hxx>'
#--include-prefix xsd
#--guard-prefix XSD
diff --git a/xsd/options-parser.hxx b/xsd/options-parser.hxx
new file mode 100644
index 0000000..9ea1e09
--- /dev/null
+++ b/xsd/options-parser.hxx
@@ -0,0 +1,31 @@
+// file : xsd/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/xsd/options.cli b/xsd/options.cli
index 3e38312..6ab4ab3 100644
--- a/xsd/options.cli
+++ b/xsd/options.cli
@@ -70,7 +70,7 @@ class options = 0
license instead of the GPL."
};
- std::vector<Cult::Types::NarrowString> --custom-literals
+ Cult::Types::NarrowString --custom-literals
{
"<file>",
"Load custom XML string to C++ literal mappings from <file>. This
diff --git a/xsd/types.hxx b/xsd/types.hxx
new file mode 100644
index 0000000..91be3ae
--- /dev/null
+++ b/xsd/types.hxx
@@ -0,0 +1,15 @@
+// file : xsd/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/xsd/xsd.cxx b/xsd/xsd.cxx
index 27f4b09..a9b67cf 100644
--- a/xsd/xsd.cxx
+++ b/xsd/xsd.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>
@@ -20,12 +21,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.cxx>
@@ -33,6 +28,9 @@
#include <xsd-frontend/transformations/schema-per-type.hxx>
#include <xsd-frontend/transformations/simplifier.hxx>
+#include <cxx/tree/options.hxx>
+#include <cxx/parser/options.hxx>
+
#include <cxx/tree/generator.hxx>
#include <cxx/parser/generator.hxx>
@@ -40,94 +38,18 @@
#include <processing/inheritance/processor.hxx>
#include <xsd.hxx>
+#include <types.hxx>
#include <options.hxx>
#include "../libxsd/xsd/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 morph_anonymous = "morph-anonymous";
- 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 custom_literals = "custom-literals";
- 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,
- morph_anonymous, Boolean,
- preserve_anonymous, Boolean,
- anonymous_regex, NarrowStrings,
- anonymous_regex_trace, Boolean,
- location_map, NarrowStrings,
- location_regex, NarrowStrings,
- location_regex_trace, Boolean,
- custom_literals, NarrowString,
- 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
@@ -242,20 +164,14 @@ main (Int argc, Char* argv[])
try
{
- CLI::FileArguments args (argc, argv, "--options-file");
-
- CLI::HelpOptions help_options (
- 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_options.value<CLI::version> () || cmd == "version")
+ if (help_ops.version () || cmd == "version")
{
std::wostream& o (wcout);
@@ -263,17 +179,15 @@ main (Int argc, Char* argv[])
XSD_STR_VERSION << endl
<< "Copyright (c) 2005-2011 Code Synthesis Tools CC" << endl;
- if (!help_options.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_options = CLI::parse (
- CLI::HelpOptionsSpec (), args, CLI::UnknownMode::stop);
+ help_ops = help_options (args, cli::unknown_mode::stop);
}
- if (help_options.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 "
@@ -289,17 +203,17 @@ main (Int argc, Char* argv[])
return 0;
}
- if (help_options.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-tree")
{
- o << "Usage: " << args[0] << " cxx-tree [options] file [file ...]"
+ o << "Usage: " << argv[0] << " cxx-tree [options] file [file ...]"
<< endl
<< "Options:" << endl;
@@ -307,7 +221,7 @@ main (Int argc, Char* argv[])
}
else 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;
@@ -316,7 +230,7 @@ main (Int argc, Char* argv[])
else
{
o << "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;
@@ -328,7 +242,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"
@@ -351,7 +265,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;
}
@@ -359,7 +273,7 @@ main (Int argc, Char* argv[])
if (cmd != "cxx-tree" && cmd != "cxx-parser")
{
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;
@@ -368,81 +282,57 @@ 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::Tree::options> tree_ops (
+ cmd == "cxx-tree" ? new CXX::Tree::options (args) : 0);
+
+ auto_ptr<CXX::Parser::options> parser_ops (
+ cmd == "cxx-parser" ? new CXX::Parser::options (args) : 0);
- CLI::CommonOptions common_ops (
- CLI::parse (
- common_spec,
- args,
- CLI::UnknownMode::skip,
- CLI::UnknownMode::skip));
+ CXX::options& common_ops (
+ cmd == "cxx-tree"
+ ? static_cast<CXX::options&> (*tree_ops)
+ : static_cast<CXX::options&> (*parser_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 ());
- if (common_ops.value<CLI::morph_anonymous> () &&
- !disabled_w_all && disabled_w.find ("D001") == disabled_w.end ())
+ if (common_ops.morph_anonymous () &&
+ !disabled_w_all &&
+ disabled_w.find ("D001") == disabled_w.end ())
{
e << "warning D001: the --morph-anonymous option is on by default and "
<< "no longer required"
<< endl;
}
- Evptr<CXX::Tree::CLI::Options> tree_ops;
- Evptr<CXX::Parser::CLI::Options> parser_ops;
-
- Boolean show_sloc (false);
-
- if (cmd == "cxx-tree")
- {
- tree_ops = new CXX::Tree::CLI::Options (
- CLI::parse (CXX::Tree::Generator::options_spec (), args));
-
- tree_ops->value<CXX::Tree::CLI::disable_multi_import> () =
- common_ops.value<CLI::disable_multi_import> ();
-
- show_sloc = tree_ops->value<CXX::Tree::CLI::show_sloc> ();
- }
- else if (cmd == "cxx-parser")
- {
- parser_ops = new CXX::Parser::CLI::Options (
- CLI::parse (CXX::Parser::Generator::options_spec (), args));
-
- show_sloc = parser_ops->value<CXX::Parser::CLI::show_sloc> ();
- }
+ // Collect all the files to compile in a vector.
+ //
+ NarrowStrings files;
+ while (args.more ())
+ files.push_back (args.next ());
- 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 ());
if (cmd == "cxx-tree" || cmd == "cxx-parser")
{
- Boolean gen (false), use (false);
-
- if (cmd == "cxx-tree")
- {
- gen = tree_ops->value<CXX::Tree::CLI::generate_xml_schema> ();
- use = tree_ops->value<CXX::Tree::CLI::extern_xml_schema> ();
- }
- else if (cmd == "cxx-parser")
- {
- gen = parser_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
- use = parser_ops->value<CXX::Parser::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/
@@ -453,7 +343,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"
@@ -462,7 +352,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;
@@ -500,22 +390,22 @@ 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 ());
// Load custom string literals, if any.
//
CXX::StringLiteralMap string_literal_map;
- if (NarrowString file = common_ops.value<CLI::custom_literals> ())
+ if (NarrowString file = common_ops.custom_literals ())
{
XercesInitializer xerces_init;
@@ -532,7 +422,7 @@ main (Int argc, Char* argv[])
// File-per-schema compilation mode.
//
- for (Size i (1); i < args.size (); ++i)
+ for (Size i (0); i < files.size (); ++i)
{
// Parse schema.
//
@@ -540,11 +430,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;
@@ -552,8 +442,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
cmd != "cxx-tree",
- !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);
@@ -567,36 +457,14 @@ 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);
-
- if (cmd == "cxx-tree")
- {
- gen_xml_schema =
- tree_ops->value<CXX::Tree::CLI::generate_xml_schema> ();
+ bool gen_xml_schema (common_ops.generate_xml_schema ());
- if (gen_xml_schema)
- {
- if (NarrowString name =
- tree_ops->value<CXX::Tree::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != name)
- gen_xml_schema = false;
- }
- }
- }
- else if (cmd == "cxx-parser")
+ if (gen_xml_schema)
{
- gen_xml_schema =
- parser_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
+ if (NarrowString name = common_ops.extern_xml_schema ())
{
- if (NarrowString name =
- parser_ops->value<CXX::Parser::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != name)
- gen_xml_schema = false;
- }
+ if (tu.native_file_string () != name)
+ gen_xml_schema = false;
}
}
@@ -610,7 +478,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -727,16 +595,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;
@@ -745,7 +613,7 @@ main (Int argc, Char* argv[])
if (cmd == "cxx-parser" &&
paths.size () > 1 &&
- parser_ops->value<CXX::Parser::CLI::generate_test_driver> ())
+ parser_ops->generate_test_driver ())
{
e << "info: generating test driver for the first schema only: '" <<
paths[0] << "'" << endl;
@@ -753,8 +621,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
cmd != "cxx-tree",
- !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);
@@ -762,7 +630,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -819,14 +687,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 ());
Schemas schemas (trans.transform (*schema));
@@ -891,7 +759,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;
@@ -908,10 +776,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;
@@ -926,7 +794,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;
@@ -940,10 +808,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)
{
@@ -978,26 +846,10 @@ main (Int argc, Char* argv[])
{
// Diagnostic has already been issued.
}
- catch (CLI::UnexpectedOption const& e)
- {
- wcerr << "error: unknown option '" << e.option ().c_str () << "'" << endl
- << "info: try '" << argv[0] << " help' for usage information"
- << endl;
- }
- catch (CLI::OptionFormat const& e)
+ catch (cli::exception const& ex)
{
- 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;
@@ -1014,7 +866,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 '='.
//
@@ -1033,7 +885,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
{
@@ -1109,7 +961,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
{
@@ -1171,7 +1023,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
@@ -1187,7 +1039,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