From bada6666c70977a058755ccf232e7d67b24adeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:21:29 +0200 Subject: New upstream release --- xsd/xsd/cxx/tree/options.cxx | 1149 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1149 insertions(+) create mode 100644 xsd/xsd/cxx/tree/options.cxx (limited to 'xsd/xsd/cxx/tree/options.cxx') diff --git a/xsd/xsd/cxx/tree/options.cxx b/xsd/xsd/cxx/tree/options.cxx new file mode 100644 index 0000000..820ebac --- /dev/null +++ b/xsd/xsd/cxx/tree/options.cxx @@ -0,0 +1,1149 @@ +// This code was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include +// +// End prologue. + +#include + +#include +#include +#include +#include +#include +#include + +namespace cli +{ + template + struct parser + { + static void + parse (X& x, bool& xs, scanner& s) + { + std::string o (s.next ()); + + if (s.more ()) + { + std::string v (s.next ()); + std::istringstream is (v); + if (!(is >> x && is.eof ())) + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (bool& x, scanner& s) + { + s.next (); + x = true; + } + }; + + template <> + struct parser + { + static void + parse (std::string& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + x = s.next (); + else + throw missing_value (o); + + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::vector& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.push_back (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::set& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.insert (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::map& m, bool& xs, scanner& s) + { + std::string o (s.next ()); + + if (s.more ()) + { + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + if (p == std::string::npos) + { + K k = K (); + + if (!ov.empty ()) + { + std::istringstream ks (ov); + + if (!(ks >> k && ks.eof ())) + throw invalid_value (o, ov); + } + + m[k] = V (); + } + else + { + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, p + 1); + + if (!kstr.empty ()) + { + std::istringstream ks (kstr); + + if (!(ks >> k && ks.eof ())) + throw invalid_value (o, ov); + } + + if (!vstr.empty ()) + { + std::istringstream vs (vstr); + + if (!(vs >> v && vs.eof ())) + throw invalid_value (o, ov); + } + + m[k] = v; + } + } + else + throw missing_value (o); + + xs = true; + } + }; + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, s); + } + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, x.*S, s); + } +} + +#include +#include + +namespace CXX +{ + namespace Tree + { + // options + // + + options:: + options () + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + } + + options:: + options (int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int start, + int& argc, + char** argv, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + options:: + options (int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + ::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + options:: + options (::cli::scanner& s, + ::cli::unknown_mode opt, + ::cli::unknown_mode arg) + : generate_polymorphic_ (), + polymorphic_type_ (), + polymorphic_type_specified_ (false), + polymorphic_type_all_ (), + polymorphic_plate_ (0), + polymorphic_plate_specified_ (false), + ordered_type_ (), + ordered_type_specified_ (false), + ordered_type_derived_ (), + ordered_type_mixed_ (), + ordered_type_all_ (), + order_container_ (), + order_container_specified_ (false), + generate_serialization_ (), + generate_ostream_ (), + generate_doxygen_ (), + generate_comparison_ (), + generate_default_ctor_ (), + generate_from_base_ctor_ (), + suppress_assignment_ (), + generate_detach_ (), + generate_wildcard_ (), + generate_any_type_ (), + generate_insertion_ (), + generate_insertion_specified_ (false), + generate_extraction_ (), + generate_extraction_specified_ (false), + generate_forward_ (), + suppress_parsing_ (), + generate_element_type_ (), + generate_element_map_ (), + generate_intellisense_ (), + omit_default_attributes_ (), + type_naming_ ("knr"), + type_naming_specified_ (false), + function_naming_ ("knr"), + function_naming_specified_ (false), + type_regex_ (), + type_regex_specified_ (false), + accessor_regex_ (), + accessor_regex_specified_ (false), + one_accessor_regex_ (), + one_accessor_regex_specified_ (false), + opt_accessor_regex_ (), + opt_accessor_regex_specified_ (false), + seq_accessor_regex_ (), + seq_accessor_regex_specified_ (false), + modifier_regex_ (), + modifier_regex_specified_ (false), + one_modifier_regex_ (), + one_modifier_regex_specified_ (false), + opt_modifier_regex_ (), + opt_modifier_regex_specified_ (false), + seq_modifier_regex_ (), + seq_modifier_regex_specified_ (false), + parser_regex_ (), + parser_regex_specified_ (false), + serializer_regex_ (), + serializer_regex_specified_ (false), + const_regex_ (), + const_regex_specified_ (false), + enumerator_regex_ (), + enumerator_regex_specified_ (false), + element_type_regex_ (), + element_type_regex_specified_ (false), + name_regex_trace_ (), + root_element_first_ (), + root_element_last_ (), + root_element_all_ (), + root_element_none_ (), + root_element_ (), + root_element_specified_ (false), + custom_type_ (), + custom_type_specified_ (false), + custom_type_regex_ (), + custom_type_regex_specified_ (false), + parts_ (1), + parts_specified_ (false), + parts_suffix_ ("-"), + parts_suffix_specified_ (false) + { + _parse (s, opt, arg); + } + + void options:: + print_usage (::std::wostream& os) + { + os << "--generate-polymorphic Generate polymorphism-aware code." << ::std::endl; + + os << "--polymorphic-type Indicate that is a root of a polymorphic" << ::std::endl + << " type hierarchy." << ::std::endl; + + os << "--polymorphic-type-all Indicate that all types should be treated as" << ::std::endl + << " polymorphic." << ::std::endl; + + os << "--polymorphic-plate Specify the polymorphic map plate the generated" << ::std::endl + << " code should register on." << ::std::endl; + + os << "--ordered-type Indicate that element order in is" << ::std::endl + << " significant." << ::std::endl; + + os << "--ordered-type-derived Automatically treat types derived from ordered" << ::std::endl + << " bases as also ordered." << ::std::endl; + + os << "--ordered-type-mixed Automatically treat complex types with mixed" << ::std::endl + << " content as ordered." << ::std::endl; + + os << "--ordered-type-all Indicate that element order in all types is" << ::std::endl + << " significant." << ::std::endl; + + os << "--order-container Specify a custom class template that should be" << ::std::endl + << " used as a container for the content order in" << ::std::endl + << " ordered types instead of the default" << ::std::endl + << " 'std::vector'." << ::std::endl; + + os << "--generate-serialization Generate serialization functions." << ::std::endl; + + os << "--generate-ostream Generate ostream insertion operators" << ::std::endl + << " ('operator<<') for generated types." << ::std::endl; + + os << "--generate-doxygen Generate documentation comments suitable for" << ::std::endl + << " extraction by the Doxygen documentation system." << ::std::endl; + + os << "--generate-comparison Generate comparison operators ('operator==' and" << ::std::endl + << " 'operator!=') for complex types." << ::std::endl; + + os << "--generate-default-ctor Generate default constructors even for types that" << ::std::endl + << " have required members." << ::std::endl; + + os << "--generate-from-base-ctor Generate constructors that expect an instance of a" << ::std::endl + << " base type followed by all required members." << ::std::endl; + + os << "--suppress-assignment Suppress the generation of copy assignment" << ::std::endl + << " operators for complex types." << ::std::endl; + + os << "--generate-detach Generate detach functions for required elements" << ::std::endl + << " and attributes." << ::std::endl; + + os << "--generate-wildcard Generate accessors and modifiers as well as" << ::std::endl + << " parsing and serialization code for XML Schema" << ::std::endl + << " wildcards ('any' and 'anyAttribute')." << ::std::endl; + + os << "--generate-any-type Extract and store content of the XML Schema" << ::std::endl + << " 'anyType' type as a DOM fragment." << ::std::endl; + + os << "--generate-insertion Generate data representation stream insertion" << ::std::endl + << " operators for the output stream type." << ::std::endl; + + os << "--generate-extraction Generate data representation stream extraction" << ::std::endl + << " constructors for the input stream type." << ::std::endl; + + os << "--generate-forward Generate a separate header file with forward" << ::std::endl + << " declarations for the types being generated." << ::std::endl; + + os << "--suppress-parsing Suppress the generation of the parsing functions" << ::std::endl + << " and constructors." << ::std::endl; + + os << "--generate-element-type Generate types instead of parsing and" << ::std::endl + << " serialization functions for root elements." << ::std::endl; + + os << "--generate-element-map Generate a root element map that allows uniform" << ::std::endl + << " parsing and serialization of multiple root" << ::std::endl + << " elements." << ::std::endl; + + os << "--generate-intellisense Generate workarounds for IntelliSense bugs in" << ::std::endl + << " Visual Studio 2005 (8.0)." << ::std::endl; + + os << "--omit-default-attributes Omit attributes with default and fixed values from" << ::std::endl + << " serialized XML documents." << ::std::endl; + + os << "--type-naming