diff options
Diffstat (limited to 'xsde/cxx/serializer/validator.cxx')
-rw-r--r-- | xsde/cxx/serializer/validator.cxx | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/xsde/cxx/serializer/validator.cxx b/xsde/cxx/serializer/validator.cxx index af4dfd1..492c192 100644 --- a/xsde/cxx/serializer/validator.cxx +++ b/xsde/cxx/serializer/validator.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <iostream> + #include <cxx/serializer/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -10,9 +13,7 @@ #include <cxx/serializer/elements.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Serializer::options const& ops, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, ops, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -40,8 +41,8 @@ namespace CXX } public: - Boolean - is_disabled (Char const* w) + bool + is_disabled (char const* w) { return disabled_warnings_all_ || disabled_warnings_.find (w) != disabled_warnings_.end (); @@ -76,10 +77,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -97,7 +98,7 @@ namespace CXX *this >> schema_names_ >> ns_ >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -141,7 +142,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -150,7 +151,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("S001")) @@ -174,7 +175,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -194,7 +195,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -208,12 +209,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -255,18 +256,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -286,12 +287,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -330,9 +331,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -356,7 +357,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -399,14 +400,14 @@ namespace CXX }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -422,9 +423,9 @@ namespace CXX // // { - Boolean ref (ops.root_element_first ()); - Boolean rel (ops.root_element_last ()); - Boolean re (ops.root_element ()); + bool ref (ops.root_element_first ()); + bool rel (ops.root_element_last ()); + bool re (ops.root_element ()); if ((ref && rel) || (ref && re) || (rel && re)) { |