From c34158508eafb020fbb7bbb7c0b2479982c426cd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jun 2012 10:20:42 +0200 Subject: Completion of the CLI port --- xsde/cxx/hybrid/serializer-name-processor.cxx | 72 ++++++++++----------------- 1 file changed, 27 insertions(+), 45 deletions(-) (limited to 'xsde/cxx/hybrid/serializer-name-processor.cxx') diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx index b8cec72..4071ecb 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.cxx +++ b/xsde/cxx/hybrid/serializer-name-processor.cxx @@ -30,31 +30,17 @@ namespace CXX class Context: public CXX::Context { public: - Context (CLI::Options const& ops, + typedef Hybrid::options options_type; + + public: + Context (options_type const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path) - : CXX::Context (std::wcerr, - root, - path, - "name", - "char", - ops.value (), - ops.value (), - ops.value (), - "", // export symbol - ops.value (), - ops.value (), - ops.value (), - ops.value (), - ops.value (), - ops.value (), - ops.value (), - !ops.value (), - ops.value ()), - impl_suffix_ (ops.value ()), - aggr_suffix_ (ops.value ()), + : CXX::Context (std::wcerr, root, path, ops, "name", "char"), + impl_suffix_ (ops.simpl_type_suffix ()), + aggr_suffix_ (ops.saggr_type_suffix ()), options (ops), - aggregate (ops.value ()), + aggregate (ops.generate_aggregate ()), impl_suffix (impl_suffix_), aggr_suffix (aggr_suffix_), custom_serializer_map (custom_serializer_map_), @@ -62,10 +48,9 @@ namespace CXX { // Custom serializer mapping. // - typedef Containers::Vector Vector; - Vector const& v (ops.value ()); + NarrowStrings const& v (ops.custom_serializer ()); - for (Vector::ConstIterator i (v.begin ()), e (v.end ()); + for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ()); i != e; ++i) { String s (*i); @@ -232,7 +217,7 @@ namespace CXX Cult::Containers::Map global_type_names_; public: - CLI::Options const& options; + options_type const& options; Boolean aggregate; String const& impl_suffix; String const& aggr_suffix; @@ -258,7 +243,7 @@ namespace CXX // Type* base_enum (0); - if (options.value () || + if (options.suppress_enum () || !Hybrid::Context::enum_mapping (e, &base_enum)) { complex_.traverse (e); @@ -538,12 +523,11 @@ namespace CXX if (aggregate) { - typedef Cult::Containers::Vector Names; - Names const& names (options.value ()); + NarrowStrings const& names (options.root_type ()); // Hopefully nobody will specify more than a handful of names. // - for (Names::ConstIterator i (names.begin ()); + for (NarrowStrings::const_iterator i (names.begin ()); i != names.end (); ++i) { if (name == String (*i)) @@ -570,7 +554,7 @@ namespace CXX ~GlobalElement () { - if (last_ != 0 && options.value ()) + if (last_ != 0 && options.root_element_last ()) process (*last_); } @@ -579,36 +563,34 @@ namespace CXX { Boolean p (false); - if (last_ == 0 && options.value ()) + if (last_ == 0 && options.root_element_first ()) p = true; last_ = &e; if (!p && - !options.value () && - !options.value () && - !options.value () && - !options.value () && - options.value ().empty ()) + !options.root_element_first () && + !options.root_element_last () && + !options.root_element_all () && + !options.root_element_none () && + options.root_element ().empty ()) { // By default process them all. // p = true; } - if (!p && options.value ()) + if (!p && options.root_element_all ()) p = true; if (!p) { - typedef Cult::Containers::Vector Names; - Names const& names (options.value ()); + NarrowStrings const& names (options.root_element ()); // Hopefully nobody will specify more than a handful of names. // - for (Names::ConstIterator i (names.begin ()); - !p && i != names.end (); - ++i) + for (NarrowStrings::const_iterator i (names.begin ()); + !p && i != names.end (); ++i) { if (e.name () == String (*i)) p = true; @@ -736,7 +718,7 @@ namespace CXX Char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen"; Void - process_impl (CLI::Options const& ops, + process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, Boolean deep) @@ -802,7 +784,7 @@ namespace CXX } Boolean SerializerNameProcessor:: - process (CLI::Options const& ops, + process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, Boolean deep) -- cgit v1.1