// file : xsd/cxx/tree/generator.cxx // author : Boris Kolpackov // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../../../libxsd/xsd/cxx/version.hxx" using std::endl; using std::wcerr; using std::wcout; using namespace XSDFrontend::SemanticGraph; // // typedef boost::filesystem::wifstream WideInputFileStream; typedef boost::filesystem::wofstream WideOutputFileStream; namespace CXX { namespace { Char const copyright_gpl[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD, an XML Schema to\n" "// C++ data binding compiler.\n" "//\n" "// This program is free software; you can redistribute it and/or modify\n" "// it under the terms of the GNU General Public License version 2 as\n" "// published by the Free Software Foundation.\n" "//\n" "// This program is distributed in the hope that it will be useful,\n" "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "// GNU General Public License for more details.\n" "//\n" "// You should have received a copy of the GNU General Public License\n" "// along with this program; if not, write to the Free Software\n" "// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n" "//\n" "// In addition, as a special exception, Code Synthesis Tools CC gives\n" "// permission to link this program with the Xerces-C++ library (or with\n" "// modified versions of Xerces-C++ that use the same license as Xerces-C++),\n" "// and distribute linked combinations including the two. You must obey\n" "// the GNU General Public License version 2 in all respects for all of\n" "// the code used other than Xerces-C++. If you modify this copy of the\n" "// program, you may extend this exception to your version of the program,\n" "// but you are not obligated to do so. If you do not wish to do so, delete\n" "// this exception statement from your version.\n" "//\n" "// Furthermore, Code Synthesis Tools CC makes a special exception for\n" "// the Free/Libre and Open Source Software (FLOSS) which is described\n" "// in the accompanying FLOSSE file.\n" "//\n\n"; Char const copyright_proprietary[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD, an XML Schema\n" "// to C++ data binding compiler, in the Proprietary License mode.\n" "// You should have received a proprietary license from Code Synthesis\n" "// Tools CC prior to generating this code. See the license text for\n" "// conditions.\n" "//\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 () { std::wostream& o (wcout); ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o); o << "--char-type " << endl << " Use as the base character type. Valid\n" << " values are 'char' (default) and 'wchar_t'." << endl; o << "--char-encoding " << endl << " Specify the character encoding that should be used\n" << " in the object model. Valid values for the 'char'\n" << " character type are 'utf8' (default), 'iso8859-1',\n" << " 'lcp', and 'custom'. For the 'wchar_t' character\n" << " type the only valid value is 'auto'." << endl; o << "--output-dir " << endl << " Write generated files to instead of current\n" << " directory." << endl; o << "--generate-polymorphic" << endl << " Generate polymorphism-aware code. Specify this\n" << " option if you use substitution groups or xsi:type." << endl; o << "--polymorphic-type " << endl << " Indicate that is a root of a polymorphic\n" << " type hierarchy." << endl; o << "--polymorphic-type-all" << endl << " Indicate that all types should be treated as\n" << " polymorphic." << endl; o << "--generate-serialization" << endl << " Generate serialization functions. They convert an\n" << " in-memory representation back to XML." << endl; o << "--generate-inline" << endl << " Generate certain functions inline." << endl; o << "--generate-ostream" << endl << " Generate ostream insertion operators." << endl; o << "--generate-doxygen" << endl << " Generate documentation comments in the Doxygen\n" << " format." << endl; o << "--generate-comparison" << endl << " Generate comparison operators." << endl; o << "--generate-default-ctor" << endl << " Generate default constructors even for types that\n" << " have required members." << endl; o << "--generate-from-base-ctor" << endl << " Generate from-base constructors." << endl; o << "--suppress-assignment" << endl << " Suppress the generation of copy assignment\n" << " operators for complex types." << endl; o << "--generate-detach" << endl << " Generate detach functions for required members." << endl; o << "--generate-wildcard" << endl << " Generate accessors/modifiers as well as parsing\n" << " and serialization code for XML Schema wildcards." << endl; o << "--generate-insertion " << endl << " Generate data representation stream insertion\n" << " operators for the output stream type." << endl; o << "--generate-extraction " << endl << " Generate data representation stream extraction\n" << " constructors for the input stream type." << endl; o << "--generate-forward" << endl << " Generate forward declaration file." << endl; o << "--generate-xml-schema" << endl << " Generate a C++ header file as if the schema being\n" << " compiled defines the XML Schema namespace." << endl; o << "--extern-xml-schema " << endl << " Generate code as if the XML Schema namespace was\n" << " defined in and xsd:included in the schema\n" << " being compiled." << endl; o << "--suppress-parsing" << endl << " Suppress the generation of parsing functions." << endl; o << "--generate-element-type" << endl << " Generate types instead of parsing/serialization\n" << " functions for root elements." << endl; o << "--generate-element-map" << endl << " Generate a root element map that allows uniform\n" << " parsing/serialization of multiple root elements.\n" << endl; o << "--generate-intellisense" << endl << " Generate workarounds for IntelliSense bugs in\n" << " Visual Studio 2005 (8.0)." << endl; o << "--omit-default-attributes" << endl << " Omit attributes with default and fixed values\n" << " from serialized XML documents." << endl; o << "--namespace-map =" << endl << " Map XML Schema namespace to C++ namespace\n" << " . Repeat this option to specify mapping for\n" << " more than one XML Schema namespace." << endl; o << "--namespace-regex " << endl << " Add to the list of regular expressions\n" << " used to translate XML Schema namespace names to\n" << " C++ namespace names." << endl; o << "--namespace-regex-trace" << endl << " Trace the process of applying regular expressions\n" << " specified with the --namespace-regex option." << endl; o << "--reserved-name " << endl << " Add to the list of names that should not\n" << " be used as identifiers. The name can optionally\n" << " be followed by '=' and the replacement name that\n" << " should be used instead." << endl; o << "--type-naming