diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/xsd/cxx/tree/counter.cxx | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/xsd/cxx/tree/counter.cxx')
-rw-r--r-- | xsd/xsd/cxx/tree/counter.cxx | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/xsd/xsd/cxx/tree/counter.cxx b/xsd/xsd/cxx/tree/counter.cxx index 9254226..23fc221 100644 --- a/xsd/xsd/cxx/tree/counter.cxx +++ b/xsd/xsd/cxx/tree/counter.cxx @@ -1,6 +1,5 @@ // file : xsd/cxx/tree/counter.cxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include <cxx/tree/counter.hxx> @@ -15,40 +14,40 @@ namespace CXX { struct Member: Traversal::Member { - Member (UnsignedLong& complexity) + Member (size_t& complexity) : complexity_ (complexity) { } - virtual Void + virtual void traverse (Type&) { complexity_++; } - UnsignedLong& complexity_; + size_t& complexity_; }; struct Any: Traversal::Any, Traversal::AnyAttribute { - Any (UnsignedLong& complexity) + Any (size_t& complexity) : complexity_ (complexity) { } - virtual Void + virtual void traverse (SemanticGraph::Any&) { complexity_++; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { complexity_++; } - UnsignedLong& complexity_; + size_t& complexity_; }; struct TypeBase: Traversal::List, @@ -57,27 +56,27 @@ namespace CXX Traversal::Complex, Context { - TypeBase (Context& c, UnsignedLong& complexity) + TypeBase (Context& c, size_t& complexity) : Context (c), complexity_ (complexity) { } - virtual Void + virtual void traverse (SemanticGraph::List&) { complexity_++; } - virtual Void + virtual void traverse (SemanticGraph::Union&) { complexity_++; } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); @@ -86,7 +85,7 @@ namespace CXX complexity_ += (string_based ? 1 : 2); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { complexity_++; // One for the type itself. @@ -99,14 +98,14 @@ namespace CXX names >> member; - if (options.value<CLI::generate_wildcard> ()) + if (options.generate_wildcard ()) names >> any; Complex::names (c, names); } private: - UnsignedLong& complexity_; + size_t& complexity_; }; @@ -120,12 +119,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { counts_.global_types++; - UnsignedLong complexity (0); + size_t complexity (0); TypeBase type (*this, complexity); type.dispatch (t); @@ -160,7 +159,7 @@ namespace CXX } } - virtual Void + virtual void traverse (Type& e) { // Check if the previous element we saw needs to be generated. @@ -177,33 +176,33 @@ namespace CXX } private: - Void + void count_last () { if (generate_p (*last_)) { counts_.generated_global_elements++; - UnsignedLong complexity (0); + size_t complexity (0); 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. } } @@ -230,21 +229,16 @@ namespace CXX }; } - Counter:: - Counter () - { - } - 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; - Traversal::Sources sources; + Sources sources; schema >> sources >> schema; |