From 54110801525371740298d5cae378bfc778749935 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jun 2012 11:50:03 +0200 Subject: Get rid of dependency on libcult --- build/import/libcult/LICENSE | 340 ----------------- build/import/libcult/configuration-rules.make | 15 - build/import/libcult/configure | 55 --- build/import/libcult/stub.make | 30 -- xsd/cxx/elements.cxx | 110 +++--- xsd/cxx/elements.hxx | 136 ++++--- xsd/cxx/literal-map.cxx | 26 +- xsd/cxx/literal-map.hxx | 10 +- xsd/cxx/options.cli | 82 ++-- xsd/cxx/parser/attribute-validation-source.cxx | 22 +- xsd/cxx/parser/attribute-validation-source.hxx | 2 +- xsd/cxx/parser/characters-validation-source.cxx | 4 +- xsd/cxx/parser/characters-validation-source.hxx | 2 +- xsd/cxx/parser/driver-source.cxx | 138 ++++--- xsd/cxx/parser/driver-source.hxx | 2 +- xsd/cxx/parser/element-validation-source.cxx | 125 +++--- xsd/cxx/parser/element-validation-source.hxx | 2 +- xsd/cxx/parser/elements.cxx | 8 +- xsd/cxx/parser/elements.hxx | 44 +-- xsd/cxx/parser/generator.cxx | 39 +- xsd/cxx/parser/generator.hxx | 15 +- xsd/cxx/parser/impl-header.cxx | 12 +- xsd/cxx/parser/impl-header.hxx | 2 +- xsd/cxx/parser/impl-source.cxx | 14 +- xsd/cxx/parser/impl-source.hxx | 2 +- xsd/cxx/parser/name-processor.cxx | 143 +++---- xsd/cxx/parser/name-processor.hxx | 6 +- xsd/cxx/parser/options.cli | 18 +- xsd/cxx/parser/parser-forward.cxx | 10 +- xsd/cxx/parser/parser-forward.hxx | 2 +- xsd/cxx/parser/parser-header.cxx | 159 ++++---- xsd/cxx/parser/parser-header.hxx | 4 +- xsd/cxx/parser/parser-inline.cxx | 39 +- xsd/cxx/parser/parser-inline.hxx | 2 +- xsd/cxx/parser/parser-source.cxx | 42 +- xsd/cxx/parser/parser-source.hxx | 2 +- xsd/cxx/parser/print-impl-common.hxx | 84 ++-- xsd/cxx/parser/state-processor.cxx | 63 +-- xsd/cxx/parser/state-processor.hxx | 7 +- xsd/cxx/parser/type-processor.cxx | 40 +- xsd/cxx/parser/type-processor.hxx | 10 +- xsd/cxx/parser/validator.cxx | 75 ++-- xsd/cxx/parser/validator.hxx | 11 +- xsd/cxx/tree/counter.cxx | 38 +- xsd/cxx/tree/default-value.cxx | 218 +++++------ xsd/cxx/tree/default-value.hxx | 128 +++---- xsd/cxx/tree/elements.cxx | 184 ++++----- xsd/cxx/tree/elements.hxx | 487 ++++++++++++------------ xsd/cxx/tree/fundamental-header.hxx | 122 +++--- xsd/cxx/tree/generator.cxx | 53 ++- xsd/cxx/tree/generator.hxx | 11 +- xsd/cxx/tree/name-processor.cxx | 208 +++++----- xsd/cxx/tree/name-processor.hxx | 6 +- xsd/cxx/tree/options.cli | 48 ++- xsd/cxx/tree/parser-header.cxx | 4 +- xsd/cxx/tree/parser-header.hxx | 2 +- xsd/cxx/tree/parser-source.cxx | 12 +- xsd/cxx/tree/parser-source.hxx | 4 +- xsd/cxx/tree/polymorphism-processor.cxx | 157 ++++---- xsd/cxx/tree/polymorphism-processor.hxx | 11 +- xsd/cxx/tree/serialization-header.cxx | 18 +- xsd/cxx/tree/serialization-header.hxx | 2 +- xsd/cxx/tree/serialization-source.cxx | 44 +-- xsd/cxx/tree/serialization-source.hxx | 6 +- xsd/cxx/tree/stream-extraction-source.cxx | 48 +-- xsd/cxx/tree/stream-extraction-source.hxx | 2 +- xsd/cxx/tree/stream-header.cxx | 14 +- xsd/cxx/tree/stream-header.hxx | 2 +- xsd/cxx/tree/stream-insertion-header.cxx | 10 +- xsd/cxx/tree/stream-insertion-header.hxx | 2 +- xsd/cxx/tree/stream-insertion-source.cxx | 36 +- xsd/cxx/tree/stream-insertion-source.hxx | 2 +- xsd/cxx/tree/stream-source.cxx | 30 +- xsd/cxx/tree/stream-source.hxx | 6 +- xsd/cxx/tree/tree-forward.cxx | 12 +- xsd/cxx/tree/tree-forward.hxx | 2 +- xsd/cxx/tree/tree-header.cxx | 100 ++--- xsd/cxx/tree/tree-header.hxx | 2 +- xsd/cxx/tree/tree-inline.cxx | 38 +- xsd/cxx/tree/tree-inline.hxx | 4 +- xsd/cxx/tree/tree-source.cxx | 235 ++++++------ xsd/cxx/tree/tree-source.hxx | 4 +- xsd/cxx/tree/validator.cxx | 75 ++-- xsd/cxx/tree/validator.hxx | 2 +- xsd/elements.hxx | 12 +- xsd/makefile | 7 +- xsd/options-parser.hxx | 7 +- xsd/options.cli | 27 +- xsd/processing/cardinality/processor.cxx | 84 ++-- xsd/processing/cardinality/processor.hxx | 8 +- xsd/processing/inheritance/processor.cxx | 60 ++- xsd/processing/inheritance/processor.hxx | 8 +- xsd/type-map/lexer.cxx | 2 +- xsd/type-map/lexer.hxx | 16 +- xsd/type-map/parser.cxx | 10 +- xsd/type-map/parser.hxx | 13 +- xsd/type-map/type-map.hxx | 29 +- xsd/types.hxx | 10 +- xsd/xsd.cxx | 132 +++---- xsd/xsd.hxx | 27 +- 100 files changed, 2128 insertions(+), 2667 deletions(-) delete mode 100644 build/import/libcult/LICENSE delete mode 100644 build/import/libcult/configuration-rules.make delete mode 100755 build/import/libcult/configure delete mode 100644 build/import/libcult/stub.make diff --git a/build/import/libcult/LICENSE b/build/import/libcult/LICENSE deleted file mode 100644 index 3912109..0000000 --- a/build/import/libcult/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/build/import/libcult/configuration-rules.make b/build/import/libcult/configuration-rules.make deleted file mode 100644 index dc19df4..0000000 --- a/build/import/libcult/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libcult/configuration-rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(dcf_root)/import/libcult/configuration-dynamic.make: | $(dcf_root)/import/libcult/. - $(call message,,$(scf_root)/import/libcult/configure $@) - -ifndef %foreign% - -disfigure:: - $(call message,rm $(dcf_root)/import/libcult/configuration-dynamic.make,\ -rm -f $(dcf_root)/import/libcult/configuration-dynamic.make) - -endif diff --git a/build/import/libcult/configure b/build/import/libcult/configure deleted file mode 100755 index afa4c9c..0000000 --- a/build/import/libcult/configure +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libcult/configure -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - - -# $1 - out file -# -# bld_root - build root -# project_name - project name -# - -source $bld_root/dialog.bash - - -$echo -$echo "Configuring external dependency on 'libcult' for '$project_name'." -$echo - -$echo -$echo "Would you like to configure dependency on the installed " -$echo "version of 'libcult' as opposed to the development build?" -$echo - -installed=`read_y_n y` - -path= - -if [ "$installed" = "n" ]; then - -$echo -$echo "Please enter the src_root for 'libcult'." -$echo - -src_root=`read_path --directory --exist` - -$echo -$echo "Please enter the out_root for 'libcult'." -$echo - -out_root=`read_path --directory $src_root` - -fi - -echo libcult_installed := $installed >$1 - -if [ "$installed" = "n" ]; then - -echo src_root := $src_root >>$1 -echo scf_root := \$\(src_root\)/build >>$1 -echo out_root := $out_root >>$1 - -fi diff --git a/build/import/libcult/stub.make b/build/import/libcult/stub.make deleted file mode 100644 index f5f7691..0000000 --- a/build/import/libcult/stub.make +++ /dev/null @@ -1,30 +0,0 @@ -# file : build/import/libcult/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(call include-once,$(scf_root)/import/libcult/configuration-rules.make,$(dcf_root)) - -libcult_installed := - -$(call -include,$(dcf_root)/import/libcult/configuration-dynamic.make) - -ifdef libcult_installed - -ifeq ($(libcult_installed),y) - -$(call export,l: -lcult,cpp-options: ) - -else - -# Include export stub. -# -$(call include,$(scf_root)/export/libcult/stub.make) - -endif - -else - -.NOTPARALLEL: - -endif diff --git a/xsd/cxx/elements.cxx b/xsd/cxx/elements.cxx index 20095e9..5181435 100644 --- a/xsd/cxx/elements.cxx +++ b/xsd/cxx/elements.cxx @@ -26,7 +26,7 @@ namespace CXX namespace { - WideChar const* keywords[] = { + wchar_t const* keywords[] = { L"NULL", L"and", L"asm", @@ -218,7 +218,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); if (pos == String::npos) throw InvalidNamespaceMapping (s, "delimiter ('=') not found"); @@ -251,7 +251,7 @@ namespace CXX // Split the string in two parts at '='. // - Size pos (s.find ('=')); + size_t pos (s.find ('=')); if (pos == String::npos) reserved_name_map_[s] = L""; @@ -261,7 +261,7 @@ namespace CXX // Populate the keyword set. // - for (Size i (0); i < sizeof (keywords) / sizeof (char*); ++i) + for (size_t i (0); i < sizeof (keywords) / sizeof (char*); ++i) keyword_set_.insert (keywords[i]); } @@ -275,7 +275,7 @@ namespace CXX using SemanticGraph::Sources; String tmp; - MapMapping::ConstIterator i (nsm_mapping.find (ns.name ())); + MapMapping::const_iterator i (nsm_mapping.find (ns.name ())); if (i != nsm_mapping.end ()) { @@ -322,7 +322,7 @@ namespace CXX // Check cache first // - MappingCache::ConstIterator i (ns_mapping_cache.find (pair)); + MappingCache::const_iterator i (ns_mapping_cache.find (pair)); if (i != ns_mapping_cache.end ()) { @@ -335,10 +335,10 @@ namespace CXX if (trace) wcerr << "namespace: '" << pair << "'" << endl; - Boolean found (false); + bool found (false); Regex colon (L"#/#::#"); - for (RegexMapping::ConstReverseIterator e (nsr_mapping.rbegin ()); + for (RegexMapping::const_reverse_iterator e (nsr_mapping.rbegin ()); e != nsr_mapping.rend (); ++e) { if (trace) @@ -482,7 +482,7 @@ namespace CXX } String Context:: - fq_name (SemanticGraph::Nameable& n, Char const* name_key) + fq_name (SemanticGraph::Nameable& n, char const* name_key) { using namespace SemanticGraph; @@ -534,17 +534,17 @@ namespace CXX escape (String const& name) { String r; - Size n (name.size ()); + size_t n (name.size ()); // In most common cases we will have that many chars. // r.reserve (n); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - Boolean first (i == 0); + bool first (i == 0); - UnsignedLong u (unicode_char (name, i)); // May advance i. + unsigned int u (unicode_char (name, i)); // May advance i. if (first) { @@ -560,7 +560,7 @@ namespace CXX u == '_')) r.push_back ('_'); else - r.push_back (static_cast (u)); + r.push_back (static_cast (u)); } if (r.empty ()) @@ -568,7 +568,7 @@ namespace CXX // Custom reserved words. // - ReservedNameMap::ConstIterator i (reserved_name_map.find (r)); + ReservedNameMap::const_iterator i (reserved_name_map.find (r)); if (i != reserved_name_map.end ()) { @@ -604,14 +604,14 @@ namespace CXX // String - charlit (UnsignedLong u) + charlit (unsigned int u) { String r ("\\x"); - Boolean lead (true); + bool lead (true); - for (Long i (7); i >= 0; --i) + for (int i (7); i >= 0; --i) { - UnsignedLong x ((u >> (i * 4)) & 0x0F); + unsigned int x ((u >> (i * 4)) & 0x0F); if (lead) { @@ -631,7 +631,7 @@ namespace CXX strlit_ascii (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -639,11 +639,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [128 - ] - unrepresentable // 127 - \x7F @@ -724,7 +724,7 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } @@ -742,7 +742,7 @@ namespace CXX return r; } - const UnsignedLong utf8_first_char_mask[5] = + const unsigned int utf8_first_char_mask[5] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0 }; @@ -751,7 +751,7 @@ namespace CXX strlit_utf8 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -759,11 +759,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [128 - ] - UTF-8 // 127 - \x7F @@ -844,15 +844,15 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } } else { - UnsignedLong count; - UnsignedLong tmp[4]; + unsigned int count; + unsigned int tmp[4]; if (u < 0x800) count = 2; @@ -884,7 +884,7 @@ namespace CXX } } - for (UnsignedLong j (0); j < count; ++j) + for (unsigned int j (0); j < count; ++j) r += charlit (tmp[j]); escape = true; @@ -900,7 +900,7 @@ namespace CXX strlit_iso8859_1 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -908,11 +908,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [256 - ] - unrepresentable // [127 - 255] - \xXX @@ -993,7 +993,7 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } @@ -1020,7 +1020,7 @@ namespace CXX strlit_utf32 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -1028,11 +1028,11 @@ namespace CXX r += L"L\""; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [128 - ] - \xUUUUUUUU // 127 - \x7F @@ -1111,7 +1111,7 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } @@ -1134,7 +1134,7 @@ namespace CXX // First see if we have a custom mapping. // assert (string_literal_map != 0); - StringLiteralMap::ConstIterator i (string_literal_map->find (str)); + StringLiteralMap::const_iterator i (string_literal_map->find (str)); if (i != string_literal_map->end ()) return i->second; @@ -1161,16 +1161,16 @@ namespace CXX { String r; - WideChar const* s (str.c_str ()); - Size size (str.size ()); + wchar_t const* s (str.c_str ()); + size_t size (str.size ()); // In most common cases we will have that many chars. // r.reserve (size); - for (WideChar const* p (s); p < s + size; ++p) + for (wchar_t const* p (s); p < s + size; ++p) { - UnsignedLong u (unicode_char (p)); // May advance p. + unsigned int u (unicode_char (p)); // May advance p. // We are going to treat \v, \f and \n as unrepresentable // here even though they can be present in C++ source code. @@ -1178,7 +1178,7 @@ namespace CXX if (u > 127 || (u < 32 && u != '\t')) r += L'?'; else - r += static_cast (u); + r += static_cast (u); } return r; @@ -1194,9 +1194,9 @@ namespace CXX wcerr << "include: '" << path << "'" << endl; String r; - Boolean found (false); + bool found (false); - for (RegexMapping::ConstReverseIterator e (include_mapping.rbegin ()); + for (RegexMapping::const_reverse_iterator e (include_mapping.rbegin ()); e != include_mapping.rend (); ++e) { if (trace) @@ -1223,8 +1223,8 @@ namespace CXX if (!r.empty () && r[0] != L'"' && r[0] != L'<') { - WideChar op (options.include_with_brackets () ? L'<' : L'"'); - WideChar cl (options.include_with_brackets () ? L'>' : L'"'); + wchar_t op (options.include_with_brackets () ? L'<' : L'"'); + wchar_t cl (options.include_with_brackets () ? L'>' : L'"'); r = op + r + cl; } @@ -1234,7 +1234,7 @@ namespace CXX // Namespace // - Void Namespace:: + void Namespace:: pre (Type& n) { String ns (ctx_.ns_name (n)); @@ -1268,7 +1268,7 @@ namespace CXX } while (true); } - Void Namespace:: + void Namespace:: post (Type& n) { String ns (ctx_.ns_name (n)); diff --git a/xsd/cxx/elements.hxx b/xsd/cxx/elements.hxx index 9ae4db8..f978f51 100644 --- a/xsd/cxx/elements.hxx +++ b/xsd/cxx/elements.hxx @@ -6,15 +6,13 @@ #ifndef CXX_ELEMENTS_HXX #define CXX_ELEMENTS_HXX +#include +#include +#include #include #include -#include -#include -#include -#include - #include #include @@ -27,8 +25,6 @@ namespace CXX { using std::endl; - typedef WideString String; - // On some platforms std::toupper can be something other than a // function with C++ linkage. @@ -42,7 +38,7 @@ namespace CXX struct UnrepresentableCharacter { - UnrepresentableCharacter (String const& str, Size pos) + UnrepresentableCharacter (String const& str, size_t pos) : str_ (str), pos_ (pos) { } @@ -53,7 +49,7 @@ namespace CXX return str_; } - Size + size_t position () const { return pos_; @@ -61,14 +57,14 @@ namespace CXX private: String str_; - Size pos_; + size_t pos_; }; struct NoNamespaceMapping { NoNamespaceMapping (SemanticGraph::Path const& file, - UnsignedLong line, - UnsignedLong column, + size_t line, + size_t column, String const& ns) : file_ (file), line_ (line), @@ -84,13 +80,13 @@ namespace CXX return file_; } - UnsignedLong + size_t line () const { return line_; } - UnsignedLong + size_t column () const { return column_; @@ -104,8 +100,8 @@ namespace CXX private: SemanticGraph::Path file_; - UnsignedLong line_; - UnsignedLong column_; + size_t line_; + size_t column_; String ns_; }; @@ -141,12 +137,12 @@ namespace CXX public: typedef cutl::re::wregex RegexPat; typedef cutl::re::wregexsub Regex; - typedef Cult::Containers::Vector RegexMapping; - typedef Cult::Containers::Map MapMapping; - typedef Cult::Containers::Map MappingCache; + typedef std::vector RegexMapping; + typedef std::map MapMapping; + typedef std::map MappingCache; - typedef Cult::Containers::Map ReservedNameMap; - typedef Cult::Containers::Set KeywordSet; + typedef std::map ReservedNameMap; + typedef std::set KeywordSet; typedef CXX::options options_type; @@ -220,11 +216,11 @@ namespace CXX // advanced by 1 if this Unicode character takes more than one // underlying character. // - static UnsignedLong - unicode_char (String const& str, Size& pos); + static unsigned int + unicode_char (String const& str, size_t& pos); - static UnsignedLong - unicode_char (WideChar const*& p); + static unsigned int + unicode_char (wchar_t const*& p); // Escape C++ keywords and illegal characters. // @@ -271,7 +267,7 @@ namespace CXX // Fully-qualified C++ name. // String - fq_name (SemanticGraph::Nameable& n, Char const* name_key = "name"); + fq_name (SemanticGraph::Nameable& n, char const* name_key = "name"); public: static SemanticGraph::Type& @@ -282,7 +278,7 @@ namespace CXX process_include_path (String const&) const; public: - static Boolean + static bool skip (SemanticGraph::Member& m) { // "Subsequent" local element. @@ -291,28 +287,28 @@ namespace CXX m.context ().count ("min") == 0; } - static UnsignedLong + static size_t min (SemanticGraph::Member const& m) { - return m.context ().get ("min"); + return m.context ().get ("min"); } - static UnsignedLong + static size_t min (SemanticGraph::Any const& a) { - return a.context ().get ("min"); + return a.context ().get ("min"); } - static UnsignedLong + static size_t max (SemanticGraph::Member const& m) { - return m.context ().get ("max"); + return m.context ().get ("max"); } - static UnsignedLong + static size_t max (SemanticGraph::Any const& a) { - return a.context ().get ("max"); + return a.context ().get ("max"); } public: @@ -380,16 +376,16 @@ namespace CXX KeywordSet keyword_set_; }; - inline UnsignedLong Context:: - unicode_char (String const& str, Size& pos) + inline unsigned int Context:: + unicode_char (String const& str, size_t& pos) { - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { return str[pos]; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { - WideChar x (str[pos]); + wchar_t x (str[pos]); if (x < 0xD800 || x > 0xDBFF) return x; @@ -400,16 +396,16 @@ namespace CXX return 0; } - inline UnsignedLong Context:: - unicode_char (WideChar const*& p) + inline unsigned int Context:: + unicode_char (wchar_t const*& p) { - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { return *p; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { - WideChar x (*p); + wchar_t x (*p); if (x < 0xD800 || x > 0xDBFF) return x; @@ -432,7 +428,7 @@ namespace CXX } private: - Cult::Containers::Set schemas_; + std::set schemas_; }; // Usual namespace mapping. @@ -444,10 +440,10 @@ namespace CXX // First scope name if always empty (global scope). The last flag // signals the last scope. // - virtual Void - enter (Type&, String const& name, Boolean last) = 0; + virtual void + enter (Type&, String const& name, bool last) = 0; - virtual Void + virtual void leave () = 0; }; @@ -462,10 +458,10 @@ namespace CXX { } - virtual Void + virtual void pre (Type&); - virtual Void + virtual void post (Type&); private: @@ -478,30 +474,30 @@ namespace CXX template struct Has : X { - Has (Boolean& result) + Has (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (typename X::Type&) { result_ = true; } private: - Boolean& result_; + bool& result_; }; // Checks if scope 'Y' names any of 'X' // template - Boolean + bool has (Y& y) { using SemanticGraph::Scope; - Boolean result (false); + bool result (false); Has t (result); for (Scope::NamesIterator i (y.names_begin ()), e (y.names_end ()); @@ -514,12 +510,12 @@ namespace CXX // Checks if the compositor has any particle of 'X' // template - Boolean + bool has_particle (SemanticGraph::Compositor& y) { using SemanticGraph::Compositor; - Boolean result (false); + bool result (false); Has t (result); for (Compositor::ContainsIterator i (y.contains_begin ()), @@ -539,7 +535,7 @@ namespace CXX // Specialization for Complex // template - Boolean + bool has_particle (SemanticGraph::Complex& c) { return c.contains_compositor_p () && @@ -558,61 +554,61 @@ namespace CXX Traversal::Fundamental::Id, Traversal::Fundamental::IdRef { - virtual Void + virtual void fundamental_type (SemanticGraph::Fundamental::Type& t) = 0; - virtual Void + virtual void fundamental_template (SemanticGraph::Fundamental::Type& t) = 0; - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Type& t) { fundamental_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { fundamental_template (t); diff --git a/xsd/cxx/literal-map.cxx b/xsd/cxx/literal-map.cxx index 5c9d8ac..e31d4aa 100644 --- a/xsd/cxx/literal-map.cxx +++ b/xsd/cxx/literal-map.cxx @@ -45,7 +45,7 @@ namespace CXX locator_ = l; } - virtual Void + virtual void startElement (const XMLCh* const, const XMLCh* const lname, const XMLCh* const, @@ -81,7 +81,7 @@ namespace CXX } } - virtual Void + virtual void endElement (const XMLCh* const, const XMLCh* const lname, const XMLCh* const) @@ -116,10 +116,10 @@ namespace CXX } #if _XERCES_VERSION >= 30000 - virtual Void + virtual void characters (const XMLCh* const s, const XMLSize_t length) #else - virtual Void + virtual void characters (const XMLCh* const s, const unsigned int length) #endif { @@ -131,9 +131,9 @@ namespace CXX lit_ += str; else { - for (Size i (0); i < str.size (); ++i) + for (size_t i (0); i < str.size (); ++i) { - WideChar c (str[i]); + wchar_t c (str[i]); if (c != 0x20 && c != 0x0A && c != 0x0D && c != 0x09) { @@ -149,30 +149,30 @@ namespace CXX // enum Severity {s_warning, s_error, s_fatal}; - virtual Void + virtual void warning (const SAXParseException& e) { handle (e, s_warning); } - virtual Void + virtual void error (const SAXParseException& e) { handle (e, s_error); } - virtual Void + virtual void fatalError (const SAXParseException& e) { handle (e, s_fatal); } - virtual Void + virtual void resetErrors () { } - Void + void handle (const SAXParseException& e, Severity s) { wcerr << file_ << ":"; @@ -243,8 +243,8 @@ namespace CXX String file_; StringLiteralMap& map_; - Boolean str_seen_; - Boolean lit_seen_; + bool str_seen_; + bool lit_seen_; String str_; String lit_; diff --git a/xsd/cxx/literal-map.hxx b/xsd/cxx/literal-map.hxx index fd8a062..c103e15 100644 --- a/xsd/cxx/literal-map.hxx +++ b/xsd/cxx/literal-map.hxx @@ -6,15 +6,13 @@ #ifndef CXX_LITERAL_MAP_HXX #define CXX_LITERAL_MAP_HXX -#include -#include +#include + +#include namespace CXX { - using namespace Cult; - typedef WideString String; - - typedef Cult::Containers::Map StringLiteralMap; + typedef std::map StringLiteralMap; bool read_literal_map (NarrowString const& file, StringLiteralMap& map); diff --git a/xsd/cxx/options.cli b/xsd/cxx/options.cli index fc73c1e..4f8aeb9 100644 --- a/xsd/cxx/options.cli +++ b/xsd/cxx/options.cli @@ -3,11 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -include ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -17,14 +15,14 @@ namespace CXX { // Character type and encoding. // - Cult::Types::NarrowString --char-type = "char" + NarrowString --char-type = "char" { "", "Generate code using the provided character instead of the default \cb{char}. Valid values are \cb{char} and \cb{wchar_t}." }; - Cult::Types::NarrowString --char-encoding + NarrowString --char-encoding { "", "Specify the character encoding that should be used in the generated @@ -42,7 +40,7 @@ namespace CXX // Output options. // - Cult::Types::NarrowString --output-dir + NarrowString --output-dir { "", "Write generated files to instead of the current directory." @@ -71,7 +69,7 @@ namespace CXX generated files for other schemas." }; - Cult::Types::NarrowString --extern-xml-schema + NarrowString --extern-xml-schema { "", "Include a header file derived from instead of generating the @@ -83,7 +81,7 @@ namespace CXX // Namespace mapping. // - std::vector --namespace-map + NarrowStrings --namespace-map { "=", "Map XML Schema namespace to C++ namespace . Repeat @@ -96,7 +94,7 @@ namespace CXX the \cb{foo::bar} C++ namespace." }; - std::vector --namespace-regex + NarrowStrings --namespace-regex { "", "Add to the list of regular expressions used to translate XML @@ -153,7 +151,7 @@ namespace CXX // Reserved names. // - std::vector --reserved-name + NarrowStrings --reserved-name { "[=]", "Add name to the list of names that should not be used as @@ -170,7 +168,7 @@ namespace CXX \cb{#include} directives." }; - Cult::Types::NarrowString --include-prefix + NarrowString --include-prefix { "", "Add to generated \cb{#include} directive paths. @@ -185,7 +183,7 @@ namespace CXX \cb{#include \"schemas/base.hxx\"}" }; - std::vector --include-regex + NarrowStrings --include-regex { "", "Add to the list of regular expressions used to transform @@ -214,7 +212,7 @@ namespace CXX regular expressions don't do what you expected them to do." }; - Cult::Types::NarrowString --guard-prefix + NarrowString --guard-prefix { "", "Add to generated header inclusion guards. The prefix is @@ -226,7 +224,7 @@ namespace CXX // File suffixes. // - Cult::Types::NarrowString --hxx-suffix = ".hxx" + NarrowString --hxx-suffix = ".hxx" { "", "Use the provided instead of the default \cb{.hxx} to @@ -235,28 +233,28 @@ namespace CXX included/imported schemas." }; - Cult::Types::NarrowString --ixx-suffix = ".ixx" + NarrowString --ixx-suffix = ".ixx" { "", "Use the provided instead of the default \cb{.ixx} to construct the name of the inline file." }; - Cult::Types::NarrowString --cxx-suffix = ".cxx" + NarrowString --cxx-suffix = ".cxx" { "", "Use the provided instead of the default \cb{.cxx} to construct the name of the source file." }; - Cult::Types::NarrowString --fwd-suffix = "-fwd.hxx" + NarrowString --fwd-suffix = "-fwd.hxx" { "", "Use the provided instead of the default \cb{-fwd.hxx} to construct the name of the forward declaration file." }; - Cult::Types::NarrowString --hxx-regex + NarrowString --hxx-regex { "", "Use the provided expression to construct the name of the header file. @@ -267,7 +265,7 @@ namespace CXX AND SHELL QUOTING section below." }; - Cult::Types::NarrowString --ixx-regex + NarrowString --ixx-regex { "", "Use the provided expression to construct the name of the inline file. @@ -276,7 +274,7 @@ namespace CXX SHELL QUOTING section below." }; - Cult::Types::NarrowString --cxx-regex + NarrowString --cxx-regex { "", "Use the provided expression to construct the name of the source file. @@ -285,7 +283,7 @@ namespace CXX SHELL QUOTING section below." }; - Cult::Types::NarrowString --fwd-regex + NarrowString --fwd-regex { "", "Use the provided expression to construct the name of the forward @@ -296,126 +294,126 @@ namespace CXX // Prologues/epilogues. // - std::vector --hxx-prologue + NarrowStrings --hxx-prologue { "", "Insert at the beginning of the header file." }; - std::vector --ixx-prologue + NarrowStrings --ixx-prologue { "", "Insert at the beginning of the inline file." }; - std::vector --cxx-prologue + NarrowStrings --cxx-prologue { "", "Insert at the beginning of the source file." }; - std::vector --fwd-prologue + NarrowStrings --fwd-prologue { "", "Insert at the beginning of the forward declaration file." }; - std::vector --prologue + NarrowStrings --prologue { "", "Insert at the beginning of each generated file for which there is no file-specific prologue." }; - std::vector --hxx-epilogue + NarrowStrings --hxx-epilogue { "", "Insert at the end of the header file." }; - std::vector --ixx-epilogue + NarrowStrings --ixx-epilogue { "", "Insert at the end of the inline file." }; - std::vector --cxx-epilogue + NarrowStrings --cxx-epilogue { "", "Insert at the end of the source file." }; - std::vector --fwd-epilogue + NarrowStrings --fwd-epilogue { "", "Insert at the end of the forward declaration file." }; - std::vector --epilogue + NarrowStrings --epilogue { "", "Insert at the end of each generated file for which there is no file-specific epilogue." }; - Cult::Types::NarrowString --hxx-prologue-file + NarrowString --hxx-prologue-file { "", "Insert the content of the at the beginning of the header file." }; - Cult::Types::NarrowString --ixx-prologue-file + NarrowString --ixx-prologue-file { "", "Insert the content of the at the beginning of the inline file." }; - Cult::Types::NarrowString --cxx-prologue-file + NarrowString --cxx-prologue-file { "", "Insert the content of the at the beginning of the source file." }; - Cult::Types::NarrowString --fwd-prologue-file + NarrowString --fwd-prologue-file { "", "Insert the content of the at the beginning of the forward declaration file." }; - Cult::Types::NarrowString --prologue-file + NarrowString --prologue-file { "", "Insert the content of the at the beginning of each generated file for which there is no file-specific prologue file." }; - Cult::Types::NarrowString --hxx-epilogue-file + NarrowString --hxx-epilogue-file { "", "Insert the content of the at the end of the header file." }; - Cult::Types::NarrowString --ixx-epilogue-file + NarrowString --ixx-epilogue-file { "", "Insert the content of the at the end of the inline file." }; - Cult::Types::NarrowString --cxx-epilogue-file + NarrowString --cxx-epilogue-file { "", "Insert the content of the at the end of the source file." }; - Cult::Types::NarrowString --fwd-epilogue-file + NarrowString --fwd-epilogue-file { "", "Insert the content of the at the end of the forward declaration file." }; - Cult::Types::NarrowString --epilogue-file + NarrowString --epilogue-file { "", "Insert the content of the at the end of each generated file @@ -424,7 +422,7 @@ namespace CXX // Export options. // - Cult::Types::NarrowString --export-symbol + NarrowString --export-symbol { "", "Insert in places where DLL export/import control statements diff --git a/xsd/cxx/parser/attribute-validation-source.cxx b/xsd/cxx/parser/attribute-validation-source.cxx index 2f07125..4aadb62 100644 --- a/xsd/cxx/parser/attribute-validation-source.cxx +++ b/xsd/cxx/parser/attribute-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (a.name ()); @@ -39,7 +39,7 @@ namespace CXX os << "n == " << strlit (name) << " && ns.empty ()"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& ns (a.definition_namespace ().name ()); @@ -93,7 +93,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -149,7 +149,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "if ("; @@ -177,7 +177,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -195,7 +195,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -227,16 +227,16 @@ namespace CXX names_attribute_state_check_ >> attribute_state_check_; } - virtual Void + virtual void traverse (Type& c) { - Boolean has_att (has (c)); - Boolean has_any (has (c)); + bool has_att (has (c)); + bool has_any (has (c)); if (!has_att && !has_any) return; - Boolean has_req_att (false); + bool has_req_att (false); if (has_att) { RequiredAttributeTest test (has_req_att); @@ -380,7 +380,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsd/cxx/parser/attribute-validation-source.hxx b/xsd/cxx/parser/attribute-validation-source.hxx index dd76ba6..72010b6 100644 --- a/xsd/cxx/parser/attribute-validation-source.hxx +++ b/xsd/cxx/parser/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsd/cxx/parser/characters-validation-source.cxx b/xsd/cxx/parser/characters-validation-source.cxx index 69803e5..900bc0d 100644 --- a/xsd/cxx/parser/characters-validation-source.cxx +++ b/xsd/cxx/parser/characters-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { if (!c.mixed_p ()) @@ -46,7 +46,7 @@ namespace CXX }; } - Void + void generate_characters_validation_source (Context& ctx) { //@@ Most of the time there is no mixed content type so diff --git a/xsd/cxx/parser/characters-validation-source.hxx b/xsd/cxx/parser/characters-validation-source.hxx index 445f168..46135cd 100644 --- a/xsd/cxx/parser/characters-validation-source.hxx +++ b/xsd/cxx/parser/characters-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_characters_validation_source (Context&); } } diff --git a/xsd/cxx/parser/driver-source.cxx b/xsd/cxx/parser/driver-source.cxx index 4d0294e..6a69442 100644 --- a/xsd/cxx/parser/driver-source.cxx +++ b/xsd/cxx/parser/driver-source.cxx @@ -3,16 +3,17 @@ // 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 +using namespace std; namespace CXX { @@ -20,11 +21,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map - TypeInstanceMap; - - typedef Cult::Containers::Set InstanceSet; + typedef map TypeInstanceMap; + typedef set InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -38,7 +36,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -47,7 +45,7 @@ namespace CXX names (c); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -130,7 +128,7 @@ namespace CXX names_ >> member_ >> belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -142,7 +140,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -156,7 +154,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -175,13 +173,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { fund_type (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -189,7 +187,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -197,79 +195,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fund_type (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fund_type (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fund_type (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fund_type (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fund_type (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fund_type (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fund_type (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fund_type (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fund_type (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fund_type (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fund_type (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fund_type (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fund_type (t, "negative_integer"); @@ -277,19 +275,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fund_type (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { fund_type (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { fund_type (t, "decimal"); @@ -297,49 +295,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { fund_type (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { fund_type (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { fund_type (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { fund_type (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { fund_type (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { fund_type (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { fund_type (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { fund_type (t, "language"); @@ -348,7 +346,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -357,19 +355,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { fund_type (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { fund_type (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { fund_type (t, "idrefs"); @@ -377,7 +375,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -385,13 +383,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { fund_type (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { fund_type (t, "hex_binary"); @@ -400,55 +398,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { fund_type (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { fund_type (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { fund_type (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { fund_type (t, "day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { fund_type (t, "month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { fund_type (t, "month_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { fund_type (t, "year"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { fund_type (t, "year_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { fund_type (t, "time"); @@ -456,20 +454,20 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { fund_type (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { fund_type (t, "entities"); } private: - virtual Void + virtual void fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -487,7 +485,7 @@ namespace CXX String base_name (escape (raw_name + L"_p")); String name (base_name); - for (UnsignedLong i (1); set_.find (name) != set_.end (); ++i) + for (size_t i (1); set_.find (name) != set_.end (); ++i) { std::wostringstream os; os << i; @@ -527,7 +525,7 @@ namespace CXX names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -536,7 +534,7 @@ namespace CXX names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -547,7 +545,7 @@ namespace CXX os << map_[&l.argumented ().type ()]; } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) @@ -567,7 +565,7 @@ namespace CXX Traversal::Inherits inherits_; Traversal::Names names_; - Boolean first_; + bool first_; }; struct ParserConnect: Traversal::List, @@ -585,7 +583,7 @@ namespace CXX names_ >> member_ >> belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -598,7 +596,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -624,7 +622,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -647,7 +645,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set type_set_; + set type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -658,7 +656,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure diff --git a/xsd/cxx/parser/driver-source.hxx b/xsd/cxx/parser/driver-source.hxx index b346720..956f733 100644 --- a/xsd/cxx/parser/driver-source.hxx +++ b/xsd/cxx/parser/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_driver_source (Context&); } } diff --git a/xsd/cxx/parser/element-validation-source.cxx b/xsd/cxx/parser/element-validation-source.cxx index 4f55ad1..3acba34 100644 --- a/xsd/cxx/parser/element-validation-source.cxx +++ b/xsd/cxx/parser/element-validation-source.cxx @@ -3,12 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include #include -#include +using namespace std; namespace CXX { @@ -16,8 +18,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector Particles; - + typedef vector Particles; // // @@ -31,7 +32,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (e.name ()); @@ -62,7 +63,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -109,7 +110,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // This compositor should already have been tested for @@ -117,9 +118,9 @@ namespace CXX // Particles const& p (c.context ().get ("prefixes")); - Boolean paren (p.size () != 1); + bool paren (p.size () != 1); - for (Particles::ConstIterator i (p.begin ()), e (p.end ()); + for (Particles::const_iterator i (p.begin ()), e (p.end ()); i != e;) { if (paren) @@ -150,21 +151,21 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); os << strlit (ns) << ", " << strlit (e.name ()); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (*a.namespace_begin ()); os << strlit (ns) << ", " << L << "\"*\""; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { Particles const& p (c.context ().get ("prefixes")); @@ -187,7 +188,7 @@ namespace CXX // Generate sub-parser setup code as well as the pre/post calls. // - Void + void pre_post_calls (SemanticGraph::Particle& p) { using SemanticGraph::Element; @@ -197,7 +198,7 @@ namespace CXX { SemanticGraph::Type& type (e->type ()); String const& fq_type (fq_name (type)); - Boolean poly (polymorphic && !anonymous (type)); + bool poly (polymorphic && !anonymous (type)); String name, inst, def_parser, map; @@ -342,10 +343,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong state (e.context ().get ("state")); + size_t state (e.context ().get ("state")); if (state != 0) os << "else "; @@ -393,14 +394,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { using SemanticGraph::Element; - UnsignedLong state (p.context ().get ("state")); + size_t state (p.context ().get ("state")); - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state << "UL:" << endl << "{"; @@ -476,15 +477,15 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Compositor; - UnsignedLong max (c.max ()); - UnsignedLong min (c.context ().get ("effective-min")); - UnsignedLong n (c.context ().get ("comp-number")); - UnsignedLong state (c.context ().get ("state")); + size_t max (c.max ()); + size_t min (c.context ().get ("effective-min")); + size_t n (c.context ().get ("comp-number")); + size_t state (c.context ().get ("state")); String func (c.is_a () ? "choice_" : "sequence_"); @@ -494,7 +495,7 @@ namespace CXX << "unsigned long s (~0UL);" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -507,7 +508,7 @@ namespace CXX if (!p.context ().count ("prefix")) break; - UnsignedLong state (p.context ().get ("state")); + size_t state (p.context ().get ("state")); if (first) first = false; @@ -610,8 +611,8 @@ namespace CXX ParticleInCompositor { ParticleInSequence (Context& c, - UnsignedLong state, - UnsignedLong next_state, + size_t state, + size_t next_state, SemanticGraph::Complex& type) : ParticleInCompositor (c, type), state_ (state), particle_name_ (c) @@ -628,10 +629,10 @@ namespace CXX next_state_ = L"~0"; } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state_ << "UL:" << endl << "{" @@ -705,14 +706,14 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Compositor; - UnsignedLong max (c.max ()); - UnsignedLong min (c.context ().get ("effective-min")); - UnsignedLong n (c.context ().get ("comp-number")); + size_t max (c.max ()); + size_t min (c.context ().get ("effective-min")); + size_t n (c.context ().get ("comp-number")); String func (c.is_a () ? "choice_" : "sequence_"); @@ -722,7 +723,7 @@ namespace CXX << "unsigned long s (~0UL);" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -735,7 +736,7 @@ namespace CXX if (!p.context ().count ("prefix")) break; - UnsignedLong state (p.context ().get ("state")); + size_t state (p.context ().get ("state")); if (first) first = false; @@ -827,7 +828,7 @@ namespace CXX } private: - UnsignedLong state_; + size_t state_; String next_state_; ParticleName particle_name_; @@ -848,7 +849,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("comp-number")) // Empty compositor. @@ -889,7 +890,7 @@ namespace CXX Element& e (dynamic_cast (ci->particle ())); String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); - UnsignedLong state (e.context ().get ("state")); + size_t state (e.context ().get ("state")); os << "if (count[" << state << "UL] == 0)" << endl << "this->_expected_element (" << endl @@ -905,7 +906,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!c.context().count ("comp-number")) // Empty compositor. @@ -913,7 +914,7 @@ namespace CXX using SemanticGraph::Compositor; - UnsignedLong n (c.context ().get ("comp-number")); + size_t n (c.context ().get ("comp-number")); os << "void " << ename (type_) << "::" << endl << "choice_" << n << " (unsigned long& state," << endl @@ -951,7 +952,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("comp-number")) // Empty compositor. @@ -959,7 +960,7 @@ namespace CXX using SemanticGraph::Compositor; - UnsignedLong n (s.context ().get ("comp-number")); + size_t n (s.context ().get ("comp-number")); os << "void " << ename (type_) << "::" << endl << "sequence_" << n << " (unsigned long& state," << endl @@ -974,7 +975,7 @@ namespace CXX << "switch (state)" << "{"; - UnsignedLong state (0); + size_t state (0); for (Compositor::ContainsIterator ci (s.contains_begin ()), ce (s.contains_end ()); ci != ce;) @@ -997,7 +998,7 @@ namespace CXX ci->particle ().is_a () && !ci->particle ().context().count ("comp-number")); - UnsignedLong next (ci == ce ? 0 : state + 1); + size_t next (ci == ce ? 0 : state + 1); ParticleInSequence t (*this, state++, next, type_); t.dispatch (p); @@ -1030,7 +1031,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // Clear the counts and push the initial state. @@ -1042,7 +1043,7 @@ namespace CXX traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "v_state_& vs = *static_cast< v_state_* > (" << @@ -1071,7 +1072,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { // The 'all' state machine reaches the final state only @@ -1089,14 +1090,14 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Compositor; - UnsignedLong max (c.max ()); - UnsignedLong min (c.context ().get ("effective-min")); - UnsignedLong n (c.context ().get ("comp-number")); + size_t max (c.max ()); + size_t min (c.context ().get ("effective-min")); + size_t n (c.context ().get ("comp-number")); String func (c.is_a () ? "choice_" : "sequence_"); @@ -1128,7 +1129,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); // Note that we don't need to worry about the compositor // being empty - this case is handled by our caller. @@ -1144,7 +1145,7 @@ namespace CXX if (!p.context ().count ("prefix")) break; - UnsignedLong state (p.context ().get ("state")); + size_t state (p.context ().get ("state")); if (first) first = false; @@ -1246,7 +1247,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { os << "all_0 (vd.state, v_all_count_.top (), " << @@ -1254,7 +1255,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "assert (vd.func != 0);" @@ -1281,7 +1282,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Element; @@ -1300,7 +1301,7 @@ namespace CXX << "all_0 (vd.state, v_all_count_.top (), empty, empty, 0, true);" << "}"; - if (a.context ().get ("effective-min") != 0) + if (a.context ().get ("effective-min") != 0) { os << "else" << endl << "this->_expected_element (" << endl; @@ -1315,10 +1316,10 @@ namespace CXX << "v_all_count_.pop ();"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { - UnsignedLong min (c.context ().get ("effective-min")); + size_t min (c.context ().get ("effective-min")); os << "v_state_& vs = *static_cast< v_state_* > (" << "this->v_state_stack_.top ());" @@ -1368,7 +1369,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { // Nothing to generate if we don't have any elements and wildcards. @@ -1385,7 +1386,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( c.inherits_p () && c.inherits ().is_a ()); @@ -1570,7 +1571,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { ctx.os << "#include " << endl diff --git a/xsd/cxx/parser/element-validation-source.hxx b/xsd/cxx/parser/element-validation-source.hxx index 276cbe2..9feb9a2 100644 --- a/xsd/cxx/parser/element-validation-source.hxx +++ b/xsd/cxx/parser/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsd/cxx/parser/elements.cxx b/xsd/cxx/parser/elements.cxx index 556398a..a721ea8 100644 --- a/xsd/cxx/parser/elements.cxx +++ b/xsd/cxx/parser/elements.cxx @@ -129,7 +129,7 @@ namespace CXX { } - Boolean Context:: + bool Context:: anonymous (SemanticGraph::Type& t) { return t.context ().count ("anonymous"); @@ -179,20 +179,20 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { os << "class " << t.context ().get (name_key_) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type // compilation model. // SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (type_ == header || type_ == impl_header)) { diff --git a/xsd/cxx/parser/elements.hxx b/xsd/cxx/parser/elements.hxx index 8b57b61..e9cbb6f 100644 --- a/xsd/cxx/parser/elements.hxx +++ b/xsd/cxx/parser/elements.hxx @@ -54,7 +54,7 @@ namespace CXX Context (Context& c, std::wostream& o); public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -73,7 +73,7 @@ namespace CXX content (SemanticGraph::Complex&); public: - static Boolean + static bool anonymous (SemanticGraph::Type&); public: @@ -110,8 +110,8 @@ namespace CXX String& cerr_inst; String& parser_map; String& std_string_type; - Boolean& validation; - Boolean& polymorphic; + bool& validation; + bool& polymorphic; Regex const* hxx_expr; Regex const* ixx_expr; @@ -126,20 +126,20 @@ namespace CXX String cerr_inst_; String parser_map_; String std_string_type_; - Boolean validation_; - Boolean polymorphic_; + bool validation_; + bool polymorphic_; }; // // struct RequiredAttributeTest: Traversal::Attribute { - RequiredAttributeTest (Boolean& result) + RequiredAttributeTest (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (!result_ && !a.optional_p ()) @@ -147,7 +147,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; // @@ -157,14 +157,14 @@ namespace CXX Traversal::Member, Context { - ParserParamDecl (Context& c, Boolean name_arg) + ParserParamDecl (Context& c, bool name_arg) : Context (c), first_ (true), name_arg_ (name_arg) { inherits_ >> *this; names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -173,7 +173,7 @@ namespace CXX names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -189,7 +189,7 @@ namespace CXX os << " /* " << comment (l.name ()) << " item */"; } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) return; @@ -211,8 +211,8 @@ namespace CXX Traversal::Inherits inherits_; Traversal::Names names_; - Boolean first_; - Boolean name_arg_; + bool first_; + bool name_arg_; }; @@ -220,16 +220,16 @@ namespace CXX // struct TypeForward: Traversal::Type, Context { - TypeForward (Context& c, Char const* name_key) + TypeForward (Context& c, char const* name_key) : Context (c), name_key_ (name_key) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); private: - Char const* name_key_; + char const* name_key_; }; struct Includes: Traversal::Imports, @@ -251,20 +251,20 @@ namespace CXX schema_ >> schema_names_ >> namespace_ >> names_ >> type_forward_; } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse_ (i); } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse_ (i); } private: - Void + void traverse_ (SemanticGraph::Uses&); private: @@ -290,7 +290,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsd/cxx/parser/generator.cxx b/xsd/cxx/parser/generator.cxx index 338705e..7ef7183 100644 --- a/xsd/cxx/parser/generator.cxx +++ b/xsd/cxx/parser/generator.cxx @@ -9,9 +9,6 @@ #include -#include -#include - #include #include #include @@ -71,7 +68,7 @@ namespace CXX { namespace { - Char const copyright_gpl[] = + 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" @@ -105,7 +102,7 @@ namespace CXX "// in the accompanying FLOSSE file.\n" "//\n\n"; - Char const copyright_proprietary[] = + 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" @@ -115,7 +112,7 @@ namespace CXX "// conditions.\n" "//\n\n"; - Char const copyright_impl[] = + char const copyright_impl[] = "// Not copyrighted - public domain.\n" "//\n" "// This sample parser implementation was generated by CodeSynthesis XSD,\n" @@ -124,7 +121,7 @@ namespace CXX "//\n\n"; } - Void Parser::Generator:: + void Parser::Generator:: usage () { CXX::Parser::options::print_usage (wcout); @@ -134,7 +131,7 @@ namespace CXX namespace { template - Void + void open (S& ifs, NarrowString const& path) { try @@ -159,7 +156,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -179,7 +176,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -195,13 +192,13 @@ namespace CXX } - UnsignedLong Parser::Generator:: + size_t Parser::Generator:: generate (Parser::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, StringLiteralMap const& string_literal_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) @@ -212,7 +209,7 @@ namespace CXX try { - Boolean generate_xml_schema (ops.generate_xml_schema ()); + bool generate_xml_schema (ops.generate_xml_schema ()); // We could be compiling several schemas at once in which case // handling of the --generate-xml-schema option gets tricky: we @@ -228,11 +225,11 @@ namespace CXX } } - Boolean impl (!generate_xml_schema && + bool impl (!generate_xml_schema && (ops.generate_noop_impl () || ops.generate_print_impl ())); - Boolean driver (gen_driver && !generate_xml_schema && + bool driver (gen_driver && !generate_xml_schema && ops.generate_test_driver ()); // Evaluate the graph for possibility of generating something useful. @@ -251,7 +248,7 @@ namespace CXX proc.process (ops, schema, file_path, string_literal_map); } - Boolean validation ((ops.xml_parser () == "expat" || + bool validation ((ops.xml_parser () == "expat" || ops.generate_validation ()) && !ops.suppress_validation ()); @@ -393,8 +390,8 @@ namespace CXX // // - Boolean inline_ (ops.generate_inline () && !generate_xml_schema); - Boolean source (!generate_xml_schema); + bool inline_ (ops.generate_inline () && !generate_xml_schema); + bool source (!generate_xml_schema); // Generate code. // @@ -697,7 +694,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -740,7 +737,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); typedef compiler::ostream_filter diff --git a/xsd/cxx/parser/generator.hxx b/xsd/cxx/parser/generator.hxx index 8391553..2af6d60 100644 --- a/xsd/cxx/parser/generator.hxx +++ b/xsd/cxx/parser/generator.hxx @@ -6,14 +6,11 @@ #ifndef CXX_PARSER_GENERATOR_HXX #define CXX_PARSER_GENERATOR_HXX -#include - -#include - #include // Path #include #include +#include #include #include @@ -22,23 +19,21 @@ namespace CXX { namespace Parser { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean file_per_type, + bool file_per_type, StringLiteralMap const&, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks); diff --git a/xsd/cxx/parser/impl-header.cxx b/xsd/cxx/parser/impl-header.cxx index 5d47cae..99e80dd 100644 --- a/xsd/cxx/parser/impl-header.cxx +++ b/xsd/cxx/parser/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -51,7 +51,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -98,7 +98,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -130,7 +130,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -161,7 +161,7 @@ namespace CXX names_parser_callback_ >> parser_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (eimpl (c)); @@ -202,7 +202,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsd/cxx/parser/impl-header.hxx b/xsd/cxx/parser/impl-header.hxx index 0d0b06d..4f769d6 100644 --- a/xsd/cxx/parser/impl-header.hxx +++ b/xsd/cxx/parser/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_header (Context&); } } diff --git a/xsd/cxx/parser/impl-source.cxx b/xsd/cxx/parser/impl-source.cxx index 3f5aec5..bf605c7 100644 --- a/xsd/cxx/parser/impl-source.cxx +++ b/xsd/cxx/parser/impl-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -91,7 +91,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -164,7 +164,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -221,7 +221,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -268,12 +268,12 @@ namespace CXX names_parser_callback_ >> parser_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (eimpl (c)); - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); os << "// " << name << endl << "//" << endl @@ -354,7 +354,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { if (ctx.options.generate_print_impl ()) diff --git a/xsd/cxx/parser/impl-source.hxx b/xsd/cxx/parser/impl-source.hxx index eabcd1c..a958c4a 100644 --- a/xsd/cxx/parser/impl-source.hxx +++ b/xsd/cxx/parser/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_source (Context&); } } diff --git a/xsd/cxx/parser/name-processor.cxx b/xsd/cxx/parser/name-processor.cxx index 2812ef4..7cd959c 100644 --- a/xsd/cxx/parser/name-processor.cxx +++ b/xsd/cxx/parser/name-processor.cxx @@ -3,15 +3,18 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + #include #include #include -#include -#include -#include +using namespace std; namespace CXX { @@ -27,7 +30,7 @@ namespace CXX { // // - typedef Cult::Containers::Set NameSet; + typedef set NameSet; class Context: public CXX::Context { @@ -67,7 +70,7 @@ namespace CXX String base_name (escape (n)); String name (base_name); - for (UnsignedLong i (1); set.find (name) != set.end (); ++i) + for (size_t i (1); set.find (name) != set.end (); ++i) { std::wostringstream os; os << i; @@ -82,16 +85,16 @@ namespace CXX String const skel_suffix_; String const impl_suffix_; - Cult::Containers::Map global_type_names_; + map global_type_names_; public: - Boolean const impl; + bool const impl; String const& skel_suffix; String const& impl_suffix; - Cult::Containers::Map& global_type_names; + map& global_type_names; - Boolean polymorphic; + bool polymorphic; }; @@ -104,7 +107,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Parser::Context::skip (m)) @@ -124,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Parser::Context::skip (m)) @@ -227,7 +230,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Parser::Context::skip (m)) @@ -264,13 +267,13 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Parser::Context::skip (m)) return; - Boolean poly (polymorphic && + bool poly (polymorphic && m.is_a () && !m.type ().context ().count ("anonymous")); @@ -328,7 +331,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -350,7 +353,7 @@ namespace CXX // inheriting by restriction in which case we need to have // the same names as our base. // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) { @@ -443,7 +446,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& c (t.context ()); @@ -512,7 +515,7 @@ namespace CXX String base_name (escape (L"post_" + n)); String post (base_name); - for (UnsignedLong i (1); set.find (post) != set.end (); ++i) + for (size_t i (1); set.find (post) != set.end (); ++i) { std::wostringstream os; os << i; @@ -535,7 +538,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { NameSet& type_set (global_type_names[ns.name ()]); @@ -613,7 +616,7 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { t.context ().set ("name", make_skel_name ("any_type")); @@ -621,7 +624,7 @@ namespace CXX t.context ().set ("post", String ("post_any_type")); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { t.context ().set ("name", make_skel_name ("any_simple_type")); @@ -631,7 +634,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { t.context ().set ("name", make_skel_name ("boolean")); @@ -641,7 +644,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { t.context ().set ("name", make_skel_name ("byte")); @@ -649,7 +652,7 @@ namespace CXX t.context ().set ("post", String ("post_byte")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { t.context ().set ("name", make_skel_name ("unsigned_byte")); @@ -657,7 +660,7 @@ namespace CXX t.context ().set ("post", String ("post_unsigned_byte")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { t.context ().set ("name", make_skel_name ("short")); @@ -665,7 +668,7 @@ namespace CXX t.context ().set ("post", String ("post_short")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { t.context ().set ("name", make_skel_name ("unsigned_short")); @@ -673,7 +676,7 @@ namespace CXX t.context ().set ("post", String ("post_unsigned_short")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { t.context ().set ("name", make_skel_name ("int")); @@ -681,7 +684,7 @@ namespace CXX t.context ().set ("post", String ("post_int")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { t.context ().set ("name", make_skel_name ("unsigned_int")); @@ -689,7 +692,7 @@ namespace CXX t.context ().set ("post", String ("post_unsigned_int")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { t.context ().set ("name", make_skel_name ("long")); @@ -697,7 +700,7 @@ namespace CXX t.context ().set ("post", String ("post_long")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { t.context ().set ("name", make_skel_name ("unsigned_long")); @@ -705,7 +708,7 @@ namespace CXX t.context ().set ("post", String ("post_unsigned_long")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { t.context ().set ("name", make_skel_name ("integer")); @@ -713,7 +716,7 @@ namespace CXX t.context ().set ("post", String ("post_integer")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { t.context ().set ("name", make_skel_name ("non_positive_integer")); @@ -721,7 +724,7 @@ namespace CXX t.context ().set ("post", String ("post_non_positive_integer")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { t.context ().set ("name", make_skel_name ("non_negative_integer")); @@ -729,7 +732,7 @@ namespace CXX t.context ().set ("post", String ("post_non_negative_integer")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { t.context ().set ("name", make_skel_name ("positive_integer")); @@ -737,7 +740,7 @@ namespace CXX t.context ().set ("post", String ("post_positive_integer")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { t.context ().set ("name", make_skel_name ("negative_integer")); @@ -747,7 +750,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { t.context ().set ("name", make_skel_name ("float")); @@ -755,7 +758,7 @@ namespace CXX t.context ().set ("post", String ("post_float")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { t.context ().set ("name", make_skel_name ("double")); @@ -763,7 +766,7 @@ namespace CXX t.context ().set ("post", String ("post_double")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { t.context ().set ("name", make_skel_name ("decimal")); @@ -773,7 +776,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { t.context ().set ("name", make_skel_name ("string")); @@ -781,7 +784,7 @@ namespace CXX t.context ().set ("post", String ("post_string")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { t.context ().set ("name", make_skel_name ("normalized_string")); @@ -789,7 +792,7 @@ namespace CXX t.context ().set ("post", String ("post_normalized_string")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { t.context ().set ("name", make_skel_name ("token")); @@ -797,7 +800,7 @@ namespace CXX t.context ().set ("post", String ("post_token")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { t.context ().set ("name", make_skel_name ("nmtoken")); @@ -805,7 +808,7 @@ namespace CXX t.context ().set ("post", String ("post_nmtoken")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { t.context ().set ("name", make_skel_name ("nmtokens")); @@ -813,7 +816,7 @@ namespace CXX t.context ().set ("post", String ("post_nmtokens")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { t.context ().set ("name", make_skel_name ("name")); @@ -821,7 +824,7 @@ namespace CXX t.context ().set ("post", String ("post_name")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { t.context ().set ("name", make_skel_name ("ncname")); @@ -829,7 +832,7 @@ namespace CXX t.context ().set ("post", String ("post_ncname")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { t.context ().set ("name", make_skel_name ("language")); @@ -840,7 +843,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { t.context ().set ("name", make_skel_name ("qname")); @@ -851,7 +854,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { t.context ().set ("name", make_skel_name ("id")); @@ -859,7 +862,7 @@ namespace CXX t.context ().set ("post", String ("post_id")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { t.context ().set ("name", make_skel_name ("idref")); @@ -867,7 +870,7 @@ namespace CXX t.context ().set ("post", String ("post_idref")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { t.context ().set ("name", make_skel_name ("idrefs")); @@ -877,7 +880,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { t.context ().set ("name", make_skel_name ("uri")); @@ -887,7 +890,7 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { t.context ().set ("name", make_skel_name ("base64_binary")); @@ -895,7 +898,7 @@ namespace CXX t.context ().set ("post", String ("post_base64_binary")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { t.context ().set ("name", make_skel_name ("hex_binary")); @@ -906,7 +909,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { t.context ().set ("name", make_skel_name ("date")); @@ -914,7 +917,7 @@ namespace CXX t.context ().set ("post", String ("post_date")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { t.context ().set ("name", make_skel_name ("date_time")); @@ -922,7 +925,7 @@ namespace CXX t.context ().set ("post", String ("post_date_time")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { t.context ().set ("name", make_skel_name ("duration")); @@ -930,7 +933,7 @@ namespace CXX t.context ().set ("post", String ("post_duration")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { t.context ().set ("name", make_skel_name ("gday")); @@ -938,7 +941,7 @@ namespace CXX t.context ().set ("post", String ("post_gday")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { t.context ().set ("name", make_skel_name ("gmonth")); @@ -946,7 +949,7 @@ namespace CXX t.context ().set ("post", String ("post_gmonth")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { t.context ().set ("name", make_skel_name ("gmonth_day")); @@ -954,7 +957,7 @@ namespace CXX t.context ().set ("post", String ("post_gmonth_day")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { t.context ().set ("name", make_skel_name ("gyear")); @@ -962,7 +965,7 @@ namespace CXX t.context ().set ("post", String ("post_gyear")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { t.context ().set ("name", make_skel_name ("gyear_month")); @@ -970,7 +973,7 @@ namespace CXX t.context ().set ("post", String ("post_gyear_month")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { t.context ().set ("name", make_skel_name ("time")); @@ -980,7 +983,7 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { t.context ().set ("name", make_skel_name ("entity")); @@ -988,7 +991,7 @@ namespace CXX t.context ().set ("post", String ("post_entity")); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { t.context ().set ("name", make_skel_name ("entities")); @@ -1017,7 +1020,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1029,7 +1032,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1041,7 +1044,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1059,7 +1062,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1072,7 +1075,7 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, @@ -1168,7 +1171,7 @@ namespace CXX } } - Void NameProcessor:: + void NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, diff --git a/xsd/cxx/parser/name-processor.hxx b/xsd/cxx/parser/name-processor.hxx index 558ca2a..a6c41ff 100644 --- a/xsd/cxx/parser/name-processor.hxx +++ b/xsd/cxx/parser/name-processor.hxx @@ -8,6 +8,8 @@ #include +#include + #include #include @@ -15,14 +17,12 @@ namespace CXX { namespace Parser { - using namespace Cult::Types; - class NameProcessor { public: NameProcessor (); // Dummy ctor, helps with long symbols on HP-UX. - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, diff --git a/xsd/cxx/parser/options.cli b/xsd/cxx/parser/options.cli index 9bbaf0f..9261778 100644 --- a/xsd/cxx/parser/options.cli +++ b/xsd/cxx/parser/options.cli @@ -3,11 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -include ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -17,7 +15,7 @@ namespace CXX { class options: CXX::options { - std::vector --type-map + NarrowStrings --type-map { "", "Read XML Schema to C++ type mapping information from . @@ -27,7 +25,7 @@ namespace CXX TYPE MAP section below for more information." }; - Cult::Types::NarrowString --xml-parser = "xerces" + NarrowString --xml-parser = "xerces" { "", "Use as the underlying XML parser. Valid values are @@ -108,7 +106,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "", "Indicate that is the document root. This information is @@ -117,21 +115,21 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --skel-type-suffix = "_pskel" + NarrowString --skel-type-suffix = "_pskel" { "", "Use the provided instead of the default \cb{_pskel} to construct the names of the generated parser skeletons." }; - Cult::Types::NarrowString --skel-file-suffix = "-pskel" + NarrowString --skel-file-suffix = "-pskel" { "", "Use the provided instead of the default \cb{-pskel} to construct the names of the generated parser skeleton files." }; - Cult::Types::NarrowString --impl-type-suffix = "_pimpl" + NarrowString --impl-type-suffix = "_pimpl" { "", "Use the provided instead of the default \cb{_pimpl} to @@ -139,7 +137,7 @@ namespace CXX XML Schema types as well as sample parser implementations." }; - Cult::Types::NarrowString --impl-file-suffix = "-pimpl" + NarrowString --impl-file-suffix = "-pimpl" { "", "Use the provided instead of the default \cb{-pimpl} to diff --git a/xsd/cxx/parser/parser-forward.cxx b/xsd/cxx/parser/parser-forward.cxx index 5451268..409dcb0 100644 --- a/xsd/cxx/parser/parser-forward.cxx +++ b/xsd/cxx/parser/parser-forward.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << "class " << ename (e) << ";"; @@ -37,7 +37,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { os << "class " << ename (l) << ";"; @@ -53,7 +53,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { os << "class " << ename (u) << ";"; @@ -69,7 +69,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { os << "class " << ename (c) << ";"; @@ -77,7 +77,7 @@ namespace CXX }; } - Void + void generate_parser_forward (Context& ctx) { ctx.os << "// Forward declarations" << endl diff --git a/xsd/cxx/parser/parser-forward.hxx b/xsd/cxx/parser/parser-forward.hxx index 6402e63..12174f6 100644 --- a/xsd/cxx/parser/parser-forward.hxx +++ b/xsd/cxx/parser/parser-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_forward (Context&); } } diff --git a/xsd/cxx/parser/parser-header.cxx b/xsd/cxx/parser/parser-header.cxx index c717fc8..5db1ef4 100644 --- a/xsd/cxx/parser/parser-header.cxx +++ b/xsd/cxx/parser/parser-header.cxx @@ -3,11 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include #include +using namespace std; + namespace CXX { namespace Parser @@ -21,7 +25,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -41,7 +45,7 @@ namespace CXX String const& ret (ret_type (e)); - Boolean same (ret == ret_type (base)); + bool same (ret == ret_type (base)); os << "virtual " << ret << endl << post_name (e) << " ()" << @@ -71,7 +75,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -173,7 +177,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -222,7 +226,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) return; @@ -251,7 +255,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -281,7 +285,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -315,14 +319,13 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("comp-number")) return; - UnsignedLong state_count ( - a.context().get ("state-count")); + size_t state_count (a.context().get ("state-count")); os << "void" << endl << "all_0 (unsigned long& state," << endl @@ -337,13 +340,13 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!c.context().count ("comp-number")) return; - UnsignedLong n (c.context ().get ("comp-number")); + size_t n (c.context ().get ("comp-number")); os << "void" << endl << "choice_" << n << " (unsigned long& state," << endl @@ -357,13 +360,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("comp-number")) return; - UnsignedLong n (s.context ().get ("comp-number")); + size_t n (s.context ().get ("comp-number")); os << "void" << endl << "sequence_" << n << " (unsigned long& state," << endl @@ -391,7 +394,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -418,7 +421,7 @@ namespace CXX names_attribute_validation_state_ >> attribute_validation_state_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -427,15 +430,15 @@ namespace CXX // generate parser callbacks, etc. since they are the same as in // the base. We only need the parsing/validation code. // - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); - Boolean he (has (c)); - Boolean ha (has (c)); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -471,7 +474,7 @@ namespace CXX String const& ret (ret_type (c)); - Boolean same (c.inherits_p () && + bool same (c.inherits_p () && ret == ret_type (c.inherits ().base ())); os << "virtual " << ret << endl @@ -605,7 +608,7 @@ namespace CXX if (validation && (he || hae)) { - UnsignedLong depth (c.context ().get ("depth")); + size_t depth (c.context ().get ("depth")); os << "protected:" << endl; @@ -769,13 +772,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { gen_typedef (t, "void", "any_type_pskel", "any_type_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_typedef (t, "void", @@ -784,7 +787,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool", "boolean_pskel", "boolean_pimpl"); @@ -792,72 +795,72 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_typedef (t, "signed char", "byte_pskel", "byte_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_typedef (t, "unsigned char", "unsigned_byte_pskel", "unsigned_byte_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_typedef (t, "short", "short_pskel", "short_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_typedef (t, "unsigned short", "unsigned_short_pskel", "unsigned_short_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_typedef (t, "int", "int_pskel", "int_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_typedef (t, "unsigned int", "unsigned_int_pskel", "unsigned_int_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { gen_typedef (t, "long long", "long_pskel", "long_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { gen_typedef (t, "unsigned long long", "unsigned_long_pskel", "unsigned_long_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { gen_typedef (t, "long long", "integer_pskel", "integer_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { gen_typedef (t, "long long", "negative_integer_pskel", "negative_integer_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { gen_typedef (t, "long long", @@ -865,14 +868,14 @@ namespace CXX "non_positive_integer_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { gen_typedef (t, "unsigned long long", "positive_integer_pskel", "positive_integer_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { gen_typedef (t, "unsigned long long", @@ -882,19 +885,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_typedef (t, "float", "float_pskel", "float_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_typedef (t, "double", "double_pskel", "double_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_typedef (t, "double", "decimal_pskel", "decimal_pimpl"); @@ -902,33 +905,33 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_typedef (t, string_type_, "string_pskel", "string_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_typedef (t, string_type_, "normalized_string_pskel", "normalized_string_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_typedef (t, string_type_, "token_pskel", "token_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = gen_typedef (t, string_type_, "nmtoken_pskel", "nmtoken_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { // NMTOKENS uses NMTOKEN implementation to parse individual items. @@ -940,19 +943,19 @@ namespace CXX "nmtokens_pskel", "nmtokens_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_typedef (t, string_type_, "name_pskel", "name_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_typedef (t, string_type_, "ncname_pskel", "ncname_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_typedef (t, string_type_, "language_pskel", "language_pimpl"); @@ -960,7 +963,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, xs_ns_ + L"::qname", "qname_pskel", "qname_pimpl"); @@ -968,19 +971,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_typedef (t, string_type_, "id_pskel", "id_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = gen_typedef (t, string_type_, "idref_pskel", "idref_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { // IDREFS uses IDREF implementation to parse individual items. @@ -994,7 +997,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_, "uri_pskel", "uri_pimpl"); @@ -1002,7 +1005,7 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { String buffer (L"::std::auto_ptr< " + xs_ns_ + L"::buffer >"); @@ -1010,7 +1013,7 @@ namespace CXX "base64_binary_pskel", "base64_binary_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { String buffer (L"::std::auto_ptr< " + xs_ns_ + L"::buffer >"); @@ -1020,60 +1023,60 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { gen_typedef (t, xs_ns_ + L"::date", "date_pskel", "date_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { gen_typedef (t, xs_ns_ + L"::date_time", "date_time_pskel", "date_time_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { gen_typedef (t, xs_ns_ + L"::duration", "duration_pskel", "duration_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { gen_typedef (t, xs_ns_ + L"::gday", "gday_pskel", "gday_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { gen_typedef (t, xs_ns_ + L"::gmonth", "gmonth_pskel", "gmonth_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { gen_typedef (t, xs_ns_ + L"::gmonth_day", "gmonth_day_pskel", "gmonth_day_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { gen_typedef (t, xs_ns_ + L"::gyear", "gyear_pskel", "gyear_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { gen_typedef (t, xs_ns_ + L"::gyear_month", "gyear_month_pskel", "gyear_month_pimpl"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { gen_typedef (t, xs_ns_ + L"::time", "time_pskel", "time_pimpl"); @@ -1081,18 +1084,18 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { } private: - Boolean + bool gen_typedef (SemanticGraph::Type& t, String const& type, String const& pskel, @@ -1119,8 +1122,8 @@ namespace CXX String impl_ns_; String string_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace: Namespace, Context @@ -1257,8 +1260,8 @@ namespace CXX }; } - Void - generate_parser_header (Context& ctx, Boolean generate_xml_schema) + void + generate_parser_header (Context& ctx, bool generate_xml_schema) { String c (ctx.char_type); @@ -1307,12 +1310,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("includes")) { - typedef Cult::Containers::Set Includes; + typedef set Includes; Includes const& is ( ctx.schema_root.context ().get ("includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -1356,12 +1359,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("includes")) { - typedef Cult::Containers::Set Includes; + typedef set Includes; Includes const& is ( ctx.schema_root.context ().get ("includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; diff --git a/xsd/cxx/parser/parser-header.hxx b/xsd/cxx/parser/parser-header.hxx index cfe8af4..6699472 100644 --- a/xsd/cxx/parser/parser-header.hxx +++ b/xsd/cxx/parser/parser-header.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Parser { - Void - generate_parser_header (Context&, Boolean generate_xml_schema); + void + generate_parser_header (Context&, bool generate_xml_schema); } } diff --git a/xsd/cxx/parser/parser-inline.cxx b/xsd/cxx/parser/parser-inline.cxx index e549e24..03eab94 100644 --- a/xsd/cxx/parser/parser-inline.cxx +++ b/xsd/cxx/parser/parser-inline.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -75,7 +75,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -84,7 +84,7 @@ namespace CXX String const& scope (ename (m.scope ())); String const& parser (eparser (m)); - Boolean poly (polymorphic && + bool poly (polymorphic && m.is_a () && !anonymous (m.type ())); @@ -117,7 +117,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) return; @@ -138,7 +138,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) return; @@ -159,14 +159,14 @@ namespace CXX } } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; struct ParserBaseSet: Traversal::Complex, @@ -180,7 +180,7 @@ namespace CXX names_ >> member_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -189,7 +189,7 @@ namespace CXX names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { String const& name (ename (l)); @@ -212,14 +212,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("comp-number")) return; - UnsignedLong state_count ( - a.context().get ("state-count")); + size_t state_count (a.context().get ("state-count")); os << "," << endl << " v_all_count_ (" << state_count << "UL, v_all_first_)"; @@ -242,15 +241,15 @@ namespace CXX names_parser_member_set_ >> parser_member_set_; } - virtual Void + virtual void traverse (Type& c) { - Boolean he (has (c)); - Boolean ha (has (c)); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); + bool hae (has_particle (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -258,7 +257,7 @@ namespace CXX names (c, names_test); } - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); if (!((!restriction && (he || ha)) || (validation && (he || hae || hra)))) @@ -305,7 +304,7 @@ namespace CXX << name << " ()" << endl << ": "; - Boolean comma (false); + bool comma (false); if (!restriction && (he || ha)) { @@ -364,7 +363,7 @@ namespace CXX }; } - Void + void generate_parser_inline (Context& ctx) { // Emit "weak" header includes that are used in the file-per-type diff --git a/xsd/cxx/parser/parser-inline.hxx b/xsd/cxx/parser/parser-inline.hxx index 23ece92..bcf0cf8 100644 --- a/xsd/cxx/parser/parser-inline.hxx +++ b/xsd/cxx/parser/parser-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_inline (Context&); } } diff --git a/xsd/cxx/parser/parser-source.cxx b/xsd/cxx/parser/parser-source.cxx index b9928bc..a83a19d 100644 --- a/xsd/cxx/parser/parser-source.cxx +++ b/xsd/cxx/parser/parser-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -29,7 +29,7 @@ namespace CXX SemanticGraph::Type& base (e.inherits ().base ()); - Boolean same (ret == ret_type (base)); + bool same (ret == ret_type (base)); if (same || ret == L"void" || polymorphic) { @@ -79,7 +79,7 @@ namespace CXX if (validation) { - Boolean gen (!anonymous (e)); + bool gen (!anonymous (e)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -131,7 +131,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -227,7 +227,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -282,13 +282,13 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) return; - Boolean poly (polymorphic && !anonymous (e.type ())); + bool poly (polymorphic && !anonymous (e.type ())); os << "if ("; @@ -384,13 +384,13 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) return; - Boolean poly (polymorphic && !anonymous (e.type ())); + bool poly (polymorphic && !anonymous (e.type ())); String const& name (ename (e)); os << "if ("; @@ -468,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -519,7 +519,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -557,14 +557,14 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { - Boolean he (has (c)); - Boolean ha (has (c)); + bool he (has (c)); + bool ha (has (c)); String const& ret (ret_type (c)); - Boolean same (c.inherits_p () && + bool same (c.inherits_p () && ret == ret_type (c.inherits ().base ())); String const& name (ename (c)); @@ -600,7 +600,7 @@ namespace CXX if (c.inherits_p () && validation) { - Boolean gen (!anonymous (c)); + bool gen (!anonymous (c)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -679,7 +679,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( c.inherits_p () && c.inherits ().is_a ()); @@ -806,7 +806,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -833,7 +833,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx) { if (ctx.polymorphic) @@ -846,8 +846,8 @@ namespace CXX else ctx.os << endl; - Boolean import_maps (ctx.options.import_maps ()); - Boolean export_maps (ctx.options.export_maps ()); + bool import_maps (ctx.options.import_maps ()); + bool export_maps (ctx.options.export_maps ()); if (import_maps || export_maps) { diff --git a/xsd/cxx/parser/parser-source.hxx b/xsd/cxx/parser/parser-source.hxx index 4212c15..43c3455 100644 --- a/xsd/cxx/parser/parser-source.hxx +++ b/xsd/cxx/parser/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_source (Context&); } } diff --git a/xsd/cxx/parser/print-impl-common.hxx b/xsd/cxx/parser/print-impl-common.hxx index 55fe648..db26ea8 100644 --- a/xsd/cxx/parser/print-impl-common.hxx +++ b/xsd/cxx/parser/print-impl-common.hxx @@ -74,7 +74,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { gen_user_type (); @@ -82,7 +82,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { if (default_type (t, "bool")) @@ -96,7 +96,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { if (default_type (t, "signed char")) @@ -108,7 +108,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { if (default_type (t, "unsigned char")) @@ -120,7 +120,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { if (default_type (t, "short")) @@ -132,7 +132,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { if (default_type (t, "unsigned short")) @@ -144,7 +144,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { if (default_type (t, "int")) @@ -156,7 +156,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { if (default_type (t, "unsigned int")) @@ -168,7 +168,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { if (default_type (t, "long long")) @@ -180,7 +180,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { if (default_type (t, "unsigned long long")) @@ -192,7 +192,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { if (default_type (t, "long long")) @@ -204,7 +204,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { if (default_type (t, "long long")) @@ -216,7 +216,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { if (default_type (t, "long long")) @@ -228,7 +228,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { if (default_type (t, "unsigned long long")) @@ -240,7 +240,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { if (default_type (t, "unsigned long long")) @@ -254,7 +254,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { if (default_type (t, "float")) @@ -266,7 +266,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { if (default_type (t, "double")) @@ -278,7 +278,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { if (default_type (t, "double")) @@ -292,61 +292,61 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_string (t); @@ -355,13 +355,13 @@ namespace CXX // String sequences. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { gen_sequence (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { gen_sequence (t); @@ -370,7 +370,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (default_type (t, xs_ns_name () + L"::qname")) @@ -391,13 +391,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_buffer (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_buffer (t); @@ -405,7 +405,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { if (default_type (t, xs_ns_name () + L"::date")) @@ -421,7 +421,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { if (default_type (t, xs_ns_name () + L"::date_time")) @@ -440,7 +440,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { if (default_type (t, xs_ns_name () + L"::duration")) @@ -463,7 +463,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { if (default_type (t, xs_ns_name () + L"::gday")) @@ -477,7 +477,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { if (default_type (t, xs_ns_name () + L"::gmonth")) @@ -491,7 +491,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { if (default_type (t, xs_ns_name () + L"::gmonth_day")) @@ -506,7 +506,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { if (default_type (t, xs_ns_name () + L"::gyear")) @@ -520,7 +520,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { if (default_type (t, xs_ns_name () + L"::gyear_month")) @@ -535,7 +535,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { if (default_type (t, xs_ns_name () + L"::time")) diff --git a/xsd/cxx/parser/state-processor.cxx b/xsd/cxx/parser/state-processor.cxx index 568154d..8664886 100644 --- a/xsd/cxx/parser/state-processor.cxx +++ b/xsd/cxx/parser/state-processor.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include + #include #include @@ -10,9 +13,7 @@ #include #include -#include - -#include +using namespace std; namespace CXX { @@ -20,7 +21,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector Particles; + typedef vector Particles; void print (Particles const& p) @@ -30,7 +31,7 @@ namespace CXX wcerr << "prefixes: " << endl; - for (Particles::ConstIterator i (p.begin ()); i != p.end (); ++i) + for (Particles::const_iterator i (p.begin ()); i != p.end (); ++i) { if (SemanticGraph::Element* e = dynamic_cast (*i)) @@ -52,10 +53,10 @@ namespace CXX Traversal::Choice, Traversal::Sequence { - Particle (UnsignedLong& all, - UnsignedLong& choice, - UnsignedLong& sequence, - UnsignedLong& depth) + Particle (size_t& all, + size_t& choice, + size_t& sequence, + size_t& depth) : all_ (all), choice_ (choice), sequence_ (sequence), @@ -63,7 +64,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +79,8 @@ namespace CXX // compositor cannot contain any nested compositors. // - UnsignedLong state (0); - UnsignedLong min (0); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (a.contains_begin ()); ci != a.contains_end (); ++ci) @@ -101,7 +102,7 @@ namespace CXX { a.context ().set ("comp-number", choice_++); a.context ().set ("prefixes", prefixes_); - a.context ().set ("state-count", UnsignedLong (prefixes_.size ())); + a.context ().set ("state-count", size_t (prefixes_.size ())); // effective-min = min * actual-min // @@ -114,7 +115,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -126,8 +127,8 @@ namespace CXX // the actual value specified in the schema. // - UnsignedLong state (0); - UnsignedLong min (1); + size_t state (0); + size_t min (1); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -144,7 +145,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -159,7 +160,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get ("effective-min") == 0) + p.context ().get ("effective-min") == 0) min = 0; } @@ -183,7 +184,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -195,9 +196,9 @@ namespace CXX // of the actual value specified in the schema. // - Boolean prefix (true); - UnsignedLong state (0); - UnsignedLong min (0); + bool prefix (true); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (s.contains_begin ()); ci != s.contains_end (); ++ci) @@ -217,7 +218,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -233,7 +234,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get ("effective-min") != 0) + if (p.context ().get ("effective-min") != 0) min = 1; } } @@ -266,11 +267,11 @@ namespace CXX private: Particles prefixes_; - UnsignedLong& all_; - UnsignedLong& choice_; - UnsignedLong& sequence_; + size_t& all_; + size_t& choice_; + size_t& sequence_; - UnsignedLong& depth_; + size_t& depth_; }; @@ -278,12 +279,12 @@ namespace CXX // struct Complex: Traversal::Complex { - virtual Void + virtual void traverse (Type& c) { if (c.contains_compositor_p ()) { - UnsignedLong all (0), choice (0), sequence (0), depth (0); + size_t all (0), choice (0), sequence (0), depth (0); Particle t (all, choice, sequence, depth); t.dispatch (c.contains_compositor ().compositor ()); @@ -296,7 +297,7 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/xsd/cxx/parser/state-processor.hxx b/xsd/cxx/parser/state-processor.hxx index c243f9d..3321582 100644 --- a/xsd/cxx/parser/state-processor.hxx +++ b/xsd/cxx/parser/state-processor.hxx @@ -6,19 +6,18 @@ #ifndef CXX_PARSER_STATE_PROCESSOR_HXX #define CXX_PARSER_STATE_PROCESSOR_HXX -#include #include +#include + namespace CXX { namespace Parser { - using namespace Cult::Types; - class StateProcessor { public: - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file); }; diff --git a/xsd/cxx/parser/type-processor.cxx b/xsd/cxx/parser/type-processor.cxx index 1fefeb3..fa60b3c 100644 --- a/xsd/cxx/parser/type-processor.cxx +++ b/xsd/cxx/parser/type-processor.cxx @@ -3,7 +3,7 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include #include #include @@ -11,6 +11,8 @@ #include #include +using namespace std; + namespace CXX { namespace Parser @@ -29,14 +31,14 @@ namespace CXX { Type (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes) + bool add_includes) : schema_ (schema), type_map_ (type_map), add_includes_ (add_includes) { } - virtual Void + virtual void traverse (SemanticGraph::Type& type) { using TypeMap::Namespace; @@ -54,7 +56,7 @@ namespace CXX // match the type in order to add include directives to the // new root schema. // - Boolean set (true); + bool set (true); if (tc.count ("ret-type")) { @@ -75,12 +77,12 @@ namespace CXX //std::wcerr << "traversing: " << ns_name << "#" << t_name << endl; - for (Namespaces::ConstIterator n (type_map_.begin ()); + for (Namespaces::const_iterator n (type_map_.begin ()); n != type_map_.end (); ++n) { // Check if the namespace matches. // - Boolean ns_match; + bool ns_match; if (!n->xsd_name ().empty ()) { @@ -143,7 +145,7 @@ namespace CXX arg_type = ret_type; else { - WideChar last (ret_type[ret_type.size () - 1]); + wchar_t last (ret_type[ret_type.size () - 1]); // If it is already a pointer or reference then use // it as is. @@ -170,7 +172,7 @@ namespace CXX { if (n->includes_begin () != n->includes_end ()) { - typedef Cult::Containers::Set Includes; + typedef std::set Includes; if (!schema_.context ().count ("includes")) schema_.context ().set ("includes", Includes ()); @@ -196,7 +198,7 @@ namespace CXX private: SemanticGraph::Schema& schema_; TypeMap::Namespaces& type_map_; - Boolean add_includes_; + bool add_includes_; }; @@ -209,7 +211,7 @@ namespace CXX { GlobalType (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes) + bool add_includes) : type_ (schema, type_map, add_includes) { inherits_ >> type_; @@ -217,20 +219,20 @@ namespace CXX argumented_ >> type_; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type_.traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { type_.traverse (l); Traversal::List::argumented (l, argumented_); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { type_.traverse (c); @@ -238,7 +240,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -254,10 +256,10 @@ namespace CXX Traversal::Argumented argumented_; }; - Void + void process_impl (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, - Boolean gen_driver, + bool gen_driver, TypeMap::Namespaces& type_map) { if (tu.names_begin ()->named ().name () == @@ -281,7 +283,7 @@ namespace CXX // If --extern-xml-schema is specified, then we don't want // includes from the XML Schema type map. // - Boolean extern_xml_schema (ops.extern_xml_schema ()); + bool extern_xml_schema (ops.extern_xml_schema ()); // // @@ -341,10 +343,10 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, - Boolean gen_driver, + bool gen_driver, TypeMap::Namespaces& tm) { process_impl (ops, s, gen_driver, tm); diff --git a/xsd/cxx/parser/type-processor.hxx b/xsd/cxx/parser/type-processor.hxx index 2165846..2889138 100644 --- a/xsd/cxx/parser/type-processor.hxx +++ b/xsd/cxx/parser/type-processor.hxx @@ -6,10 +6,10 @@ #ifndef CXX_PARSER_TYPE_PROCESSOR_HXX #define CXX_PARSER_TYPE_PROCESSOR_HXX -#include - #include +#include + #include #include @@ -18,17 +18,15 @@ namespace CXX { namespace Parser { - using namespace Cult::Types; - class TypeProcessor { public: TypeProcessor (); // Dummy ctor, helps with long symbols on HP-UX. - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, - Boolean gen_driver, + bool gen_driver, TypeMap::Namespaces&); }; } diff --git a/xsd/cxx/parser/validator.cxx b/xsd/cxx/parser/validator.cxx index 96110f1..e808e27 100644 --- a/xsd/cxx/parser/validator.cxx +++ b/xsd/cxx/parser/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 +#include + #include #include @@ -10,9 +13,7 @@ #include -#include - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Parser::options const& ops, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, ops, 0, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -38,8 +39,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 (); @@ -74,10 +75,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_; }; // @@ -98,20 +99,20 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) return; using SemanticGraph::Any; - Boolean q (e.qualified_p ()); + bool q (e.qualified_p ()); String ns (q ? e.namespace_ ().name () : ""); for (Any::NamespaceIterator i (any_.namespace_begin ()); i != any_.namespace_end (); ++i) { - Boolean failed (false); + bool failed (false); if (*i == L"##any") { @@ -184,14 +185,14 @@ namespace CXX { } - virtual Void + virtual void post (Type& c) { // Go down the inheritance hierarchy. // if (down_) { - Boolean up = up_; + bool up = up_; up_ = false; if (c.inherits_p ()) @@ -204,7 +205,7 @@ namespace CXX // if (up_) { - Boolean down = down_; + bool down = down_; down_ = false; for (Type::BegetsIterator i (c.begets_begin ()); @@ -218,10 +219,10 @@ namespace CXX } private: - Boolean up_, down_; + bool up_, down_; }; - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Compositor; @@ -273,7 +274,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -319,7 +320,7 @@ namespace CXX Complex::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -328,7 +329,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("P002")) @@ -352,7 +353,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -372,7 +373,7 @@ namespace CXX } private: - Containers::Set types_; + set types_; Sources sources_; @@ -405,7 +406,7 @@ namespace CXX *this >> names_; } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -446,7 +447,7 @@ namespace CXX return false; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) return; @@ -464,7 +465,7 @@ namespace CXX Traversal::Element::traverse (e); } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (traverse_common (a)) @@ -481,9 +482,9 @@ namespace CXX } private: - Boolean anonymous_error_issued_; + bool anonymous_error_issued_; - Containers::Set types_; + set types_; Sources sources_; @@ -500,7 +501,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -550,14 +551,14 @@ namespace CXX // Dummy ctor, helps with long symbols on HP-UX. } - 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); // @@ -629,9 +630,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)) { @@ -646,8 +647,8 @@ namespace CXX // // - Boolean import_maps (ops.import_maps ()); - Boolean export_maps (ops.export_maps ()); + bool import_maps (ops.import_maps ()); + bool export_maps (ops.export_maps ()); if (import_maps && export_maps) { diff --git a/xsd/cxx/parser/validator.hxx b/xsd/cxx/parser/validator.hxx index 35c13fc..036e38c 100644 --- a/xsd/cxx/parser/validator.hxx +++ b/xsd/cxx/parser/validator.hxx @@ -6,27 +6,26 @@ #ifndef CXX_PARSER_VALIDATOR_HXX #define CXX_PARSER_VALIDATOR_HXX +#include +#include + #include #include -#include - namespace CXX { namespace Parser { - using namespace Cult::Types; - class Validator { public: Validator (); // Dummy ctor, helps with long symbols on HP-UX. - Boolean + bool validate (options const&, SemanticGraph::Schema&, SemanticGraph::Path const& tu, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings); }; } diff --git a/xsd/cxx/tree/counter.cxx b/xsd/cxx/tree/counter.cxx index 548fc77..40a7c61 100644 --- a/xsd/cxx/tree/counter.cxx +++ b/xsd/cxx/tree/counter.cxx @@ -15,40 +15,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 +57,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 +86,7 @@ namespace CXX complexity_ += (string_based ? 1 : 2); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { complexity_++; // One for the type itself. @@ -106,7 +106,7 @@ namespace CXX } private: - UnsignedLong& complexity_; + size_t& complexity_; }; @@ -120,12 +120,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 +160,7 @@ namespace CXX } } - virtual Void + virtual void traverse (Type& e) { // Check if the previous element we saw needs to be generated. @@ -177,14 +177,14 @@ 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_)) { diff --git a/xsd/cxx/tree/default-value.cxx b/xsd/cxx/tree/default-value.cxx index 6ac5f5c..1ed6a48 100644 --- a/xsd/cxx/tree/default-value.cxx +++ b/xsd/cxx/tree/default-value.cxx @@ -13,14 +13,14 @@ namespace CXX { namespace { - Void + void normalize (String& s) { - Size n (s.size ()); + size_t n (s.size ()); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - WideChar& c (s[i]); + wchar_t& c (s[i]); if (c == 0x0D || // carriage return c == 0x09 || // tab @@ -29,15 +29,15 @@ namespace CXX } } - Void + void collapse (String& s) { - Size n (s.size ()), j (0); - Boolean subs (false), trim (true); + size_t n (s.size ()), j (0); + bool subs (false), trim (true); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - WideChar c (s[i]); + wchar_t c (s[i]); if (c == 0x20 || c == 0x09 || c == 0x0A) subs = true; @@ -61,21 +61,21 @@ namespace CXX s.resize (j); } - Void + void strip_zeros (String& s) { - Size n (s.size ()), i (0); + size_t n (s.size ()), i (0); if (n > 0 && (s[i] == '-' || s[i] == '+')) i++; - Size j (i); + size_t j (i); - Boolean strip (true); + bool strip (true); for (; i < n; ++i) { - WideChar c (s[i]); + wchar_t c (s[i]); if (c == '0') { @@ -97,7 +97,7 @@ namespace CXX s.resize (j); } - Void + void make_float (String& s) { if (s.find ('.') == String::npos && @@ -112,13 +112,13 @@ namespace CXX // IsLiteralValue:: - IsLiteralValue (Boolean& r) + IsLiteralValue (bool& r) : IsFundamentalType (r) { *this >> inherits_ >> *this; } - Void IsLiteralValue:: + void IsLiteralValue:: traverse (SemanticGraph::Complex& c) { inherits (c); @@ -144,7 +144,7 @@ namespace CXX return literal_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Complex& c) { inherits (c); @@ -152,7 +152,7 @@ namespace CXX // Boolean. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Boolean&) { collapse (value_); @@ -161,7 +161,7 @@ namespace CXX // Integral types. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Byte&) { collapse (value_); @@ -169,7 +169,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedByte&) { collapse (value_); @@ -177,7 +177,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Short&) { collapse (value_); @@ -185,7 +185,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedShort&) { collapse (value_); @@ -193,7 +193,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Int&) { collapse (value_); @@ -201,7 +201,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedInt&) { collapse (value_); @@ -209,7 +209,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Long&) { collapse (value_); @@ -218,7 +218,7 @@ namespace CXX literal_ += L"LL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedLong&) { collapse (value_); @@ -227,7 +227,7 @@ namespace CXX literal_ += L"ULL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Integer&) { collapse (value_); @@ -235,7 +235,7 @@ namespace CXX literal_ = value_ + L"LL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { collapse (value_); @@ -243,7 +243,7 @@ namespace CXX literal_ = value_ + L"LL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { collapse (value_); @@ -251,7 +251,7 @@ namespace CXX literal_ = value_ + L"ULL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::PositiveInteger&) { collapse (value_); @@ -259,7 +259,7 @@ namespace CXX literal_ = value_ + L"ULL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NegativeInteger&) { collapse (value_); @@ -269,7 +269,7 @@ namespace CXX // Floats. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Float& t) { collapse (value_); @@ -297,7 +297,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Double& t) { collapse (value_); @@ -325,7 +325,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Decimal&) { collapse (value_); @@ -345,43 +345,43 @@ namespace CXX *this >> inherits_ >> *this; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::List&) { r_ = function; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Complex& c) { inherits (c); } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Fundamental::Base64Binary&) { r_ = data; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Fundamental::HexBinary&) { r_ = data; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Fundamental::NameTokens&) { r_ = function; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Fundamental::IdRefs&) { r_ = function; } - Void InitKind:: + void InitKind:: traverse (SemanticGraph::Fundamental::Entities&) { r_ = function; @@ -397,14 +397,14 @@ namespace CXX { } - Void InitValue:: + void InitValue:: dispatch (SemanticGraph::Node& type, String const& value) { value_ = value; Traversal::NodeBase::dispatch (type); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::List& l) { collapse (value_); @@ -415,9 +415,9 @@ namespace CXX SemanticGraph::Type& t (l.argumented ().type ()); String ov (value_); - Size b (0); + size_t b (0); - for (Size e (ov.find (' ')); ; e = ov.find (' ', b)) + for (size_t e (ov.find (' ')); ; e = ov.find (' ', b)) { String v (ov, b, e != String::npos ? e - b : e); @@ -448,13 +448,13 @@ namespace CXX value_ = ov; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Union&) { os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Complex& c) { Traversal::NodeBase::dispatch (ultimate_base (c)); @@ -462,13 +462,13 @@ namespace CXX // anyType & anySimpleType. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::AnyType& t) { os << fq_name (t) << " (" << strlit (value_) << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::AnySimpleType& t) { os << fq_name (t) << " (" << strlit (value_) << ")"; @@ -476,34 +476,34 @@ namespace CXX // Strings. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::String&) { os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NormalizedString&) { normalize (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Token&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameToken&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameTokens&) { string_sequence_type ( @@ -511,21 +511,21 @@ namespace CXX xs_ns ().find ("NMTOKEN").first->named ())); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Name&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NCName&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Language&) { collapse (value_); @@ -534,10 +534,10 @@ namespace CXX // Qualified name. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::QName& t) { - Size p (value_.rfind ('#')); + size_t p (value_.rfind ('#')); if (p != String::npos) { @@ -569,21 +569,21 @@ namespace CXX // ID/IDREF. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Id&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRef&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRefs&) { string_sequence_type ( @@ -593,7 +593,7 @@ namespace CXX // URI. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::AnyURI&) { collapse (value_); @@ -621,7 +621,7 @@ namespace CXX return r; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Base64Binary& t) { collapse (value_); @@ -634,17 +634,17 @@ namespace CXX // Decode. // - Size size (value_.size ()); + size_t size (value_.size ()); // Remove all whitespaces. // { - Size j (0); - Boolean subs (false); + size_t j (0); + bool subs (false); - for (Size i (0); i < size; ++i) + for (size_t i (0); i < size; ++i) { - WideChar c (value_[i]); + wchar_t c (value_[i]); if (c == 0x20 || c == 0x0A || c == 0x0D || c == 0x09) subs = true; @@ -663,20 +663,20 @@ namespace CXX // Our length should be a multiple of four. // - Size quad_count (size / 4); + size_t quad_count (size / 4); // Source and destination indexes. // - Size si (0), di (0); + size_t si (0), di (0); // Process all quads except the last one. // unsigned short v; unsigned char b1, b2, b3, b4; - WideChar prev_fill (os.fill ('0')); + wchar_t prev_fill (os.fill ('0')); - for (Size q (0); q < quad_count - 1; ++q) + for (size_t q (0); q < quad_count - 1; ++q) { b1 = base64_decode (value_[si++]); b2 = base64_decode (value_[si++]); @@ -709,7 +709,7 @@ namespace CXX b1 = base64_decode (value_[si++]); b2 = base64_decode (value_[si++]); - WideChar e3 (value_[si++]), e4 (value_[si++]); + wchar_t e3 (value_[si++]), e4 (value_[si++]); if (quad_count != 1) os << ", "; @@ -803,7 +803,7 @@ namespace CXX return r; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::HexBinary& t) { collapse (value_); @@ -816,10 +816,10 @@ namespace CXX // Decode. // - Size n (value_.size () / 2); - WideChar prev_fill (os.fill ('0')); + size_t n (value_.size () / 2); + wchar_t prev_fill (os.fill ('0')); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { unsigned char h (hex_decode (value_[2 * i])); unsigned char l (hex_decode (value_[2 * i + 1])); @@ -862,15 +862,15 @@ namespace CXX // Date/time. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Date& t) { // date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM] // collapse (value_); - Size b (0); - Size e (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t b (0); + size_t e (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, e); b = e + 1; @@ -888,15 +888,15 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::DateTime& t) { // date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM] // collapse (value_); - Size b (0); - Size e (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t b (0); + size_t e (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, e); b = e + 1; @@ -915,7 +915,7 @@ namespace CXX e = b + 2; for (; e < value_.size (); ++e) { - WideChar c (value_[e]); + wchar_t c (value_[e]); if (c == 'Z' || c == '+' || c == '-') break; @@ -940,12 +940,12 @@ namespace CXX namespace { - Size - find_delim (String const& s, Size pos) + size_t + find_delim (String const& s, size_t pos) { for (; pos < s.size (); ++pos) { - WideChar c (s[pos]); + wchar_t c (s[pos]); if (c == 'Y' || c == 'D' || c == 'M' || c == 'H' || c == 'M' || c == 'S' || c == 'T') @@ -956,14 +956,14 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Duration& t) { // duration := [-]P[nY][nM][nD][TnHnMn[.n+]S] // collapse (value_); - Size b (1), e, n (value_.size ()); + size_t b (1), e, n (value_.size ()); os << fq_name (t) << " ("; @@ -1059,7 +1059,7 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Day& t) { // gday := ---DD[Z|(+|-)HH:MM] @@ -1074,7 +1074,7 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Month& t) { // gmonth := --MM[Z|(+|-)HH:MM] @@ -1089,7 +1089,7 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::MonthDay& t) { // gmonth_day := --MM-DD[Z|(+|-)HH:MM] @@ -1107,17 +1107,17 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Year& t) { // gyear := [-]CCYY[N]*[Z|(+|-)HH:MM] // collapse (value_); - Size pos (value_[0] == '-' ? 5 : 4); + size_t pos (value_[0] == '-' ? 5 : 4); for (; pos < value_.size (); ++pos) { - WideChar c (value_[pos]); + wchar_t c (value_[pos]); if (c == 'Z' || c == '+' || c == '-') break; @@ -1131,14 +1131,14 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::YearMonth& t) { // gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM] // collapse (value_); - Size pos (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t pos (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, pos); String month (value_, pos + 1, 2); @@ -1151,7 +1151,7 @@ namespace CXX os << ")"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Time& t) { // time := HH:MM:SS[.S+][Z|(+|-)HH:MM] @@ -1161,10 +1161,10 @@ namespace CXX String hours (value_, 0, 2); String minutes (value_, 3, 2); - Size e (8); + size_t e (8); for (; e < value_.size (); ++e) { - WideChar c (value_[e]); + wchar_t c (value_[e]); if (c == 'Z' || c == '+' || c == '-') break; @@ -1182,8 +1182,8 @@ namespace CXX os << ")"; } - Void InitValue:: - time_zone (Size pos) + void InitValue:: + time_zone (size_t pos) { // time_zone := Z|(+|-)HH:MM // @@ -1217,14 +1217,14 @@ namespace CXX // Entity. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entity&) { collapse (value_); os << strlit (value_); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entities&) { string_sequence_type ( @@ -1232,7 +1232,7 @@ namespace CXX xs_ns ().find ("ENTITY").first->named ())); } - Void InitValue:: + void InitValue:: string_sequence_type (SemanticGraph::Type& t) { collapse (value_); @@ -1240,9 +1240,9 @@ namespace CXX if (!value_) return; - Size b (0); + size_t b (0); - for (Size e (value_.find (' ')); ; e = value_.find (' ', b)) + for (size_t e (value_.find (' ')); ; e = value_.find (' ', b)) { String v (value_, b, e != String::npos ? e - b : e); diff --git a/xsd/cxx/tree/default-value.hxx b/xsd/cxx/tree/default-value.hxx index cd3d0f2..f8451c2 100644 --- a/xsd/cxx/tree/default-value.hxx +++ b/xsd/cxx/tree/default-value.hxx @@ -17,9 +17,9 @@ namespace CXX { struct IsLiteralValue: IsFundamentalType, Traversal::Complex { - IsLiteralValue (Boolean& r); + IsLiteralValue (bool& r); - virtual Void + virtual void traverse (SemanticGraph::Complex&); private: @@ -57,64 +57,64 @@ namespace CXX // Handle inheritance. // - virtual Void + virtual void traverse (SemanticGraph::Complex&); // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&); // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&); // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&); private: @@ -148,25 +148,25 @@ namespace CXX // InitKind (Kind& r); - virtual Void + virtual void traverse (SemanticGraph::List&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&); private: @@ -218,136 +218,136 @@ namespace CXX { InitValue (Context&); - Void + void data (String const& data) { data_ = data; dispatch_count_ = 0; } - Void + void dispatch (SemanticGraph::Node& type, String const& value); - virtual Void + virtual void traverse (SemanticGraph::List&); - virtual Void + virtual void traverse (SemanticGraph::Union&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType&); - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&); // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&); // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&); // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&); // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&); // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&); // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&); // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&); private: - Void + void string_sequence_type (SemanticGraph::Type& element_type); - Void - time_zone (Size pos); + void + time_zone (size_t pos); private: String value_; String data_; - Size dispatch_count_; + size_t dispatch_count_; MemberTypeName type_name_; LiteralValue literal_value_; }; diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx index a608672..f96c24c 100644 --- a/xsd/cxx/tree/elements.cxx +++ b/xsd/cxx/tree/elements.cxx @@ -11,14 +11,14 @@ namespace CXX { // Context // - Void Context:: + void Context:: update_ns_scope () // Keeping this function first helps HP-UX { // (long symbols). ns_scope.clear (); - Boolean first (true); + bool first (true); - for (NamespaceStack::Iterator i (ns_scope_stack.begin ()); + for (NamespaceStack::iterator i (ns_scope_stack.begin ()); i != ns_scope_stack.end (); ++i) { @@ -39,7 +39,7 @@ namespace CXX SemanticGraph::Path const& path, options_type const& ops, Counts const& counts_, - Boolean generate_xml_schema__, + bool generate_xml_schema__, StringLiteralMap const* map, Regex const* fe, Regex const* he, @@ -178,7 +178,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); // If no delimiter found then both type and base are empty. // @@ -231,11 +231,11 @@ namespace CXX if (s.empty ()) throw InvalidCustomTypeMapping (s, "mapping string is empty"); - WideChar delimiter (s[0]); + wchar_t delimiter (s[0]); // First get pattern. // - Size pos (s.find (delimiter, 1)); + size_t pos (s.find (delimiter, 1)); if (pos == String::npos) throw InvalidCustomTypeMapping ( @@ -363,7 +363,7 @@ namespace CXX { } - Boolean Context:: + bool Context:: custom_type (SemanticGraph::Type const& t, String& r) const { String const& name (t.name ()); @@ -371,7 +371,7 @@ namespace CXX // First search the direct mapping. // { - DirectCustomTypeMap::ConstIterator i ( + DirectCustomTypeMap::const_iterator i ( direct_custom_type_map.find (name)); if (i != direct_custom_type_map.end ()) @@ -384,7 +384,7 @@ namespace CXX // Second search the regex mapping. // - for (RegexCustomTypeMap::ConstIterator + for (RegexCustomTypeMap::const_iterator i (regex_custom_type_map.begin ()), e (regex_custom_type_map.end ()); i != e; ++i) @@ -422,7 +422,7 @@ namespace CXX return r; } - Boolean Context:: + bool Context:: renamed_type (SemanticGraph::Type const& t, String& r) const { String const& name (t.name ()); @@ -430,7 +430,7 @@ namespace CXX // First search the direct mapping. // { - DirectCustomTypeMap::ConstIterator i ( + DirectCustomTypeMap::const_iterator i ( direct_custom_type_map.find (name)); if (i != direct_custom_type_map.end ()) @@ -443,7 +443,7 @@ namespace CXX // Second search the regex mapping. // - for (RegexCustomTypeMap::ConstIterator + for (RegexCustomTypeMap::const_iterator i (regex_custom_type_map.begin ()), e (regex_custom_type_map.end ()); i != e; ++i) @@ -464,17 +464,17 @@ namespace CXX return false; } - Void Context:: + void Context:: write_annotation (SemanticGraph::Annotation& a) { String const& doc (a.documentation ()); - WideChar const* s (doc.c_str ()); - Size size (doc.size ()); + wchar_t const* s (doc.c_str ()); + size_t size (doc.size ()); // Remove leading and trailing whitespaces. // - while (*s == WideChar (0x20) || *s == WideChar (0x0A) || - *s == WideChar (0x0D) || *s == WideChar (0x09)) + while (*s == wchar_t (0x20) || *s == wchar_t (0x0A) || + *s == wchar_t (0x0D) || *s == wchar_t (0x09)) { s++; size--; @@ -482,11 +482,11 @@ namespace CXX if (size != 0) { - WideChar const* e (s + size - 1); + wchar_t const* e (s + size - 1); while (e > s && - (*e == WideChar (0x20) || *e == WideChar (0x0A) || - *e == WideChar (0x0D) || *e == WideChar (0x09))) + (*e == wchar_t (0x20) || *e == wchar_t (0x0A) || + *e == wchar_t (0x0D) || *e == wchar_t (0x09))) --e; size = s <= e ? e - s + 1 : 0; @@ -499,15 +499,15 @@ namespace CXX // Go over the data, forcing newline after 80 chars and adding // ' * ' after each new line. // - WideChar const* last_space (0); - WideChar const* b (s); - WideChar const* e (s); - Boolean after_newline (false); - Boolean rogue (false); + wchar_t const* last_space (0); + wchar_t const* b (s); + wchar_t const* e (s); + bool after_newline (false); + bool rogue (false); for (; e < s + size; ++e) { - UnsignedLong u (unicode_char (e)); // May advance e. + unsigned int u (unicode_char (e)); // May advance e. // We are going to treat \v and \f as rogue here even though // they can be present in C++ source code. @@ -564,16 +564,16 @@ namespace CXX } } - Void Context:: - write_rogue_text (WideChar const* s, Size size, Boolean rogue) + void Context:: + write_rogue_text (wchar_t const* s, size_t size, bool rogue) { if (!rogue) os.write (s, size); else { - for (WideChar const* p (s); p < s + size; ++p) + for (wchar_t const* p (s); p < s + size; ++p) { - UnsignedLong u (unicode_char (p)); // May advance p. + unsigned int u (unicode_char (p)); // May advance p. // We are going to treat \v and \f as rogue here even though // they can be present in C++ source code. @@ -581,12 +581,12 @@ namespace CXX if (u > 127 || (u < 32 && u != '\t' && u != '\n')) os.put ('?'); else - os.put (static_cast (u)); + os.put (static_cast (u)); } } } - Boolean Context:: + bool Context:: polymorphic_p (SemanticGraph::Type& t) { // IDREF templates cannot be polymorphic. @@ -598,16 +598,16 @@ namespace CXX if (polymorphic_all) { - Boolean fund (false); + bool fund (false); IsFundamentalType test (fund); test.dispatch (t); return !fund; } else - return t.context ().get ("polymorphic"); + return t.context ().get ("polymorphic"); } - Boolean Context:: + bool Context:: anonymous_substitutes_p (SemanticGraph::Type& t) { // IDREF templates cannot match. @@ -636,14 +636,14 @@ namespace CXX // GenerateDefautCtor // GenerateDefaultCtor:: - GenerateDefaultCtor (Context& c, Boolean& generate, Boolean no_base) + GenerateDefaultCtor (Context& c, bool& generate, bool no_base) : Context (c), generate_ (generate), no_base_ (no_base) { *this >> inherits_ >> *this; *this >> names_ >> *this; } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Complex& c) { // Make sure we figure out if we have any required members before @@ -655,35 +655,35 @@ namespace CXX Complex::inherits (c, inherits_); } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Type&) { if (!no_base_) generate_ = true; } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Enumeration&) { if (!no_base_) generate_ = true; } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Element& e) { if (!skip (e) && min (e) == 1 && max (e) == 1) generate_ = true; } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Attribute& a) { if (min (a) == 1 && !a.fixed_p ()) generate_ = true; } - Void GenerateDefaultCtor:: + void GenerateDefaultCtor:: traverse (SemanticGraph::Any& a) { if (options.generate_wildcard () && @@ -695,7 +695,7 @@ namespace CXX // GenerateFromBaseCtor // GenerateFromBaseCtor:: - GenerateFromBaseCtor (Context& c, Boolean& generate) + GenerateFromBaseCtor (Context& c, bool& generate) : generate_ (generate), custom_ (false), traverser_ (c, generate, custom_) @@ -703,7 +703,7 @@ namespace CXX inherits_ >> traverser_; } - Void GenerateFromBaseCtor:: + void GenerateFromBaseCtor:: traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -721,14 +721,14 @@ namespace CXX } GenerateFromBaseCtor::Traverser:: - Traverser (Context& c, Boolean& generate, Boolean& custom) + Traverser (Context& c, bool& generate, bool& custom) : Context (c), generate_ (generate), custom_ (custom) { *this >> inherits_ >> *this; *this >> names_ >> *this; } - Void GenerateFromBaseCtor::Traverser:: + void GenerateFromBaseCtor::Traverser:: traverse (SemanticGraph::Type& t) { if (!custom_) @@ -738,7 +738,7 @@ namespace CXX } } - Void GenerateFromBaseCtor::Traverser:: + void GenerateFromBaseCtor::Traverser:: traverse (SemanticGraph::Complex& c) { names (c, names_); @@ -750,21 +750,21 @@ namespace CXX traverse (static_cast (c)); } - Void GenerateFromBaseCtor::Traverser:: + void GenerateFromBaseCtor::Traverser:: traverse (SemanticGraph::Element& e) { if (!skip (e) && min (e) == 1 && max (e) == 1) generate_ = true; } - Void GenerateFromBaseCtor::Traverser:: + void GenerateFromBaseCtor::Traverser:: traverse (SemanticGraph::Attribute& a) { if (min (a) == 1 && !a.fixed_p ()) generate_ = true; } - Void GenerateFromBaseCtor::Traverser:: + void GenerateFromBaseCtor::Traverser:: traverse (SemanticGraph::Any& a) { if (options.generate_wildcard () && @@ -776,10 +776,10 @@ namespace CXX // HasComplexPolyNonOptArgs:: HasComplexPolyNonOptArgs (Context& c, - Boolean base, - Boolean& complex, - Boolean& poly, - Boolean& clash) + bool base, + bool& complex, + bool& poly, + bool& clash) : Context (c), complex_ (complex), poly_ (poly), @@ -791,7 +791,7 @@ namespace CXX *this >> names_ >> *this; } - Void HasComplexPolyNonOptArgs:: + void HasComplexPolyNonOptArgs:: traverse (SemanticGraph::Complex& c) { // No optimizations: need to check every arg for clashes. @@ -800,14 +800,14 @@ namespace CXX names (c, names_); } - Void HasComplexPolyNonOptArgs:: + void HasComplexPolyNonOptArgs:: traverse (SemanticGraph::Element& e) { if (!skip (e) && min (e) == 1 && max (e) == 1) { - Boolean poly (polymorphic && polymorphic_p (e.type ())); + bool poly (polymorphic && polymorphic_p (e.type ())); - Boolean simple (true); + bool simple (true); IsSimpleType t (simple); t.dispatch (e.type ()); @@ -825,12 +825,12 @@ namespace CXX // FromBaseCtorArg // FromBaseCtorArg:: - FromBaseCtorArg (Context& c, ArgType at, Boolean arg) + FromBaseCtorArg (Context& c, ArgType at, bool arg) : Context (c), arg_type_ (at), arg_ (arg) { } - Void FromBaseCtorArg:: + void FromBaseCtorArg:: traverse (SemanticGraph::Any& a) { if (!options.generate_wildcard ()) @@ -848,7 +848,7 @@ namespace CXX } } - Void FromBaseCtorArg:: + void FromBaseCtorArg:: traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -860,13 +860,13 @@ namespace CXX os << "," << endl; - Boolean auto_ptr (false); + bool auto_ptr (false); switch (arg_type_) { case arg_complex_auto_ptr: { - Boolean simple (true); + bool simple (true); IsSimpleType t (simple); t.dispatch (e.type ()); auto_ptr = !simple; @@ -891,7 +891,7 @@ namespace CXX } } - Void FromBaseCtorArg:: + void FromBaseCtorArg:: traverse (SemanticGraph::Attribute& a) { // Note that we are not going to include attributes with @@ -936,7 +936,7 @@ namespace CXX *this >> names_ >> *this; } - Void CtorArgs:: + void CtorArgs:: traverse (SemanticGraph::Type& t) { os << comma () << "const "; @@ -957,7 +957,7 @@ namespace CXX } } - Void CtorArgs:: + void CtorArgs:: traverse (SemanticGraph::Enumeration& e) { os << comma () << "const "; @@ -974,7 +974,7 @@ namespace CXX } } - Void CtorArgs:: + void CtorArgs:: traverse (SemanticGraph::Any& a) { if (!options.generate_wildcard ()) @@ -989,7 +989,7 @@ namespace CXX } } - Void CtorArgs:: + void CtorArgs:: traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -997,13 +997,13 @@ namespace CXX if (min (e) == 1 && max (e) == 1) { - Boolean auto_ptr (false); + bool auto_ptr (false); switch (arg_type_) { case arg_complex_auto_ptr: { - Boolean simple (true); + bool simple (true); IsSimpleType t (simple); t.dispatch (e.type ()); auto_ptr = !simple; @@ -1028,7 +1028,7 @@ namespace CXX } } - Void CtorArgs:: + void CtorArgs:: traverse (SemanticGraph::Attribute& a) { // Note that we are not going to include attributes with @@ -1047,7 +1047,7 @@ namespace CXX String CtorArgs:: comma () { - Boolean tmp (first_); + bool tmp (first_); first_ = false; return tmp ? "" : ",\n"; } @@ -1056,14 +1056,14 @@ namespace CXX // CtorArgsWithoutBase // CtorArgsWithoutBase:: - CtorArgsWithoutBase (Context& c, ArgType at, Boolean arg, Boolean first) + CtorArgsWithoutBase (Context& c, ArgType at, bool arg, bool first) : Context (c), arg_type_ (at), arg_ (arg), first_ (first) { *this >> inherits_ >> *this; *this >> names_ >> *this; } - Void CtorArgsWithoutBase:: + void CtorArgsWithoutBase:: traverse (SemanticGraph::Any& a) { if (!options.generate_wildcard ()) @@ -1078,7 +1078,7 @@ namespace CXX } } - Void CtorArgsWithoutBase:: + void CtorArgsWithoutBase:: traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -1086,13 +1086,13 @@ namespace CXX if (min (e) == 1 && max (e) == 1) { - Boolean auto_ptr (false); + bool auto_ptr (false); switch (arg_type_) { case arg_complex_auto_ptr: { - Boolean simple (true); + bool simple (true); IsSimpleType t (simple); t.dispatch (e.type ()); auto_ptr = !simple; @@ -1117,7 +1117,7 @@ namespace CXX } } - Void CtorArgsWithoutBase:: + void CtorArgsWithoutBase:: traverse (SemanticGraph::Attribute& a) { // Note that we are not going to include attributes with @@ -1136,14 +1136,14 @@ namespace CXX String CtorArgsWithoutBase:: comma () { - Boolean tmp (first_); + bool tmp (first_); first_ = false; return tmp ? "" : ",\n"; } // GlobalElementBase // - Boolean GlobalElementBase:: + bool GlobalElementBase:: generate_p (SemanticGraph::Element& e) { if (e.substitutes_p () && ctx_.polymorphic) @@ -1163,7 +1163,7 @@ namespace CXX return true; } - Boolean GlobalElementBase:: + bool GlobalElementBase:: doc_root_p (SemanticGraph::Element& e) { if (!ctx_.options.root_element_first () && @@ -1207,8 +1207,8 @@ namespace CXX // Namespace:: Namespace (Context& c, - UnsignedLong first, - UnsignedLong last) + size_t first, + size_t last) : CXX::Namespace (c, *this), GlobalElementBase (c), ctx_ (c), @@ -1218,7 +1218,7 @@ namespace CXX { } - Void Namespace:: + void Namespace:: traverse (Type& ns) { using SemanticGraph::Element; @@ -1227,7 +1227,7 @@ namespace CXX CXX::Namespace::traverse (ns); else { - Boolean opened (false); + bool opened (false); for (Type::NamesIterator i (ns.names_begin ()); i != ns.names_end (); ++i) @@ -1257,13 +1257,13 @@ namespace CXX } } - Void Namespace:: - enter (Type&, String const& name, Boolean) + void Namespace:: + enter (Type&, String const& name, bool) { ctx_.enter_ns_scope (name); } - Void Namespace:: + void Namespace:: leave () { ctx_.leave_ns_scope (); @@ -1271,7 +1271,7 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { String const& name (ename (t)); @@ -1293,14 +1293,14 @@ namespace CXX os << "class " << name << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type // compilation model. // Type t (type_); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); SemanticGraph::Schema& s (u.schema ()); if (weak && t == header) diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx index da9a182..d02bfe7 100644 --- a/xsd/cxx/tree/elements.hxx +++ b/xsd/cxx/tree/elements.hxx @@ -6,14 +6,13 @@ #ifndef CXX_TREE_ELEMENTS_HXX #define CXX_TREE_ELEMENTS_HXX +#include +#include +#include #include #include -#include -#include -#include - #include #include @@ -34,15 +33,15 @@ namespace CXX { } - UnsignedLong global_types; - UnsignedLong global_elements; - UnsignedLong generated_global_elements; + size_t global_types; + size_t global_elements; + size_t generated_global_elements; // Complexity value for each global type and generated global // element, in order. // - Cult::Containers::Vector complexity; - UnsignedLong complexity_total; + std::vector complexity; + size_t complexity_total; }; struct InvalidCustomTypeMapping @@ -106,13 +105,8 @@ namespace CXX String base_sub; }; - typedef - Cult::Containers::Vector - RegexCustomTypeMap; - - typedef - Cult::Containers::Map - DirectCustomTypeMap; + typedef std::vector RegexCustomTypeMap; + typedef std::map DirectCustomTypeMap; public: Context (std::wostream& o, @@ -120,7 +114,7 @@ namespace CXX SemanticGraph::Path const& path, options_type const& ops, Counts const& counts_, - Boolean generate_xml_schema, + bool generate_xml_schema, StringLiteralMap const*, Regex const* fwd_expr, Regex const* hxx_expr, @@ -142,7 +136,7 @@ namespace CXX // populated with the custom type name or empty if the // original name should be used. // - Boolean + bool custom_type (SemanticGraph::Type const&, String& name) const; // Returns true if this type has been renamed as part of the @@ -150,7 +144,7 @@ namespace CXX // name string is populated with the new name or empty if // the type should not be generated at all. // - Boolean + bool renamed_type (SemanticGraph::Type const&, String& name) const; public: @@ -158,16 +152,16 @@ namespace CXX // line after 80 characters as well as "commentizing" the text by // adding '* ' after each newline. // - Void + void write_annotation (SemanticGraph::Annotation&); // // public: - Boolean + bool polymorphic_p (SemanticGraph::Type&); - Boolean + bool anonymous_p (SemanticGraph::Type const& t) { return t.context ().count ("anonymous"); @@ -176,7 +170,7 @@ namespace CXX // Return true if this anonymous type is defined in an element // that belongs to a substitution group. // - Boolean + bool anonymous_substitutes_p (SemanticGraph::Type&); // Escaped names. @@ -338,7 +332,7 @@ namespace CXX // dom_document // - static Boolean + static bool edom_document_p (SemanticGraph::Complex const& c) { return c.context ().count ("dom-document"); @@ -350,7 +344,7 @@ namespace CXX return c.context ().get ("dom-document"); } - static Boolean + static bool edom_document_member_p (SemanticGraph::Complex const& c) { return c.context ().count ("dom-document-member"); @@ -377,14 +371,14 @@ namespace CXX } public: - Void + void enter_ns_scope (String const& name) { ns_scope_stack.push_back (name); update_ns_scope (); } - Void + void leave_ns_scope () { ns_scope_stack.pop_back (); @@ -392,15 +386,15 @@ namespace CXX } private: - Void + void update_ns_scope (); private: // Write text that may contain characters that we will have // to escape (indicated by the rogue flag). // - Void - write_rogue_text (WideChar const* s, Size size, Boolean rogue); + void + write_rogue_text (wchar_t const* s, size_t size, bool rogue); public: options_type const& options; @@ -426,11 +420,11 @@ namespace CXX String& as_double_type; String& as_decimal_type; - Boolean& generate_xml_schema; - Boolean& doxygen; - Boolean polymorphic; - Boolean polymorphic_all; - Boolean detach; + bool& generate_xml_schema; + bool& doxygen; + bool polymorphic; + bool polymorphic_all; + bool detach; Regex const* fwd_expr; Regex const* hxx_expr; @@ -463,16 +457,11 @@ namespace CXX String as_double_type_; String as_decimal_type_; - Boolean generate_xml_schema_; - Boolean doxygen_; - - typedef - Cult::Containers::Deque - NamespaceStack; + bool generate_xml_schema_; + bool doxygen_; - typedef - Cult::Containers::Deque - ScopeStack; + typedef std::deque NamespaceStack; + typedef std::deque ScopeStack; String ns_scope_; @@ -510,86 +499,86 @@ namespace CXX Traversal::Fundamental::Decimal { - IsFundamentalType (Boolean& r) + IsFundamentalType (bool& r) : r_ (r) { } // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { r_ = true; @@ -597,7 +586,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { r_ = true; @@ -605,26 +594,26 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { r_ = true; } private: - Boolean& r_; + bool& r_; }; // Check whether this is a string-based type. @@ -639,19 +628,19 @@ namespace CXX Traversal::Fundamental::NCName, Traversal::Fundamental::Language { - IsStringBasedType (Boolean& r) + IsStringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); } - virtual Void + virtual void traverse (SemanticGraph::Union&) { // Current mapping of union is string-based. @@ -661,50 +650,50 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { r_ = true; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -722,7 +711,7 @@ namespace CXX inherits_ >> enum_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -736,7 +725,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e_ == 0) @@ -829,25 +818,25 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { abort (); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { os << fq_name (l); } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { os << fq_name (u); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { os << fq_name (c); @@ -855,13 +844,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { os << fq_name (t); @@ -869,79 +858,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { os << fq_name (t); @@ -949,7 +938,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { os << fq_name (t); @@ -957,19 +946,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { os << fq_name (t); @@ -977,49 +966,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { os << fq_name (t); @@ -1028,7 +1017,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { os << fq_name (t); @@ -1037,13 +1026,13 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { if (t.named_p ()) @@ -1063,7 +1052,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { if (t.named_p ()) @@ -1086,7 +1075,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { os << fq_name (t); @@ -1094,13 +1083,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { os << fq_name (t); @@ -1109,55 +1098,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { os << fq_name (t); @@ -1165,13 +1154,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { os << fq_name (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { os << fq_name (t); @@ -1209,7 +1198,7 @@ namespace CXX { } - virtual Void + virtual void fundamental_base (SemanticGraph::Type& t) { os << "::xsd::cxx::tree::fundamental_base< " << @@ -1219,79 +1208,79 @@ namespace CXX // Integrals. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fundamental_base (t); @@ -1299,7 +1288,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fundamental_base (t); @@ -1307,13 +1296,13 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fundamental_base (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { os << "::xsd::cxx::tree::fundamental_base< " << @@ -1322,7 +1311,7 @@ namespace CXX "::xsd::cxx::tree::schema_type::double_ >"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { os << "::xsd::cxx::tree::fundamental_base< " << @@ -1339,14 +1328,14 @@ namespace CXX Traversal::Any, Traversal::AnyAttribute { - IsSimpleType (Boolean& v) + IsSimpleType (bool& v) : v_ (v) { *this >> names_ >> *this; *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { names (c, names_); @@ -1355,26 +1344,26 @@ namespace CXX inherits (c, inherits_); } - virtual Void + virtual void traverse (SemanticGraph::Member&) { v_ = false; } - virtual Void + virtual void traverse (SemanticGraph::Any&) { v_ = false; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { v_ = false; } private: - Boolean& v_; + bool& v_; Traversal::Names names_; Traversal::Inherits inherits_; }; @@ -1392,29 +1381,29 @@ namespace CXX { // generate should initially be false. // - GenerateDefaultCtor (Context&, Boolean& generate, Boolean no_base); + GenerateDefaultCtor (Context&, bool& generate, bool no_base); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Type&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Element&); - virtual Void + virtual void traverse (SemanticGraph::Attribute&); - virtual Void + virtual void traverse (SemanticGraph::Any&); private: - Boolean& generate_; - Boolean no_base_; + bool& generate_; + bool no_base_; private: Traversal::Inherits inherits_; @@ -1427,14 +1416,14 @@ namespace CXX { // generate should initially be false. // - GenerateFromBaseCtor (Context& c, Boolean& generate); + GenerateFromBaseCtor (Context& c, bool& generate); - virtual Void + virtual void traverse (SemanticGraph::Complex& c); private: - Boolean& generate_; - Boolean custom_; + bool& generate_; + bool custom_; // Note that we are not interested in anyAttribute since it is always // mapped to a sequence. @@ -1446,26 +1435,26 @@ namespace CXX Traversal::Any, Context { - Traverser (Context& c, Boolean& generate, Boolean& custom); + Traverser (Context& c, bool& generate, bool& custom); - virtual Void + virtual void traverse (SemanticGraph::Type&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Attribute&); - virtual Void + virtual void traverse (SemanticGraph::Element&); - virtual Void + virtual void traverse (SemanticGraph::Any&); private: - Boolean& generate_; - Boolean& custom_; + bool& generate_; + bool& custom_; private: Traversal::Inherits inherits_; @@ -1486,21 +1475,21 @@ namespace CXX // should initially be true. // HasComplexPolyNonOptArgs (Context& c, - Boolean including_base, - Boolean& complex, - Boolean& poly, - Boolean& clash); + bool including_base, + bool& complex, + bool& poly, + bool& clash); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Element&); private: - Boolean& complex_; - Boolean& poly_; - Boolean& clash_; + bool& complex_; + bool& poly_; + bool& clash_; Traversal::Inherits inherits_; Traversal::Names names_; @@ -1521,20 +1510,20 @@ namespace CXX arg_poly_auto_ptr }; - FromBaseCtorArg (Context& c, ArgType, Boolean arg); + FromBaseCtorArg (Context& c, ArgType, bool arg); - virtual Void + virtual void traverse (SemanticGraph::Any&); - virtual Void + virtual void traverse (SemanticGraph::Attribute&); - virtual Void + virtual void traverse (SemanticGraph::Element&); private: ArgType arg_type_; - Boolean arg_; + bool arg_; }; // List of all non-optional members and a simple base. Note that @@ -1561,19 +1550,19 @@ namespace CXX CtorArgs (Context&, ArgType); CtorArgs (Context&, ArgType, String& base_arg); - virtual Void + virtual void traverse (SemanticGraph::Type&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Any&); - virtual Void + virtual void traverse (SemanticGraph::Attribute&); - virtual Void + virtual void traverse (SemanticGraph::Element&); private: @@ -1584,7 +1573,7 @@ namespace CXX ArgType arg_type_; String base_; String* base_arg_; - Boolean first_; + bool first_; private: Traversal::Inherits inherits_; @@ -1616,92 +1605,92 @@ namespace CXX { // generate should initially be false. // - GenerateWithoutBaseCtor (Boolean& generate) + GenerateWithoutBaseCtor (bool& generate) : generate_ (generate) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Union&) { // No default initialization. } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration&) { // No default initialization. } - virtual Void + virtual void traverse (SemanticGraph::AnyType&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&) { generate_ = true; } private: - Boolean& generate_; + bool& generate_; Traversal::Inherits inherits_; }; @@ -1722,15 +1711,15 @@ namespace CXX arg_poly_auto_ptr }; - CtorArgsWithoutBase (Context& c, ArgType, Boolean arg, Boolean first); + CtorArgsWithoutBase (Context& c, ArgType, bool arg, bool first); - virtual Void + virtual void traverse (SemanticGraph::Any&); - virtual Void + virtual void traverse (SemanticGraph::Element&); - virtual Void + virtual void traverse (SemanticGraph::Attribute&); private: @@ -1739,8 +1728,8 @@ namespace CXX private: ArgType arg_type_; - Boolean arg_; - Boolean first_; + bool arg_; + bool first_; private: Traversal::Inherits inherits_; @@ -1756,10 +1745,10 @@ namespace CXX { } - Boolean + bool generate_p (SemanticGraph::Element&); - Boolean + bool doc_root_p (SemanticGraph::Element&); private: @@ -1774,26 +1763,26 @@ namespace CXX CXX::Namespace::ScopeTracker { Namespace (Context&, - UnsignedLong first = 1, - UnsignedLong last = 0); + size_t first = 1, + size_t last = 0); - virtual Void + virtual void traverse (Type&); protected: - virtual Void - enter (Type&, String const& name, Boolean last); + virtual void + enter (Type&, String const& name, bool last); - virtual Void + virtual void leave (); protected: Context& ctx_; private: - UnsignedLong first_; - UnsignedLong last_; - UnsignedLong count_; + size_t first_; + size_t last_; + size_t count_; }; // @@ -1805,8 +1794,8 @@ namespace CXX { } - virtual Void - enter (Type& ns, String const& name, Boolean last) + virtual void + enter (Type& ns, String const& name, bool last) { Namespace::enter (ns, name, last); @@ -1832,7 +1821,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); }; @@ -1857,26 +1846,26 @@ namespace CXX schema_ >> schema_names_ >> namespace_ >> names_ >> type_forward_; } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse_ (i); } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse_ (i); } private: - Void + void traverse_ (SemanticGraph::Uses&); private: Context& ctx_; Type type_; - Boolean forward_; + bool forward_; Traversal::Schema schema_; Traversal::Names schema_names_; @@ -1916,85 +1905,85 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_include (t, "byte.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_include (t, "unsigned-byte.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_include (t, "short.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_include (t, "unsigned-short.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_include (t, "int.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_include (t, "unsigned-int.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { if (!long_) long_ = gen_include (t, "long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { if (!unsigned_long_) unsigned_long_ = gen_include (t, "unsigned-long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { if (!long_) long_ = gen_include (t, "long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { if (!long_) long_ = gen_include (t, "long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { if (!unsigned_long_) unsigned_long_ = gen_include (t, "unsigned-long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { if (!unsigned_long_) unsigned_long_ = gen_include (t, "unsigned-long.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { if (!long_) @@ -2003,7 +1992,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_include (t, "boolean.hxx"); @@ -2011,26 +2000,26 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_include (t, "float.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_include (t, "double.hxx"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_include (t, "decimal.hxx"); } private: - Boolean + bool gen_include (SemanticGraph::Type& t, String const& file) { String custom; @@ -2055,8 +2044,8 @@ namespace CXX private: String prefix_; - Boolean long_; - Boolean unsigned_long_; + bool long_; + bool unsigned_long_; }; } } diff --git a/xsd/cxx/tree/fundamental-header.hxx b/xsd/cxx/tree/fundamental-header.hxx index 424034d..dd67f89 100644 --- a/xsd/cxx/tree/fundamental-header.hxx +++ b/xsd/cxx/tree/fundamental-header.hxx @@ -6,8 +6,8 @@ #ifndef CXX_TREE_FUNDAMENTAL_HEADER_HXX #define CXX_TREE_FUNDAMENTAL_HEADER_HXX -#include -#include +#include +#include #include #include @@ -88,13 +88,13 @@ namespace CXX xs_ns_ = ns_name (xs_ns ()); } - Void + void gen_typedef (String const& name, String const& type, String const& arg1 = L"", String const& arg2 = L"", String const& arg3 = L"", - Boolean export_type = true) + bool export_type = true) { os << "typedef " << type; @@ -225,7 +225,7 @@ namespace CXX // anyType and anySimpleType // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { os << "// anyType and anySimpleType." << endl @@ -237,7 +237,7 @@ namespace CXX type_ = built_in_type (t, "::xsd::cxx::tree::type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { simple_type_ = built_in_type ( @@ -259,7 +259,7 @@ namespace CXX // Integrals. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { os << "// 8-bit" << endl @@ -271,14 +271,14 @@ namespace CXX built_in_type (t, "signed char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { built_in_type (t, "unsigned char"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { os << "// 16-bit" << endl @@ -290,14 +290,14 @@ namespace CXX built_in_type (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { built_in_type (t, "unsigned short"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { os << "// 32-bit" << endl @@ -309,14 +309,14 @@ namespace CXX built_in_type (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { built_in_type (t, "unsigned int"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { os << "// 64-bit" << endl @@ -328,14 +328,14 @@ namespace CXX built_in_type (t, "long long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { built_in_type (t, "unsigned long long"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { os << "// Supposed to be arbitrary-length integral types." << endl @@ -347,25 +347,25 @@ namespace CXX built_in_type (t, "long long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { built_in_type (t, "long long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { built_in_type (t, "unsigned long long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { built_in_type (t, "unsigned long long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { built_in_type (t, "long long"); @@ -374,7 +374,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { os << "// Boolean." << endl @@ -390,7 +390,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { os << "// Floating-point types." << endl @@ -402,13 +402,13 @@ namespace CXX built_in_type (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { double_ = built_in_type (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { decimal_ = built_in_type (t, "double"); @@ -418,7 +418,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { os << "// String types." << endl @@ -431,7 +431,7 @@ namespace CXX t, L"::xsd::cxx::tree::string< " + char_type + L", ", simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { norm_string_ = built_in_type ( @@ -440,21 +440,21 @@ namespace CXX string_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { token_ = built_in_type ( t, L"::xsd::cxx::tree::token< " + char_type + L", ", norm_string_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = built_in_type ( t, L"::xsd::cxx::tree::nmtoken< " + char_type + L", ", token_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { built_in_type ( @@ -464,21 +464,21 @@ namespace CXX nmtoken_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { name_ = built_in_type ( t, L"::xsd::cxx::tree::name< " + char_type + L", ", token_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { ncname_ = built_in_type ( t, L"::xsd::cxx::tree::ncname< " + char_type + L", ", name_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { built_in_type ( @@ -489,7 +489,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { os << "// ID/IDREF." << endl @@ -502,14 +502,14 @@ namespace CXX t, L"::xsd::cxx::tree::id< " + char_type + L", ", ncname_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = built_in_type ( t, L"::xsd::cxx::tree::idref< " + char_type + L", ", ncname_, type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { built_in_type ( @@ -524,7 +524,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { os << "// URI." << endl @@ -541,7 +541,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { os << "// Qualified name." << endl @@ -562,7 +562,7 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { os << "// Binary." << endl @@ -586,7 +586,7 @@ namespace CXX simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { built_in_type ( @@ -600,7 +600,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { os << "// Date/time." << endl @@ -622,7 +622,7 @@ namespace CXX t, L"::xsd::cxx::tree::date< " + char_type + L", ", simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { built_in_type ( @@ -631,7 +631,7 @@ namespace CXX simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { built_in_type ( @@ -640,21 +640,21 @@ namespace CXX simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { built_in_type ( t, L"::xsd::cxx::tree::gday< " + char_type + L", ", simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { built_in_type ( t, L"::xsd::cxx::tree::gmonth< " + char_type + L", ", simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { built_in_type ( @@ -663,14 +663,14 @@ namespace CXX simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { built_in_type ( t, L"::xsd::cxx::tree::gyear< " + char_type + L", ", simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { built_in_type ( @@ -679,7 +679,7 @@ namespace CXX simple_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { built_in_type ( @@ -690,7 +690,7 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { os << "// Entity." << endl @@ -703,7 +703,7 @@ namespace CXX t, L"::xsd::cxx::tree::entity< " + char_type + L", ", ncname_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { built_in_type ( @@ -715,14 +715,14 @@ namespace CXX os << endl; } - virtual Void + virtual void post (SemanticGraph::Namespace& n) { SemanticGraph::Context& c (xs_ns ().context()); - Boolean parsing (!options.suppress_parsing ()); - Boolean serialization (options.generate_serialization ()); - Boolean element_map (options.generate_element_map ()); + bool parsing (!options.suppress_parsing ()); + bool serialization (options.generate_serialization ()); + bool element_map (options.generate_element_map ()); if (options.generate_element_type ()) { @@ -1228,7 +1228,7 @@ namespace CXX { StringSet ns_set; - for (StringList::ConstIterator i (exports_.begin ()); + for (StringList::const_iterator i (exports_.begin ()); i != exports_.end (); ++i) { String const& e (*i); @@ -1245,14 +1245,14 @@ namespace CXX << "namespace cxx" << "{"; - for (StringSet::ConstIterator i (ns_set.begin ()); + for (StringSet::const_iterator i (ns_set.begin ()); i != ns_set.end (); ++i) { String const& ns (*i); String prefix (L"::xsd::cxx::" + ns); - Size n (1); - for (Size b (0), e (ns.find (':')); ; n++) + size_t n (1); + for (size_t b (0), e (ns.find (':')); ; n++) { os << "namespace " << String (ns, b, e) << "{"; @@ -1264,7 +1264,7 @@ namespace CXX e = ns.find (':', b); } - for (StringList::ConstIterator i (exports_.begin ()); + for (StringList::const_iterator i (exports_.begin ()); i != exports_.end (); ++i) { String const& e (*i); @@ -1289,10 +1289,10 @@ namespace CXX } private: - typedef Cult::Containers::Set StringSet; - typedef Cult::Containers::Vector StringList; + typedef std::set StringSet; + typedef std::vector StringList; - Boolean export_; + bool export_; StringList exports_; StringSet exports_set_; String xs_ns_; diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx index 4eb4de2..ff2b705 100644 --- a/xsd/cxx/tree/generator.cxx +++ b/xsd/cxx/tree/generator.cxx @@ -3,6 +3,7 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include #include #include @@ -10,9 +11,6 @@ #include #include -#include -#include - #include #include #include @@ -50,10 +48,7 @@ #include "../../../libxsd/xsd/cxx/version.hxx" -using std::endl; -using std::wcerr; -using std::wcout; - +using namespace std; using namespace cutl; using namespace XSDFrontend::SemanticGraph; @@ -71,7 +66,7 @@ namespace CXX { namespace { - Char const copyright_gpl[] = + 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" @@ -105,7 +100,7 @@ namespace CXX "// in the accompanying FLOSSE file.\n" "//\n\n"; - Char const copyright_proprietary[] = + 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" @@ -116,7 +111,7 @@ namespace CXX "//\n\n"; } - Void Tree::Generator:: + void Tree::Generator:: usage () { CXX::Tree::options::print_usage (wcout); @@ -125,7 +120,7 @@ namespace CXX namespace { - Void + void open (WideInputFileStream& ifs, NarrowString const& path) { try @@ -150,7 +145,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -170,7 +165,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -186,24 +181,20 @@ namespace CXX } - UnsignedLong Tree::Generator:: + size_t Tree::Generator:: generate (Tree::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, StringLiteralMap const& string_literal_map, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) { - using std::ios_base; - typedef cutl::re::regexsub Regex; - using Cult::Containers::Vector; - - typedef Vector Paths; - typedef Vector > WideOutputFileStreams; + typedef vector Paths; + typedef vector > WideOutputFileStreams; try { @@ -280,7 +271,7 @@ namespace CXX // // - Boolean generate_xml_schema (ops.generate_xml_schema ()); + bool generate_xml_schema (ops.generate_xml_schema ()); // We could be compiling several schemas at once in which case // handling of the --generate-xml-schema option gets tricky: we @@ -296,9 +287,9 @@ namespace CXX } } - Boolean inline_ (ops.generate_inline () && !generate_xml_schema); - Boolean forward (ops.generate_forward () && !generate_xml_schema); - Boolean source (!generate_xml_schema); + bool inline_ (ops.generate_inline () && !generate_xml_schema); + bool forward (ops.generate_forward () && !generate_xml_schema); + bool source (!generate_xml_schema); // Generate code. // @@ -370,7 +361,7 @@ namespace CXX { if (parts > 1) { - for (UnsignedLong i (0); i < parts; ++i) + for (size_t i (0); i < parts; ++i) { std::ostringstream os; os << i; @@ -430,7 +421,7 @@ namespace CXX ixx_path = out_dir / ixx_path; fwd_path = out_dir / fwd_path; - for (Paths::Iterator i (cxx_paths.begin ()); + for (Paths::iterator i (cxx_paths.begin ()); i != cxx_paths.end (); ++i) *i = out_dir / *i; } @@ -493,7 +484,7 @@ namespace CXX // if (source) { - for (Paths::Iterator i (cxx_paths.begin ()); + for (Paths::iterator i (cxx_paths.begin ()); i != cxx_paths.end (); ++i) { shared_ptr s ( @@ -514,7 +505,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); if (forward) @@ -539,7 +530,7 @@ namespace CXX if (source) { - for (WideOutputFileStreams::Iterator i (cxx.begin ()); + for (WideOutputFileStreams::iterator i (cxx.begin ()); i != cxx.end (); ++i) **i << copyright; } @@ -568,7 +559,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); typedef compiler::ostream_filter diff --git a/xsd/cxx/tree/generator.hxx b/xsd/cxx/tree/generator.hxx index 0e05585..5db4a5d 100644 --- a/xsd/cxx/tree/generator.hxx +++ b/xsd/cxx/tree/generator.hxx @@ -6,12 +6,11 @@ #ifndef CXX_TREE_GENERATOR_HXX #define CXX_TREE_GENERATOR_HXX -#include - #include // Path #include #include +#include #include #include @@ -20,21 +19,19 @@ namespace CXX { namespace Tree { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean file_per_type, + bool file_per_type, StringLiteralMap const&, const WarningSet& disabled_warnings, FileList& file_list, diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx index 5fc7876..1e21bab 100644 --- a/xsd/cxx/tree/name-processor.cxx +++ b/xsd/cxx/tree/name-processor.cxx @@ -3,18 +3,19 @@ // copyright : Copyright (c) 2006-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 +using namespace std; + namespace CXX { namespace Tree @@ -29,7 +30,7 @@ namespace CXX { // // - typedef Cult::Containers::Set NameSet; + typedef set NameSet; class Context: public Tree::Context { @@ -38,7 +39,7 @@ namespace CXX Context (Tree::options const& ops, Counts const& counts, - Boolean generate_xml_schema, + bool generate_xml_schema, SemanticGraph::Schema& root, SemanticGraph::Path const& path, StringLiteralMap const& map) @@ -69,12 +70,9 @@ namespace CXX enumerator_regex (enumerator_regex_), element_type_regex (element_type_regex_) { - typedef Containers::Vector Vector; - NarrowString tn (options.type_naming ()); NarrowString fn (options.function_naming ()); - // Type name regex. // { @@ -285,12 +283,12 @@ namespace CXX typedef cutl::re::wregexsub Regex; typedef cutl::re::wformat RegexFormat; - struct RegexVector: Cult::Containers::Vector + struct RegexVector: vector { void push_back (String const& r) { - Cult::Containers::Vector::push_back (Regex (r)); + vector::push_back (Regex (r)); } }; @@ -299,12 +297,12 @@ namespace CXX RegexVector const& rv, String const& id) { - Boolean trace (options.name_regex_trace ()); + bool trace (options.name_regex_trace ()); if (trace) os << id << " name: '" << name << "'" << endl; - for (RegexVector::ConstReverseIterator i (rv.rbegin ()); + for (RegexVector::const_reverse_iterator i (rv.rbegin ()); i != rv.rend (); ++i) { if (trace) @@ -333,12 +331,12 @@ namespace CXX RegexVector const& backup, String const& id) { - Boolean trace (options.name_regex_trace ()); + bool trace (options.name_regex_trace ()); if (trace) os << id << " name: '" << name << "'" << endl; - for (RegexVector::ConstReverseIterator i (primary.rbegin ()); + for (RegexVector::const_reverse_iterator i (primary.rbegin ()); i != primary.rend (); ++i) { if (trace) @@ -358,7 +356,7 @@ namespace CXX os << '-' << endl; } - for (RegexVector::ConstReverseIterator i (backup.rbegin ()); + for (RegexVector::const_reverse_iterator i (backup.rbegin ()); i != backup.rend (); ++i) { if (trace) @@ -388,12 +386,12 @@ namespace CXX String const& id) { String s (ns + L' ' + name); - Boolean trace (options.name_regex_trace ()); + bool trace (options.name_regex_trace ()); if (trace) os << id << " name: '" << s << "'" << endl; - for (RegexVector::ConstReverseIterator i (rv.rbegin ()); + for (RegexVector::const_reverse_iterator i (rv.rbegin ()); i != rv.rend (); ++i) { if (trace) @@ -424,12 +422,12 @@ namespace CXX String const& id) { String s (ns + L' ' + name); - Boolean trace (options.name_regex_trace ()); + bool trace (options.name_regex_trace ()); if (trace) os << id << " name: '" << s << "'" << endl; - for (RegexVector::ConstReverseIterator i (primary.rbegin ()); + for (RegexVector::const_reverse_iterator i (primary.rbegin ()); i != primary.rend (); ++i) { if (trace) @@ -449,7 +447,7 @@ namespace CXX os << '-' << endl; } - for (RegexVector::ConstReverseIterator i (backup.rbegin ()); + for (RegexVector::const_reverse_iterator i (backup.rbegin ()); i != backup.rend (); ++i) { if (trace) @@ -476,11 +474,11 @@ namespace CXX String find_name (String const& base_name, NameSet& set, - Boolean insert = true) + bool insert = true) { String name (base_name); - for (UnsignedLong i (1); set.find (name) != set.end (); ++i) + for (size_t i (1); set.find (name) != set.end (); ++i) { std::wostringstream os; os << i; @@ -494,7 +492,7 @@ namespace CXX } private: - Void + void compile_regex (NarrowStrings const& sv, RegexVector& rv, String const& id) @@ -517,8 +515,8 @@ namespace CXX } private: - Cult::Containers::Map global_type_names_; - Cult::Containers::Map global_element_names_; + map global_type_names_; + map global_element_names_; RegexVector type_regex_; RegexVector accessor_regex_; @@ -535,10 +533,10 @@ namespace CXX RegexVector element_type_regex_; public: - Cult::Containers::Map& global_type_names; - Cult::Containers::Map& global_element_names; + map& global_type_names; + map& global_element_names; - Boolean detach; + bool detach; RegexVector& type_regex; RegexVector& accessor_regex; @@ -564,7 +562,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // Process the name with enumerator name regex. @@ -591,7 +589,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // Use processed name. @@ -631,7 +629,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Tree::Context::skip (m)) @@ -658,19 +656,19 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (Tree::Context::skip (m)) return; - UnsignedLong max (Tree::Context::max (m)); - UnsignedLong min (Tree::Context::min (m)); + size_t max (Tree::Context::max (m)); + size_t min (Tree::Context::min (m)); String const& s (m.context ().get ("stem")); String const& b (m.context ().get ("name")); - Boolean def_attr (m.default_p () && + bool def_attr (m.default_p () && m.is_a ()); // Accessors/modifiers. Note that we postpone inserting @@ -810,7 +808,7 @@ namespace CXX // if (m.default_p ()) { - Boolean simple (true); + bool simple (true); if (m.is_a ()) { @@ -827,7 +825,7 @@ namespace CXX m.context ().set ( "default-value", find_name (an, name_set_)); - Boolean lit (false); + bool lit (false); { IsLiteralValue test (lit); test.dispatch (m.type ()); @@ -855,7 +853,7 @@ namespace CXX Any (Context& c, NameSet& name_set, NameSet& stem_set, - Boolean& has_wildcard) + bool& has_wildcard) : Context (c), name_set_ (name_set), stem_set_ (stem_set), @@ -863,11 +861,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong max (Tree::Context::max (a)); - UnsignedLong min (Tree::Context::min (a)); + size_t max (Tree::Context::max (a)); + size_t min (Tree::Context::min (a)); String s (find_name (L"any", stem_set_)); @@ -985,7 +983,7 @@ namespace CXX has_wildcard_ = true; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String s (find_name (L"any,attribute", stem_set_)); @@ -1051,7 +1049,7 @@ namespace CXX private: NameSet& name_set_; NameSet& stem_set_; - Boolean& has_wildcard_; + bool& has_wildcard_; }; // @@ -1063,7 +1061,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -1149,7 +1147,7 @@ namespace CXX // if (options.generate_wildcard ()) { - Boolean has_wildcard (false); + bool has_wildcard (false); Any any (*this, member_set, stem_set, has_wildcard); Traversal::Names names (any); Complex::names (c, names); @@ -1212,7 +1210,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // Process the name with type name regex. @@ -1255,7 +1253,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First we need to figure out if we need to process this @@ -1430,7 +1428,7 @@ namespace CXX if (type_set_.find (r) != type_set_.end ()) r += L"_"; - for (UnsignedLong i (1); + for (size_t i (1); element_set_.find (r) != element_set_.end () || type_set_.find (r) != type_set_.end (); ++i) { @@ -1454,7 +1452,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { NameSet& type_set (global_type_names[ns.name ()]); @@ -1475,7 +1473,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { String const& name (ns.name ()); @@ -1557,7 +1555,7 @@ namespace CXX *this >> names_ >> *this; } - Void + void process_name (SemanticGraph::Type& t, String const& name) { String r ( @@ -1567,10 +1565,10 @@ namespace CXX t.context ().set ("name", escape (r)); } - Void + void process_name (SemanticGraph::Namespace& n, String const& name, - Char const* key) + char const* key) { String r (process_regex (name, type_regex, L"type")); n.context ().set (key, escape (r)); @@ -1578,13 +1576,13 @@ namespace CXX // anyType and anySimpleType // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { process_name (t, "type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { process_name (t, "simple,type"); @@ -1592,79 +1590,79 @@ namespace CXX // Integrals. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { process_name (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { process_name (t, "unsigned,byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { process_name (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { process_name (t, "unsigned,short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { process_name (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { process_name (t, "unsigned,int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { process_name (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { process_name (t, "unsigned,long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { process_name (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { process_name (t, "non,positive,integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { process_name (t, "non,negative,integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { process_name (t, "positive,integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { process_name (t, "negative,integer"); @@ -1672,7 +1670,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { process_name (t, "boolean"); @@ -1680,19 +1678,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { process_name (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { process_name (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { process_name (t, "decimal"); @@ -1700,49 +1698,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { process_name (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { process_name (t, "normalized,string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { process_name (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { process_name (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { process_name (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { process_name (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { process_name (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { process_name (t, "language"); @@ -1750,19 +1748,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { process_name (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { process_name (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { process_name (t, "idrefs"); @@ -1771,7 +1769,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { process_name (t, "uri"); @@ -1779,7 +1777,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { process_name (t, "qname"); @@ -1787,13 +1785,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { process_name (t, "base64,binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { process_name (t, "hex,binary"); @@ -1802,55 +1800,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { process_name (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { process_name (t, "date,time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { process_name (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { process_name (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { process_name (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { process_name (t, "gmonth,day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { process_name (t, "gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { process_name (t, "gyear,month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { process_name (t, "time"); @@ -1858,19 +1856,19 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { process_name (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { process_name (t, "entities"); } - virtual Void + virtual void post (SemanticGraph::Namespace& n) { // Assign names to extra stuff in the XML Schema namespace. @@ -1955,7 +1953,7 @@ namespace CXX // struct UsesPassOne: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -1970,7 +1968,7 @@ namespace CXX struct UsesPassThree: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -1988,7 +1986,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2001,7 +1999,7 @@ namespace CXX } }; - Boolean + bool process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, @@ -2128,7 +2126,7 @@ namespace CXX } } - Boolean NameProcessor:: + bool NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, diff --git a/xsd/cxx/tree/name-processor.hxx b/xsd/cxx/tree/name-processor.hxx index 2d87388..8026a3d 100644 --- a/xsd/cxx/tree/name-processor.hxx +++ b/xsd/cxx/tree/name-processor.hxx @@ -6,6 +6,8 @@ #ifndef CXX_TREE_NAME_PROCESSOR_HXX #define CXX_TREE_NAME_PROCESSOR_HXX +#include + #include #include @@ -13,14 +15,12 @@ namespace CXX { namespace Tree { - using namespace Cult::Types; - class NameProcessor { public: NameProcessor (); // Dummy ctor, helps with long symbols on HP-UX. - Boolean + bool process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, diff --git a/xsd/cxx/tree/options.cli b/xsd/cxx/tree/options.cli index 9d67653..0d548e4 100644 --- a/xsd/cxx/tree/options.cli +++ b/xsd/cxx/tree/options.cli @@ -3,11 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -include ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -27,7 +25,7 @@ namespace CXX hierarchies are polymorphic." }; - std::vector --polymorphic-type + NarrowStrings --polymorphic-type { "", "Indicate that is a root of a polymorphic type hierarchy. The @@ -113,7 +111,7 @@ namespace CXX this option." }; - std::vector --generate-insertion + NarrowStrings --generate-insertion { "", "Generate data representation stream insertion operators for the @@ -125,7 +123,7 @@ namespace CXX declarations." }; - std::vector --generate-extraction + NarrowStrings --generate-extraction { "", "Generate data representation stream extraction constructors for the @@ -181,7 +179,7 @@ namespace CXX // Naming. // - Cult::Types::NarrowString --type-naming = "knr" + NarrowString --type-naming = "knr" { "