diff options
100 files changed, 2128 insertions, 2667 deletions
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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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. - - <signature of Ty Coon>, 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 <boris@kolpackov.net> -# 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 <boris@kolpackov.net> -# 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 <boris@kolpackov.net> -# 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<WideChar> (u)); + r.push_back (static_cast<wchar_t> (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<WideChar> (u); + r += static_cast<wchar_t> (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<WideChar> (u); + r += static_cast<wchar_t> (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<WideChar> (u); + r += static_cast<wchar_t> (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<WideChar> (u); + r += static_cast<wchar_t> (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<WideChar> (u); + r += static_cast<wchar_t> (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 <set> +#include <map> +#include <vector> #include <ostream> #include <cutl/re.hxx> -#include <cult/types.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/vector.hxx> - #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> @@ -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<Regex> RegexMapping; - typedef Cult::Containers::Map<String, String> MapMapping; - typedef Cult::Containers::Map<String, String> MappingCache; + typedef std::vector<Regex> RegexMapping; + typedef std::map<String, String> MapMapping; + typedef std::map<String, String> MappingCache; - typedef Cult::Containers::Map<String, String> ReservedNameMap; - typedef Cult::Containers::Set<String> KeywordSet; + typedef std::map<String, String> ReservedNameMap; + typedef std::set<String> 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<UnsignedLong> ("min"); + return m.context ().get<size_t> ("min"); } - static UnsignedLong + static size_t min (SemanticGraph::Any const& a) { - return a.context ().get<UnsignedLong> ("min"); + return a.context ().get<size_t> ("min"); } - static UnsignedLong + static size_t max (SemanticGraph::Member const& m) { - return m.context ().get<UnsignedLong> ("max"); + return m.context ().get<size_t> ("max"); } - static UnsignedLong + static size_t max (SemanticGraph::Any const& a) { - return a.context ().get<UnsignedLong> ("max"); + return a.context ().get<size_t> ("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<SemanticGraph::Schema*> schemas_; + std::set<SemanticGraph::Schema*> 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 <typename X> 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 <typename X, typename Y> - Boolean + bool has (Y& y) { using SemanticGraph::Scope; - Boolean result (false); + bool result (false); Has<X> 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 <typename X> - Boolean + bool has_particle (SemanticGraph::Compositor& y) { using SemanticGraph::Compositor; - Boolean result (false); + bool result (false); Has<X> t (result); for (Compositor::ContainsIterator i (y.contains_begin ()), @@ -539,7 +535,7 @@ namespace CXX // Specialization for Complex // template <typename X> - 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 <cult/types.hxx> -#include <cult/containers/map.hxx> +#include <map> + +#include <types.hxx> namespace CXX { - using namespace Cult; - typedef WideString String; - - typedef Cult::Containers::Map<String, String> StringLiteralMap; + typedef std::map<String, String> 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 <vector>; -include <string>; include <cstddef>; // std::size_t -include <cult/types.hxx>; // NarrowString +include <types.hxx>; // NarrowString, NarrowStrings include <options.cli>; @@ -17,14 +15,14 @@ namespace CXX { // Character type and encoding. // - Cult::Types::NarrowString --char-type = "char" + NarrowString --char-type = "char" { "<type>", "Generate code using the provided character <type> instead of the default \cb{char}. Valid values are \cb{char} and \cb{wchar_t}." }; - Cult::Types::NarrowString --char-encoding + NarrowString --char-encoding { "<enc>", "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 { "<dir>", "Write generated files to <dir> 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 { "<file>", "Include a header file derived from <file> instead of generating the @@ -83,7 +81,7 @@ namespace CXX // Namespace mapping. // - std::vector<Cult::Types::NarrowString> --namespace-map + NarrowStrings --namespace-map { "<xns>=<cns>", "Map XML Schema namespace <xns> to C++ namespace <cns>. Repeat @@ -96,7 +94,7 @@ namespace CXX the \cb{foo::bar} C++ namespace." }; - std::vector<Cult::Types::NarrowString> --namespace-regex + NarrowStrings --namespace-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate XML @@ -153,7 +151,7 @@ namespace CXX // Reserved names. // - std::vector<Cult::Types::NarrowString> --reserved-name + NarrowStrings --reserved-name { "<n>[=<r>]", "Add name <n> 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 { "<prefix>", "Add <prefix> to generated \cb{#include} directive paths. @@ -185,7 +183,7 @@ namespace CXX \cb{#include \"schemas/base.hxx\"}" }; - std::vector<Cult::Types::NarrowString> --include-regex + NarrowStrings --include-regex { "<regex>", "Add <regex> 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 { "<prefix>", "Add <prefix> 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" { "<suffix>", "Use the provided <suffix> 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" { "<suffix>", "Use the provided <suffix> instead of the default \cb{.ixx} to construct the name of the inline file." }; - Cult::Types::NarrowString --cxx-suffix = ".cxx" + NarrowString --cxx-suffix = ".cxx" { "<suffix>", "Use the provided <suffix> 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" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-fwd.hxx} to construct the name of the forward declaration file." }; - Cult::Types::NarrowString --hxx-regex + NarrowString --hxx-regex { "<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 { "<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 { "<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 { "<regex>", "Use the provided expression to construct the name of the forward @@ -296,126 +294,126 @@ namespace CXX // Prologues/epilogues. // - std::vector<Cult::Types::NarrowString> --hxx-prologue + NarrowStrings --hxx-prologue { "<text>", "Insert <text> at the beginning of the header file." }; - std::vector<Cult::Types::NarrowString> --ixx-prologue + NarrowStrings --ixx-prologue { "<text>", "Insert <text> at the beginning of the inline file." }; - std::vector<Cult::Types::NarrowString> --cxx-prologue + NarrowStrings --cxx-prologue { "<text>", "Insert <text> at the beginning of the source file." }; - std::vector<Cult::Types::NarrowString> --fwd-prologue + NarrowStrings --fwd-prologue { "<text>", "Insert <text> at the beginning of the forward declaration file." }; - std::vector<Cult::Types::NarrowString> --prologue + NarrowStrings --prologue { "<text>", "Insert <text> at the beginning of each generated file for which there is no file-specific prologue." }; - std::vector<Cult::Types::NarrowString> --hxx-epilogue + NarrowStrings --hxx-epilogue { "<text>", "Insert <text> at the end of the header file." }; - std::vector<Cult::Types::NarrowString> --ixx-epilogue + NarrowStrings --ixx-epilogue { "<text>", "Insert <text> at the end of the inline file." }; - std::vector<Cult::Types::NarrowString> --cxx-epilogue + NarrowStrings --cxx-epilogue { "<text>", "Insert <text> at the end of the source file." }; - std::vector<Cult::Types::NarrowString> --fwd-epilogue + NarrowStrings --fwd-epilogue { "<text>", "Insert <text> at the end of the forward declaration file." }; - std::vector<Cult::Types::NarrowString> --epilogue + NarrowStrings --epilogue { "<text>", "Insert <text> 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 { "<file>", "Insert the content of the <file> at the beginning of the header file." }; - Cult::Types::NarrowString --ixx-prologue-file + NarrowString --ixx-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the inline file." }; - Cult::Types::NarrowString --cxx-prologue-file + NarrowString --cxx-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the source file." }; - Cult::Types::NarrowString --fwd-prologue-file + NarrowString --fwd-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the forward declaration file." }; - Cult::Types::NarrowString --prologue-file + NarrowString --prologue-file { "<file>", "Insert the content of the <file> 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 { "<file>", "Insert the content of the <file> at the end of the header file." }; - Cult::Types::NarrowString --ixx-epilogue-file + NarrowString --ixx-epilogue-file { "<file>", "Insert the content of the <file> at the end of the inline file." }; - Cult::Types::NarrowString --cxx-epilogue-file + NarrowString --cxx-epilogue-file { "<file>", "Insert the content of the <file> at the end of the source file." }; - Cult::Types::NarrowString --fwd-epilogue-file + NarrowString --fwd-epilogue-file { "<file>", "Insert the content of the <file> at the end of the forward declaration file." }; - Cult::Types::NarrowString --epilogue-file + NarrowString --epilogue-file { "<file>", "Insert the content of the <file> at the end of each generated file @@ -424,7 +422,7 @@ namespace CXX // Export options. // - Cult::Types::NarrowString --export-symbol + NarrowString --export-symbol { "<symbol>", "Insert <symbol> 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<Traversal::Attribute> (c)); - Boolean has_any (has<Traversal::AnyAttribute> (c)); + bool has_att (has<Traversal::Attribute> (c)); + bool has_any (has<Traversal::AnyAttribute> (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 <set> +#include <map> +#include <sstream> + #include <cxx/parser/driver-source.hxx> #include <cxx/parser/print-impl-common.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/set.hxx> - -#include <sstream> +using namespace std; namespace CXX { @@ -20,11 +21,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map<SemanticGraph::Type*, String> - TypeInstanceMap; - - typedef Cult::Containers::Set<String> InstanceSet; + typedef map<SemanticGraph::Type*, String> TypeInstanceMap; + typedef set<String> 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<SemanticGraph::Type*> type_set_; + set<SemanticGraph::Type*> 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 <vector> + #include <cxx/parser/element-validation-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/vector.hxx> +using namespace std; namespace CXX { @@ -16,8 +18,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; - + typedef vector<SemanticGraph::Particle*> 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<Particles> ("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<Particles> ("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<UnsignedLong> ("state")); + size_t state (e.context ().get<size_t> ("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<UnsignedLong> ("state")); + size_t state (p.context ().get<size_t> ("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<UnsignedLong> ("effective-min")); - UnsignedLong n (c.context ().get<UnsignedLong> ("comp-number")); - UnsignedLong state (c.context ().get<UnsignedLong> ("state")); + size_t max (c.max ()); + size_t min (c.context ().get<size_t> ("effective-min")); + size_t n (c.context ().get<size_t> ("comp-number")); + size_t state (c.context ().get<size_t> ("state")); String func (c.is_a<SemanticGraph::Choice> () ? "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<UnsignedLong> ("state")); + size_t state (p.context ().get<size_t> ("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<UnsignedLong> ("effective-min")); - UnsignedLong n (c.context ().get<UnsignedLong> ("comp-number")); + size_t max (c.max ()); + size_t min (c.context ().get<size_t> ("effective-min")); + size_t n (c.context ().get<size_t> ("comp-number")); String func (c.is_a<SemanticGraph::Choice> () ? "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<UnsignedLong> ("state")); + size_t state (p.context ().get<size_t> ("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<Element&> (ci->particle ())); String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); - UnsignedLong state (e.context ().get<UnsignedLong> ("state")); + size_t state (e.context ().get<size_t> ("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<UnsignedLong> ("comp-number")); + size_t n (c.context ().get<size_t> ("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<UnsignedLong> ("comp-number")); + size_t n (s.context ().get<size_t> ("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<Compositor> () && !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<UnsignedLong> ("effective-min")); - UnsignedLong n (c.context ().get<UnsignedLong> ("comp-number")); + size_t max (c.max ()); + size_t min (c.context ().get<size_t> ("effective-min")); + size_t n (c.context ().get<size_t> ("comp-number")); String func (c.is_a<SemanticGraph::Choice> () ? "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<UnsignedLong> ("state")); + size_t state (p.context ().get<size_t> ("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<UnsignedLong> ("effective-min") != 0) + if (a.context ().get<size_t> ("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<UnsignedLong> ("effective-min")); + size_t min (c.context ().get<size_t> ("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<SemanticGraph::Restricts> ()); @@ -1570,7 +1571,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { ctx.os << "#include <cassert>" << 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<String> (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 <cutl/re.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> - #include <cutl/compiler/code-stream.hxx> #include <cutl/compiler/cxx-indenter.hxx> #include <cutl/compiler/sloc-counter.hxx> @@ -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 <typename S> - 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<compiler::cxx_indenter, wchar_t> 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 <cult/types.hxx> - -#include <cult/containers/vector.hxx> - #include <xsd-frontend/semantic-graph/elements.hxx> // Path #include <xsd-frontend/semantic-graph/schema.hxx> #include <xsd.hxx> +#include <types.hxx> #include <cxx/literal-map.hxx> #include <cxx/parser/options.hxx> @@ -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 <set> +#include <map> +#include <sstream> +#include <iostream> + #include <cxx/parser/name-processor.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> -#include <sstream> -#include <iostream> +using namespace std; namespace CXX { @@ -27,7 +30,7 @@ namespace CXX { // // - typedef Cult::Containers::Set<String> NameSet; + typedef set<String> 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<String, NameSet> global_type_names_; + map<String, NameSet> global_type_names_; public: - Boolean const impl; + bool const impl; String const& skel_suffix; String const& impl_suffix; - Cult::Containers::Map<String, NameSet>& global_type_names; + map<String, NameSet>& 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<SemanticGraph::Element> () && !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 <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> + #include <cxx/elements.hxx> #include <cxx/parser/options.hxx> @@ -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 <vector>; -include <string>; include <cstddef>; // std::size_t -include <cult/types.hxx>; // NarrowString +include <types.hxx>; // NarrowString, NarrowStrings include <cxx/options.cli>; @@ -17,7 +15,7 @@ namespace CXX { class options: CXX::options { - std::vector<Cult::Types::NarrowString> --type-map + NarrowStrings --type-map { "<mapfile>", "Read XML Schema to C++ type mapping information from <mapfile>. @@ -27,7 +25,7 @@ namespace CXX TYPE MAP section below for more information." }; - Cult::Types::NarrowString --xml-parser = "xerces" + NarrowString --xml-parser = "xerces" { "<parser>", "Use <parser> as the underlying XML parser. Valid values are @@ -108,7 +106,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "<element>", "Indicate that <element> 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" { "<suffix>", "Use the provided <suffix> 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" { "<suffix>", "Use the provided <suffix> 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" { "<suffix>", "Use the provided <suffix> 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" { "<suffix>", "Use the provided <suffix> 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 <set> + #include <cxx/parser/parser-header.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +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<UnsignedLong> ("state-count")); + size_t state_count (a.context().get<size_t> ("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<UnsignedLong> ("comp-number")); + size_t n (c.context ().get<size_t> ("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<UnsignedLong> ("comp-number")); + size_t n (s.context ().get<size_t> ("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<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); - Boolean haa (has<Traversal::AnyAttribute> (c)); + bool hae (has_particle<Traversal::Any> (c)); + bool haa (has<Traversal::AnyAttribute> (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<UnsignedLong> ("depth")); + size_t depth (c.context ().get<size_t> ("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<String> Includes; + typedef set<String> Includes; Includes const& is ( ctx.schema_root.context ().get<Includes> ("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<String> Includes; + typedef set<String> Includes; Includes const& is ( ctx.schema_root.context ().get<Includes> ("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<SemanticGraph::Element> () && !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<UnsignedLong> ("state-count")); + size_t state_count (a.context().get<size_t> ("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<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); + bool hae (has_particle<Traversal::Any> (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<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (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<SemanticGraph::Restricts> ()); @@ -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 <vector> +#include <iostream> + #include <cxx/parser/state-processor.hxx> #include <cxx/parser/elements.hxx> @@ -10,9 +13,7 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/vector.hxx> - -#include <iostream> +using namespace std; namespace CXX { @@ -20,7 +21,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> 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<SemanticGraph::Element*> (*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<UnsignedLong> ("effective-min") == 0) + p.context ().get<size_t> ("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<UnsignedLong> ("effective-min") != 0) + if (p.context ().get<size_t> ("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 <cult/types.hxx> #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> + 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 <cult/containers/set.hxx> +#include <set> #include <cxx/parser/elements.hxx> #include <cxx/parser/type-processor.hxx> @@ -11,6 +11,8 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +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<String> Includes; + typedef std::set<String> 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 <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> + #include <type-map/type-map.hxx> #include <cxx/parser/options.hxx> @@ -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 <set> +#include <iostream> + #include <cxx/parser/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -10,9 +13,7 @@ #include <cxx/parser/elements.hxx> -#include <iostream> - -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<String> types_; + set<String> 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<String> types_; + set<String> 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 <xsd.hxx> +#include <types.hxx> + #include <cxx/parser/elements.hxx> #include <cxx/parser/options.hxx> -#include <xsd.hxx> - 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<WideChar> (u)); + os.put (static_cast<wchar_t> (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<Boolean> ("polymorphic"); + return t.context ().get<bool> ("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<SemanticGraph::Type&> (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 <map> +#include <deque> +#include <vector> #include <sstream> #include <cutl/re.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/deque.hxx> -#include <cult/containers/vector.hxx> - #include <types.hxx> #include <cxx/elements.hxx> @@ -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<UnsignedLong> complexity; - UnsignedLong complexity_total; + std::vector<size_t> complexity; + size_t complexity_total; }; struct InvalidCustomTypeMapping @@ -106,13 +105,8 @@ namespace CXX String base_sub; }; - typedef - Cult::Containers::Vector<RegexCustomTypeMapInfo> - RegexCustomTypeMap; - - typedef - Cult::Containers::Map<String, DirectCustomTypeMapInfo> - DirectCustomTypeMap; + typedef std::vector<RegexCustomTypeMapInfo> RegexCustomTypeMap; + typedef std::map<String, DirectCustomTypeMapInfo> 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<String> ("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<String> - NamespaceStack; + bool generate_xml_schema_; + bool doxygen_; - typedef - Cult::Containers::Deque<String> - ScopeStack; + typedef std::deque<String> NamespaceStack; + typedef std::deque<String> 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 <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> +#include <set> +#include <vector> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> @@ -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<String> StringSet; - typedef Cult::Containers::Vector<String> StringList; + typedef std::set<String> StringSet; + typedef std::vector<String> 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 <vector> #include <iostream> #include <boost/filesystem/fstream.hpp> @@ -10,9 +11,6 @@ #include <cutl/re.hxx> #include <cutl/shared-ptr.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> - #include <cutl/compiler/code-stream.hxx> #include <cutl/compiler/cxx-indenter.hxx> #include <cutl/compiler/sloc-counter.hxx> @@ -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<Path> Paths; - typedef Vector<shared_ptr<WideOutputFileStream> > WideOutputFileStreams; + typedef vector<Path> Paths; + typedef vector<shared_ptr<WideOutputFileStream> > 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<WideOutputFileStream> 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<compiler::cxx_indenter, wchar_t> 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 <cult/types.hxx> - #include <xsd-frontend/semantic-graph/elements.hxx> // Path #include <xsd-frontend/semantic-graph/schema.hxx> #include <xsd.hxx> +#include <types.hxx> #include <cxx/literal-map.hxx> #include <cxx/tree/options.hxx> @@ -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 <set> +#include <map> +#include <vector> #include <sstream> #include <iostream> #include <cutl/re.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/vector.hxx> - #include <cxx/tree/default-value.hxx> #include <cxx/tree/name-processor.hxx> +using namespace std; + namespace CXX { namespace Tree @@ -29,7 +30,7 @@ namespace CXX { // // - typedef Cult::Containers::Set<String> NameSet; + typedef set<String> 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<NarrowString> 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<Regex> + struct RegexVector: vector<Regex> { void push_back (String const& r) { - Cult::Containers::Vector<Regex>::push_back (Regex (r)); + vector<Regex>::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<String, NameSet> global_type_names_; - Cult::Containers::Map<String, NameSet> global_element_names_; + map<String, NameSet> global_type_names_; + map<String, NameSet> global_element_names_; RegexVector type_regex_; RegexVector accessor_regex_; @@ -535,10 +533,10 @@ namespace CXX RegexVector element_type_regex_; public: - Cult::Containers::Map<String, NameSet>& global_type_names; - Cult::Containers::Map<String, NameSet>& global_element_names; + map<String, NameSet>& global_type_names; + map<String, NameSet>& 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<String> ("stem")); String const& b (m.context ().get<String> ("name")); - Boolean def_attr (m.default_p () && + bool def_attr (m.default_p () && m.is_a<SemanticGraph::Attribute> ()); // 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<SemanticGraph::Element> ()) { @@ -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 <types.hxx> + #include <cxx/tree/elements.hxx> #include <cxx/tree/options.hxx> @@ -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 <vector>; -include <string>; include <cstddef>; // std::size_t -include <cult/types.hxx>; // NarrowString +include <types.hxx>; // NarrowString, NarrowStrings include <cxx/options.cli>; @@ -27,7 +25,7 @@ namespace CXX hierarchies are polymorphic." }; - std::vector<Cult::Types::NarrowString> --polymorphic-type + NarrowStrings --polymorphic-type { "<type>", "Indicate that <type> is a root of a polymorphic type hierarchy. The @@ -113,7 +111,7 @@ namespace CXX this option." }; - std::vector<Cult::Types::NarrowString> --generate-insertion + NarrowStrings --generate-insertion { "<os>", "Generate data representation stream insertion operators for the <os> @@ -125,7 +123,7 @@ namespace CXX declarations." }; - std::vector<Cult::Types::NarrowString> --generate-extraction + NarrowStrings --generate-extraction { "<is>", "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" { "<style>", "Specify the type naming convention that should be used in the @@ -190,7 +188,7 @@ namespace CXX information." }; - Cult::Types::NarrowString --function-naming = "knr" + NarrowString --function-naming = "knr" { "<style>", "Specify the function naming convention that should be used in the @@ -199,7 +197,7 @@ namespace CXX information." }; - std::vector<Cult::Types::NarrowString> --type-regex + NarrowStrings --type-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -207,7 +205,7 @@ namespace CXX section below for more information." }; - std::vector<Cult::Types::NarrowString> --accessor-regex + NarrowStrings --accessor-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -215,7 +213,7 @@ namespace CXX names. See the NAMING CONVENTION section below for more information." }; - std::vector<Cult::Types::NarrowString> --one-accessor-regex + NarrowStrings --one-accessor-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -224,7 +222,7 @@ namespace CXX below for more information." }; - std::vector<Cult::Types::NarrowString> --opt-accessor-regex + NarrowStrings --opt-accessor-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -233,7 +231,7 @@ namespace CXX below for more information." }; - std::vector<Cult::Types::NarrowString> --seq-accessor-regex + NarrowStrings --seq-accessor-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -242,7 +240,7 @@ namespace CXX below for more information." }; - std::vector<Cult::Types::NarrowString> --modifier-regex + NarrowStrings --modifier-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -250,7 +248,7 @@ namespace CXX names. See the NAMING CONVENTION section below for more information." }; - std::vector<Cult::Types::NarrowString> --one-modifier-regex + NarrowStrings --one-modifier-regex { "<regex>", @@ -260,7 +258,7 @@ namespace CXX for more information." }; - std::vector<Cult::Types::NarrowString> --opt-modifier-regex + NarrowStrings --opt-modifier-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -269,7 +267,7 @@ namespace CXX below for more information." }; - std::vector<Cult::Types::NarrowString> --seq-modifier-regex + NarrowStrings --seq-modifier-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -278,7 +276,7 @@ namespace CXX below for more information." }; - std::vector<Cult::Types::NarrowString> --parser-regex + NarrowStrings --parser-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -286,7 +284,7 @@ namespace CXX NAMING CONVENTION section below for more information." }; - std::vector<Cult::Types::NarrowString> --serializer-regex + NarrowStrings --serializer-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -294,7 +292,7 @@ namespace CXX the NAMING CONVENTION section below for more information." }; - std::vector<Cult::Types::NarrowString> --enumerator-regex + NarrowStrings --enumerator-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -302,7 +300,7 @@ namespace CXX NAMING CONVENTION section below for more information." }; - std::vector<Cult::Types::NarrowString> --element-type-regex + NarrowStrings --element-type-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate @@ -345,7 +343,7 @@ namespace CXX global elements are considered document roots." }; - std::vector<Cult::Types::NarrowString> --root-element + NarrowStrings --root-element { "<element>", "Treat only <element> as a document root. Repeat this option to @@ -354,7 +352,7 @@ namespace CXX // Custom type. // - std::vector<Cult::Types::NarrowString> --custom-type + NarrowStrings --custom-type { "<map>", "Use a custom C++ type instead of the generated class. The <map> @@ -367,7 +365,7 @@ namespace CXX still generated but with that name." }; - std::vector<Cult::Types::NarrowString> --custom-type-regex + NarrowStrings --custom-type-regex { "<regex>", "Use custom C++ types instead of the generated classes. The <regex> @@ -397,7 +395,7 @@ namespace CXX to insufficient memory)." }; - Cult::Types::NarrowString --parts-suffix = "-" + NarrowString --parts-suffix = "-" { "<suffix>", "Use <suffix> instead of the default '\cb{-}' to separate the file diff --git a/xsd/cxx/tree/parser-header.cxx b/xsd/cxx/tree/parser-header.cxx index 61eb79a..59cc043 100644 --- a/xsd/cxx/tree/parser-header.cxx +++ b/xsd/cxx/tree/parser-header.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) @@ -449,7 +449,7 @@ namespace CXX } - Void + void generate_parser_header (Context& ctx) { ctx.os << "#include <iosfwd>" << endl diff --git a/xsd/cxx/tree/parser-header.hxx b/xsd/cxx/tree/parser-header.hxx index 478ddff..0857f83 100644 --- a/xsd/cxx/tree/parser-header.hxx +++ b/xsd/cxx/tree/parser-header.hxx @@ -13,7 +13,7 @@ namespace CXX { namespace Tree { - Void + void generate_parser_header (Context&); } } diff --git a/xsd/cxx/tree/parser-source.cxx b/xsd/cxx/tree/parser-source.cxx index ee83fd2..32491ac 100644 --- a/xsd/cxx/tree/parser-source.cxx +++ b/xsd/cxx/tree/parser-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) @@ -294,7 +294,7 @@ namespace CXX // DOM. // - Boolean fund (false); + bool fund (false); { IsFundamentalType test (fund); test.dispatch (t); @@ -304,7 +304,7 @@ namespace CXX // If this element's type is anonymous then we don't need to do // anything. // - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); // const DOMDocument& // @@ -517,10 +517,8 @@ namespace CXX }; } - Void - generate_parser_source (Context& ctx, - UnsignedLong first, - UnsignedLong last) + void + generate_parser_source (Context& ctx, size_t first, size_t last) { ctx.os << "#include <istream>" << endl << "#include <xsd/cxx/xml/sax/std-input-source.hxx>" << endl diff --git a/xsd/cxx/tree/parser-source.hxx b/xsd/cxx/tree/parser-source.hxx index b4d0d15..62f7bbc 100644 --- a/xsd/cxx/tree/parser-source.hxx +++ b/xsd/cxx/tree/parser-source.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Tree { - Void - generate_parser_source (Context&, UnsignedLong first, UnsignedLong last); + void + generate_parser_source (Context&, size_t first, size_t last); } } diff --git a/xsd/cxx/tree/polymorphism-processor.cxx b/xsd/cxx/tree/polymorphism-processor.cxx index 66e7c63..be9fe81 100644 --- a/xsd/cxx/tree/polymorphism-processor.cxx +++ b/xsd/cxx/tree/polymorphism-processor.cxx @@ -3,17 +3,16 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <iostream> + #include <cxx/tree/elements.hxx> #include <cxx/tree/polymorphism-processor.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> - -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -30,10 +29,10 @@ namespace CXX insert (*begin); } - Void + void insert (String const& name) { - Size p (name.rfind ('#')); + size_t p (name.rfind ('#')); if (p == String::npos) unames_.insert (name); @@ -41,7 +40,7 @@ namespace CXX qnames_.insert (name); } - Boolean + bool find (SemanticGraph::Type& t) { if (!unames_.empty ()) @@ -61,7 +60,7 @@ namespace CXX } private: - typedef Cult::Containers::Set<String> StringSet; + typedef set<String> StringSet; StringSet unames_; StringSet qnames_; @@ -78,7 +77,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& ctx (t.context ()); @@ -87,7 +86,7 @@ namespace CXX ctx.set ("polymorphic", poly_types_.find (t)); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Context& ctx (c.context ()); @@ -96,7 +95,7 @@ namespace CXX { // First check our base. // - Boolean pb (false); + bool pb (false); if (c.inherits_p ()) { SemanticGraph::Type& b (c.inherits ().base ()); @@ -104,7 +103,7 @@ namespace CXX if (!b.context ().count ("polymorphic")) dispatch (b); - pb = b.context ().get<Boolean> ("polymorphic"); + pb = b.context ().get<bool> ("polymorphic"); } ctx.set ("polymorphic", pb || poly_types_.find (c)); @@ -171,13 +170,13 @@ namespace CXX Traversal::Fundamental::Entity, Traversal::Fundamental::Entities { - FundType (TypeSet& poly_types, Boolean& valid) + FundType (TypeSet& poly_types, bool& valid) : poly_types_ (poly_types), valid_ (valid) { } - Void - check (SemanticGraph::Type& t, Boolean fund) + void + check (SemanticGraph::Type& t, bool fund) { SemanticGraph::Context& ctx (t.context ()); @@ -201,13 +200,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { check (t, false); @@ -215,7 +214,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { check (t, true); @@ -223,79 +222,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { check (t, true); @@ -303,19 +302,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { check (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { check (t, true); @@ -323,49 +322,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { check (t, false); @@ -374,7 +373,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { check (t, false); @@ -383,19 +382,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { check (t, false); @@ -403,7 +402,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { check (t, false); @@ -411,13 +410,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { check (t, false); @@ -426,55 +425,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { check (t, false); @@ -482,13 +481,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { check (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { check (t, false); @@ -496,13 +495,13 @@ namespace CXX private: TypeSet& poly_types_; - Boolean& valid_; + bool& valid_; }; struct GlobalElement: Traversal::Element { GlobalElement (TypeSet& poly_types, - Boolean& valid, + bool& valid, const WarningSet& disabled_warnings) : poly_types_ (poly_types), valid_ (valid), warning_ (true) { @@ -511,7 +510,7 @@ namespace CXX warning_ = false; } - virtual Void + virtual void traverse (Type& e) { using SemanticGraph::Schema; @@ -528,13 +527,13 @@ namespace CXX // We may need to override the previous value. // - if (ctx.count ("polymorphic") && ctx.get<Boolean> ("polymorphic")) + if (ctx.count ("polymorphic") && ctx.get<bool> ("polymorphic")) return; // Built-in types that are mapped to fundamental types cannot // be declared polymorphic. // - Boolean fund (false); + bool fund (false); IsFundamentalType test (fund); test.dispatch (rt); @@ -585,7 +584,7 @@ namespace CXX private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -606,8 +605,8 @@ namespace CXX private: TypeSet& poly_types_; - Boolean& valid_; - Boolean warning_; + bool& valid_; + bool warning_; }; // Go into sourced/included/imported schemas while making sure @@ -617,12 +616,12 @@ namespace CXX Traversal::Includes, Traversal::Imports { - Uses (Char const* seen_key) + Uses (char const* seen_key) : seen_key_ (seen_key) { } - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -634,7 +633,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -646,7 +645,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -659,19 +658,19 @@ namespace CXX } private: - Char const* seen_key_; + char const* seen_key_; }; - Char const* pass_one_key = "cxx-tree-polymorphism-processor-seen-one"; - Char const* pass_two_key = "cxx-tree-polymorphism-processor-seen-two"; + char const* pass_one_key = "cxx-tree-polymorphism-processor-seen-one"; + char const* pass_two_key = "cxx-tree-polymorphism-processor-seen-two"; - Boolean + bool process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const&, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); // Prepare a set of polymorphic types. // @@ -779,7 +778,7 @@ namespace CXX } } - Boolean PolymorphismProcessor:: + bool PolymorphismProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, diff --git a/xsd/cxx/tree/polymorphism-processor.hxx b/xsd/cxx/tree/polymorphism-processor.hxx index aebf8d4..fb0a29a 100644 --- a/xsd/cxx/tree/polymorphism-processor.hxx +++ b/xsd/cxx/tree/polymorphism-processor.hxx @@ -6,24 +6,21 @@ #ifndef CXX_TREE_POLYMORPHISM_PROCESSOR_HXX #define CXX_TREE_POLYMORPHISM_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> -#include <cxx/tree/options.hxx> - #include <xsd.hxx> +#include <types.hxx> + +#include <cxx/tree/options.hxx> namespace CXX { namespace Tree { - using namespace Cult::Types; - class PolymorphismProcessor { public: - Boolean + bool process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, diff --git a/xsd/cxx/tree/serialization-header.cxx b/xsd/cxx/tree/serialization-header.cxx index 1070847..33359fc 100644 --- a/xsd/cxx/tree/serialization-header.cxx +++ b/xsd/cxx/tree/serialization-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -67,7 +67,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -112,7 +112,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -156,7 +156,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -175,7 +175,7 @@ namespace CXX "const " << name << "&);" << endl; - Boolean simple (true); + bool simple (true); { IsSimpleType t (simple); t.dispatch (c); @@ -211,7 +211,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (doc_root_p (e)) @@ -237,7 +237,7 @@ namespace CXX } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) @@ -533,10 +533,10 @@ namespace CXX } - Void + void generate_serialization_header (Context& ctx) { - Boolean elemen_type (ctx.options.generate_element_type ()); + bool elemen_type (ctx.options.generate_element_type ()); if (!elemen_type) ctx.os << "#include <iosfwd>" << endl diff --git a/xsd/cxx/tree/serialization-header.hxx b/xsd/cxx/tree/serialization-header.hxx index b0eb726..0b772e3 100644 --- a/xsd/cxx/tree/serialization-header.hxx +++ b/xsd/cxx/tree/serialization-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_serialization_header (Context&); } } diff --git a/xsd/cxx/tree/serialization-source.cxx b/xsd/cxx/tree/serialization-source.cxx index 411a5ef..8711210 100644 --- a/xsd/cxx/tree/serialization-source.cxx +++ b/xsd/cxx/tree/serialization-source.cxx @@ -42,7 +42,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -133,7 +133,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -204,7 +204,7 @@ namespace CXX inherits_base_ >> base_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -290,7 +290,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) @@ -307,7 +307,7 @@ namespace CXX // dynamically-type with xsi:type. // SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); os << "// " << comment (e.name ()) << endl << "//" << endl; @@ -514,7 +514,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& aname (eaname (a)); @@ -572,7 +572,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& aname (eaname (a)); @@ -665,7 +665,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& aname (eaname (a)); @@ -702,7 +702,7 @@ namespace CXX inherits_ >> base_; } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -760,7 +760,7 @@ namespace CXX os << "}"; - Boolean simple (true); + bool simple (true); { IsSimpleType t (simple); t.dispatch (c); @@ -768,7 +768,7 @@ namespace CXX if (simple) { - Boolean hb (c.inherits_p ()); + bool hb (c.inherits_p ()); // operator<< (xercesc::DOMAttr) // @@ -849,7 +849,7 @@ namespace CXX belongs_ >> type_name_; } - virtual Void + virtual void traverse (Type& e) { if (polymorphic && e.substitutes_p ()) @@ -892,7 +892,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (doc_root_p (e)) @@ -928,7 +928,7 @@ namespace CXX } private: - Boolean element_map_; + bool element_map_; }; struct ElementFunction: Traversal::Element, @@ -940,7 +940,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) @@ -961,7 +961,7 @@ namespace CXX // If this element's type is anonymous then we don't need to do // anything. // - Boolean poly (polymorphic && + bool poly (polymorphic && polymorphic_p (type) && !anonymous_p (type)); @@ -1240,12 +1240,10 @@ namespace CXX }; } - Void - generate_serialization_source (Context& ctx, - UnsignedLong first, - UnsignedLong last) + void + generate_serialization_source (Context& ctx, size_t first, size_t last) { - Boolean elemen_type (ctx.options.generate_element_type ()); + bool elemen_type (ctx.options.generate_element_type ()); if (!elemen_type) ctx.os << "#include <ostream>" << endl @@ -1259,8 +1257,8 @@ namespace CXX ctx.os << "#include <xsd/cxx/tree/type-serializer-map.hxx>" << endl << 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/tree/serialization-source.hxx b/xsd/cxx/tree/serialization-source.hxx index b86537c..12f31f2 100644 --- a/xsd/cxx/tree/serialization-source.hxx +++ b/xsd/cxx/tree/serialization-source.hxx @@ -12,10 +12,8 @@ namespace CXX { namespace Tree { - Void - generate_serialization_source (Context&, - UnsignedLong first, - UnsignedLong last); + void + generate_serialization_source (Context&, size_t first, size_t last); } } diff --git a/xsd/cxx/tree/stream-extraction-source.cxx b/xsd/cxx/tree/stream-extraction-source.cxx index 53eaa09..622056f 100644 --- a/xsd/cxx/tree/stream-extraction-source.cxx +++ b/xsd/cxx/tree/stream-extraction-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -43,7 +43,7 @@ namespace CXX base += L" >"; - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_extraction ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -102,7 +102,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -115,7 +115,7 @@ namespace CXX String const& base (xs_string_type); - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_extraction ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -162,7 +162,7 @@ namespace CXX inherits_base_ >> base_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -173,13 +173,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); if (string_based) { SemanticGraph::Enumeration* base_enum (0); @@ -193,7 +193,7 @@ namespace CXX if (string_based) value = evalue (e); - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_extraction ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -260,7 +260,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) @@ -280,7 +280,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -292,7 +292,7 @@ namespace CXX << " " << member << " (this->" << dom_doc << " ())"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& member (emember (a)); @@ -312,7 +312,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) @@ -323,7 +323,7 @@ namespace CXX SemanticGraph::Type& t (e.type ()); String type (etype (e)); - Boolean fund (false); + bool fund (false); { IsFundamentalType traverser (fund); traverser.dispatch (t); @@ -335,7 +335,7 @@ namespace CXX // from which makes it impossible to substitute or dynamically- // type with xsi:type. // - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); if (max (e) != 1) { @@ -495,13 +495,13 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& member (emember (a)); String type (etype (a)); - Boolean fund (false); + bool fund (false); { IsFundamentalType traverser (fund); traverser.dispatch (a.type ()); @@ -565,7 +565,7 @@ namespace CXX names_ctor_member_ >> ctor_any_; } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -576,9 +576,9 @@ namespace CXX if (renamed_type (c, name) && !name) return; - Boolean has_members (has<Traversal::Member> (c)); + bool has_members (has<Traversal::Member> (c)); - Boolean facets (false); + bool facets (false); if (c.inherits_p ()) { // See if we have any facets that we need to handle. @@ -596,7 +596,7 @@ namespace CXX } } - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_extraction ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -696,7 +696,7 @@ namespace CXX }; } - Void + void generate_stream_extraction_source (Context& ctx) { if (ctx.polymorphic) @@ -706,8 +706,8 @@ namespace CXX ctx.os << "#include <xsd/cxx/tree/stream-extraction-map.hxx>" << endl << 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) { @@ -759,7 +759,7 @@ namespace CXX ctx.os << "namespace _xsd" << "{"; - UnsignedLong n (0); + size_t n (0); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) { diff --git a/xsd/cxx/tree/stream-extraction-source.hxx b/xsd/cxx/tree/stream-extraction-source.hxx index 04f5f20..6d00140 100644 --- a/xsd/cxx/tree/stream-extraction-source.hxx +++ b/xsd/cxx/tree/stream-extraction-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_stream_extraction_source (Context&); } } diff --git a/xsd/cxx/tree/stream-header.cxx b/xsd/cxx/tree/stream-header.cxx index 76c1ac9..258d335 100644 --- a/xsd/cxx/tree/stream-header.cxx +++ b/xsd/cxx/tree/stream-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -48,7 +48,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -75,7 +75,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -86,13 +86,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); if (string_based) { SemanticGraph::Enumeration* be (0); @@ -129,7 +129,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -149,7 +149,7 @@ namespace CXX }; } - Void + void generate_stream_header (Context& ctx) { String c (ctx.char_type); diff --git a/xsd/cxx/tree/stream-header.hxx b/xsd/cxx/tree/stream-header.hxx index 6c9414c..e2689dd 100644 --- a/xsd/cxx/tree/stream-header.hxx +++ b/xsd/cxx/tree/stream-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_stream_header (Context&); } } diff --git a/xsd/cxx/tree/stream-insertion-header.cxx b/xsd/cxx/tree/stream-insertion-header.cxx index 139bf8b..5907dad 100644 --- a/xsd/cxx/tree/stream-insertion-header.cxx +++ b/xsd/cxx/tree/stream-insertion-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -55,7 +55,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -89,7 +89,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -122,7 +122,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -149,7 +149,7 @@ namespace CXX }; } - Void + void generate_stream_insertion_header (Context& ctx) { String c (ctx.char_type); diff --git a/xsd/cxx/tree/stream-insertion-header.hxx b/xsd/cxx/tree/stream-insertion-header.hxx index 23c5bb6..d224a13 100644 --- a/xsd/cxx/tree/stream-insertion-header.hxx +++ b/xsd/cxx/tree/stream-insertion-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_stream_insertion_header (Context&); } } diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx index 2dbbc79..9c93060 100644 --- a/xsd/cxx/tree/stream-insertion-source.cxx +++ b/xsd/cxx/tree/stream-insertion-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -43,7 +43,7 @@ namespace CXX base += L" >"; - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_insertion ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -101,7 +101,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -114,7 +114,7 @@ namespace CXX String const& base (xs_string_type); - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_insertion ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -161,7 +161,7 @@ namespace CXX inherits_base_ >> base_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -172,13 +172,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); if (string_based) { SemanticGraph::Enumeration* base_enum (0); @@ -192,7 +192,7 @@ namespace CXX if (string_based) value = evalue (e); - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_insertion ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -253,7 +253,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) return; @@ -268,7 +268,7 @@ namespace CXX // from which makes it impossible to substitute or dynamically- // type with xsi:type. // - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); if (max (e) != 1) { @@ -363,7 +363,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& aname (eaname (a)); @@ -393,7 +393,7 @@ namespace CXX inherits_ >> base_; } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -404,9 +404,9 @@ namespace CXX if (renamed_type (c, name) && !name) return; - Boolean has_body (has<Traversal::Member> (c) || c.inherits_p ()); + bool has_body (has<Traversal::Member> (c) || c.inherits_p ()); - UnsignedLong n (0); + size_t n (0); NarrowStrings const& st (options.generate_insertion ()); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) @@ -471,7 +471,7 @@ namespace CXX }; } - Void + void generate_stream_insertion_source (Context& ctx) { if (ctx.polymorphic) @@ -481,8 +481,8 @@ namespace CXX ctx.os << "#include <xsd/cxx/tree/stream-insertion-map.hxx>" << endl << 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) { @@ -533,7 +533,7 @@ namespace CXX ctx.os << "namespace _xsd" << "{"; - UnsignedLong n (0); + size_t n (0); for (NarrowStrings::const_iterator i (st.begin ()); i != st.end (); ++i) { diff --git a/xsd/cxx/tree/stream-insertion-source.hxx b/xsd/cxx/tree/stream-insertion-source.hxx index fb61b43..22db93f 100644 --- a/xsd/cxx/tree/stream-insertion-source.hxx +++ b/xsd/cxx/tree/stream-insertion-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_stream_insertion_source (Context&); } } diff --git a/xsd/cxx/tree/stream-source.cxx b/xsd/cxx/tree/stream-source.cxx index e2c0ca5..77cfa81 100644 --- a/xsd/cxx/tree/stream-source.cxx +++ b/xsd/cxx/tree/stream-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -89,7 +89,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -135,7 +135,7 @@ namespace CXX inherits_base_ >> base_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -146,13 +146,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); if (string_based) { SemanticGraph::Enumeration* be (0); @@ -217,7 +217,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) @@ -232,7 +232,7 @@ namespace CXX // dynamically-type with xsi:type. // SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); // aCC cannot handle an inline call to std_ostream_map_instance. // @@ -310,7 +310,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& aname (eaname (a)); @@ -340,7 +340,7 @@ namespace CXX inherits_ >> base_; } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -353,7 +353,7 @@ namespace CXX // // - Boolean has_body (has<Traversal::Member> (c) || c.inherits_p ()); + bool has_body (has<Traversal::Member> (c) || c.inherits_p ()); os << std_ostream_type << "&" << endl << "operator<< (" << std_ostream_type << "& o, " << @@ -408,10 +408,8 @@ namespace CXX }; } - Void - generate_stream_source (Context& ctx, - UnsignedLong first, - UnsignedLong last) + void + generate_stream_source (Context& ctx, size_t first, size_t last) { String c (ctx.char_type); @@ -423,8 +421,8 @@ namespace CXX ctx.os << "#include <xsd/cxx/tree/std-ostream-map.hxx>" << endl << 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/tree/stream-source.hxx b/xsd/cxx/tree/stream-source.hxx index d45d5c3..06fc66e 100644 --- a/xsd/cxx/tree/stream-source.hxx +++ b/xsd/cxx/tree/stream-source.hxx @@ -12,10 +12,8 @@ namespace CXX { namespace Tree { - Void - generate_stream_source (Context&, - UnsignedLong first, - UnsignedLong last); + void + generate_stream_source (Context&, size_t first, size_t last); } } diff --git a/xsd/cxx/tree/tree-forward.cxx b/xsd/cxx/tree/tree-forward.cxx index 7f8f5ea..b3468ed 100644 --- a/xsd/cxx/tree/tree-forward.cxx +++ b/xsd/cxx/tree/tree-forward.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -52,7 +52,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -82,7 +82,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -112,7 +112,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -136,7 +136,7 @@ namespace CXX }; } - Void + void generate_forward (Context& ctx) { NarrowString xml_schema (ctx.options.extern_xml_schema ()); @@ -178,7 +178,7 @@ namespace CXX << endl; } - Boolean element_map (ctx.options.generate_element_map ()); + bool element_map (ctx.options.generate_element_map ()); if (element_map) ctx.os << "#include <xsd/cxx/tree/element-map.hxx>" << endl diff --git a/xsd/cxx/tree/tree-forward.hxx b/xsd/cxx/tree/tree-forward.hxx index d542bf1..b0b131b 100644 --- a/xsd/cxx/tree/tree-forward.hxx +++ b/xsd/cxx/tree/tree-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_forward (Context&); } } diff --git a/xsd/cxx/tree/tree-header.cxx b/xsd/cxx/tree/tree-header.cxx index 9d7aea5..4024bc3 100644 --- a/xsd/cxx/tree/tree-header.cxx +++ b/xsd/cxx/tree/tree-header.cxx @@ -25,7 +25,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -317,7 +317,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -551,7 +551,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (doxygen && e.annotated_p ()) @@ -579,7 +579,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -590,13 +590,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); SemanticGraph::Enumeration* base_enum (0); if (string_based) @@ -614,7 +614,7 @@ namespace CXX // Get to the ultimate base and see if is a fundamental type. // - Boolean fund_based (false); + bool fund_based (false); SemanticGraph::Type& ult_base (ultimate_base (e)); { IsFundamentalType t (fund_based); @@ -623,7 +623,7 @@ namespace CXX // Count enumerators. // - UnsignedLong enum_count (0); + size_t enum_count (0); for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -1032,7 +1032,7 @@ namespace CXX os << "};"; } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -1059,7 +1059,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -1070,13 +1070,13 @@ namespace CXX String kind (m.is_a<SemanticGraph::Element> () ? "element" : "attribute"); - Boolean fund (false); + bool fund (false); { IsFundamentalType t (fund); t.dispatch (m.type ()); } - Boolean def_attr (m.default_p () && + bool def_attr (m.default_p () && m.is_a<SemanticGraph::Attribute> ()); if (max (m) != 1) @@ -1374,7 +1374,7 @@ namespace CXX // if (m.default_p ()) { - Boolean simple (true); + bool simple (true); if (m.is_a<SemanticGraph::Element> ()) { @@ -1384,7 +1384,7 @@ namespace CXX if (simple) { - Boolean lit (false); + bool lit (false); { IsLiteralValue test (lit); test.dispatch (m.type ()); @@ -1426,7 +1426,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& aname (eaname (a)); @@ -1699,7 +1699,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& aname (eaname (a)); @@ -1779,16 +1779,16 @@ namespace CXX belongs_ >> type_name_; } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) return; String const& type (etype (m)); - Boolean el (m.is_a<SemanticGraph::Element> ()); + bool el (m.is_a<SemanticGraph::Element> ()); - Boolean def_attr (m.default_p () && !el); + bool def_attr (m.default_p () && !el); if (doxygen) { @@ -1850,7 +1850,7 @@ namespace CXX if (max (m) != 1) { String const& container (econtainer (m)); - Boolean isense (options.generate_intellisense ()); + bool isense (options.generate_intellisense ()); // sequence // @@ -1968,7 +1968,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (doxygen) @@ -2070,7 +2070,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& container (econtainer (a)); @@ -2153,14 +2153,14 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) return; String const& member (emember (m)); - Boolean def_attr (m.default_p () && + bool def_attr (m.default_p () && m.is_a<SemanticGraph::Attribute> ()); if (max (m) != 1) @@ -2187,7 +2187,7 @@ namespace CXX // if (m.default_p ()) { - Boolean simple (true); + bool simple (true); if (m.is_a<SemanticGraph::Element> ()) { @@ -2197,7 +2197,7 @@ namespace CXX if (simple) { - Boolean lit (false); + bool lit (false); { IsLiteralValue test (lit); test.dispatch (m.type ()); @@ -2222,7 +2222,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -2247,7 +2247,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << econtainer (a) << " " << emember (a) << ";"; @@ -2278,7 +2278,7 @@ namespace CXX names_data_ >> data_any_; } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -2289,20 +2289,20 @@ namespace CXX if (renamed_type (c, name) && !name) return; - Boolean has_members (has<Traversal::Member> (c)); + bool has_members (has<Traversal::Member> (c)); - Boolean hae (has<Traversal::Any> (c)); - Boolean haa (has<Traversal::AnyAttribute> (c)); + bool hae (has<Traversal::Any> (c)); + bool haa (has<Traversal::AnyAttribute> (c)); - Boolean gen_wildcard (options.generate_wildcard ()); + bool gen_wildcard (options.generate_wildcard ()); - Boolean simple (true); + bool simple (true); { IsSimpleType t (simple); t.dispatch (c); } - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (c); @@ -2408,15 +2408,15 @@ namespace CXX << "//" << endl; } - Boolean generate_no_base_ctor (false); + bool generate_no_base_ctor (false); { GenerateWithoutBaseCtor t (generate_no_base_ctor); t.traverse (c); } - Boolean has_complex_non_op_args (false); - Boolean has_poly_non_op_args (false); - Boolean complex_poly_args_clash (true); + bool has_complex_non_op_args (false); + bool has_poly_non_op_args (false); + bool complex_poly_args_clash (true); { HasComplexPolyNonOptArgs t (*this, true, has_complex_non_op_args, @@ -2435,7 +2435,7 @@ namespace CXX // c-tor (all-non-optional-members) if we have no required // members. // - Boolean generate (false); + bool generate (false); { GenerateDefaultCtor t (*this, generate, generate_no_base_ctor); t.traverse (c); @@ -2471,7 +2471,7 @@ namespace CXX // customized version may not necessarily be convertible to // the base without loss of information. // - Boolean generate (false); + bool generate (false); { GenerateFromBaseCtor t (*this, generate); t.traverse (c); @@ -2479,9 +2479,9 @@ namespace CXX if (generate) { - Boolean has_complex_non_op_args (false); - Boolean has_poly_non_op_args (false); - Boolean complex_poly_args_clash (true); + bool has_complex_non_op_args (false); + bool has_poly_non_op_args (false); + bool complex_poly_args_clash (true); { HasComplexPolyNonOptArgs t (*this, false, has_complex_non_op_args, @@ -3147,7 +3147,7 @@ namespace CXX belongs_ >> type_name_; } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) @@ -3155,13 +3155,13 @@ namespace CXX SemanticGraph::Type& t (e.type ()); - Boolean fund (false); + bool fund (false); { IsFundamentalType test (fund); test.dispatch (t); } - Boolean simple (true); + bool simple (true); if (!fund) { IsSimpleType test (simple); @@ -3660,7 +3660,7 @@ namespace CXX }; } - Void + void generate_tree_header (Context& ctx) { if (ctx.generate_xml_schema) @@ -3691,7 +3691,7 @@ namespace CXX << endl; } - Boolean element_map (ctx.options.generate_element_map ()); + bool element_map (ctx.options.generate_element_map ()); if (element_map) ctx.os << "#include <xsd/cxx/tree/element-map.hxx>" << endl @@ -3800,7 +3800,7 @@ namespace CXX } else { - Boolean inline_ (ctx.options.generate_inline ()); + bool inline_ (ctx.options.generate_inline ()); ctx.os << "#include <memory> // std::auto_ptr" << endl << "#include <limits> // std::numeric_limits" << endl diff --git a/xsd/cxx/tree/tree-header.hxx b/xsd/cxx/tree/tree-header.hxx index 5d785f5..ec34603 100644 --- a/xsd/cxx/tree/tree-header.hxx +++ b/xsd/cxx/tree/tree-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Tree { - Void + void generate_tree_header (Context&); } } diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx index 9656a2d..0641a4d 100644 --- a/xsd/cxx/tree/tree-inline.cxx +++ b/xsd/cxx/tree/tree-inline.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -106,7 +106,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -182,7 +182,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { // This type should be ultimately string based. @@ -196,7 +196,7 @@ namespace CXX os << ")"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Type& t) { base_type_name_.dispatch (t); @@ -217,7 +217,7 @@ namespace CXX inherits_member_ >> member_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -228,13 +228,13 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } - Boolean enum_based (false); + bool enum_based (false); if (string_based) { SemanticGraph::Enumeration* be (0); @@ -250,7 +250,7 @@ namespace CXX // Get to the ultimate base and see if is a fundamental type. // - Boolean fund_based (false); + bool fund_based (false); SemanticGraph::Type& ult_base (ultimate_base (e)); { IsFundamentalType t (fund_based); @@ -427,7 +427,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -437,13 +437,13 @@ namespace CXX String const& mname (emname (m)); String const& member (emember (m)); - Boolean fund (false); + bool fund (false); { IsFundamentalType t (fund); t.dispatch (m.type ()); } - Boolean def_attr (m.default_p () && + bool def_attr (m.default_p () && m.is_a<SemanticGraph::Attribute> ()); if (max (m) != 1) @@ -613,7 +613,7 @@ namespace CXX // if (m.default_p ()) { - Boolean simple (true); + bool simple (true); if (m.is_a<SemanticGraph::Element> ()) { @@ -660,7 +660,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& aname (eaname (a)); @@ -810,7 +810,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& aname (eaname (a)); @@ -862,7 +862,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -924,13 +924,13 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!doc_root_p (e)) return; - Boolean fund (false); + bool fund (false); { IsFundamentalType test (fund); test.dispatch (e.type ()); @@ -1007,8 +1007,8 @@ namespace CXX }; } - Void - generate_tree_inline (Context& ctx, UnsignedLong first, UnsignedLong last) + void + generate_tree_inline (Context& ctx, size_t first, size_t last) { // Generate includes. // diff --git a/xsd/cxx/tree/tree-inline.hxx b/xsd/cxx/tree/tree-inline.hxx index 7293102..9ea352e 100644 --- a/xsd/cxx/tree/tree-inline.hxx +++ b/xsd/cxx/tree/tree-inline.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Tree { - Void - generate_tree_inline (Context&, UnsignedLong first, UnsignedLong last); + void + generate_tree_inline (Context&, size_t first, size_t last); } } diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx index 45628cf..fb4be66 100644 --- a/xsd/cxx/tree/tree-source.cxx +++ b/xsd/cxx/tree/tree-source.cxx @@ -3,7 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cult/containers/list.hxx> +#include <map> +#include <list> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> @@ -11,6 +12,8 @@ #include <cxx/tree/tree-source.hxx> #include <cxx/tree/default-value.hxx> +using namespace std; + namespace CXX { namespace Tree @@ -24,7 +27,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String name (ename (l)); @@ -158,7 +161,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String name (ename (u)); @@ -264,7 +267,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << strlit (e.name ()); @@ -285,13 +288,13 @@ namespace CXX String name_; }; - Boolean + bool operator< (LiteralInfo const& x, LiteralInfo const& y) { return x.value_ < y.value_; } - typedef Cult::Containers::List<LiteralInfo> LiteralInfoList; + typedef list<LiteralInfo> LiteralInfoList; // Populate LiteralInfoList @@ -304,7 +307,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { list_.push_back (LiteralInfo (e.name (), ename (e))); @@ -323,7 +326,7 @@ namespace CXX names_enumerator_literal_ >> enumerator_literal_; } - virtual Void + virtual void traverse (Type& e) { String name (ename (e)); @@ -334,14 +337,14 @@ namespace CXX if (renamed_type (e, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (e); } SemanticGraph::Enumeration* be (0); - Boolean enum_based (false); + bool enum_based (false); if (string_based) { IsEnumBasedType t (be); @@ -354,7 +357,7 @@ namespace CXX if (string_based) value = evalue (e); - UnsignedLong enum_count (0); + size_t enum_count (0); for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -506,7 +509,7 @@ namespace CXX String fq_name (ns_scope + L"::" + name); - for (LiteralInfoList::Iterator + for (LiteralInfoList::iterator b (l.begin ()), i (b), end (l.end ()); i != end; ++i) { if (i != b) @@ -552,7 +555,7 @@ namespace CXX } } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -573,7 +576,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -584,7 +587,7 @@ namespace CXX if (m.default_p ()) { SemanticGraph::Type& t (m.type ()); - Boolean simple (true); + bool simple (true); if (m.is_a<SemanticGraph::Element> ()) { @@ -594,7 +597,7 @@ namespace CXX if (simple) { - Boolean lit (false); + bool lit (false); { IsLiteralValue test (lit); test.dispatch (t); @@ -685,7 +688,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) @@ -698,7 +701,7 @@ namespace CXX SemanticGraph::Type& t (e.type ()); - Boolean fund (false); + bool fund (false); { IsFundamentalType traverser (fund); traverser.dispatch (t); @@ -710,7 +713,7 @@ namespace CXX // derived from which makes it impossible to substitute or // dynamically-type with xsi:type. // - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); os << "// " << comment (e.name ()) << endl << "//" << endl; @@ -887,7 +890,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (skip (e)) @@ -917,7 +920,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& member (emember (a)); @@ -1054,7 +1057,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (max (a) == 1 && min (a) == 1) @@ -1079,7 +1082,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& member (emember (a)); @@ -1099,7 +1102,7 @@ namespace CXX << "{"; } - Boolean fund (false); + bool fund (false); { IsFundamentalType traverser (fund); traverser.dispatch (a.type ()); @@ -1133,7 +1136,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& member (emember (a)); @@ -1226,7 +1229,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& member (emember (a)); @@ -1270,21 +1273,21 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { if (base_arg_) os << base_arg_; } - virtual Void + virtual void traverse (SemanticGraph::Enumeration&) { if (base_arg_) os << base_arg_; } - Void + void traverse (SemanticGraph::Complex& c) { Args args (*this, base_arg_); @@ -1310,21 +1313,21 @@ namespace CXX *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type&) { if (base_arg_) os << comma () << base_arg_; } - virtual Void + virtual void traverse (SemanticGraph::Enumeration&) { if (base_arg_) os << comma () << base_arg_; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (!options.generate_wildcard ()) @@ -1338,7 +1341,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!skip (e) && min (e) == 1 && max (e) == 1) @@ -1349,7 +1352,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Note that we are not including attributes with default @@ -1369,14 +1372,14 @@ namespace CXX String comma () { - Boolean tmp (first_); + bool tmp (first_); first_ = false; return tmp ? "" : ",\n"; } private: String base_arg_; - Boolean first_; + bool first_; Traversal::Inherits inherits_; Traversal::Names names_; @@ -1395,7 +1398,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -1426,12 +1429,12 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& member (emember (a)); - Boolean def (a.default_p ()); + bool def (a.default_p ()); if (min (a) == 0 && !def) { @@ -1472,7 +1475,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -1504,7 +1507,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& dom_doc ( @@ -1524,7 +1527,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) @@ -1550,7 +1553,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -1563,7 +1566,7 @@ namespace CXX arg_name << "." << member << ", this->" << dom_doc << " ())"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& member (emember (a)); @@ -1587,7 +1590,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) @@ -1607,14 +1610,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); os << "this->" << member << " = x." << member << ";"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& member (emember (a)); @@ -1632,7 +1635,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& m) { if (skip (m)) @@ -1654,7 +1657,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -1666,7 +1669,7 @@ namespace CXX << " " << member << " (this->" << dom_doc << " ())"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& member (emember (a)); @@ -1691,7 +1694,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -1703,7 +1706,7 @@ namespace CXX << " " << member << " (this)"; } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& member (emember (a)); @@ -1732,7 +1735,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& member (emember (a)); @@ -1744,7 +1747,7 @@ namespace CXX << " " << member << " (this->" << dom_doc << " ())"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& member (emember (a)); @@ -1771,39 +1774,39 @@ namespace CXX { // generate should initially be false. // - HasComparisonOperator (Context& c, Boolean& generate) + HasComparisonOperator (Context& c, bool& generate) : Context (c), generate_ (generate) { *this >> inherits_ >> *this; *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Type&) { // All built-in types are comparable. generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::List&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Union&) { generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { Traversal::Enumeration::inherits (e); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::names (c); @@ -1812,21 +1815,21 @@ namespace CXX Complex::inherits (c); } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (!skip (m)) generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Any&) { if (options.generate_wildcard ()) generate_ = true; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { if (options.generate_wildcard ()) @@ -1834,7 +1837,7 @@ namespace CXX } private: - Boolean& generate_; + bool& generate_; Traversal::Inherits inherits_; Traversal::Names names_; @@ -1851,7 +1854,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -1866,7 +1869,7 @@ namespace CXX // dynamically-type with xsi:type. // SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); if (!poly) { @@ -1942,7 +1945,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& aname (eaname (a)); @@ -1962,7 +1965,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& aname (eaname (a)); @@ -1978,7 +1981,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& aname (eaname (a)); @@ -1999,14 +2002,14 @@ namespace CXX Traversal::AnyAttribute, Context { - HasParseFunction (Context& c, Boolean& has_el, Boolean& has_at) + HasParseFunction (Context& c, bool& has_el, bool& has_at) : Context (c), has_el_ (has_el), has_at_ (has_at) { *this >> names_ >> *this; *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { names (c); @@ -2015,25 +2018,25 @@ namespace CXX inherits (c); } - virtual Void + virtual void traverse (SemanticGraph::Element&) { has_el_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Any&) { has_el_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Attribute&) { has_at_ = true; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { if (options.generate_wildcard ()) @@ -2041,8 +2044,8 @@ namespace CXX } private: - Boolean& has_el_; - Boolean& has_at_; + bool& has_el_; + bool& has_at_; Traversal::Names names_; Traversal::Inherits inherits_; @@ -2057,14 +2060,14 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { Facets f; FacetCollector col (f); col.traverse (c); - for (Facets::ConstIterator i (f.begin ()); i != f.end (); ++i) + for (Facets::const_iterator i (f.begin ()); i != f.end (); ++i) { if (i->first == L"fractionDigits") os << "{::xsd::cxx::tree::facet::fraction_digits, " << @@ -2076,7 +2079,7 @@ namespace CXX } private: - typedef Cult::Containers::Map<String, String> Facets; + typedef map<String, String> Facets; struct FacetCollector: Traversal::Complex { @@ -2086,7 +2089,7 @@ namespace CXX *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (Type& c) { if (c.inherits_p ()) @@ -2148,7 +2151,7 @@ namespace CXX comparison_member_ (c), facet_array_ (c) { - Boolean gen_wildcard (options.generate_wildcard ()); + bool gen_wildcard (options.generate_wildcard ()); inherits_member_ >> member_name_; @@ -2186,7 +2189,7 @@ namespace CXX } - virtual Void + virtual void traverse (Type& c) { String name (ename (c)); @@ -2197,7 +2200,7 @@ namespace CXX if (renamed_type (c, name) && !name) return; - Boolean string_based (false); + bool string_based (false); { IsStringBasedType t (string_based); t.dispatch (c); @@ -2209,7 +2212,7 @@ namespace CXX t.dispatch (c); } - Boolean facets (false); + bool facets (false); String base; // base type name if (c.inherits_p ()) { @@ -2272,15 +2275,15 @@ namespace CXX // c-tors // - Boolean generate_no_base_ctor (false); + bool generate_no_base_ctor (false); { GenerateWithoutBaseCtor t (generate_no_base_ctor); t.traverse (c); } - Boolean has_complex_non_op_args (false); - Boolean has_poly_non_op_args (false); - Boolean complex_poly_args_clash (true); + bool has_complex_non_op_args (false); + bool has_poly_non_op_args (false); + bool complex_poly_args_clash (true); { HasComplexPolyNonOptArgs t (*this, true, has_complex_non_op_args, @@ -2293,7 +2296,7 @@ namespace CXX // if (options.generate_default_ctor ()) { - Boolean generate (false); + bool generate (false); { GenerateDefaultCtor t (*this, generate, generate_no_base_ctor); t.traverse (c); @@ -2326,7 +2329,7 @@ namespace CXX // if (options.generate_from_base_ctor ()) { - Boolean generate (false); + bool generate (false); { GenerateFromBaseCtor t (*this, generate); t.traverse (c); @@ -2334,9 +2337,9 @@ namespace CXX if (generate) { - Boolean has_complex_non_op_args (false); - Boolean has_poly_non_op_args (false); - Boolean complex_poly_args_clash (true); + bool has_complex_non_op_args (false); + bool has_poly_non_op_args (false); + bool complex_poly_args_clash (true); { HasComplexPolyNonOptArgs t (*this, false, has_complex_non_op_args, @@ -2856,13 +2859,13 @@ namespace CXX // // - Boolean he (has<Traversal::Element> (c)); - Boolean hae (has<Traversal::Any> (c)); + bool he (has<Traversal::Element> (c)); + bool hae (has<Traversal::Any> (c)); - Boolean ha (has<Traversal::Attribute> (c)); - Boolean haa (has<Traversal::AnyAttribute> (c)); + bool ha (has<Traversal::Attribute> (c)); + bool haa (has<Traversal::AnyAttribute> (c)); - Boolean gen_wildcard (options.generate_wildcard ()); + bool gen_wildcard (options.generate_wildcard ()); // // @@ -2897,7 +2900,7 @@ namespace CXX os << "this->_facet_table (_xsd_" << name << "_facet_table);" << endl; - Boolean base_has_el (false), base_has_at (false); + bool base_has_el (false), base_has_at (false); // We are only interested in this information if we are // generating out own parse(). @@ -2925,7 +2928,7 @@ namespace CXX os << "}"; - Boolean simple (true); + bool simple (true); { IsSimpleType t (simple); t.dispatch (c); @@ -3118,7 +3121,7 @@ namespace CXX (he || ha || !c.inherits_p () || ((hae || haa) && gen_wildcard))) { - Boolean base_comp (false); + bool base_comp (false); if (c.inherits_p ()) { @@ -3126,7 +3129,7 @@ namespace CXX test.dispatch (c.inherits ().base ()); } - Boolean has_body (he || ha || base_comp || + bool has_body (he || ha || base_comp || ((hae || haa) && gen_wildcard)); os << "bool" << endl @@ -3219,20 +3222,20 @@ namespace CXX belongs_ >> type_name_; } - virtual Void + virtual void traverse (Type& e) { if (element_type_ && doc_root_p (e)) { SemanticGraph::Type& t (e.type ()); - Boolean fund (false); + bool fund (false); { IsFundamentalType test (fund); test.dispatch (t); } - Boolean simple (true); + bool simple (true); if (!fund) { IsSimpleType test (simple); @@ -3308,7 +3311,7 @@ namespace CXX String const& name_member (ec.get<String> ("element-name-member")); String const& ns_member (ec.get<String> ("element-ns-member")); - Boolean parsing (!options.suppress_parsing ()); + bool parsing (!options.suppress_parsing ()); if (parsing) { String const& tr (etraits (e)); @@ -3432,17 +3435,15 @@ namespace CXX } private: - Boolean element_type_; - Boolean element_map_; + bool element_type_; + bool element_map_; Traversal::Belongs belongs_; MemberTypeName type_name_; }; } - Void - generate_tree_source (Context& ctx, - UnsignedLong first, - UnsignedLong last) + void + generate_tree_source (Context& ctx, size_t first, size_t last) { if (ctx.options.generate_wildcard ()) { @@ -3456,8 +3457,8 @@ namespace CXX if (ctx.polymorphic) { - Boolean parsing (!ctx.options.suppress_parsing ()); - Boolean comparison (ctx.options.generate_comparison ()); + bool parsing (!ctx.options.suppress_parsing ()); + bool comparison (ctx.options.generate_comparison ()); if (parsing) ctx.os << "#include <xsd/cxx/tree/type-factory-map.hxx>" << endl @@ -3469,8 +3470,8 @@ namespace CXX if (parsing || comparison) { - 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/tree/tree-source.hxx b/xsd/cxx/tree/tree-source.hxx index 8983687..221bd5f 100644 --- a/xsd/cxx/tree/tree-source.hxx +++ b/xsd/cxx/tree/tree-source.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Tree { - Void - generate_tree_source (Context&, UnsignedLong first, UnsignedLong last); + void + generate_tree_source (Context&, size_t first, size_t last); } } diff --git a/xsd/cxx/tree/validator.cxx b/xsd/cxx/tree/validator.cxx index 00dfe29..32aaeb0 100644 --- a/xsd/cxx/tree/validator.cxx +++ b/xsd/cxx/tree/validator.cxx @@ -3,18 +3,17 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/tree/validator.hxx> +#include <set> +#include <iostream> -#include <cult/containers/set.hxx> +#include <cxx/tree/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> #include <cxx/tree/elements.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -30,8 +29,8 @@ namespace CXX Tree::options const& ops, const WarningSet& disabled_warnings, Counts const& counts, - Boolean generate_xml_schema, - Boolean& valid_) + bool generate_xml_schema, + bool& valid_) : Context (std::wcerr, root, path, @@ -53,8 +52,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 (); @@ -95,12 +94,12 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; + bool disabled_warnings_all_; - Boolean& valid; + bool& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; @@ -122,7 +121,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) @@ -130,13 +129,13 @@ namespace CXX 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") { @@ -205,14 +204,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 ()) @@ -225,7 +224,7 @@ namespace CXX // if (up_) { - Boolean down = down_; + bool down = down_; down_ = false; for (Type::BegetsIterator i (c.begets_begin ()); @@ -239,10 +238,10 @@ namespace CXX } private: - Boolean up_, down_; + bool up_, down_; }; - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Compositor; @@ -295,7 +294,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -341,7 +340,7 @@ namespace CXX Complex::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // This is also used to traverse Complex. @@ -352,7 +351,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("T002")) @@ -379,7 +378,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -399,7 +398,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -432,7 +431,7 @@ namespace CXX *this >> names_; } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -473,7 +472,7 @@ namespace CXX return false; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (skip (e)) return; @@ -491,7 +490,7 @@ namespace CXX Traversal::Element::traverse (e); } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (traverse_common (a)) @@ -508,9 +507,9 @@ namespace CXX } private: - Boolean anonymous_error_issued_; + bool anonymous_error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -527,21 +526,21 @@ namespace CXX // Dummy ctor, helps with long symbols on HP-UX. } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& schema, SemanticGraph::Path const& path, const WarningSet& disabled_warnings, Counts const& counts) { - Boolean valid (true); + bool valid (true); ValidationContext ctx ( schema, path, ops, disabled_warnings, counts, false, valid); // // - 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) { @@ -601,9 +600,9 @@ namespace CXX // // - Boolean element_type (ops.generate_element_type ()); - Boolean par (!ops.suppress_parsing ()); - Boolean ser (ops.generate_serialization ()); + bool element_type (ops.generate_element_type ()); + bool par (!ops.suppress_parsing ()); + bool ser (ops.generate_serialization ()); if (ops.generate_element_map ()) { diff --git a/xsd/cxx/tree/validator.hxx b/xsd/cxx/tree/validator.hxx index ad156ff..f79adcb 100644 --- a/xsd/cxx/tree/validator.hxx +++ b/xsd/cxx/tree/validator.hxx @@ -20,7 +20,7 @@ namespace CXX public: Validator (); // Dummy ctor, helps with long symbols on HP-UX. - Boolean + bool validate (options const&, SemanticGraph::Schema&, SemanticGraph::Path const& tu, diff --git a/xsd/elements.hxx b/xsd/elements.hxx index 7f4baf8..ee425e9 100644 --- a/xsd/elements.hxx +++ b/xsd/elements.hxx @@ -6,18 +6,14 @@ #ifndef ELEMENTS_HXX #define ELEMENTS_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -using namespace Cult; -typedef WideString String; +#include <types.hxx> namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Traversal = XSDFrontend::Traversal; - // Anonymous feedback via belongs edge. // struct AnonymousBase : Traversal::Element, Traversal::Attribute @@ -63,7 +59,7 @@ public: public: - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); @@ -82,7 +78,7 @@ public: } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { SemanticGraph::Type& t (a.type ()); @@ -109,7 +105,7 @@ private: { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (d1_) diff --git a/xsd/makefile b/xsd/makefile index cbf9f21..00bab30 100644 --- a/xsd/makefile +++ b/xsd/makefile @@ -86,10 +86,6 @@ $(call import,\ l: cutl.l,cpp-options: cutl.l.cpp-options) $(call import,\ - $(scf_root)/import/libcult/stub.make,\ - l: cult.l,cpp-options: cult.l.cpp-options) - -$(call import,\ $(scf_root)/import/libboost/filesystem/stub.make,\ l: fs.l,cpp-options: fs.l.cpp-options) @@ -103,12 +99,11 @@ $(call import,\ # Build. # -$(xsd): $(cxx_obj) $(xsd_fe.l) $(cult.l) $(cutl.l) $(fs.l) $(xerces_c.l) +$(xsd): $(cxx_obj) $(xsd_fe.l) $(cutl.l) $(fs.l) $(xerces_c.l) $(cxx_obj) $(cxx_od): cpp_options := -I$(src_base) $(cxx_obj) $(cxx_od): \ $(xsd_fe.l.cpp-options) \ - $(cult.l.cpp-options) \ $(cutl.l.cpp-options) \ $(fs.l.cpp-options) \ $(xerces_c.l.cpp-options) diff --git a/xsd/options-parser.hxx b/xsd/options-parser.hxx index 9ea1e09..26a0782 100644 --- a/xsd/options-parser.hxx +++ b/xsd/options-parser.hxx @@ -6,17 +6,16 @@ #ifndef OPTIONS_PARSER_HXX #define OPTIONS_PARSER_HXX -#include <cult/types.hxx> - +#include <types.hxx> #include <options.hxx> namespace cli { template <> - struct parser<Cult::Types::NarrowString> + struct parser<NarrowString> { static void - parse (Cult::Types::NarrowString& x, scanner& s) + parse (NarrowString& x, scanner& s) { const char* o (s.next ()); diff --git a/xsd/options.cli b/xsd/options.cli index 6ab4ab3..f10fbec 100644 --- a/xsd/options.cli +++ b/xsd/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 <vector>; -include <string>; include <cstddef>; // std::size_t -include <cult/types.hxx>; // NarrowString +include <types.hxx>; // NarrowString, NarrowStrings class help_options { @@ -20,7 +18,7 @@ class help_options class options = 0 { - std::vector<Cult::Types::NarrowString> --disable-warning + NarrowStrings --disable-warning { "<warn>", "Disable printing warning with id <warn>. If \cb{all} is specified for @@ -70,7 +68,7 @@ class options = 0 license instead of the GPL." }; - Cult::Types::NarrowString --custom-literals + NarrowString --custom-literals { "<file>", "Load custom XML string to C++ literal mappings from <file>. This @@ -100,7 +98,7 @@ class options = 0 only makes sense together with the \cb{--preserve-anonymous} option." }; - std::vector<Cult::Types::NarrowString> --anonymous-regex + NarrowStrings --anonymous-regex { "<regex>", "Add <regex> to the list of regular expressions used to derive names for @@ -143,7 +141,7 @@ class options = 0 // Location options. // - std::vector<Cult::Types::NarrowString> --location-map + NarrowStrings --location-map { "<ol>=<nl>", "Map the original schema location <ol> that is specified in the XML @@ -155,7 +153,7 @@ class options = 0 \cb{--location-map http://example.com/foo.xsd=foo.xsd}" }; - std::vector<Cult::Types::NarrowString> --location-regex + NarrowStrings --location-regex { "<regex>", "Add <regex> to the list of regular expressions used to map schema @@ -197,7 +195,7 @@ class options = 0 \cb{--fat-type-file}, and \cb{--file-list}." }; - std::vector<Cult::Types::NarrowString> --type-file-regex + NarrowStrings --type-file-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate type @@ -227,7 +225,8 @@ class options = 0 \cb{--type-file-regex} option. Use this option to find out why your regular expressions don't do what you expected them to do." }; - std::vector<Cult::Types::NarrowString> --schema-file-regex + + NarrowStrings --schema-file-regex { "<regex>", "Add <regex> to the list of regular expressions used to translate schema @@ -274,7 +273,7 @@ class options = 0 // File list options. // - Cult::Types::NarrowString --file-list + NarrowString --file-list { "<file>", "Write a list of generated C++ files to <file>. This option is primarily @@ -283,7 +282,7 @@ class options = 0 fragment." }; - Cult::Types::NarrowString --file-list-prologue + NarrowString --file-list-prologue { "<text>", "Insert <text> at the beginning of the file list. As a convenience, all @@ -292,7 +291,7 @@ class options = 0 generated file list to a makefile variable." }; - Cult::Types::NarrowString --file-list-epilogue + NarrowString --file-list-epilogue { "<text>", "Insert <text> at the end of the file list. As a convenience, all @@ -300,7 +299,7 @@ class options = 0 with new lines." }; - Cult::Types::NarrowString --file-list-delim = "\n" + NarrowString --file-list-delim = "\n" { "<text>", "Delimit file names written to the file list with <text> instead of new diff --git a/xsd/processing/cardinality/processor.cxx b/xsd/processing/cardinality/processor.cxx index a47ed96..87fdad3 100644 --- a/xsd/processing/cardinality/processor.cxx +++ b/xsd/processing/cardinality/processor.cxx @@ -3,24 +3,22 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <processing/cardinality/processor.hxx> - -#include <elements.hxx> +#include <map> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> +#include <elements.hxx> + +#include <processing/cardinality/processor.hxx> + +using namespace std; namespace Processing { - using namespace Cult; - namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Traversal = XSDFrontend::Traversal; - typedef WideString String; - namespace Cardinality { namespace @@ -39,8 +37,7 @@ namespace Processing { } - ElementInfo (SemanticGraph::Element& e, - UnsignedLong min_, UnsignedLong max_) + ElementInfo (SemanticGraph::Element& e, size_t min_, size_t max_) : min (min_), max (max_), e_ (&e) { } @@ -53,13 +50,13 @@ namespace Processing } public: - UnsignedLong min, max; + size_t min, max; private: SemanticGraph::Element* e_; }; - typedef Cult::Containers::Map<String, ElementInfo> ElementInfoMap; + typedef map<String, ElementInfo> ElementInfoMap; // // @@ -75,8 +72,7 @@ namespace Processing { } - AnyInfo (SemanticGraph::Any& a, - UnsignedLong min_, UnsignedLong max_) + AnyInfo (SemanticGraph::Any& a, size_t min_, size_t max_) : min (min_), max (max_), a_ (&a) { } @@ -89,13 +85,13 @@ namespace Processing } public: - UnsignedLong min, max; + size_t min, max; private: SemanticGraph::Any* a_; }; - typedef Cult::Containers::Map<String, AnyInfo> AnyInfoMap; + typedef map<String, AnyInfo> AnyInfoMap; // // @@ -105,13 +101,13 @@ namespace Processing Traversal::Element, Traversal::Any { - virtual Void + virtual void traverse (SemanticGraph::All& a) { traverse_sequence (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -135,13 +131,13 @@ namespace Processing // those that are we need to choose minimum between // the two for min and maximum for max. // - for (ElementInfoMap::Iterator i (el_map.begin ()); + for (ElementInfoMap::iterator i (el_map.begin ()); i != el_map.end (); ++i) { String const& name (i->first); ElementInfo& ei (i->second); - ElementInfoMap::Iterator j (t.el_map.find (name)); + ElementInfoMap::iterator j (t.el_map.find (name)); if (j == t.el_map.end ()) ei.min = 0; @@ -156,13 +152,13 @@ namespace Processing // not in the map, we need to add to the map and set their // min to 0. // - for (ElementInfoMap::Iterator i (t.el_map.begin ()); + for (ElementInfoMap::iterator i (t.el_map.begin ()); i != t.el_map.end (); ++i) { String const& name (i->first); ElementInfo& ei (i->second); - ElementInfoMap::Iterator j (el_map.find (name)); + ElementInfoMap::iterator j (el_map.find (name)); if (j == el_map.end ()) el_map[name] = ElementInfo (ei.element (), 0, ei.max); @@ -173,7 +169,7 @@ namespace Processing // we need to copy them from each arm of choice and set min to // 0. // - for (AnyInfoMap::Iterator i (t.any_map.begin ()); + for (AnyInfoMap::iterator i (t.any_map.begin ()); i != t.any_map.end (); ++i) { String const& name (i->first); @@ -187,19 +183,19 @@ namespace Processing // Choice's min and max. // - UnsignedLong cmin (c.min ()), cmax (c.max ()); + size_t cmin (c.min ()), cmax (c.max ()); // Iterate over elements and wildcards in the maps and multiply // their cardinality by cmin and cmax. // - for (ElementInfoMap::Iterator i (el_map.begin ()); + for (ElementInfoMap::iterator i (el_map.begin ()); i != el_map.end (); ++i) { i->second.min *= cmin; i->second.max *= cmax; } - for (AnyInfoMap::Iterator i (any_map.begin ()); + for (AnyInfoMap::iterator i (any_map.begin ()); i != any_map.end (); ++i) { i->second.min *= cmin; // Not really necessary since min == 0. @@ -207,20 +203,20 @@ namespace Processing } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { traverse_sequence (s); } - Void + void traverse_sequence (SemanticGraph::Compositor& c) { using SemanticGraph::Compositor; // Sequence's min and max. // - UnsignedLong smin (c.min ()), smax (c.max ()); + size_t smin (c.min ()), smax (c.max ()); // Go over all particles we contain and add them to the map. // @@ -232,14 +228,14 @@ namespace Processing // Handle elements. // - for (ElementInfoMap::Iterator i (t.el_map.begin ()); + for (ElementInfoMap::iterator i (t.el_map.begin ()); i != t.el_map.end (); ++i) { String const& name (i->first); ElementInfo& ei (i->second); - UnsignedLong min (ei.min * smin); - UnsignedLong max (ei.max * smax); - ElementInfoMap::Iterator j (el_map.find (name)); + size_t min (ei.min * smin); + size_t max (ei.max * smax); + ElementInfoMap::iterator j (el_map.find (name)); if (j != el_map.end ()) { @@ -255,13 +251,13 @@ namespace Processing // Handle wildcards. // - for (AnyInfoMap::Iterator i (t.any_map.begin ()); + for (AnyInfoMap::iterator i (t.any_map.begin ()); i != t.any_map.end (); ++i) { String const& name (i->first); AnyInfo& ai (i->second); - UnsignedLong min (ai.min * smin); - UnsignedLong max (ai.max * smax); + size_t min (ai.min * smin); + size_t max (ai.max * smax); assert (any_map.find (name) == any_map.end ()); @@ -270,7 +266,7 @@ namespace Processing } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::ContainsParticle& cp (e.contained_particle ()); @@ -282,7 +278,7 @@ namespace Processing el_map[name] = ElementInfo (e, cp.min (), cp.max ()); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { SemanticGraph::ContainsParticle& cp (a.contained_particle ()); @@ -300,7 +296,7 @@ namespace Processing // struct Complex: Traversal::Complex { - virtual Void + virtual void traverse (Type& c) { if (c.contains_compositor_p ()) @@ -308,7 +304,7 @@ namespace Processing Particle t; t.dispatch (c.contains_compositor ().compositor ()); - for (ElementInfoMap::Iterator i (t.el_map.begin ()); + for (ElementInfoMap::iterator i (t.el_map.begin ()); i != t.el_map.end (); ++i) { ElementInfo& ei (i->second); @@ -318,7 +314,7 @@ namespace Processing ctx.set ("max", ei.max); } - for (AnyInfoMap::Iterator i (t.any_map.begin ()); + for (AnyInfoMap::iterator i (t.any_map.begin ()); i != t.any_map.end (); ++i) { AnyInfo& ai (i->second); @@ -340,7 +336,7 @@ namespace Processing // struct Attribute: Traversal::Attribute { - virtual Void + virtual void traverse (Type& a) { SemanticGraph::Context& ctx (a.context ()); @@ -355,7 +351,7 @@ namespace Processing // struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -369,7 +365,7 @@ namespace Processing }; } - Void Processor:: + void Processor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/xsd/processing/cardinality/processor.hxx b/xsd/processing/cardinality/processor.hxx index fa1dffd..5d7fb3c 100644 --- a/xsd/processing/cardinality/processor.hxx +++ b/xsd/processing/cardinality/processor.hxx @@ -6,23 +6,21 @@ #ifndef PROCESSING_CARDINALITY_PROCESSOR_HXX #define PROCESSING_CARDINALITY_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/elements.hxx> // Path #include <xsd-frontend/semantic-graph/schema.hxx> +#include <types.hxx> + namespace Processing { namespace Cardinality { - using namespace Cult::Types; - class Processor { public: struct Failed {}; - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file); }; diff --git a/xsd/processing/inheritance/processor.cxx b/xsd/processing/inheritance/processor.cxx index 7d103db..1e46282 100644 --- a/xsd/processing/inheritance/processor.cxx +++ b/xsd/processing/inheritance/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 <set> +#include <iostream> + #include <processing/inheritance/processor.hxx> #include <elements.hxx> @@ -10,21 +13,13 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> - -#include <iostream> -using std::wcerr; -using std::endl; +using namespace std; namespace Processing { - using namespace Cult; - namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Traversal = XSDFrontend::Traversal; - typedef WideString String; - namespace Inheritance { namespace @@ -43,15 +38,14 @@ namespace Processing String member_xpath; }; - inline Boolean + inline bool operator< (Dep const& a, Dep const& b) { return &a.type < &b.type; } - typedef Containers::Set<Dep> DepSet; - typedef Containers::Set<SemanticGraph::Type*> TypeSet; - + typedef set<Dep> DepSet; + typedef set<SemanticGraph::Type*> TypeSet; String xpath (SemanticGraph::Nameable& n) @@ -88,7 +82,7 @@ namespace Processing *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -103,7 +97,7 @@ namespace Processing names (c); } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -158,14 +152,14 @@ namespace Processing } template <typename E> - Void + void add_edge_left (E& e) { node_.add_edge_left (e, arg_); } template <typename E> - Void + void add_edge_right (E& e) { node_.add_edge_right (e, arg_); @@ -185,26 +179,26 @@ namespace Processing { Global (SemanticGraph::Schema& root, SemanticGraph::Schema& schema, - Boolean& failed) + bool& failed) : root_ (root), schema_ (schema), failed_ (failed) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) types_seen_.insert (&t); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { check_dep (c, c); types_seen_.insert (&c); }; - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); @@ -218,7 +212,7 @@ namespace Processing }; private: - Void + void check_dep (SemanticGraph::Nameable& global, SemanticGraph::Type& type) { @@ -236,7 +230,7 @@ namespace Processing complex.dispatch (type); } - for (DepSet::ConstIterator i (prereqs.begin ()); + for (DepSet::const_iterator i (prereqs.begin ()); i != prereqs.end (); ++i) { Dep const& dep (*i); @@ -364,7 +358,7 @@ namespace Processing private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -387,7 +381,7 @@ namespace Processing SemanticGraph::Schema& root_; SemanticGraph::Schema& schema_; TypeSet types_seen_; - Boolean& failed_; + bool& failed_; }; @@ -403,7 +397,7 @@ namespace Processing } private: - Cult::Containers::Set<SemanticGraph::Schema*> schemas_; + set<SemanticGraph::Schema*> schemas_; }; // Go into included/imported schemas while making sure we don't @@ -411,25 +405,25 @@ namespace Processing // struct Uses: Traversal::Includes, Traversal::Imports { - Uses (SemanticGraph::Schema& root, Boolean& failed) + Uses (SemanticGraph::Schema& root, bool& failed) : root_ (root), failed_ (failed) { } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse (i.schema ()); } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse (i.schema ()); } private: - Void + void traverse (SemanticGraph::Schema& s) { if (!s.context ().count ("processing-inheritance-seen")) @@ -457,14 +451,14 @@ namespace Processing private: SemanticGraph::Schema& root_; - Boolean& failed_; + bool& failed_; }; } - Void Processor:: + void Processor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { - Boolean failed (false); + bool failed (false); // We need to process include/imported schemas since other // parts of the process, for example, name processors can diff --git a/xsd/processing/inheritance/processor.hxx b/xsd/processing/inheritance/processor.hxx index 32cccc4..7bb8a7f 100644 --- a/xsd/processing/inheritance/processor.hxx +++ b/xsd/processing/inheritance/processor.hxx @@ -6,23 +6,21 @@ #ifndef PROCESSING_INHERITANCE_PROCESSOR_HXX #define PROCESSING_INHERITANCE_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/elements.hxx> // Path #include <xsd-frontend/semantic-graph/schema.hxx> +#include <types.hxx> + namespace Processing { namespace Inheritance { - using namespace Cult::Types; - class Processor { public: struct Failed {}; - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file); }; diff --git a/xsd/type-map/lexer.cxx b/xsd/type-map/lexer.cxx index 6e1f34a..b8ea0e7 100644 --- a/xsd/type-map/lexer.cxx +++ b/xsd/type-map/lexer.cxx @@ -68,7 +68,7 @@ namespace TypeMap if (is_.eof ()) return Token (Token::eos, L"<end-of-stream>", line_); - Boolean quote (c == '"'); + bool quote (c == '"'); if (!quote) lexeme += c; diff --git a/xsd/type-map/lexer.hxx b/xsd/type-map/lexer.hxx index 762b67c..012533a 100644 --- a/xsd/type-map/lexer.hxx +++ b/xsd/type-map/lexer.hxx @@ -9,13 +9,10 @@ #include <locale> #include <iosfwd> -#include <cult/types.hxx> +#include <types.hxx> namespace TypeMap { - using namespace Cult::Types; - typedef WideString String; - class Lexer { public: @@ -29,7 +26,7 @@ namespace TypeMap eos }; - Token (Type type, String const& lexeme, UnsignedLong line) + Token (Type type, String const& lexeme, size_t line) : type_ (type), lexeme_ (lexeme), line_ (line) { } @@ -46,7 +43,7 @@ namespace TypeMap return lexeme_; } - UnsignedLong + size_t line () const { return line_; @@ -55,7 +52,7 @@ namespace TypeMap private: Type type_; String lexeme_; - UnsignedLong line_; + size_t line_; }; Lexer (std::istream&, String const& path); @@ -69,12 +66,11 @@ namespace TypeMap std::locale locale_; std::istream& is_; String path_; - UnsignedLong line_; + size_t line_; String held_lexeme_; - Boolean comment_; + bool comment_; }; } #endif // XSD_TYPE_MAP_LEXER_HXX - diff --git a/xsd/type-map/parser.cxx b/xsd/type-map/parser.cxx index 5bc2ffc..7d44543 100644 --- a/xsd/type-map/parser.cxx +++ b/xsd/type-map/parser.cxx @@ -21,7 +21,7 @@ namespace TypeMap { } - Boolean Parser:: + bool Parser:: parse (Namespaces& ns) { try @@ -83,7 +83,7 @@ namespace TypeMap return true; } - Boolean Parser:: + bool Parser:: namespace_ (Namespaces& ns) { // First get XML namespace. @@ -115,7 +115,7 @@ namespace TypeMap // t = lex_.next (); - Boolean has_cxx_name (false); + bool has_cxx_name (false); String cxx_name; if (t.type () != Token::token) @@ -191,7 +191,7 @@ namespace TypeMap return true; } - Boolean Parser:: + bool Parser:: include (Namespace& n) { Token t (lex_.next ()); @@ -222,7 +222,7 @@ namespace TypeMap return true; } - Boolean Parser:: + bool Parser:: type (Token t, Namespace& n) { Pattern xsd_name; diff --git a/xsd/type-map/parser.hxx b/xsd/type-map/parser.hxx index 603ffc8..375b824 100644 --- a/xsd/type-map/parser.hxx +++ b/xsd/type-map/parser.hxx @@ -6,16 +6,13 @@ #ifndef XSD_TYPE_MAP_PARSER_HXX #define XSD_TYPE_MAP_PARSER_HXX -#include <cult/types.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> #include <type-map/lexer.hxx> namespace TypeMap { - using namespace Cult::Types; - typedef WideString String; - class Parser { public: @@ -23,17 +20,17 @@ namespace TypeMap // Merge parsed namespaces. // - Boolean + bool parse (Namespaces&); private: - Boolean + bool namespace_ (Namespaces&); - Boolean + bool include (Namespace&); - Boolean + bool type (Lexer::Token, Namespace&); private: diff --git a/xsd/type-map/type-map.hxx b/xsd/type-map/type-map.hxx index e5715dd..2fda512 100644 --- a/xsd/type-map/type-map.hxx +++ b/xsd/type-map/type-map.hxx @@ -6,15 +6,14 @@ #ifndef XSD_TYPE_MAP_TYPE_MAP_HXX #define XSD_TYPE_MAP_TYPE_MAP_HXX +#include <vector> + #include <cutl/re.hxx> -#include <cult/types.hxx> -#include <cult/containers/vector.hxx> +#include <types.hxx> namespace TypeMap { - using namespace Cult::Types; - typedef WideString String; typedef cutl::re::wregex Pattern; class Type @@ -81,7 +80,7 @@ namespace TypeMap } Namespace (Pattern const& xsd_name, - Boolean has_cxx_name, + bool has_cxx_name, String const& cxx_name) : xsd_name_ (xsd_name), has_cxx_name_ (has_cxx_name), @@ -91,8 +90,8 @@ namespace TypeMap // // - typedef Cult::Containers::Vector<String> Includes; - typedef Includes::ConstIterator IncludesIterator; + typedef std::vector<String> Includes; + typedef Includes::const_iterator IncludesIterator; IncludesIterator includes_begin () const @@ -106,7 +105,7 @@ namespace TypeMap return includes_.end (); } - Void + void includes_push_back (String const& i) { includes_.push_back (i); @@ -114,8 +113,8 @@ namespace TypeMap // // - typedef Cult::Containers::Vector<Type> Types; - typedef Types::ConstIterator TypesIterator; + typedef std::vector<Type> Types; + typedef Types::const_iterator TypesIterator; TypesIterator types_begin () const @@ -129,7 +128,7 @@ namespace TypeMap return types_.end (); } - Void + void types_push_back (String const& xsd_type, String const& cxx_ret_type, String const& cxx_arg_type = L"") @@ -137,7 +136,7 @@ namespace TypeMap types_.push_back (Type (xsd_type, cxx_ret_type, cxx_arg_type)); } - Void + void types_push_back (Pattern const& xsd_type, String const& cxx_ret_type, String const& cxx_arg_type = L"") @@ -155,7 +154,7 @@ namespace TypeMap // // - Boolean + bool has_cxx_name () const { return has_cxx_name_; @@ -171,11 +170,11 @@ namespace TypeMap Includes includes_; Types types_; Pattern xsd_name_; - Boolean has_cxx_name_; + bool has_cxx_name_; String cxx_name_; }; - typedef Cult::Containers::Vector<Namespace> Namespaces; + typedef std::vector<Namespace> Namespaces; } #endif // XSD_TYPE_MAP_TYPE_MAP_HXX diff --git a/xsd/types.hxx b/xsd/types.hxx index 91be3ae..ff78081 100644 --- a/xsd/types.hxx +++ b/xsd/types.hxx @@ -7,9 +7,15 @@ #define TYPES_HXX #include <vector> +#include <cstddef> // std::size_t -#include <cult/types.hxx> +#include <xsd-frontend/types.hxx> -typedef std::vector<Cult::Types::NarrowString> NarrowStrings; +using std::size_t; + +using XSDFrontend::String; +using XSDFrontend::NarrowString; + +typedef std::vector<NarrowString> NarrowStrings; #endif // TYPES_HXX diff --git a/xsd/xsd.cxx b/xsd/xsd.cxx index a9b67cf..de6f2fd 100644 --- a/xsd/xsd.cxx +++ b/xsd/xsd.cxx @@ -3,6 +3,7 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <map> #include <vector> #include <memory> // std::auto_ptr #include <cstddef> // std::size_t @@ -14,13 +15,6 @@ #include <cutl/re.hxx> -#include <cult/types.hxx> - -#include <cult/trace/log.hxx> - -#include <cult/containers/map.hxx> -#include <cult/containers/vector.hxx> - #include <xsd-frontend/parser.hxx> #include <xsd-frontend/transformations/anonymous.hxx> #include <xsd-frontend/transformations/enum-synthesis.cxx> @@ -43,8 +37,6 @@ #include "../libxsd/xsd/cxx/version.hxx" -using namespace Cult::Types; - namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Transformations = XSDFrontend::Transformations; @@ -58,24 +50,24 @@ struct LocationTranslator: XSDFrontend::LocationTranslator LocationTranslator (NarrowStrings const& map, NarrowStrings const& regex, - Boolean trace); + bool trace); virtual NarrowString translate (NarrowString const&); private: - typedef Cult::Containers::Map<NarrowString, NarrowString> Map; + typedef map<NarrowString, NarrowString> Map; typedef cutl::re::regexsub Regex; typedef cutl::re::format RegexFormat; - typedef Cult::Containers::Vector<Regex> RegexVector; + typedef vector<Regex> RegexVector; - typedef Cult::Containers::Map<NarrowString, NarrowString> Cache; + typedef map<NarrowString, NarrowString> Cache; Map map_; RegexVector regex_; Cache cache_; - Boolean trace_; + bool trace_; }; // @@ -84,21 +76,21 @@ struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator { struct Failed {}; - AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace); + AnonymousNameTranslator (NarrowStrings const& regex, bool trace); - virtual WideString - translate (WideString const& file, - WideString const& ns, - WideString const& name, - WideString const& xpath); + virtual String + translate (String const& file, + String const& ns, + String const& name, + String const& xpath); private: typedef cutl::re::wregexsub Regex; typedef cutl::re::wformat RegexFormat; - typedef Cult::Containers::Vector<Regex> RegexVector; + typedef vector<Regex> RegexVector; RegexVector regex_; - Boolean trace_; + bool trace_; }; @@ -109,12 +101,12 @@ struct SchemaPerTypeTranslator: Transformations::SchemaPerTypeTranslator struct Failed {}; SchemaPerTypeTranslator (NarrowStrings const& type_regex, - Boolean type_trace, + bool type_trace, NarrowStrings const& schema_regex, - Boolean schema_trace); + bool schema_trace); - virtual WideString - translate_type (WideString const& ns, WideString const& name); + virtual String + translate_type (String const& ns, String const& name); virtual NarrowString translate_schema (NarrowString const& file); @@ -122,17 +114,17 @@ struct SchemaPerTypeTranslator: Transformations::SchemaPerTypeTranslator private: typedef cutl::re::wregexsub TypeRegex; typedef cutl::re::wformat TypeRegexFormat; - typedef Cult::Containers::Vector<TypeRegex> TypeRegexVector; + typedef vector<TypeRegex> TypeRegexVector; TypeRegexVector type_regex_; - Boolean type_trace_; + bool type_trace_; typedef cutl::re::regexsub SchemaRegex; typedef cutl::re::format SchemaRegexFormat; - typedef Cult::Containers::Vector<SchemaRegex> SchemaRegexVector; + typedef vector<SchemaRegex> SchemaRegexVector; SchemaRegexVector schema_regex_; - Boolean schema_trace_; + bool schema_trace_; }; // @@ -152,15 +144,13 @@ struct XercesInitializer // Expand the \n escape sequence. // -Void +void expand_nl (NarrowString& s); -Int -main (Int argc, Char* argv[]) +int +main (int argc, char* argv[]) { - std::wostream& e (wcerr); - - Cult::Trace::Log::instance ().level (0); + wostream& e (wcerr); try { @@ -173,7 +163,7 @@ main (Int argc, Char* argv[]) if (help_ops.version () || cmd == "version") { - std::wostream& o (wcout); + wostream& o (wcout); o << "CodeSynthesis XSD XML Schema to C++ compiler " << XSD_STR_VERSION << endl @@ -205,7 +195,7 @@ main (Int argc, Char* argv[]) if (help_ops.help () || cmd == "help") { - std::wostream& o (wcout); + wostream& o (wcout); if (cmd == "help" && args.more ()) { @@ -303,7 +293,7 @@ main (Int argc, Char* argv[]) disabled_w.insert (*i); } - Boolean disabled_w_all (disabled_w.find ("all") != disabled_w.end ()); + bool disabled_w_all (disabled_w.find ("all") != disabled_w.end ()); if (common_ops.morph_anonymous () && !disabled_w_all && @@ -327,7 +317,7 @@ main (Int argc, Char* argv[]) return 1; } - Boolean fpt (common_ops.file_per_type ()); + bool fpt (common_ops.file_per_type ()); if (cmd == "cxx-tree" || cmd == "cxx-parser") { @@ -422,7 +412,7 @@ main (Int argc, Char* argv[]) // File-per-schema compilation mode. // - for (Size i (0); i < files.size (); ++i) + for (size_t i (0); i < files.size (); ++i) { // Parse schema. // @@ -595,7 +585,7 @@ main (Int argc, Char* argv[]) // SemanticGraph::Paths paths; - for (Size i (0); i < files.size (); ++i) + for (size_t i (0); i < files.size (); ++i) { try { @@ -684,7 +674,7 @@ main (Int argc, Char* argv[]) // Rearrange the graph so that each type is in a seperate // schema file. // - typedef std::vector<SemanticGraph::Schema*> Schemas; + typedef vector<SemanticGraph::Schema*> Schemas; SchemaPerTypeTranslator type_translator ( common_ops.type_file_regex (), @@ -768,7 +758,7 @@ main (Int argc, Char* argv[]) OutputFileStream ofs; SemanticGraph::Path path (fl); - ofs.open (fl, std::ios_base::out); + ofs.open (fl, ios_base::out); if (!ofs.is_open ()) { @@ -785,7 +775,7 @@ main (Int argc, Char* argv[]) ofs << p; } - for (FileList::Iterator i (file_list.begin ()), e (file_list.end ()); + for (FileList::iterator i (file_list.begin ()), e (file_list.end ()); i != e;) { ofs << *i; @@ -861,7 +851,7 @@ main (Int argc, Char* argv[]) LocationTranslator:: LocationTranslator (NarrowStrings const& map, NarrowStrings const& regex, - Boolean trace) + bool trace) : trace_ (trace) { // Map. @@ -870,7 +860,7 @@ LocationTranslator (NarrowStrings const& map, { // Split the string in two parts at the last '='. // - Size pos (i->rfind ('=')); + size_t pos (i->rfind ('=')); if (pos == NarrowString::npos) { @@ -907,14 +897,14 @@ translate (NarrowString const& l) { // First check the cache. // - Cache::ConstIterator ci (cache_.find (l)); + Cache::const_iterator ci (cache_.find (l)); if (ci != cache_.end ()) return ci->second; // Then check the direct map. // - Map::ConstIterator mi (map_.find (l)); + Map::const_iterator mi (map_.find (l)); if (mi != map_.end ()) { @@ -927,7 +917,7 @@ translate (NarrowString const& l) if (trace_) wcerr << "location: '" << l.c_str () << "'" << endl; - for (RegexVector::ReverseIterator i (regex_.rbegin ()); + for (RegexVector::reverse_iterator i (regex_.rbegin ()); i != regex_.rend (); ++i) { if (trace_) @@ -958,14 +948,14 @@ translate (NarrowString const& l) // AnonymousNameTranslator:: -AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace) +AnonymousNameTranslator (NarrowStrings const& regex, bool trace) : trace_ (trace) { for (NarrowStrings::const_iterator i (regex.begin ()); i != regex.end (); ++i) { try { - regex_.push_back (Regex (WideString (*i))); + regex_.push_back (Regex (String (*i))); } catch (RegexFormat const& e) { @@ -977,18 +967,18 @@ AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace) } } -WideString AnonymousNameTranslator:: -translate (WideString const& file, - WideString const& ns, - WideString const& name, - WideString const& xpath) +String AnonymousNameTranslator:: +translate (String const& file, + String const& ns, + String const& name, + String const& xpath) { - WideString s (file + L' ' + ns + L' ' + xpath); + String s (file + L' ' + ns + L' ' + xpath); if (trace_) wcerr << "anonymous type: '" << s << "'" << endl; - for (RegexVector::ReverseIterator i (regex_.rbegin ()); + for (RegexVector::reverse_iterator i (regex_.rbegin ()); i != regex_.rend (); ++i) { if (trace_) @@ -996,7 +986,7 @@ translate (WideString const& file, if (i->match (s)) { - WideString r (i->replace (s)); + String r (i->replace (s)); if (trace_) wcerr << "'" << r << "' : +" << endl; @@ -1018,9 +1008,9 @@ translate (WideString const& file, SchemaPerTypeTranslator:: SchemaPerTypeTranslator (NarrowStrings const& type_regex, - Boolean type_trace, + bool type_trace, NarrowStrings const& schema_regex, - Boolean schema_trace) + bool schema_trace) : type_trace_ (type_trace), schema_trace_ (schema_trace) { for (NarrowStrings::const_iterator i (type_regex.begin ()); @@ -1028,7 +1018,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex, { try { - type_regex_.push_back (TypeRegex (WideString (*i))); + type_regex_.push_back (TypeRegex (String (*i))); } catch (TypeRegexFormat const& e) { @@ -1056,15 +1046,15 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex, } } -WideString SchemaPerTypeTranslator:: -translate_type (WideString const& ns, WideString const& name) +String SchemaPerTypeTranslator:: +translate_type (String const& ns, String const& name) { - WideString s (ns + L' ' + name); + String s (ns + L' ' + name); if (type_trace_) wcerr << "type: '" << s << "'" << endl; - for (TypeRegexVector::ReverseIterator i (type_regex_.rbegin ()); + for (TypeRegexVector::reverse_iterator i (type_regex_.rbegin ()); i != type_regex_.rend (); ++i) { if (type_trace_) @@ -1072,7 +1062,7 @@ translate_type (WideString const& ns, WideString const& name) if (i->match (s)) { - WideString r (i->replace (s)); + String r (i->replace (s)); if (type_trace_) wcerr << "'" << r << "' : +" << endl; @@ -1095,7 +1085,7 @@ translate_schema (NarrowString const& file) if (schema_trace_) wcerr << "schema: '" << file.c_str () << "'" << endl; - for (SchemaRegexVector::ReverseIterator i (schema_regex_.rbegin ()); + for (SchemaRegexVector::reverse_iterator i (schema_regex_.rbegin ()); i != schema_regex_.rend (); ++i) { if (schema_trace_) @@ -1122,10 +1112,10 @@ translate_schema (NarrowString const& file) // // -Void +void expand_nl (NarrowString& s) { - for (Size i (0); i < s.size ();) + for (size_t i (0); i < s.size ();) { if (s[i] == '\\' && (i + 1) < s.size () && s[i + 1] == 'n') { diff --git a/xsd/xsd.hxx b/xsd/xsd.hxx index 1af00a0..43f38ea 100644 --- a/xsd/xsd.hxx +++ b/xsd/xsd.hxx @@ -6,25 +6,18 @@ #ifndef XSD_HXX #define XSD_HXX +#include <set> +#include <vector> #include <cstdio> // std::remove #include <cutl/shared-ptr.hxx> #include <xsd-frontend/semantic-graph/elements.hxx> // Path -#include <cult/types.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> +#include <types.hxx> -using namespace Cult::Types; - -// -// -typedef Cult::Containers::Set<NarrowString> WarningSet; - -// -// -typedef Cult::Containers::Vector<NarrowString> FileList; +typedef std::set<NarrowString> WarningSet; +typedef std::vector<NarrowString> FileList; // // @@ -49,14 +42,14 @@ struct AutoUnlink private: XSDFrontend::SemanticGraph::Path file_; - Boolean canceled_; + bool canceled_; }; // // struct AutoUnlinks { - Void + void add (XSDFrontend::SemanticGraph::Path const& file) { unlinks_.push_back( @@ -64,15 +57,15 @@ struct AutoUnlinks new (shared) AutoUnlink (file))); } - Void + void cancel () { - for (Unlinks::Iterator i (unlinks_.begin ()); i != unlinks_.end (); ++i) + for (Unlinks::iterator i (unlinks_.begin ()); i != unlinks_.end (); ++i) (*i)->cancel (); } private: - typedef Cult::Containers::Vector<cutl::shared_ptr<AutoUnlink> > Unlinks; + typedef std::vector<cutl::shared_ptr<AutoUnlink> > Unlinks; Unlinks unlinks_; }; |