diff options
138 files changed, 3290 insertions, 4087 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/xsde/cxx/elements.cxx b/xsde/cxx/elements.cxx index e466ff1..07917e6 100644 --- a/xsde/cxx/elements.cxx +++ b/xsde/cxx/elements.cxx @@ -24,7 +24,7 @@ namespace CXX namespace { - WideChar const* keywords[] = { + wchar_t const* keywords[] = { L"NULL", L"and", L"asm", @@ -111,7 +111,7 @@ namespace CXX SemanticGraph::Schema& root, SemanticGraph::Path const& path, options_type const& ops, - Char const* name_key, + char const* name_key, NarrowString const& char_type__) : os (o), schema_root (root), @@ -204,7 +204,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"); @@ -237,7 +237,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""; @@ -247,7 +247,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]); } @@ -261,7 +261,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 ()) { @@ -308,7 +308,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 ()) { @@ -321,10 +321,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) @@ -468,7 +468,7 @@ namespace CXX } String Context:: - fq_name (SemanticGraph::Nameable& n, Char const* name_key) const + fq_name (SemanticGraph::Nameable& n, char const* name_key) const { using namespace SemanticGraph; @@ -565,17 +565,17 @@ namespace CXX escape (String const& name) const { 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) { @@ -591,7 +591,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 ()) @@ -599,7 +599,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 ()) { @@ -635,14 +635,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) { @@ -658,7 +658,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 }; @@ -667,7 +667,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. // @@ -675,11 +675,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 @@ -760,15 +760,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; @@ -800,7 +800,7 @@ namespace CXX } } - for (UnsignedLong j (0); j < count; ++j) + for (unsigned int j (0); j < count; ++j) r += charlit (tmp[j]); escape = true; @@ -816,7 +816,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. // @@ -824,11 +824,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 @@ -909,7 +909,7 @@ namespace CXX } default: { - r += static_cast<WideChar> (u); + r += static_cast<wchar_t> (u); break; } } @@ -936,7 +936,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. // @@ -944,11 +944,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 - ] - \xUUUUUUUU // 127 - \x7F @@ -1029,7 +1029,7 @@ namespace CXX } default: { - r += static_cast<WideChar> (u); + r += static_cast<wchar_t> (u); break; } } @@ -1065,16 +1065,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. @@ -1082,7 +1082,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; @@ -1098,9 +1098,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) @@ -1127,8 +1127,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; } @@ -1138,7 +1138,7 @@ namespace CXX // Namespace // - Void Namespace:: + void Namespace:: pre (Type& n) { String ns (ctx_.ns_name (n)); @@ -1173,7 +1173,7 @@ namespace CXX } while (true); } - Void Namespace:: + void Namespace:: post (Type& n) { String ns (ctx_.ns_name (n)); @@ -1214,14 +1214,14 @@ namespace CXX // LiteralValue // - Void LiteralValue:: + void LiteralValue:: 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 @@ -1230,15 +1230,15 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: 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; @@ -1262,21 +1262,21 @@ namespace CXX s.resize (j); } - Void LiteralValue:: + void LiteralValue:: 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') { @@ -1298,7 +1298,7 @@ namespace CXX s.resize (j); } - Void LiteralValue:: + void LiteralValue:: make_float (String& s) { if (s.find ('.') == String::npos && @@ -1308,7 +1308,7 @@ namespace CXX } LiteralValue:: - LiteralValue (Context& c, Boolean str) + LiteralValue (Context& c, bool str) : Context (c), str_ (str) { } @@ -1322,7 +1322,7 @@ namespace CXX return literal_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::AnySimpleType&) { if (str_) @@ -1331,7 +1331,7 @@ namespace CXX // Boolean. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Boolean&) { collapse (value_); @@ -1340,7 +1340,7 @@ namespace CXX // Integral types. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Byte&) { collapse (value_); @@ -1348,7 +1348,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedByte&) { collapse (value_); @@ -1356,7 +1356,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Short&) { collapse (value_); @@ -1364,7 +1364,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedShort&) { collapse (value_); @@ -1372,7 +1372,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Int&) { collapse (value_); @@ -1380,7 +1380,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedInt&) { collapse (value_); @@ -1388,7 +1388,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Long&) { collapse (value_); @@ -1397,7 +1397,7 @@ namespace CXX literal_ += long_long ? L"LL" : L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedLong&) { collapse (value_); @@ -1406,7 +1406,7 @@ namespace CXX literal_ += long_long ? L"ULL" : L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Integer&) { collapse (value_); @@ -1414,7 +1414,7 @@ namespace CXX literal_ = value_ + L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { collapse (value_); @@ -1422,7 +1422,7 @@ namespace CXX literal_ = value_ + L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { collapse (value_); @@ -1430,7 +1430,7 @@ namespace CXX literal_ = value_ + L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::PositiveInteger&) { collapse (value_); @@ -1438,7 +1438,7 @@ namespace CXX literal_ = value_ + L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NegativeInteger&) { collapse (value_); @@ -1448,7 +1448,7 @@ namespace CXX // Floats. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Float&) { collapse (value_); @@ -1473,7 +1473,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Double&) { collapse (value_); @@ -1498,7 +1498,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Decimal&) { collapse (value_); @@ -1509,14 +1509,14 @@ namespace CXX // Strings. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::String&) { if (str_) literal_ = strlit (value_); } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NormalizedString&) { if (str_) @@ -1526,7 +1526,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Token&) { if (str_) @@ -1536,7 +1536,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NameToken&) { if (str_) @@ -1546,7 +1546,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Name&) { if (str_) @@ -1556,7 +1556,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NCName&) { if (str_) @@ -1566,7 +1566,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Language&) { if (str_) @@ -1579,7 +1579,7 @@ namespace CXX // ID/IDREF. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Id&) { if (str_) @@ -1589,7 +1589,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::IdRef&) { if (str_) @@ -1601,7 +1601,7 @@ namespace CXX // URI. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::AnyURI&) { if (str_) @@ -1613,7 +1613,7 @@ namespace CXX // Entity. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Entity&) { if (str_) diff --git a/xsde/cxx/elements.hxx b/xsde/cxx/elements.hxx index 5dbb1cd..fb73960 100644 --- a/xsde/cxx/elements.hxx +++ b/xsde/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/map.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> - #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> @@ -26,8 +24,6 @@ namespace CXX { using std::endl; - typedef WideString String; - // On some platforms std::toupper can be something other than a // function with C++ linkage. @@ -41,7 +37,7 @@ namespace CXX struct UnrepresentableCharacter { - UnrepresentableCharacter (String const& str, Size pos) + UnrepresentableCharacter (String const& str, size_t pos) : str_ (str), pos_ (pos) { } @@ -52,7 +48,7 @@ namespace CXX return str_; } - Size + size_t position () const { return pos_; @@ -60,14 +56,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), @@ -82,13 +78,13 @@ namespace CXX return file_; } - UnsignedLong + size_t line () const { return line_; } - UnsignedLong + size_t column () const { return column_; @@ -102,8 +98,8 @@ namespace CXX private: SemanticGraph::Path file_; - UnsignedLong line_; - UnsignedLong column_; + size_t line_; + size_t column_; String ns_; }; @@ -140,12 +136,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; @@ -154,7 +150,7 @@ namespace CXX SemanticGraph::Schema& root, SemanticGraph::Path const& path, options_type const&, - Char const* name_key, + char const* name_key, NarrowString const& char_type); protected: @@ -224,11 +220,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. // @@ -275,7 +271,7 @@ namespace CXX // Fully-qualified C++ name. // String - fq_name (SemanticGraph::Nameable& n, Char const* name_key = 0) const; + fq_name (SemanticGraph::Nameable& n, char const* name_key = 0) const; public: static SemanticGraph::Type& @@ -286,7 +282,7 @@ namespace CXX process_include_path (String const&) const; public: - static Boolean + static bool anonymous (SemanticGraph::Type& t) { return t.context ().count ("anonymous"); @@ -331,8 +327,8 @@ namespace CXX String& inst_exp; String& inl; - Boolean custom_alloc; - Boolean long_long; + bool custom_alloc; + bool long_long; public: MappingCache& ns_mapping_cache; @@ -374,16 +370,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; @@ -394,16 +390,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; @@ -426,7 +422,7 @@ namespace CXX } private: - Cult::Containers::Set<SemanticGraph::Schema*> schemas_; + std::set<SemanticGraph::Schema*> schemas_; }; // Usual namespace mapping. @@ -438,10 +434,10 @@ namespace CXX virtual ~ScopeTracker () {} - virtual Void + virtual void enter (String const&) = 0; - virtual Void + virtual void leave () = 0; }; @@ -456,10 +452,10 @@ namespace CXX { } - virtual Void + virtual void pre (Type&); - virtual Void + virtual void post (Type&); private: @@ -473,30 +469,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 ()); @@ -509,12 +505,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 ()), @@ -534,7 +530,7 @@ namespace CXX // Specialization for Complex // template <typename X> - Boolean + bool has_particle (SemanticGraph::Complex& c) { return c.contains_compositor_p () && @@ -553,61 +549,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); @@ -651,127 +647,127 @@ namespace CXX Context { - LiteralValue (Context&, Boolean str); + LiteralValue (Context&, bool str); String dispatch (SemanticGraph::Node& type, String const& value); - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&); // 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&); // 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::Name&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&); // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&); // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&); // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&); public: - static Void + static void normalize (String&); - static Void + static void collapse (String&); - static Void + static void strip_zeros (String&); - static Void + static void make_float (String&); private: - Boolean str_; + bool str_; String value_; String literal_; }; diff --git a/xsde/cxx/hybrid/aggregate-elements.hxx b/xsde/cxx/hybrid/aggregate-elements.hxx index a7ac9c7..c73696e 100644 --- a/xsde/cxx/hybrid/aggregate-elements.hxx +++ b/xsde/cxx/hybrid/aggregate-elements.hxx @@ -6,7 +6,7 @@ #ifndef CXX_HYBRID_AGGREGATE_ELEMENTS_HXX #define CXX_HYBRID_AGGREGATE_ELEMENTS_HXX -#include <cult/containers/map.hxx> +#include <map> #include <cxx/hybrid/elements.hxx> @@ -14,9 +14,7 @@ namespace CXX { namespace Hybrid { - typedef - Cult::Containers::Map<SemanticGraph::Type*, String> - TypeInstanceMap; + typedef std::map<SemanticGraph::Type*, String> TypeInstanceMap; struct InstanceInfo { @@ -24,7 +22,7 @@ namespace CXX String name; }; - typedef Cult::Containers::Map<String, InstanceInfo> TypeIdInstanceMap; + typedef std::map<String, InstanceInfo> TypeIdInstanceMap; } } diff --git a/xsde/cxx/hybrid/aggregate-include.hxx b/xsde/cxx/hybrid/aggregate-include.hxx index 03a5198..01ec3c9 100644 --- a/xsde/cxx/hybrid/aggregate-include.hxx +++ b/xsde/cxx/hybrid/aggregate-include.hxx @@ -6,7 +6,7 @@ #ifndef CXX_HYBRID_AGGREGATE_INCLUDE_HXX #define CXX_HYBRID_AGGREGATE_INCLUDE_HXX -#include <cult/containers/set.hxx> +#include <set> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> @@ -31,7 +31,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -71,7 +71,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (types_.find (&t) != types_.end ()) @@ -83,7 +83,7 @@ namespace CXX collect (t); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (types_.find (&c) != types_.end ()) @@ -104,7 +104,7 @@ namespace CXX } private: - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -120,7 +120,7 @@ namespace CXX } } - virtual Void + virtual void emit (SemanticGraph::Type& t) { using SemanticGraph::Schema; @@ -173,8 +173,8 @@ namespace CXX } private: - Cult::Containers::Set<SemanticGraph::Type*> types_; - Cult::Containers::Set<SemanticGraph::Schema*> schemas_; + std::set<SemanticGraph::Type*> types_; + std::set<SemanticGraph::Schema*> schemas_; BaseInclude base_; Traversal::Inherits inherits_; @@ -194,19 +194,19 @@ namespace CXX Traversal::Element, Context { - AggregateInclude (Context& c, Char const* key) + AggregateInclude (Context& c, char const* key) : Context (c), key_ (key), type_include_ (c) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.context ().count (key_)) type_include_.dispatch (t); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.context ().count (key_)) @@ -214,7 +214,7 @@ namespace CXX } private: - Char const* key_; + char const* key_; TypeInclude type_include_; }; } diff --git a/xsde/cxx/hybrid/default-value.cxx b/xsde/cxx/hybrid/default-value.cxx index d6287a8..f45ff4b 100644 --- a/xsde/cxx/hybrid/default-value.cxx +++ b/xsde/cxx/hybrid/default-value.cxx @@ -24,18 +24,18 @@ 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) { SemanticGraph::Type& t (l.argumented ().type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); LiteralValue::collapse (value_); @@ -45,9 +45,9 @@ namespace CXX String ov (value_); String om (member_); - 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); @@ -146,7 +146,7 @@ namespace CXX value_ = ov; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Union& u) { String const& value (u.context ().get<String> ("value")); @@ -178,13 +178,13 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Complex& c) { Traversal::NodeBase::dispatch (ultimate_base (c)); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Enumeration& e) { using SemanticGraph::Enumerator; @@ -215,7 +215,7 @@ namespace CXX // String const& vt (e.context ().get<String> ("value-type")); - Size n (0); + size_t n (0); { Enumeration const& tmp (x); for (Enumeration::NamesConstIterator i (tmp.names_begin ()); @@ -233,7 +233,7 @@ namespace CXX os << ");"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Type& t) { // This is a fall-back case where we handle all other (literal) @@ -245,7 +245,7 @@ namespace CXX // anySimpleType. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::AnySimpleType& t) { string_type (t); @@ -253,49 +253,49 @@ namespace CXX // Strings. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::String& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NormalizedString& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Token& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameToken& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameTokens&) { string_sequence_type (); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Name& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NCName& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Language& t) { string_type (t); @@ -303,13 +303,13 @@ namespace CXX // Qualified name. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::QName&) { // Newer version of the XSD frontend provide resolved values // in the form <namespace>#<qname>. // - Size p (value_.rfind ('#')); + size_t p (value_.rfind ('#')); if (p != String::npos) value_ = String (value_, p + 1, value_.size () - p - 1); @@ -348,19 +348,19 @@ namespace CXX // ID/IDREF. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Id& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRef& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRefs&) { string_sequence_type (); @@ -368,7 +368,7 @@ namespace CXX // URI. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::AnyURI& t) { string_type (t); @@ -376,7 +376,7 @@ namespace CXX // Binary. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Base64Binary&) { LiteralValue::collapse (value_); @@ -386,7 +386,7 @@ namespace CXX << endl; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::HexBinary&) { LiteralValue::collapse (value_); @@ -399,15 +399,15 @@ namespace CXX // Date/time. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Date&) { // date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM] // LiteralValue::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; @@ -427,15 +427,15 @@ namespace CXX time_zone (b + 2); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::DateTime&) { // date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM] // LiteralValue::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; @@ -454,7 +454,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; @@ -482,12 +482,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') @@ -498,14 +498,14 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Duration&) { // duration := [-]P[nY][nM][nD][TnHnMn[.n+]S] // LiteralValue::collapse (value_); - Size b (1), e, n (value_.size ()); + size_t b (1), e, n (value_.size ()); if (value_[0] == '-') { @@ -583,7 +583,7 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Day&) { // gday := ---DD[Z|(+|-)HH:MM] @@ -598,7 +598,7 @@ namespace CXX time_zone (5); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Month&) { // gmonth := --MM[Z|(+|-)HH:MM] @@ -613,7 +613,7 @@ namespace CXX time_zone (4); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::MonthDay&) { // gmonth_day := --MM-DD[Z|(+|-)HH:MM] @@ -632,17 +632,17 @@ namespace CXX time_zone (7); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Year&) { // gyear := [-]CCYY[N]*[Z|(+|-)HH:MM] // LiteralValue::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; @@ -656,14 +656,14 @@ namespace CXX time_zone (pos); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::YearMonth&) { // gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM] // LiteralValue::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); @@ -677,7 +677,7 @@ namespace CXX time_zone (pos + 3); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Time&) { // time := HH:MM:SS[.S+][Z|(+|-)HH:MM] @@ -687,10 +687,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; @@ -710,8 +710,8 @@ namespace CXX time_zone (e); } - Void InitValue:: - time_zone (Size pos) + void InitValue:: + time_zone (size_t pos) { // time_zone := Z|(+|-)HH:MM // @@ -746,19 +746,19 @@ namespace CXX // Entity. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entity& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entities&) { string_sequence_type (); } - Void InitValue:: + void InitValue:: string_type (SemanticGraph::Type& t) { // In case STL is disabled, strings are returned as literals @@ -795,7 +795,7 @@ namespace CXX } } - Void InitValue:: + void InitValue:: string_sequence_type () { LiteralValue::collapse (value_); @@ -803,9 +803,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); @@ -856,7 +856,7 @@ namespace CXX { } - Void CompareValue:: + void CompareValue:: dispatch (SemanticGraph::Node& type, String const& lhs, String const& rhs) { lhs_ = &lhs; @@ -864,7 +864,7 @@ namespace CXX Traversal::NodeBase::dispatch (type); } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Union& u) { String const& value (u.context ().get<String> ("value")); @@ -873,13 +873,13 @@ namespace CXX " ()"; } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Complex& c) { Traversal::NodeBase::dispatch (ultimate_base (c)); } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Enumeration& e) { // First see if we should delegate this one to the Complex @@ -894,7 +894,7 @@ namespace CXX os << *lhs_ << " == " << *rhs_; } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Type&) { // This is a fall-back case where we handle all other types. diff --git a/xsde/cxx/hybrid/default-value.hxx b/xsde/cxx/hybrid/default-value.hxx index 2a806bd..562279b 100644 --- a/xsde/cxx/hybrid/default-value.hxx +++ b/xsde/cxx/hybrid/default-value.hxx @@ -60,130 +60,130 @@ namespace CXX { InitValue (Context&); - 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&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Type& t); // anySimpleType. // - 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_type (SemanticGraph::Type&); - Void + void string_sequence_type (); - Void - time_zone (Size pos); + void + time_zone (size_t pos); private: String member_; @@ -202,21 +202,21 @@ namespace CXX { CompareValue (Context&); - Void + void dispatch (SemanticGraph::Node& type, String const& lhs, String const& rhs); - virtual Void + virtual void traverse (SemanticGraph::Union&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Type& t); private: diff --git a/xsde/cxx/hybrid/elements.cxx b/xsde/cxx/hybrid/elements.cxx index 9356b66..fe1e533 100644 --- a/xsde/cxx/hybrid/elements.cxx +++ b/xsde/cxx/hybrid/elements.cxx @@ -350,7 +350,7 @@ namespace CXX // // String Context:: - scope (SemanticGraph::Compositor& c, Boolean fq) const + scope (SemanticGraph::Compositor& c, bool fq) const { using namespace SemanticGraph; @@ -403,7 +403,7 @@ namespace CXX } String Context:: - scope (SemanticGraph::Element& e, Boolean fq) const + scope (SemanticGraph::Element& e, bool fq) const { SemanticGraph::Compositor& c (e.contained_particle ().compositor ()); @@ -414,7 +414,7 @@ namespace CXX } String Context:: - scope (SemanticGraph::Attribute& a, Boolean fq) const + scope (SemanticGraph::Attribute& a, bool fq) const { using SemanticGraph::Complex; @@ -425,7 +425,7 @@ namespace CXX : ename_custom (t); } - Boolean Context:: + bool Context:: recursive_base (SemanticGraph::Complex& c) { using namespace SemanticGraph; @@ -443,17 +443,17 @@ namespace CXX return false; } - Void Context:: + void Context:: close_ns () { - for (Size i (0), n (ns_stack.size () - 1); i < n; ++i) + for (size_t i (0), n (ns_stack.size () - 1); i < n; ++i) os << "}"; } - Void Context:: + void Context:: open_ns () { - for (NamespaceStack::Iterator i (ns_stack.begin () + 1); + for (NamespaceStack::iterator i (ns_stack.begin () + 1); i != ns_stack.end (); ++i) { @@ -484,11 +484,11 @@ namespace CXX return os; } - Boolean Context:: + bool Context:: enum_mapping (SemanticGraph::Enumeration& e, SemanticGraph::Enumeration** base) { - Boolean gen (false); + bool gen (false); StringBasedType t (gen); t.dispatch (e); @@ -515,18 +515,18 @@ namespace CXX // Namespace // Namespace:: - Namespace (Context& c, Boolean track_scope) + Namespace (Context& c, bool track_scope) : CXX::Namespace (c, track_scope ? this : 0), ctx_ (c) { } - Void Namespace:: + void Namespace:: enter (String const& name) { ctx_.ns_stack.push_back (name); } - Void Namespace:: + void Namespace:: leave () { ctx_.ns_stack.pop_back (); @@ -534,7 +534,7 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { SemanticGraph::Context& ctx (t.context ()); @@ -558,7 +558,7 @@ namespace CXX os << "class " << ename (t) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type @@ -566,7 +566,7 @@ namespace CXX // Type t (type_); SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (t == header || t == impl_header)) { diff --git a/xsde/cxx/hybrid/elements.hxx b/xsde/cxx/hybrid/elements.hxx index f4b00e8..a1fb22e 100644 --- a/xsde/cxx/hybrid/elements.hxx +++ b/xsde/cxx/hybrid/elements.hxx @@ -6,12 +6,11 @@ #ifndef CXX_HYBRID_ELEMENTS_HXX #define CXX_HYBRID_ELEMENTS_HXX +#include <deque> #include <sstream> #include <cutl/re.hxx> -#include <cult/containers/deque.hxx> - #include <cxx/elements.hxx> #include <cxx/hybrid/options.hxx> @@ -253,10 +252,10 @@ namespace CXX return c.context ().get<String> ("arm-tag"); } - static UnsignedLong const& + static size_t const& arm_tag_count (SemanticGraph::Choice& c) { - return c.context ().get<UnsignedLong> ("arm-tag-count"); + return c.context ().get<size_t> ("arm-tag-count"); } static String const& @@ -515,16 +514,16 @@ namespace CXX private: String - scope (SemanticGraph::Compositor&, Boolean fq) const; + scope (SemanticGraph::Compositor&, bool fq) const; String - scope (SemanticGraph::Element&, Boolean fq) const; + scope (SemanticGraph::Element&, bool fq) const; String - scope (SemanticGraph::Attribute&, Boolean fq) const; + scope (SemanticGraph::Attribute&, bool fq) const; public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -539,31 +538,31 @@ namespace CXX } public: - static Boolean + static bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get<Boolean> ("fixed"); + return t.context ().get<bool> ("fixed"); } - static Boolean + static bool fixed_length (SemanticGraph::Compositor& c) { - return c.context ().get<Boolean> ("fixed"); + return c.context ().get<bool> ("fixed"); } - static Boolean + static bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); } - static Boolean + static bool polymorphic (SemanticGraph::Type& t) { return t.context ().count ("polymorphic"); } - static Boolean + static bool recursive_base (SemanticGraph::Complex& c); public: @@ -574,38 +573,36 @@ namespace CXX ostream (NarrowString const& os) const; public: - Void + void close_ns (); - Void + void open_ns (); public: // Determine whether we are generating the enum mapping for this // enumeration. Also optionally return the base enum. // - static Boolean + static bool enum_mapping (SemanticGraph::Enumeration& e, SemanticGraph::Enumeration** base = 0); public: - typedef - Cult::Containers::Deque<String> - NamespaceStack; + typedef std::deque<String> NamespaceStack; public: options_type const& options; - Boolean exceptions; - Boolean stl; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean clone; - Boolean detach; - Boolean typeinfo; - Boolean mixin; - Boolean tiein; - Boolean enum_; + bool exceptions; + bool stl; + bool poly_code; + bool poly_runtime; + bool reset; + bool clone; + bool detach; + bool typeinfo; + bool mixin; + bool tiein; + bool enum_; Regex const* fwd_expr; Regex const* hxx_expr; @@ -646,13 +643,13 @@ namespace CXX // struct Namespace: CXX::Namespace, CXX::Namespace::ScopeTracker { - Namespace (Context&, Boolean track_scope = false); + Namespace (Context&, bool track_scope = false); protected: - virtual Void + virtual void enter (String const& name); - virtual Void + virtual void leave (); protected: @@ -682,86 +679,86 @@ namespace CXX Traversal::Fundamental::Decimal { - FundamentalType (Boolean& result) + FundamentalType (bool& result) : r_ (result) { } // 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; @@ -769,7 +766,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { r_ = true; @@ -777,26 +774,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_; }; // @@ -815,85 +812,85 @@ namespace CXX Traversal::Fundamental::AnyURI, Traversal::Fundamental::Entity { - StringType (Boolean& result) + StringType (bool& result) : r_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { r_ = true; } - 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; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { r_ = true; } private: - Boolean& r_; + bool& r_; }; // Check whether this is a string-based type (excluding ID, IDFER, @@ -908,13 +905,13 @@ namespace CXX Traversal::Fundamental::NCName, Traversal::Fundamental::Language { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -922,50 +919,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_; }; @@ -984,7 +981,7 @@ namespace CXX inherits_ >> enum_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -999,7 +996,7 @@ namespace CXX *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (Type& e) { e_ = &e; @@ -1097,7 +1094,7 @@ namespace CXX xs_ns_ = xs_ns_name (); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type (t); @@ -1105,13 +1102,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { if (stl || use_ != base) @@ -1122,7 +1119,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { if (use_ != base) @@ -1133,7 +1130,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { if (use_ != base) @@ -1142,7 +1139,7 @@ namespace CXX os << xs_ns_ << "::byte_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { if (use_ != base) @@ -1151,7 +1148,7 @@ namespace CXX os << xs_ns_ << "::unsigned_byte_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { if (use_ != base) @@ -1160,7 +1157,7 @@ namespace CXX os << xs_ns_ << "::short_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { if (use_ != base) @@ -1169,7 +1166,7 @@ namespace CXX os << xs_ns_ << "::unsigned_short_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { if (use_ != base) @@ -1178,7 +1175,7 @@ namespace CXX os << xs_ns_ << "::int_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { if (use_ != base) @@ -1187,7 +1184,7 @@ namespace CXX os << xs_ns_ << "::unsigned_int_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { if (use_ != base) @@ -1201,7 +1198,7 @@ namespace CXX os << xs_ns_ << "::long_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { if (use_ != base) @@ -1215,7 +1212,7 @@ namespace CXX os << xs_ns_ << "::unsigned_long_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { if (use_ != base) @@ -1224,7 +1221,7 @@ namespace CXX os << xs_ns_ << "::integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { if (use_ != base) @@ -1233,7 +1230,7 @@ namespace CXX os << xs_ns_ << "::non_positive_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { if (use_ != base) @@ -1242,7 +1239,7 @@ namespace CXX os << xs_ns_ << "::non_negative_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { if (use_ != base) @@ -1251,7 +1248,7 @@ namespace CXX os << xs_ns_ << "::positive_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { if (use_ != base) @@ -1262,7 +1259,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { if (use_ != base) @@ -1271,7 +1268,7 @@ namespace CXX os << xs_ns_ << "::float_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { if (use_ != base) @@ -1280,7 +1277,7 @@ namespace CXX os << xs_ns_ << "::double_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { if (use_ != base) @@ -1291,7 +1288,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { if (stl || use_ != base) @@ -1300,7 +1297,7 @@ namespace CXX os << xs_ns_ << "::string_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { if (stl || use_ != base) @@ -1309,7 +1306,7 @@ namespace CXX os << xs_ns_ << "::normalized_string_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { if (stl || use_ != base) @@ -1318,7 +1315,7 @@ namespace CXX os << xs_ns_ << "::token_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { if (stl || use_ != base) @@ -1327,13 +1324,13 @@ namespace CXX os << xs_ns_ << "::nmtoken_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { if (stl || use_ != base) @@ -1342,7 +1339,7 @@ namespace CXX os << xs_ns_ << "::name_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { if (stl || use_ != base) @@ -1351,7 +1348,7 @@ namespace CXX os << xs_ns_ << "::ncname_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { if (stl || use_ != base) @@ -1363,7 +1360,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { type (t); @@ -1372,7 +1369,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { if (stl || use_ != base) @@ -1381,7 +1378,7 @@ namespace CXX os << xs_ns_ << "::id_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { if (stl || use_ != base) @@ -1390,7 +1387,7 @@ namespace CXX os << xs_ns_ << "::idref_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { type (t); @@ -1398,7 +1395,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { if (stl || use_ != base) @@ -1409,13 +1406,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { type (t); @@ -1424,55 +1421,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { type (t); @@ -1480,7 +1477,7 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { if (stl || use_ != base) @@ -1489,14 +1486,14 @@ namespace CXX os << xs_ns_ << "::entity_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { type (t); } private: - Void + void type (SemanticGraph::Type& t) { String fq (fq_name (t)); @@ -1550,8 +1547,8 @@ namespace CXX } } - Void - fund_type (Char const* name) + void + fund_type (char const* name) { switch (use_) { @@ -1573,7 +1570,7 @@ namespace CXX } } - Void + void string_type () { switch (use_) @@ -1688,7 +1685,7 @@ namespace CXX Traversal::Fundamental::Entity, Traversal::Fundamental::Entities { - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type (t); @@ -1696,13 +1693,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { string_type (t); @@ -1710,7 +1707,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t); @@ -1718,79 +1715,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fund_type (t); @@ -1798,19 +1795,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { fund_type (t); @@ -1818,49 +1815,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { string_type (t); @@ -1868,7 +1865,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { type (t); @@ -1876,19 +1873,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { type (t); @@ -1896,7 +1893,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { string_type (t); @@ -1904,13 +1901,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { type (t); @@ -1918,55 +1915,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { type (t); @@ -1974,26 +1971,26 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { type (t); } protected: - virtual Void + virtual void type (SemanticGraph::Type&) = 0; - virtual Void + virtual void fund_type (SemanticGraph::Type&) = 0; - virtual Void + virtual void string_type (SemanticGraph::Type&) = 0; }; @@ -2005,19 +2002,19 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { if (!fixed_length (t)) os << "*"; } - virtual Void + virtual void fund_type (SemanticGraph::Type&) { } - virtual Void + virtual void string_type (SemanticGraph::Type&) { } @@ -2030,7 +2027,7 @@ namespace CXX { } - Void + void dispatch (SemanticGraph::Node& type, String const& var) { var_ = var; @@ -2038,7 +2035,7 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { if (!custom_alloc) @@ -2054,13 +2051,13 @@ namespace CXX } } - virtual Void + virtual void fund_type (SemanticGraph::Type& t) { type (t); } - virtual Void + virtual void string_type (SemanticGraph::Type& t) { if (stl) @@ -2089,7 +2086,7 @@ namespace CXX // Copy member from 'this' to 'c'. // - Void + void dispatch (SemanticGraph::Node& type, SemanticGraph::Member& member) { member_ = &member; @@ -2097,7 +2094,7 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { String const& name (ename (*member_)); @@ -2115,13 +2112,13 @@ namespace CXX << "}"; } - virtual Void + virtual void fund_type (SemanticGraph::Type& t) { type (t); } - virtual Void + virtual void string_type (SemanticGraph::Type&) { // We can only get here if STL is disabled. @@ -2154,7 +2151,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); }; @@ -2181,26 +2178,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_; Regex const* regex_; Traversal::Schema schema_; @@ -2214,19 +2211,19 @@ namespace CXX // struct AggregateTest: Traversal::Type, Traversal::Element { - AggregateTest (Boolean& generate, Char const* key) + AggregateTest (bool& generate, char const* key) : gen_ (generate), key_ (key) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (!gen_ && t.context ().count (key_)) gen_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!gen_ && e.context ().count (key_)) @@ -2234,8 +2231,8 @@ namespace CXX } private: - Boolean& gen_; - Char const* key_; + bool& gen_; + char const* key_; }; } } diff --git a/xsde/cxx/hybrid/extraction-header.cxx b/xsde/cxx/hybrid/extraction-header.cxx index 25b4b43..3ec42d1 100644 --- a/xsde/cxx/hybrid/extraction-header.cxx +++ b/xsde/cxx/hybrid/extraction-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -62,7 +62,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -91,7 +91,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -124,7 +124,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -149,12 +149,12 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -179,18 +179,18 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Sequence: Traversal::Sequence, Context { - Sequence (Context& c, Boolean in_choice) + Sequence (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -215,7 +215,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Complex : Traversal::Complex, Context @@ -245,7 +245,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -285,7 +285,7 @@ namespace CXX }; } - Void + void generate_extraction_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/extraction-header.hxx b/xsde/cxx/hybrid/extraction-header.hxx index d6e1af3..1670f64 100644 --- a/xsde/cxx/hybrid/extraction-header.hxx +++ b/xsde/cxx/hybrid/extraction-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_extraction_header (Context&); } } diff --git a/xsde/cxx/hybrid/extraction-source.cxx b/xsde/cxx/hybrid/extraction-source.cxx index 413ffdc..cfdaf56 100644 --- a/xsde/cxx/hybrid/extraction-source.cxx +++ b/xsde/cxx/hybrid/extraction-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -75,7 +75,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -113,7 +113,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -159,7 +159,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Nothing is serialized for fixed attributes. @@ -169,8 +169,8 @@ namespace CXX SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); String const& name (ename (a)); @@ -309,7 +309,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { // See also ChoiceParticleData. @@ -328,8 +328,8 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); if (!fl) { @@ -434,7 +434,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -442,7 +442,7 @@ namespace CXX // if (a.min () == 0) { - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String const& name (ename (a)); String const& present (epresent (a)); @@ -524,7 +524,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << scope (e) << "::" << etag (e) << ":" @@ -546,8 +546,8 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); if (!fl) { @@ -643,7 +643,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { os << "case " << scope (c) << "::" << etag (c) << ":" @@ -665,7 +665,7 @@ namespace CXX } else { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); if (c.min () == 0) { @@ -747,7 +747,7 @@ namespace CXX contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -762,7 +762,7 @@ namespace CXX } else if (c.min () == 0) { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& name (ename (c)); String const& present (epresent (c)); @@ -870,7 +870,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -885,7 +885,7 @@ namespace CXX } else if (s.min () == 0) { - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); String const& name (ename (s)); String const& present (epresent (s)); @@ -969,7 +969,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1005,13 +1005,13 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_data_ (c) { contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -1060,7 +1060,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticleData particle_data_; Traversal::ContainsParticle contains_data_; @@ -1070,7 +1070,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_data) : Context (c), in_choice_ (in_choice), @@ -1078,7 +1078,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1111,7 +1111,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_data_; }; @@ -1175,7 +1175,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -1186,7 +1186,7 @@ namespace CXX if (!name) return; - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); for (NarrowStrings::const_iterator i (istreams.begin ()); i != istreams.end (); ++i) @@ -1203,7 +1203,7 @@ namespace CXX { SemanticGraph::Type& b (c.inherits ().base ()); - Boolean c_str (false); + bool c_str (false); if (!stl) { @@ -1291,7 +1291,7 @@ namespace CXX }; } - Void + void generate_extraction_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/extraction-source.hxx b/xsde/cxx/hybrid/extraction-source.hxx index 363f5c1..0d28daa 100644 --- a/xsde/cxx/hybrid/extraction-source.hxx +++ b/xsde/cxx/hybrid/extraction-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_extraction_source (Context&); } } diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx index c2289ae..eac7cf0 100644 --- a/xsde/cxx/hybrid/generator.cxx +++ b/xsde/cxx/hybrid/generator.cxx @@ -10,9 +10,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> @@ -75,7 +72,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/e, an XML Schema\n" @@ -96,7 +93,7 @@ namespace CXX "//\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/e, an XML Schema to\n" @@ -107,7 +104,7 @@ namespace CXX "//\n\n"; } - Void Hybrid::Generator:: + void Hybrid::Generator:: usage () { CXX::Hybrid::options::print_usage (wcout); @@ -125,12 +122,12 @@ namespace CXX sloc_filter; NarrowString - find_value (NarrowStrings const& v, Char const* key) + find_value (NarrowStrings const& v, char const* key) { for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ()); i != e; ++i) { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -161,15 +158,15 @@ namespace CXX return NarrowString (); } - Void - copy_values (NarrowStrings& dst, NarrowStrings const& src, Char const* key) + void + copy_values (NarrowStrings& dst, NarrowStrings const& src, char const* key) { dst.clear (); for (NarrowStrings::const_iterator i (src.begin ()), e (src.end ()); i != e; ++i) { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -201,7 +198,7 @@ namespace CXX struct FundNamespace: Namespace, Hybrid::Context { - FundNamespace (Hybrid::Context& c, Char type) + FundNamespace (Hybrid::Context& c, char type) : Namespace (c), Hybrid::Context (c), type_ (type) { } @@ -214,7 +211,7 @@ namespace CXX os << "using ::xsde::cxx::hybrid::any_type;" << endl; - Boolean us, ui; + bool us, ui; String skel, impl; if (type_ == 'p') @@ -250,7 +247,7 @@ namespace CXX } private: - Char type_; + char type_; }; } @@ -271,7 +268,7 @@ namespace CXX r->skel_type_suffix (h.pskel_type_suffix ()); r->impl_type_suffix (h.pimpl_type_suffix ()); - Char const* k = "pskel"; + char const* k = "pskel"; r->hxx_regex (find_value (h.hxx_regex (), k)); r->ixx_regex (find_value (h.ixx_regex (), k)); @@ -337,7 +334,7 @@ namespace CXX r->skel_type_suffix (h.sskel_type_suffix ()); r->impl_type_suffix (h.simpl_type_suffix ()); - Char const* k = "pskel"; + char const* k = "pskel"; r->hxx_regex (find_value (h.hxx_regex (), k)); r->ixx_regex (find_value (h.ixx_regex (), k)); @@ -386,7 +383,7 @@ namespace CXX return r; } - Void Hybrid::Generator:: + void Hybrid::Generator:: calculate_size (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file, @@ -400,7 +397,7 @@ namespace CXX throw Failed (); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_tree_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -409,7 +406,7 @@ namespace CXX proc.process (ops, schema, file, false); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_parser_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -419,7 +416,7 @@ namespace CXX throw Failed (); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_serializer_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -432,7 +429,7 @@ namespace CXX namespace { template <typename S> - Void + void open (S& ifs, NarrowString const& path) { try @@ -457,7 +454,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -477,19 +474,19 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def, - Char const* primary_key, - Char const* def_key) + char const* primary_key, + char const* def_key) { for (NarrowStrings const* v = &primary; v != 0; v = (v == &def ? 0 : &def)) { - Boolean found (false); - Char const* key (v == &primary ? primary_key : def_key); + bool found (false); + char const* key (v == &primary ? primary_key : def_key); for (NarrowStrings::const_iterator i (v->begin ()), e (v->end ()); i != e; ++i) @@ -498,7 +495,7 @@ namespace CXX os << i->c_str () << endl; else { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -535,22 +532,21 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def, - Char const* key) + char const* key) { append (os, primary, def, key, key); } } - - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_tree (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet& disabled_warnings, TypeMap::Namespaces& parser_type_map, TypeMap::Namespaces& serializer_type_map, @@ -562,7 +558,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 @@ -595,9 +591,9 @@ namespace CXX // Generate code. // - 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); NarrowString name (file_path.leaf ()); @@ -769,7 +765,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); if (forward) @@ -806,7 +802,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1288,11 +1284,11 @@ namespace CXX } } - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_parser (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet&, FileList& file_list, AutoUnlinks& unlinks) @@ -1303,7 +1299,7 @@ namespace CXX try { { - Boolean gen_xml_schema (ops.generate_xml_schema ()); + bool gen_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 @@ -1450,7 +1446,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -1479,7 +1475,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1493,7 +1489,7 @@ namespace CXX if (guard_prefix) guard_prefix += '_'; - Boolean aggr (ops.generate_aggregate ()); + bool aggr (ops.generate_aggregate ()); // HXX // @@ -1674,11 +1670,11 @@ namespace CXX } } - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_serializer (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet&, FileList& file_list, AutoUnlinks& unlinks) @@ -1689,7 +1685,7 @@ namespace CXX try { { - Boolean gen_xml_schema (ops.generate_xml_schema ()); + bool gen_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 @@ -1836,7 +1832,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -1865,7 +1861,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1879,7 +1875,7 @@ namespace CXX if (guard_prefix) guard_prefix += '_'; - Boolean aggr (ops.generate_aggregate ()); + bool aggr (ops.generate_aggregate ()); // HXX // diff --git a/xsde/cxx/hybrid/generator.hxx b/xsde/cxx/hybrid/generator.hxx index cbef109..131c241 100644 --- a/xsde/cxx/hybrid/generator.hxx +++ b/xsde/cxx/hybrid/generator.hxx @@ -8,14 +8,11 @@ #include <memory> // std::auto_ptr -#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 <xsde.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> #include <cxx/parser/options.hxx> @@ -26,14 +23,12 @@ namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class Generator { public: struct Failed {}; - static Void + static void usage (); static std::auto_ptr<Parser::options> @@ -48,7 +43,7 @@ namespace CXX // Calculate type sizes. // - static Void + static void calculate_size ( options const&, XSDFrontend::SemanticGraph::Schema&, @@ -57,19 +52,19 @@ namespace CXX // Assign names to global declarations. // - static Void + static void process_tree_names ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); - static Void + static void process_parser_names ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); - static Void + static void process_serializer_names ( options const&, XSDFrontend::SemanticGraph::Schema&, @@ -77,34 +72,34 @@ namespace CXX // Generate code. // - static UnsignedLong + static size_t generate_tree ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, TypeMap::Namespaces& parser_type_map, TypeMap::Namespaces& serializer_type_map, FileList&, AutoUnlinks&); - static UnsignedLong + static size_t generate_parser ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, FileList&, AutoUnlinks&); - static UnsignedLong + static size_t generate_serializer ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/hybrid/insertion-header.cxx b/xsde/cxx/hybrid/insertion-header.cxx index a054d9e..8c11707 100644 --- a/xsde/cxx/hybrid/insertion-header.cxx +++ b/xsde/cxx/hybrid/insertion-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -62,7 +62,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -91,7 +91,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -124,7 +124,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -149,12 +149,12 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -179,18 +179,18 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Sequence: Traversal::Sequence, Context { - Sequence (Context& c, Boolean in_choice) + Sequence (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -215,7 +215,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Complex : Traversal::Complex, Context @@ -245,7 +245,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -285,7 +285,7 @@ namespace CXX }; } - Void + void generate_insertion_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/insertion-header.hxx b/xsde/cxx/hybrid/insertion-header.hxx index b3ecc83..487de93 100644 --- a/xsde/cxx/hybrid/insertion-header.hxx +++ b/xsde/cxx/hybrid/insertion-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_insertion_header (Context&); } } diff --git a/xsde/cxx/hybrid/insertion-source.cxx b/xsde/cxx/hybrid/insertion-source.cxx index d579964..4002384 100644 --- a/xsde/cxx/hybrid/insertion-source.cxx +++ b/xsde/cxx/hybrid/insertion-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -66,7 +66,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -105,7 +105,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -142,7 +142,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Don't waste space on fixed attributes. @@ -203,7 +203,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1 && e.min () == 0) @@ -241,7 +241,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -283,7 +283,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << scope (e) << "::" << etag (e) << ":" @@ -295,7 +295,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { os << "case " << scope (c) << "::" << etag (c) << ":" @@ -342,7 +342,7 @@ namespace CXX contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -412,7 +412,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -464,7 +464,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -500,13 +500,13 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_data_ (c) { contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -552,7 +552,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticleData particle_data_; Traversal::ContainsParticle contains_data_; @@ -562,7 +562,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_data) : Context (c), in_choice_ (in_choice), @@ -570,7 +570,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -603,7 +603,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_data_; }; @@ -667,7 +667,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -678,7 +678,7 @@ namespace CXX if (!name) return; - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); for (NarrowStrings::const_iterator i (ostreams.begin ()); i != ostreams.end (); ++i) @@ -754,7 +754,7 @@ namespace CXX }; } - Void + void generate_insertion_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/insertion-source.hxx b/xsde/cxx/hybrid/insertion-source.hxx index 166bfee..d5da94a 100644 --- a/xsde/cxx/hybrid/insertion-source.hxx +++ b/xsde/cxx/hybrid/insertion-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_insertion_source (Context&); } } diff --git a/xsde/cxx/hybrid/options.cli b/xsde/cxx/hybrid/options.cli index 33b05b0..64ae2fd 100644 --- a/xsde/cxx/hybrid/options.cli +++ b/xsde/cxx/hybrid/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>; @@ -77,7 +75,7 @@ namespace CXX same tree or between different trees." }; - std::vector<Cult::Types::NarrowString> --generate-insertion + NarrowStrings --generate-insertion { "<os>", "Generate data representation stream insertion operators for the @@ -89,7 +87,7 @@ namespace CXX \cb{--hxx-prologue*} options to include the necessary declarations." }; - std::vector<Cult::Types::NarrowString> --generate-extraction + NarrowStrings --generate-extraction { "<is>", "Generate data representation stream extraction operators for the @@ -121,7 +119,7 @@ namespace CXX configured with polymorphism support." }; - std::vector<Cult::Types::NarrowString> --polymorphic-type + NarrowStrings --polymorphic-type { "<type>", "Indicate that <type> is a root of a polymorphic type hierarchy. The @@ -140,7 +138,7 @@ namespace CXX standard C++ RTTI mechanism to determine object's type at runtime." }; - std::vector<Cult::Types::NarrowString> --polymorphic-schema + NarrowStrings --polymorphic-schema { "<file>", "Indicate that <file> contains derivations of polymorphic types that @@ -164,7 +162,7 @@ namespace CXX // Custom data/type. // - std::vector<Cult::Types::NarrowString> --custom-data + NarrowStrings --custom-data { "<type>", "Add the ability to store custom data to the C++ class generated for @@ -173,7 +171,7 @@ namespace CXX containing the compositor, for example, \cb{foo::sequence::choise1}." }; - std::vector<Cult::Types::NarrowString> --custom-type + NarrowStrings --custom-type { "<map>", "Use a custom type implementation instead of the generated version. @@ -194,7 +192,7 @@ namespace CXX \ci{base} is specified) or instead of the generated version." }; - std::vector<Cult::Types::NarrowString> --custom-parser + NarrowStrings --custom-parser { "<map>", "Use a custom parser implementation instead of the generated version. @@ -209,7 +207,7 @@ namespace CXX generated version." }; - std::vector<Cult::Types::NarrowString> --custom-serializer + NarrowStrings --custom-serializer { "<map>", "Use a custom serializer implementation instead of the generated @@ -260,7 +258,7 @@ namespace CXX also the \cb{--generate-aggregate} option." }; - std::vector<Cult::Types::NarrowString> --root-element + NarrowStrings --root-element { "<element>", "Treat only <element> as a document root. This determines for which @@ -269,7 +267,7 @@ namespace CXX \cb{--generate-aggregate} option." }; - std::vector<Cult::Types::NarrowString> --root-type + NarrowStrings --root-type { "<type>", "Generate parser/serializer aggregate for <type>. Repeat this option @@ -279,70 +277,70 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --pskel-type-suffix = "_pskel" + NarrowString --pskel-type-suffix = "_pskel" { "<suffix>", "Use <suffix> instead of the default \cb{_pskel} to construct the names of generated parser skeletons." }; - Cult::Types::NarrowString --sskel-type-suffix = "_sskel" + NarrowString --sskel-type-suffix = "_sskel" { "<suffix>", "Use <suffix> instead of the default \cb{_sskel} to construct the names of generated serializer skeletons." }; - Cult::Types::NarrowString --pskel-file-suffix = "-pskel" + NarrowString --pskel-file-suffix = "-pskel" { "<suffix>", "Use <suffix> instead of the default \cb{-pskel} to construct the names of generated parser skeleton files." }; - Cult::Types::NarrowString --sskel-file-suffix = "-sskel" + NarrowString --sskel-file-suffix = "-sskel" { "<suffix>", "Use <suffix> instead of the default \cb{-sskel} to construct the names of generated serializer skeleton files." }; - Cult::Types::NarrowString --pimpl-type-suffix = "_pimpl" + NarrowString --pimpl-type-suffix = "_pimpl" { "<suffix>", "Use <suffix> instead of the default \cb{_pimpl} to construct the names of generated parser implementations." }; - Cult::Types::NarrowString --simpl-type-suffix = "_simpl" + NarrowString --simpl-type-suffix = "_simpl" { "<suffix>", "Use <suffix> instead of the default \cb{_simpl} to construct the names of generated serializer implementations." }; - Cult::Types::NarrowString --pimpl-file-suffix = "-pimpl" + NarrowString --pimpl-file-suffix = "-pimpl" { "<suffix>", "Use <suffix> instead of the default \cb{-pimpl} to construct the names of generated parser implementation files." }; - Cult::Types::NarrowString --simpl-file-suffix = "-simpl" + NarrowString --simpl-file-suffix = "-simpl" { "<suffix>", "Use <suffix> instead of the default \cb{-simpl} to construct the names of generated serializer implementation files." }; - Cult::Types::NarrowString --paggr-type-suffix = "_paggr" + NarrowString --paggr-type-suffix = "_paggr" { "<suffix>", "Use <suffix> instead of the default \cb{_paggr} to construct the names of generated parser aggregates." }; - Cult::Types::NarrowString --saggr-type-suffix = "_saggr" + NarrowString --saggr-type-suffix = "_saggr" { "<suffix>", "Use <suffix> instead of the default \cb{_saggr} to construct the @@ -354,18 +352,18 @@ namespace CXX // "override" them here. Note that the documentation is still // specified in the common version. // - std::vector<Cult::Types::NarrowString> --hxx-regex; - std::vector<Cult::Types::NarrowString> --ixx-regex; - std::vector<Cult::Types::NarrowString> --cxx-regex; - - std::vector<Cult::Types::NarrowString> --hxx-prologue-file; - std::vector<Cult::Types::NarrowString> --ixx-prologue-file; - std::vector<Cult::Types::NarrowString> --cxx-prologue-file; - std::vector<Cult::Types::NarrowString> --prologue-file; - std::vector<Cult::Types::NarrowString> --hxx-epilogue-file; - std::vector<Cult::Types::NarrowString> --ixx-epilogue-file; - std::vector<Cult::Types::NarrowString> --cxx-epilogue-file; - std::vector<Cult::Types::NarrowString> --epilogue-file; + NarrowStrings --hxx-regex; + NarrowStrings --ixx-regex; + NarrowStrings --cxx-regex; + + NarrowStrings --hxx-prologue-file; + NarrowStrings --ixx-prologue-file; + NarrowStrings --cxx-prologue-file; + NarrowStrings --prologue-file; + NarrowStrings --hxx-epilogue-file; + NarrowStrings --ixx-epilogue-file; + NarrowStrings --cxx-epilogue-file; + NarrowStrings --epilogue-file; }; } } diff --git a/xsde/cxx/hybrid/parser-aggregate-header.cxx b/xsde/cxx/hybrid/parser-aggregate-header.cxx index 967f1db..c75e0eb 100644 --- a/xsde/cxx/hybrid/parser-aggregate-header.cxx +++ b/xsde/cxx/hybrid/parser-aggregate-header.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> + #include <cxx/hybrid/parser-aggregate-header.hxx> #include <cxx/hybrid/aggregate-elements.hxx> #include <cxx/hybrid/aggregate-include.hxx> @@ -10,7 +12,7 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> +using namespace std; namespace CXX { @@ -18,7 +20,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Set<String> InstanceSet; + typedef set<String> InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -32,7 +34,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -44,7 +46,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -146,7 +148,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -158,7 +160,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -172,7 +174,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -196,7 +198,7 @@ namespace CXX } } - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -227,7 +229,7 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { if (fund_type (t, "any_type")) @@ -237,7 +239,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -245,7 +247,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -253,79 +255,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"); @@ -333,19 +335,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"); @@ -353,49 +355,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"); @@ -404,7 +406,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -413,19 +415,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"); @@ -433,7 +435,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -441,13 +443,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"); @@ -456,55 +458,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"); @@ -512,20 +514,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 Boolean + virtual bool fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -542,7 +544,7 @@ namespace CXX { String name (escape (raw_name + L"_p_")); - 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; @@ -584,7 +586,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -592,7 +594,7 @@ namespace CXX if (!tc.count ("paggr")) return; - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (tc.get<String> ("paggr")); String pre (unclash (name, "pre")); @@ -752,7 +754,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "p:impl") << " " << i->second << ";"; @@ -774,7 +776,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -783,7 +785,7 @@ namespace CXX return; SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (ec.get<String> ("paggr")); String pre (unclash (name, "pre")); @@ -960,7 +962,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "p:impl") << " " << i->second << ";"; @@ -977,10 +979,10 @@ namespace CXX }; } - Void + void generate_parser_aggregate_header (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/parser-aggregate-header.hxx b/xsde/cxx/hybrid/parser-aggregate-header.hxx index 0e75792..5e5cad9 100644 --- a/xsde/cxx/hybrid/parser-aggregate-header.hxx +++ b/xsde/cxx/hybrid/parser-aggregate-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_aggregate_header (Context&); } } diff --git a/xsde/cxx/hybrid/parser-aggregate-source.cxx b/xsde/cxx/hybrid/parser-aggregate-source.cxx index a1d9bf3..5c81eaa 100644 --- a/xsde/cxx/hybrid/parser-aggregate-source.cxx +++ b/xsde/cxx/hybrid/parser-aggregate-source.cxx @@ -9,7 +9,6 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> namespace CXX { @@ -23,8 +22,8 @@ namespace CXX { ParticleArg (Context& c, TypeInstanceMap& map, - Boolean& first, - Boolean poly, + bool& first, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -35,7 +34,7 @@ namespace CXX { } - ParticleArg (Context& c, Boolean& result, Boolean poly) + ParticleArg (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -44,7 +43,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -68,26 +67,26 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; String arg_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (&map), first_ (&first), result_ (0) { } - AttributeArg (Context& c, Boolean& result) + AttributeArg (Context& c, bool& result) : Context (c), map_ (0), first_ (0), result_ (&result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -106,8 +105,8 @@ namespace CXX private: TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; }; struct ArgList : Traversal::Complex, @@ -116,7 +115,7 @@ namespace CXX { ArgList (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -137,7 +136,7 @@ namespace CXX names_ >> attribute_; } - ArgList (Context& c, Boolean& result, Boolean poly) + ArgList (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -156,7 +155,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -168,7 +167,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -189,7 +188,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; Traversal::Inherits inherits_; @@ -202,8 +201,8 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; - Boolean* result_; + bool first_; + bool* result_; }; struct ParserConnect: Traversal::List, @@ -212,13 +211,13 @@ namespace CXX { ParserConnect (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& map_inst = String ()) : Context (c), poly_ (poly), map_ (map), map_inst_ (map_inst) { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -229,7 +228,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (has_members (c)) @@ -246,17 +245,17 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { - Boolean r (false); + bool r (false); ArgList test (*this, r, poly_); test.traverse (c); return r; } private: - Boolean poly_; + bool poly_; TypeInstanceMap& map_; String map_inst_; }; @@ -271,7 +270,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -312,9 +311,9 @@ namespace CXX { String const& entry (tc.get<String> ("paggr-parser-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -330,7 +329,7 @@ namespace CXX // ParserConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -341,7 +340,7 @@ namespace CXX ParserConnect connect ( *this, map, true, tc.get<String> ("paggr-parser-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -357,7 +356,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -398,9 +397,9 @@ namespace CXX { String const& entry (ec.get<String> ("paggr-parser-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -416,7 +415,7 @@ namespace CXX // ParserConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -427,7 +426,7 @@ namespace CXX ParserConnect connect ( *this, map, true, ec.get<String> ("paggr-parser-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -457,10 +456,10 @@ namespace CXX }; } - Void + void generate_parser_aggregate_source (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/parser-aggregate-source.hxx b/xsde/cxx/hybrid/parser-aggregate-source.hxx index bac9fed..e4237fe 100644 --- a/xsde/cxx/hybrid/parser-aggregate-source.hxx +++ b/xsde/cxx/hybrid/parser-aggregate-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_aggregate_source (Context&); } } diff --git a/xsde/cxx/hybrid/parser-header.cxx b/xsde/cxx/hybrid/parser-header.cxx index 64a7f55..4a1ec35 100644 --- a/xsde/cxx/hybrid/parser-header.cxx +++ b/xsde/cxx/hybrid/parser-header.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.inherits_p ()) @@ -52,7 +52,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -73,8 +73,8 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (e)); - Boolean val (!options.suppress_validation () && + bool fl (fixed_length (e)); + bool val (!options.suppress_validation () && !options.suppress_parser_val ()); SemanticGraph::Type& b (e.inherits ().base ()); @@ -232,7 +232,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (epimpl_custom (l)); @@ -323,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (epimpl_custom (u)); @@ -333,7 +333,7 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (u)); + bool fl (fixed_length (u)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << epskel (u) @@ -437,7 +437,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -467,7 +467,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -482,7 +482,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { os << "virtual void" << endl @@ -492,7 +492,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -519,7 +519,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& arg (parg_type (e.type ())); @@ -542,7 +542,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.fixed_p ()) @@ -595,7 +595,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (epimpl_custom (c)); @@ -605,14 +605,14 @@ namespace CXX // if (name) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); + bool hb (c.inherits_p ()); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); + bool hae (has_particle<Traversal::Any> (c)); - Boolean restriction (restriction_p (c)); - Boolean fixed (fixed_length (c)); - Boolean rec (recursive (c)); + bool restriction (restriction_p (c)); + bool fixed (fixed_length (c)); + bool rec (recursive (c)); String const& ret (pret_type (c)); @@ -784,7 +784,7 @@ namespace CXX }; } - Void + void generate_parser_header (Context& ctx) { ctx.os << "#include <xsde/cxx/stack.hxx>" << endl diff --git a/xsde/cxx/hybrid/parser-header.hxx b/xsde/cxx/hybrid/parser-header.hxx index 230ba49..62a1b06 100644 --- a/xsde/cxx/hybrid/parser-header.hxx +++ b/xsde/cxx/hybrid/parser-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_header (Context&); } } diff --git a/xsde/cxx/hybrid/parser-name-processor.cxx b/xsde/cxx/hybrid/parser-name-processor.cxx index d5f7edd..9c0f9fd 100644 --- a/xsde/cxx/hybrid/parser-name-processor.cxx +++ b/xsde/cxx/hybrid/parser-name-processor.cxx @@ -3,6 +3,11 @@ // 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/elements.hxx> #include <cxx/hybrid/elements.hxx> #include <cxx/hybrid/parser-name-processor.hxx> @@ -10,11 +15,7 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/map.hxx> - -#include <sstream> -#include <iostream> +using namespace std; namespace CXX { @@ -22,10 +23,7 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set<String> NameSet; - + typedef set<String> NameSet; struct Failed {}; class Context: public CXX::Context @@ -61,7 +59,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 base and include are empty. // @@ -107,13 +105,13 @@ namespace CXX } public: - Boolean + bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get<Boolean> ("fixed"); + return t.context ().get<bool> ("fixed"); } - Boolean + bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); @@ -125,7 +123,7 @@ namespace CXX { String name (escape (n + suffix)); - 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; @@ -212,25 +210,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map<String, CustomParser> - CustomParserMap; + typedef map<String, CustomParser> CustomParserMap; private: String const impl_suffix_; String const aggr_suffix_; CustomParserMap custom_parser_map_; - Cult::Containers::Map<String, NameSet*> global_type_names_; + map<String, NameSet*> global_type_names_; public: options_type const& options; - Boolean aggregate; + bool aggregate; String const& impl_suffix; String const& aggr_suffix; CustomParserMap const& custom_parser_map; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; }; // @@ -242,7 +238,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -268,7 +264,7 @@ namespace CXX if (!name) return; - Boolean fl (fixed_length (e)); + bool fl (fixed_length (e)); NameSet set; set.insert (name); @@ -297,7 +293,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -331,7 +327,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -368,7 +364,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -393,7 +389,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -409,7 +405,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a<SemanticGraph::Restricts> () && @@ -472,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -482,8 +478,8 @@ namespace CXX // See if this parser is being customized. // - Boolean custom (false); - CustomParserMap::ConstIterator i (custom_parser_map.find (name)); + bool custom (false); + CustomParserMap::const_iterator i (custom_parser_map.find (name)); if (i != custom_parser_map.end ()) { @@ -550,10 +546,10 @@ namespace CXX process (*last_); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean p (false); + bool p (false); if (last_ == 0 && options.root_element_first ()) p = true; @@ -595,7 +591,7 @@ namespace CXX } private: - Void + void process (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -618,7 +614,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -669,7 +665,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -681,7 +677,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -693,7 +689,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -705,16 +701,16 @@ namespace CXX } } - static Char const* seen_key; + static char const* seen_key; }; - Char const* Uses::seen_key = "cxx-hybrid-parser-name-processor-seen"; + char const* Uses::seen_key = "cxx-hybrid-parser-name-processor-seen"; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -776,11 +772,11 @@ namespace CXX } } - Boolean ParserNameProcessor:: + bool ParserNameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { try { diff --git a/xsde/cxx/hybrid/parser-name-processor.hxx b/xsde/cxx/hybrid/parser-name-processor.hxx index 20721ee..d5fd390 100644 --- a/xsde/cxx/hybrid/parser-name-processor.hxx +++ b/xsde/cxx/hybrid/parser-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_PARSER_NAME_PROCESSOR_HXX #define CXX_HYBRID_PARSER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class ParserNameProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/parser-source.cxx b/xsde/cxx/hybrid/parser-source.cxx index 3b6ed31..a5df5bc 100644 --- a/xsde/cxx/hybrid/parser-source.cxx +++ b/xsde/cxx/hybrid/parser-source.cxx @@ -23,10 +23,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { - Boolean clear (false); + bool clear (false); if (scope_ == 0) { @@ -70,7 +70,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { using SemanticGraph::Enumeration; @@ -96,7 +96,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -119,9 +119,9 @@ namespace CXX << "//" << endl << endl; - Boolean fl (fixed_length (e)); + bool fl (fixed_length (e)); - Boolean val (!options.suppress_validation () && + bool val (!options.suppress_validation () && !options.suppress_parser_val ()); SemanticGraph::Context& ec (e.context ()); @@ -430,7 +430,7 @@ namespace CXX os << type << "* r = this->" << state << ".x_;" << "this->" << state << ".x_ = 0;"; - Boolean flb (fixed_length (b)); + bool flb (fixed_length (b)); // Copy the value if our base is fixed-length. // @@ -486,7 +486,7 @@ namespace CXX << "}"; } - virtual Void + virtual void comma (Type&) { os << "else "; @@ -509,7 +509,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (epimpl_custom (l)); @@ -662,7 +662,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (epimpl_custom (u)); @@ -863,13 +863,13 @@ namespace CXX // for the current element in the container is returned. // String - access_seq (SemanticGraph::Particle& p, Boolean element = true) + access_seq (SemanticGraph::Particle& p, bool element = true) { using namespace SemanticGraph; String r; - Boolean seq (false); + bool seq (false); Compositor* c; @@ -957,7 +957,7 @@ namespace CXX if (!seq) { - Boolean fixed (fixed_length (t)); + bool fixed (fixed_length (t)); String const& s (epstate_member (t)); if (!r) @@ -1036,24 +1036,24 @@ namespace CXX struct CompositorTest: Traversal::Compositor { - CompositorTest (Boolean& p) + CompositorTest (bool& p) : p_ (p) { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // We are only interested in var-length required compositors. // if (c.max () == 1 && c.min () == 1 && - !c.context ().get<Boolean> ("fixed")) + !c.context ().get<bool> ("fixed")) p_ = true; } private: - Boolean& p_; + bool& p_; }; // @@ -1070,7 +1070,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -1129,7 +1129,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { String const& s (epimpl_custom (scope (c))); @@ -1350,7 +1350,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1487,7 +1487,7 @@ namespace CXX } private: - Boolean init_; + bool init_; CompositorTest compositor_test_; }; @@ -1498,7 +1498,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Complex; @@ -1547,7 +1547,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Complex; @@ -1598,7 +1598,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (epimpl_custom (c)); @@ -1606,15 +1606,15 @@ namespace CXX if (!name) return; - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean fixed (fixed_length (c)); - Boolean rec (recursive (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool fixed (fixed_length (c)); + bool rec (recursive (c)); - Boolean validation (!options.suppress_validation () && + bool validation (!options.suppress_validation () && !options.suppress_parser_val ()); - Boolean c_string_base (false); + bool c_string_base (false); if (!stl && hb) { StringType test (c_string_base); @@ -2086,7 +2086,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx, Regex const& hxx_obj_expr) { if (ctx.enum_) diff --git a/xsde/cxx/hybrid/parser-source.hxx b/xsde/cxx/hybrid/parser-source.hxx index b664041..5a02361 100644 --- a/xsde/cxx/hybrid/parser-source.hxx +++ b/xsde/cxx/hybrid/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_source (Context&, Regex const& hxx_obj_expr); } } diff --git a/xsde/cxx/hybrid/serializer-aggregate-header.cxx b/xsde/cxx/hybrid/serializer-aggregate-header.cxx index cfcb203..e8316b7 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-header.cxx +++ b/xsde/cxx/hybrid/serializer-aggregate-header.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> + #include <cxx/hybrid/serializer-aggregate-header.hxx> #include <cxx/hybrid/aggregate-elements.hxx> #include <cxx/hybrid/aggregate-include.hxx> @@ -10,8 +12,7 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/set.hxx> +using namespace std; namespace CXX { @@ -19,7 +20,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Set<String> InstanceSet; + typedef set<String> InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -33,7 +34,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -45,7 +46,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -147,7 +148,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -159,7 +160,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -172,7 +173,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -196,7 +197,7 @@ namespace CXX } } - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -227,7 +228,7 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { if (fund_type (t, "any_type")) @@ -237,7 +238,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -245,7 +246,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -253,79 +254,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"); @@ -333,19 +334,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"); @@ -353,49 +354,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"); @@ -404,7 +405,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -413,19 +414,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"); @@ -433,7 +434,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -441,13 +442,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"); @@ -456,55 +457,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"); @@ -512,20 +513,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 Boolean + virtual bool fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -542,7 +543,7 @@ namespace CXX { String name (escape (raw_name + L"_s_")); - 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; @@ -584,7 +585,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -592,7 +593,7 @@ namespace CXX if (!tc.count ("saggr")) return; - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (tc.get<String> ("saggr")); String pre (unclash (name, "pre")); @@ -757,7 +758,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "s:impl") << " " << i->second << ";"; @@ -781,7 +782,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -790,7 +791,7 @@ namespace CXX return; SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (ec.get<String> ("saggr")); String pre (unclash (name, "pre")); @@ -972,7 +973,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "s:impl") << " " << i->second << ";"; @@ -990,10 +991,10 @@ namespace CXX }; } - Void + void generate_serializer_aggregate_header (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/serializer-aggregate-header.hxx b/xsde/cxx/hybrid/serializer-aggregate-header.hxx index 7c0d73a..8836261 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-header.hxx +++ b/xsde/cxx/hybrid/serializer-aggregate-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_aggregate_header (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-aggregate-source.cxx b/xsde/cxx/hybrid/serializer-aggregate-source.cxx index e9edeea..ef7ff76 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-source.cxx +++ b/xsde/cxx/hybrid/serializer-aggregate-source.cxx @@ -9,8 +9,6 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> - namespace CXX { namespace Hybrid @@ -21,8 +19,8 @@ namespace CXX { ParticleArg (Context& c, TypeInstanceMap& map, - Boolean& first, - Boolean poly, + bool& first, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -33,7 +31,7 @@ namespace CXX { } - ParticleArg (Context& c, Boolean& result, Boolean poly) + ParticleArg (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -42,7 +40,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -66,26 +64,26 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; String arg_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (&map), first_ (&first), result_ (0) { } - AttributeArg (Context& c, Boolean& result) + AttributeArg (Context& c, bool& result) : Context (c), map_ (0), first_ (0), result_ (&result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -104,8 +102,8 @@ namespace CXX private: TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; }; struct ArgList : Traversal::Complex, @@ -114,7 +112,7 @@ namespace CXX { ArgList (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -135,7 +133,7 @@ namespace CXX names_ >> attribute_; } - ArgList (Context& c, Boolean& result, Boolean poly) + ArgList (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -154,7 +152,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -166,7 +164,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -187,7 +185,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; Traversal::Inherits inherits_; @@ -200,8 +198,8 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; - Boolean* result_; + bool first_; + bool* result_; }; struct SerializerConnect: Traversal::List, @@ -210,13 +208,13 @@ namespace CXX { SerializerConnect (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& map_inst = String ()) : Context (c), poly_ (poly), map_ (map), map_inst_ (map_inst) { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -227,7 +225,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (has_members (c)) @@ -244,17 +242,17 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { - Boolean r (false); + bool r (false); ArgList test (*this, r, poly_); test.traverse (c); return r; } private: - Boolean poly_; + bool poly_; TypeInstanceMap& map_; String map_inst_; }; @@ -268,7 +266,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -310,9 +308,9 @@ namespace CXX String const& entry ( tc.get<String> ("saggr-serializer-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -328,7 +326,7 @@ namespace CXX // SerializerConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -339,7 +337,7 @@ namespace CXX SerializerConnect connect ( *this, map, true, tc.get<String> ("saggr-serializer-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -355,7 +353,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -397,9 +395,9 @@ namespace CXX String const& entry ( ec.get<String> ("saggr-serializer-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -415,7 +413,7 @@ namespace CXX // SerializerConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -426,7 +424,7 @@ namespace CXX SerializerConnect connect ( *this, map, true, ec.get<String> ("saggr-serializer-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -456,10 +454,10 @@ namespace CXX }; } - Void + void generate_serializer_aggregate_source (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/serializer-aggregate-source.hxx b/xsde/cxx/hybrid/serializer-aggregate-source.hxx index ba2357d..11bfd97 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-source.hxx +++ b/xsde/cxx/hybrid/serializer-aggregate-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_aggregate_source (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-header.cxx b/xsde/cxx/hybrid/serializer-header.cxx index 2297474..7a4117f 100644 --- a/xsde/cxx/hybrid/serializer-header.cxx +++ b/xsde/cxx/hybrid/serializer-header.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.inherits_p ()) @@ -52,7 +52,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -156,7 +156,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (esimpl_custom (l)); @@ -236,7 +236,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (esimpl_custom (u)); @@ -298,7 +298,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -323,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -353,7 +353,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -368,12 +368,12 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -396,10 +396,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -425,10 +425,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (min == 0 && max == 1) { @@ -458,7 +458,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -513,7 +513,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (esimpl_custom (c)); @@ -527,16 +527,16 @@ namespace CXX // generate serializer callbacks, etc. since they are the same // as in the base. We only need the serialization/validation code. // - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + 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 rec (recursive (c)); + bool rec (recursive (c)); String const& arg (sarg_type (c)); @@ -689,7 +689,7 @@ namespace CXX }; } - Void + void generate_serializer_header (Context& ctx) { ctx.os << "#include <xsde/cxx/stack.hxx>" << endl diff --git a/xsde/cxx/hybrid/serializer-header.hxx b/xsde/cxx/hybrid/serializer-header.hxx index ddf3ded..9e6f8d6 100644 --- a/xsde/cxx/hybrid/serializer-header.hxx +++ b/xsde/cxx/hybrid/serializer-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_header (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx index 4071ecb..b29b509 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.cxx +++ b/xsde/cxx/hybrid/serializer-name-processor.cxx @@ -3,6 +3,11 @@ // 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/elements.hxx> #include <cxx/hybrid/elements.hxx> #include <cxx/hybrid/serializer-name-processor.hxx> @@ -10,10 +15,7 @@ #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 { @@ -21,10 +23,7 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set<String> NameSet; - + typedef set<String> NameSet; struct Failed {}; class Context: public CXX::Context @@ -60,7 +59,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 base and include are empty. // @@ -111,7 +110,7 @@ namespace CXX { String name (escape (n + suffix)); - 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; @@ -129,7 +128,7 @@ namespace CXX } public: - Boolean + bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); @@ -205,25 +204,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map<String, CustomSerializer> - CustomSerializerMap; + typedef map<String, CustomSerializer> CustomSerializerMap; private: String const impl_suffix_; String const aggr_suffix_; CustomSerializerMap custom_serializer_map_; - Cult::Containers::Map<String, NameSet*> global_type_names_; + map<String, NameSet*> global_type_names_; public: options_type const& options; - Boolean aggregate; + bool aggregate; String const& impl_suffix; String const& aggr_suffix; CustomSerializerMap const& custom_serializer_map; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; }; // @@ -235,7 +232,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -283,7 +280,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -319,7 +316,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -350,7 +347,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -375,7 +372,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -400,7 +397,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -416,7 +413,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a<SemanticGraph::Restricts> () && @@ -479,7 +476,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -489,8 +486,8 @@ namespace CXX // See if this serializer is being customized. // - Boolean custom (false); - CustomSerializerMap::ConstIterator i ( + bool custom (false); + CustomSerializerMap::const_iterator i ( custom_serializer_map.find (name)); if (i != custom_serializer_map.end ()) @@ -558,10 +555,10 @@ namespace CXX process (*last_); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean p (false); + bool p (false); if (last_ == 0 && options.root_element_first ()) p = true; @@ -602,7 +599,7 @@ namespace CXX } private: - Void + void process (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -625,7 +622,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -676,7 +673,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -688,7 +685,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -700,7 +697,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -712,16 +709,16 @@ namespace CXX } } - static Char const* seen_key; + static char const* seen_key; }; - Char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen"; + char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen"; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -783,11 +780,11 @@ namespace CXX } } - Boolean SerializerNameProcessor:: + bool SerializerNameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { try { diff --git a/xsde/cxx/hybrid/serializer-name-processor.hxx b/xsde/cxx/hybrid/serializer-name-processor.hxx index 0840f52..f7e3ea4 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.hxx +++ b/xsde/cxx/hybrid/serializer-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_SERIALIZER_NAME_PROCESSOR_HXX #define CXX_HYBRID_SERIALIZER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class SerializerNameProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/serializer-source.cxx b/xsde/cxx/hybrid/serializer-source.cxx index d99d167..d93ffa4 100644 --- a/xsde/cxx/hybrid/serializer-source.cxx +++ b/xsde/cxx/hybrid/serializer-source.cxx @@ -30,38 +30,38 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { if (!stl) os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { os << "&"; @@ -77,10 +77,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { - Boolean clear (false); + bool clear (false); if (scope_ == 0) { @@ -127,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -239,7 +239,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (esimpl_custom (l)); @@ -306,7 +306,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (esimpl_custom (u)); @@ -367,13 +367,13 @@ namespace CXX // for the current element in the container is returned. // String - access_seq (SemanticGraph::Particle& p, Boolean element = true) + access_seq (SemanticGraph::Particle& p, bool element = true) { using namespace SemanticGraph; String r; - Boolean seq (false); + bool seq (false); Compositor* c; @@ -538,19 +538,19 @@ namespace CXX struct CompositorTest: Traversal::Choice, Traversal::Sequence { - CompositorTest (Boolean& seq) + CompositorTest (bool& seq) : seq_ (seq) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) seq_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -564,17 +564,17 @@ namespace CXX } private: - Boolean& seq_; + bool& seq_; }; struct ParticleTest: Traversal::Element { - ParticleTest (Boolean& seq) + ParticleTest (bool& seq) : seq_ (seq) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -582,7 +582,7 @@ namespace CXX } private: - Boolean& seq_; + bool& seq_; }; // @@ -598,7 +598,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -617,7 +617,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -650,7 +650,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -691,7 +691,7 @@ namespace CXX contains_particle_test_ >> particle_test_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -710,7 +710,7 @@ namespace CXX All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { SemanticGraph::Complex& t (scope (c)); @@ -831,7 +831,7 @@ namespace CXX Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { String const& sc (esimpl_custom (scope (s))); @@ -906,7 +906,7 @@ namespace CXX private: Traversal::ContainsParticle& init_; - Boolean seq_; + bool seq_; CompositorTest compositor_test_; ParticleTest particle_test_; Traversal::ContainsParticle contains_particle_test_; @@ -919,7 +919,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& s ( @@ -1039,7 +1039,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s ( @@ -1056,7 +1056,7 @@ namespace CXX if (a.default_p ()) { - Boolean omit (options.omit_default_attributes ()); + bool omit (options.omit_default_attributes ()); if (a.fixed_p ()) os << "return " << (omit ? "false" : "true") << ";"; @@ -1132,7 +1132,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (esimpl_custom (c)); @@ -1140,11 +1140,11 @@ namespace CXX if (!name) return; - Boolean hb (c.inherits_p ()); - Boolean rec (recursive (c)); - Boolean restriction (restriction_p (c)); + bool hb (c.inherits_p ()); + bool rec (recursive (c)); + bool restriction (restriction_p (c)); - Boolean validation (!options.suppress_validation () && + bool validation (!options.suppress_validation () && !options.suppress_serializer_val ()); String state; @@ -1392,7 +1392,7 @@ namespace CXX }; } - Void + void generate_serializer_source (Context& ctx, Regex const& hxx_obj_expr) { if (ctx.poly_code && !ctx.stl) diff --git a/xsde/cxx/hybrid/serializer-source.hxx b/xsde/cxx/hybrid/serializer-source.hxx index 17caaee..76a7ab4 100644 --- a/xsde/cxx/hybrid/serializer-source.hxx +++ b/xsde/cxx/hybrid/serializer-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_source (Context&, Regex const& hxx_obj_expr); } } diff --git a/xsde/cxx/hybrid/tree-forward.cxx b/xsde/cxx/hybrid/tree-forward.cxx index 6fbd424..bd2fdeb 100644 --- a/xsde/cxx/hybrid/tree-forward.cxx +++ b/xsde/cxx/hybrid/tree-forward.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -65,7 +65,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& ctx (l.context ()); @@ -97,7 +97,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& ctx (u.context ()); @@ -129,7 +129,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& ctx (c.context ()); @@ -234,13 +234,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType&) { gen_using ("::xsde::cxx::hybrid::any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { gen_typedef ("any_simple_type", string_type_); @@ -253,7 +253,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { gen_typedef ("boolean", "bool"); @@ -263,7 +263,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { gen_typedef ("byte", "signed char"); @@ -271,7 +271,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { gen_typedef ("unsigned_byte", "unsigned char"); @@ -279,7 +279,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { gen_typedef ("short", "short"); @@ -287,7 +287,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { gen_typedef ("unsigned_short", "unsigned short"); @@ -295,7 +295,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { gen_typedef ("int", "int"); @@ -303,7 +303,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { gen_typedef ("unsigned_int", "unsigned int"); @@ -311,7 +311,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { gen_typedef ("long", long_type_); @@ -319,7 +319,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { gen_typedef ("unsigned_long", unsigned_long_type_); @@ -327,7 +327,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { gen_typedef ("integer", "long"); @@ -335,7 +335,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { gen_typedef ("negative_integer", "long"); @@ -343,7 +343,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { gen_typedef ("non_positive_integer", "long"); @@ -351,7 +351,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { gen_typedef ("positive_integer", "unsigned long"); @@ -359,7 +359,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { gen_typedef ("non_negative_integer", "unsigned long"); @@ -369,7 +369,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { gen_typedef ("float", "float"); @@ -377,7 +377,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { gen_typedef ("double", "double"); @@ -385,7 +385,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { gen_typedef ("decimal", "double"); @@ -395,7 +395,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { gen_typedef ("string", string_type_); @@ -406,7 +406,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { gen_typedef ("normalized_string", string_type_); @@ -417,7 +417,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { gen_typedef ("token", string_type_); @@ -426,7 +426,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { gen_typedef ("nmtoken", string_type_); @@ -435,14 +435,14 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&) { gen_typedef ("nmtokens", "::xsde::cxx::string_sequence"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { gen_typedef ("name", string_type_); @@ -451,7 +451,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { gen_typedef ("ncname", string_type_); @@ -460,7 +460,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { gen_typedef ("language", string_type_); @@ -471,7 +471,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { gen_using ("::xsde::cxx::qname"); @@ -480,7 +480,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { gen_typedef ("id", string_type_); @@ -489,7 +489,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { gen_typedef ("idref", string_type_); @@ -498,7 +498,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&) { gen_typedef ("idrefs", "::xsde::cxx::string_sequence"); @@ -507,7 +507,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { gen_typedef ("uri", string_type_); @@ -518,14 +518,14 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&) { gen_using ("::xsde::cxx::buffer"); gen_typedef ("base64_binary", "::xsde::cxx::buffer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&) { gen_typedef ("hex_binary", "::xsde::cxx::buffer"); @@ -535,56 +535,56 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&) { gen_using ("::xsde::cxx::time_zone"); gen_using ("::xsde::cxx::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&) { gen_using ("::xsde::cxx::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&) { gen_using ("::xsde::cxx::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&) { gen_using ("::xsde::cxx::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&) { gen_using ("::xsde::cxx::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&) { gen_using ("::xsde::cxx::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&) { gen_using ("::xsde::cxx::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&) { gen_using ("::xsde::cxx::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&) { gen_using ("::xsde::cxx::time"); @@ -592,24 +592,24 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { } private: - Void + void gen_typedef (String const& name, String const& type) { os << "typedef " << type << " " << escape (name) << ";"; } - Void + void gen_using (String const& name) { os << "using " << name << ";"; @@ -667,8 +667,8 @@ namespace CXX // Data representation stream types. // - Boolean icdr (false), ocdr (false); - Boolean ixdr (false), oxdr (false); + bool icdr (false), ocdr (false); + bool ixdr (false), oxdr (false); for (NarrowStrings::const_iterator i (istreams.begin ()); i != istreams.end (); ++i) @@ -721,8 +721,8 @@ namespace CXX }; } - Void - generate_tree_forward (Context& ctx, Boolean generate_xml_schema) + void + generate_tree_forward (Context& ctx, bool generate_xml_schema) { NarrowString xml_schema (ctx.options.extern_xml_schema ()); diff --git a/xsde/cxx/hybrid/tree-forward.hxx b/xsde/cxx/hybrid/tree-forward.hxx index 5b5fa84..84cf830 100644 --- a/xsde/cxx/hybrid/tree-forward.hxx +++ b/xsde/cxx/hybrid/tree-forward.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Hybrid { - Void - generate_tree_forward (Context&, Boolean generate_xml_schema); + void + generate_tree_forward (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/hybrid/tree-header.cxx b/xsde/cxx/hybrid/tree-header.cxx index ae24feb..0cbbaf4 100644 --- a/xsde/cxx/hybrid/tree-header.cxx +++ b/xsde/cxx/hybrid/tree-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << ename (e); @@ -39,7 +39,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -61,9 +61,9 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (e)); - Boolean cd (ec.count ("cd-name")); - Boolean poly (polymorphic (e)); + bool fl (fixed_length (e)); + bool cd (ec.count ("cd-name")); + bool poly (polymorphic (e)); String const& vt (ec.get<String> ("value-type")); os << "// " << comment (e.name ()) << " (" << @@ -237,7 +237,7 @@ namespace CXX } } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -258,7 +258,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -269,8 +269,8 @@ namespace CXX // if (name) { - Boolean cd (lc.count ("cd-name")); - Boolean poly (polymorphic (l)); + bool cd (lc.count ("cd-name")); + bool poly (polymorphic (l)); os << "// " << comment (l.name ()) << " (variable-length)" << endl << "//" << endl; @@ -397,7 +397,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -408,9 +408,9 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (u)); - Boolean poly (polymorphic (u)); - Boolean cd (uc.count ("cd-name")); + bool fl (fixed_length (u)); + bool poly (polymorphic (u)); + bool cd (uc.count ("cd-name")); os << "// " << comment (u.name ()) << " (" << (fl ? "fixed-length" : "variable-length") << ")" << endl @@ -694,7 +694,7 @@ namespace CXX // length types. // - Void + void dispatch (SemanticGraph::Node& n) { rank_ = 1; @@ -705,19 +705,19 @@ namespace CXX os << type_; } - virtual Void + virtual void traverse (SemanticGraph::List&) { align_type ("size_t", 5); } - virtual Void + virtual void traverse (SemanticGraph::Union&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c, inherits_); @@ -730,7 +730,7 @@ namespace CXX // anySimpleType // - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { align_type ("size_t", 5); // std::string @@ -738,7 +738,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { // In worst case scenario bool is 4 bytes. Assume that. @@ -748,43 +748,43 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { align_type ("signed char", 1); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { align_type ("unsigned char", 1); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { align_type ("unsigned short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { align_type ("unsigned int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { if (options.no_long_long ()) @@ -793,7 +793,7 @@ namespace CXX align_type ("long long", 8); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { if (options.no_long_long ()) @@ -802,31 +802,31 @@ namespace CXX align_type ("unsigned long long", 8); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { align_type ("long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { align_type ("long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { align_type ("unsigned long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { align_type ("unsigned long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { align_type ("long", 5); @@ -834,19 +834,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { align_type ("float", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { align_type ("double", 7); @@ -854,43 +854,43 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { align_type ("size_t", 5); // std::string @@ -898,7 +898,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { align_type ("size_t", 5); // std::string @@ -906,13 +906,13 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { align_type ("size_t", 5); // std::string @@ -920,7 +920,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { align_type ("size_t", 5); // std::string @@ -928,55 +928,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&) { align_type ("double", 7); @@ -984,15 +984,15 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { align_type ("size_t", 5); // std::string } private: - Void - align_type (Char const* type, unsigned short rank) + void + align_type (char const* type, unsigned short rank) { if (rank > rank_) { @@ -1010,7 +1010,7 @@ namespace CXX struct Attribute: Traversal::Attribute { - virtual Void + virtual void traverse (Type& a) { if (!a.fixed_p ()) @@ -1035,7 +1035,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1062,7 +1062,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -1092,7 +1092,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -1147,7 +1147,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1178,7 +1178,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -1216,7 +1216,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // For choice in choice we always have a nested class. @@ -1263,7 +1263,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1293,7 +1293,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // For sequence in choice we always have a nested class. @@ -1347,18 +1347,18 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { os << "// " << comment (a.name ()) << endl << "//" << endl; - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& name (ename (a)); SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); if (a.optional_p () && !fix) @@ -1447,7 +1447,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "// " << comment (e.name ()) << endl @@ -1455,7 +1455,7 @@ namespace CXX String const& name (ename (e)); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); if (e.max () != 1) { @@ -1558,7 +1558,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1566,8 +1566,8 @@ namespace CXX // if (a.min () == 0) { - Boolean fl (fixed_length (a)); - Boolean cd (a.context ().count ("cd-name")); + bool fl (fixed_length (a)); + bool cd (a.context ().count ("cd-name")); String const& name (ename (a)); String const& type (etype (a)); @@ -1733,31 +1733,31 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { emit_tag (etag (e)); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { emit_tag (etag (a)); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { emit_tag (etag (c)); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { emit_tag (etag (s)); } - virtual Void + virtual void emit_tag (String const& tag) { if (first_) @@ -1769,7 +1769,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct ChoiceInSequence: Traversal::Choice, Context @@ -1780,14 +1780,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); String const& name (ename (c)); - Boolean fl; + bool fl; String type; if (max != 1 || min == 0) @@ -1871,7 +1871,7 @@ namespace CXX if (max != 1 || min == 0) { - Boolean cd (c.context ().count ("cd-name")); + bool cd (c.context ().count ("cd-name")); // Custom data. // @@ -2029,16 +2029,16 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When shoice is in choice we generate nested class even // for min == max == 1. // - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); - Boolean fl (fixed_length (c)); - Boolean cd (c.context ().count ("cd-name")); + bool fl (fixed_length (c)); + bool cd (c.context ().count ("cd-name")); String const& name (ename (c)); String const& type (etype (c)); @@ -2268,10 +2268,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max == 1 && min == 1) { @@ -2279,8 +2279,8 @@ namespace CXX return; } - Boolean fl (fixed_length (s)); - Boolean cd (s.context ().count ("cd-name")); + bool fl (fixed_length (s)); + bool cd (s.context ().count ("cd-name")); String const& name (ename (s)); String const& type (etype (s)); @@ -2474,14 +2474,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even // for min == max == 1. // - Boolean fl (fixed_length (s)); - Boolean cd (s.context ().count ("cd-name")); + bool fl (fixed_length (s)); + bool cd (s.context ().count ("cd-name")); String const& name (ename (s)); String const& type (etype (s)); @@ -2740,7 +2740,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -2751,10 +2751,10 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (c)); - Boolean poly (polymorphic (c)); - Boolean restriction (restriction_p (c)); - Boolean cd (cc.count ("cd-name")); + bool fl (fixed_length (c)); + bool poly (polymorphic (c)); + bool restriction (restriction_p (c)); + bool cd (cc.count ("cd-name")); os << "// " << comment (c.name ()) << " (" << (fl ? "fixed-length" : "variable-length") << ")" << endl @@ -2943,10 +2943,10 @@ namespace CXX }; } - Void + void generate_tree_header (Context& ctx) { - Boolean inline_ (ctx.options.generate_inline ()); + bool inline_ (ctx.options.generate_inline ()); // Emit header includes. // diff --git a/xsde/cxx/hybrid/tree-header.hxx b/xsde/cxx/hybrid/tree-header.hxx index 0259349..2ca8914 100644 --- a/xsde/cxx/hybrid/tree-header.hxx +++ b/xsde/cxx/hybrid/tree-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_header (Context&); } } diff --git a/xsde/cxx/hybrid/tree-inline.cxx b/xsde/cxx/hybrid/tree-inline.cxx index 2f6815e..2d845f4 100644 --- a/xsde/cxx/hybrid/tree-inline.cxx +++ b/xsde/cxx/hybrid/tree-inline.cxx @@ -24,7 +24,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -131,7 +131,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -195,7 +195,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -361,11 +361,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& name (ename (a)); String member; @@ -374,7 +374,7 @@ namespace CXX member = emember (a); SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String scope (Context::scope (a)); if (a.optional_p () && !fix) @@ -566,14 +566,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); String const& member (emember (e)); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String scope (Context::scope (e)); if (e.max () != 1) @@ -720,7 +720,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); @@ -764,10 +764,10 @@ namespace CXX } else { - UnsignedLong min (e.min ()); + size_t min (e.min ()); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String const& tag (etag (e)); String const& arm_member (earm_member (c)); @@ -936,7 +936,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -949,7 +949,7 @@ namespace CXX String const& present (epresent (a)); String const& member (emember (a)); - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String scope (Context::scope (a)); @@ -1077,10 +1077,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (max == 1 && min == 1) { @@ -1131,7 +1131,7 @@ namespace CXX } else if (min == 0) { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& type (etype (c)); String const& present (epresent (c)); @@ -1258,10 +1258,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max == 1 && min == 1) { @@ -1300,7 +1300,7 @@ namespace CXX } else if (min == 0) { - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); String const& type (etype (s)); String const& present (epresent (s)); @@ -1427,7 +1427,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // When compositor is in choice we generate nested class even @@ -1474,9 +1474,9 @@ namespace CXX } else { - UnsignedLong min (c.min ()); + size_t min (c.min ()); - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& type (etype (c)); String const& tag (etag (c)); @@ -1632,7 +1632,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { CompositorInChoiceFunc::traverse (c); @@ -1646,7 +1646,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { CompositorInChoiceFunc::traverse (s); @@ -1664,7 +1664,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1717,7 +1717,7 @@ namespace CXX struct Choice: Traversal::Choice, Context { Choice (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_func) : Context (c), in_choice_ (in_choice), @@ -1725,7 +1725,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -1785,7 +1785,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_func_; }; @@ -1798,7 +1798,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1 || s.min () == 0) @@ -1855,7 +1855,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1969,7 +1969,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& scope (ename_custom (c)); @@ -2062,7 +2062,7 @@ namespace CXX }; } - Void + void generate_tree_inline (Context& ctx) { // Generate includes. diff --git a/xsde/cxx/hybrid/tree-inline.hxx b/xsde/cxx/hybrid/tree-inline.hxx index 56f466c..214bfc7 100644 --- a/xsde/cxx/hybrid/tree-inline.hxx +++ b/xsde/cxx/hybrid/tree-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_inline (Context&); } } diff --git a/xsde/cxx/hybrid/tree-name-processor.cxx b/xsde/cxx/hybrid/tree-name-processor.cxx index 0558907..148033e 100644 --- a/xsde/cxx/hybrid/tree-name-processor.cxx +++ b/xsde/cxx/hybrid/tree-name-processor.cxx @@ -3,6 +3,13 @@ // 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 <cutl/shared-ptr.hxx> + #include <cxx/elements.hxx> #include <cxx/hybrid/elements.hxx> @@ -11,11 +18,8 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/map.hxx> - -#include <sstream> -#include <iostream> +using namespace std; +using cutl::shared_ptr; namespace CXX { @@ -23,10 +27,8 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set<String> NameSet; - Char const* member_set_key = "cxx-hybrid-name-processor-member-set"; + typedef set<String> NameSet; + char const* member_set_key = "cxx-hybrid-name-processor-member-set"; class Context: public CXX::Context { @@ -62,10 +64,10 @@ namespace CXX e = name.find (L"::", b); String entry (name, b, e == String::npos ? e : e - b); - Shptr<CustomDataMap>& p ((*map)[entry]); + shared_ptr<CustomDataMap>& p ((*map)[entry]); if (p == 0) - p = Shptr<CustomDataMap> (new CustomDataMap); + p = shared_ptr<CustomDataMap> (new (shared) CustomDataMap); b = e; @@ -73,7 +75,7 @@ namespace CXX { // Last name. Add an empty string to indicate this. // - (*p)[L""] = Shptr<CustomDataMap> (0); + (*p)[L""] = shared_ptr<CustomDataMap> (); break; } @@ -99,7 +101,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 type, base, and include are empty. // @@ -173,19 +175,19 @@ namespace CXX } public: - Boolean + bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get<Boolean> ("fixed"); + return t.context ().get<bool> ("fixed"); } - Boolean + bool fixed_length (SemanticGraph::Compositor& c) { - return c.context ().get<Boolean> ("fixed"); + return c.context ().get<bool> ("fixed"); } - Void + void mark_variable (SemanticGraph::Compositor& c) { SemanticGraph::Compositor* p (&c); @@ -199,7 +201,7 @@ namespace CXX p = &p->contained_particle ().compositor (); - if (!p->context ().get<Boolean> ("fixed")) + if (!p->context ().get<bool> ("fixed")) break; } } @@ -210,7 +212,7 @@ namespace CXX { String name (escape (n + suffix)); - 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; @@ -228,10 +230,7 @@ namespace CXX } public: - struct CustomDataMap: - Cult::Containers::Map<String, Shptr<CustomDataMap> > - { - }; + struct CustomDataMap: map<String, shared_ptr<CustomDataMap> > {}; public: struct CustomType @@ -248,25 +247,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map<String, CustomType> - CustomTypeMap; + typedef map<String, CustomType> CustomTypeMap; private: CustomDataMap custom_data_map_; CustomTypeMap custom_type_map_; - Cult::Containers::Map<String, NameSet*> global_type_names_; + map<String, NameSet*> global_type_names_; public: - Boolean stl; - Boolean detach; - Boolean enum_; + bool stl; + bool detach; + bool enum_; CustomDataMap& custom_data_map; CustomTypeMap& custom_type_map; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; }; // @@ -280,7 +277,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { a.context ().set ("name", find_name (a.name (), set_)); @@ -297,7 +294,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { e.context ().set ("name", find_name (e.name (), set_)); @@ -314,7 +311,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -332,12 +329,12 @@ namespace CXX struct PrimaryChoice: Traversal::Choice, Context { - PrimaryChoice (Context& c, NameSet& set, Boolean in_choice) + PrimaryChoice (Context& c, NameSet& set, bool in_choice) : Context (c), set_ (set), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // In case of choice assign primary name even if there is @@ -352,17 +349,17 @@ namespace CXX private: NameSet& set_; - Boolean in_choice_; + bool in_choice_; }; struct PrimarySequence: Traversal::Sequence, Context { - PrimarySequence (Context& c, NameSet& set, Boolean in_choice) + PrimarySequence (Context& c, NameSet& set, bool in_choice) : Context (c), set_ (set), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we have nested class even @@ -376,7 +373,7 @@ namespace CXX private: NameSet& set_; - Boolean in_choice_; + bool in_choice_; }; // @@ -385,18 +382,18 @@ namespace CXX struct SecondaryAttribute: Traversal::Attribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean data_members) + SecondaryAttribute (Context& c, NameSet& set, bool data_members) : Context (c), set_ (set), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { SemanticGraph::Context& ac (a.context ()); - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& base (ac.get<String> ("name")); @@ -438,17 +435,17 @@ namespace CXX private: NameSet& set_; - Boolean data_members_; + bool data_members_; }; struct SecondaryElement: Traversal::Element, Context { - SecondaryElement (Context& c, NameSet& set, Boolean data_members) + SecondaryElement (Context& c, NameSet& set, bool data_members) : Context (c), set_ (set), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -495,7 +492,7 @@ namespace CXX private: NameSet& set_; - Boolean data_members_; + bool data_members_; }; struct SecondaryAll: Traversal::All, Context @@ -503,7 +500,7 @@ namespace CXX SecondaryAll (Context& c, NameSet& set, CustomDataMap* map, - Boolean data_members) + bool data_members) : Context (c), set_ (set), map_ (map), @@ -511,7 +508,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -530,7 +527,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -621,7 +618,7 @@ namespace CXX private: NameSet& set_; CustomDataMap* map_; - Boolean data_members_; + bool data_members_; }; struct ParticleTag: Traversal::Element, @@ -635,27 +632,27 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& base (e.context ().get<String> ("name")); e.context ().set ("tag", find_name (base, L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { a.context ().set ("tag", find_name (L"any", L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { String const& base (c.context ().get<String> ("name")); c.context ().set ("tag", find_name (base, L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { String const& base (s.context ().get<String> ("name")); @@ -671,8 +668,8 @@ namespace CXX SecondaryChoice (Context& c, NameSet& set, CustomDataMap* map, - Boolean in_choice, - Boolean data_members) + bool in_choice, + bool data_members) : Context (c), set_ (set), map_ (map), @@ -681,17 +678,17 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice&); - Void + void traverse_nested (SemanticGraph::Choice&, NameSet&, CustomDataMap*); private: NameSet& set_; CustomDataMap* map_; - Boolean in_choice_; - Boolean data_members_; + bool in_choice_; + bool data_members_; }; struct SecondarySequence: Traversal::Sequence, Context @@ -699,8 +696,8 @@ namespace CXX SecondarySequence (Context& c, NameSet& set, CustomDataMap* map, - Boolean in_choice, - Boolean data_members) + bool in_choice, + bool data_members) : Context (c), set_ (set), map_ (map), @@ -709,21 +706,21 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence&); - Void + void traverse_nested (SemanticGraph::Sequence&, NameSet&, CustomDataMap*); private: NameSet& set_; CustomDataMap* map_; - Boolean in_choice_; - Boolean data_members_; + bool in_choice_; + bool data_members_; }; - Void SecondaryChoice:: + void SecondaryChoice:: traverse (SemanticGraph::Choice& c) { SemanticGraph::Context& cc (c.context ()); @@ -743,7 +740,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -774,7 +771,7 @@ namespace CXX cc.set ("arm-tag", find_name (arm + L"_tag", name_set)); { - UnsignedLong count (name_set.size ()); + size_t count (name_set.size ()); ParticleTag particle (*this, name_set); Traversal::ContainsParticle contains (particle); @@ -869,7 +866,7 @@ namespace CXX cc.set ("arm-tag", find_name (arm + L"_tag", set_)); { - UnsignedLong count (set_.size ()); + size_t count (set_.size ()); ParticleTag particle (*this, set_); Traversal::ContainsParticle contains (particle); @@ -889,7 +886,7 @@ namespace CXX } } - Void SecondaryChoice:: + void SecondaryChoice:: traverse_nested (SemanticGraph::Choice& c, NameSet& name_set, CustomDataMap* map) @@ -948,7 +945,7 @@ namespace CXX Choice::contains (c, choice_contains_particle); } - Void SecondarySequence:: + void SecondarySequence:: traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we have nested class even @@ -968,7 +965,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -1062,7 +1059,7 @@ namespace CXX Sequence::contains (s); } - Void SecondarySequence:: + void SecondarySequence:: traverse_nested (SemanticGraph::Sequence& s, NameSet& name_set, CustomDataMap* map) @@ -1130,7 +1127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& n (e.name ()); @@ -1149,12 +1146,12 @@ namespace CXX Traversal::Enumeration, Context { - GlobalTypeMembers (Context& c, Boolean data_members) + GlobalTypeMembers (Context& c, bool data_members) : Context (c), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { // First see if we should delegate this one to Complex. @@ -1201,7 +1198,7 @@ namespace CXX // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (e.name ())); + CustomDataMap::iterator i (custom_data_map.find (e.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1232,7 +1229,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Context& lc (l.context ()); @@ -1250,7 +1247,7 @@ namespace CXX { // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (l.name ())); + CustomDataMap::iterator i (custom_data_map.find (l.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1283,7 +1280,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Context& uc (u.context ()); @@ -1311,7 +1308,7 @@ namespace CXX // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (u.name ())); + CustomDataMap::iterator i (custom_data_map.find (u.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1340,7 +1337,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (data_members_) @@ -1349,7 +1346,7 @@ namespace CXX assign_names (c); } - virtual Void + virtual void assign_names (SemanticGraph::Complex& c) { SemanticGraph::Context& cc (c.context ()); @@ -1368,7 +1365,7 @@ namespace CXX // CustomDataMap* map (0); { - CustomDataMap::Iterator i (custom_data_map.find (c.name ())); + CustomDataMap::iterator i (custom_data_map.find (c.name ())); if (i != custom_data_map.end ()) map = i->second.get (); } @@ -1380,7 +1377,7 @@ namespace CXX // Add our base's members to the initial list. // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) { @@ -1519,7 +1516,7 @@ namespace CXX } } - virtual Void + virtual void assign_data (SemanticGraph::Complex& c) { SemanticGraph::Context& cc (c.context ()); @@ -1535,7 +1532,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a<SemanticGraph::Restricts> () && @@ -1606,7 +1603,7 @@ namespace CXX } private: - Boolean data_members_; + bool data_members_; }; // @@ -1621,7 +1618,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& name (t.name ()); @@ -1631,7 +1628,7 @@ namespace CXX // See if this parser is being customized. // - CustomTypeMap::ConstIterator i (custom_type_map.find (name)); + CustomTypeMap::const_iterator i (custom_type_map.find (name)); if (i != custom_type_map.end ()) { @@ -1650,7 +1647,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { traverse (static_cast<SemanticGraph::Type&> (u)); @@ -1674,7 +1671,7 @@ namespace CXX uc.set ("value", find_name ("value", set)); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { traverse (static_cast<SemanticGraph::Type&> (e)); @@ -1720,7 +1717,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -1816,13 +1813,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_name (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_name (t, "any_simple_type"); @@ -1830,7 +1827,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_name (t, "boolean"); @@ -1838,79 +1835,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_name (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_name (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_name (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_name (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_name (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_name (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_name (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_name (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_name (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_name (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_name (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_name (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_name (t, "negative_integer"); @@ -1918,19 +1915,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_name (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_name (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_name (t, "decimal"); @@ -1938,49 +1935,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_name (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_name (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_name (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_name (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_name (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_name (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_name (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_name (t, "language"); @@ -1989,7 +1986,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_name (t, "qname"); @@ -1998,19 +1995,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_name (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_name (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_name (t, "idrefs"); @@ -2018,7 +2015,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_name (t, "uri"); @@ -2026,13 +2023,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_name (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_name (t, "hex_binary"); @@ -2041,55 +2038,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_name (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_name (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_name (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_name (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_name (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_name (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_name (t, "gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_name (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_name (t, "time"); @@ -2097,20 +2094,20 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_name (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_name (t, "entities"); } private: - Void + void set_name (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); @@ -2125,7 +2122,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -2137,7 +2134,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2149,7 +2146,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2167,7 +2164,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2180,11 +2177,11 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -2294,11 +2291,11 @@ namespace CXX } } - Void TreeNameProcessor:: + void TreeNameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { process_impl (ops, tu, file, deep); } diff --git a/xsde/cxx/hybrid/tree-name-processor.hxx b/xsde/cxx/hybrid/tree-name-processor.hxx index fff1fb8..5b488fa 100644 --- a/xsde/cxx/hybrid/tree-name-processor.hxx +++ b/xsde/cxx/hybrid/tree-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_TREE_NAME_PROCESSOR_HXX #define CXX_HYBRID_TREE_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class TreeNameProcessor { public: - Void + void process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/tree-size-processor.cxx b/xsde/cxx/hybrid/tree-size-processor.cxx index 0d734ca..2872bf6 100644 --- a/xsde/cxx/hybrid/tree-size-processor.cxx +++ b/xsde/cxx/hybrid/tree-size-processor.cxx @@ -3,19 +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 <vector> +#include <iostream> + #include <cxx/hybrid/elements.hxx> #include <cxx/hybrid/tree-size-processor.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> - -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -23,53 +22,52 @@ namespace CXX { namespace { - typedef Cult::Containers::Set<String> TypeSet; - + typedef set<String> TypeSet; struct CustomType { - Boolean fixed; + bool fixed; String base; }; - typedef Cult::Containers::Map<String, CustomType> CustomTypeMap; + typedef map<String, CustomType> CustomTypeMap; - Boolean + bool test (SemanticGraph::Type& t) { return t.context ().count ("fixed") != 0; } - Void - set (SemanticGraph::Type& t, Boolean v) + void + set (SemanticGraph::Type& t, bool v) { t.context ().set ("fixed", v); } - Void - set (SemanticGraph::Compositor& c, Boolean v) + void + set (SemanticGraph::Compositor& c, bool v) { c.context ().set ("fixed", v); } - Boolean + bool get (SemanticGraph::Type& t) { - return t.context ().get<Boolean> ("fixed"); + return t.context ().get<bool> ("fixed"); } // // struct Particle: Traversal::Element { - Particle (Boolean& fixed, - Boolean& poly, + Particle (bool& fixed, + bool& poly, Traversal::NodeBase& type_traverser) : fixed_ (fixed), poly_ (poly), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { // Check the type. We need to do it even if fixed_ is @@ -91,7 +89,7 @@ namespace CXX } /* - virtual Void + virtual void traverse (SemanticGraph::Any&) { // Types with wildcards are always variable length. @@ -102,8 +100,8 @@ namespace CXX */ private: - Boolean& fixed_; - Boolean& poly_; + bool& fixed_; + bool& poly_; Traversal::NodeBase& type_traverser_; }; @@ -111,14 +109,14 @@ namespace CXX Traversal::Choice, Traversal::Sequence { - Compositor (Boolean& fixed, - Boolean& poly, + Compositor (bool& fixed, + bool& poly, Traversal::NodeBase& type_traverser) : fixed_ (fixed), poly_ (poly), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -127,7 +125,7 @@ namespace CXX // if (a.min () == 0) { - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -147,13 +145,13 @@ namespace CXX All::contains (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // Here we need to assign the size for the nested class in // all three cases because this choice might be in choice. // - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -172,13 +170,13 @@ namespace CXX fixed_ = false; } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Here we need to assign the size for the nested class in // all three cases because this sequence might be in choice. // - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -198,19 +196,19 @@ namespace CXX } private: - Boolean& fixed_; - Boolean& poly_; + bool& fixed_; + bool& poly_; Traversal::NodeBase& type_traverser_; }; struct Attribute: Traversal::Attribute { - Attribute (Boolean& fixed, Traversal::NodeBase& type_traverser) + Attribute (bool& fixed, Traversal::NodeBase& type_traverser) : fixed_ (fixed), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Simple types cannot be recursive. @@ -227,7 +225,7 @@ namespace CXX } /* - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { // Types with wildcards are always variable length. @@ -238,7 +236,7 @@ namespace CXX */ private: - Boolean& fixed_; + bool& fixed_; Traversal::NodeBase& type_traverser_; }; @@ -249,13 +247,13 @@ namespace CXX Traversal::Complex, Traversal::Enumeration { - Type (Boolean& valid, + Type (bool& valid, TypeSet& custom_data, CustomTypeMap& custom_type_map, TypeSet& poly_types, - Boolean stl_, - Boolean poly_, - Boolean enum_mapping) + bool stl_, + bool poly_, + bool enum_mapping) : valid_ (valid), custom_data_ (custom_data), custom_type_map_ (custom_type_map), @@ -266,19 +264,19 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!test (l)) set (l, false); } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { if (!test (u)) { - Boolean fixed (stl); + bool fixed (stl); // Check for custom data. // @@ -292,7 +290,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { if (!test (e)) @@ -313,7 +311,7 @@ namespace CXX return; } - Boolean fixed (true); + bool fixed (true); if (base_enum && !get (b)) fixed = false; @@ -330,7 +328,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Context& ctx (c.context ()); @@ -344,7 +342,7 @@ namespace CXX // Mark all the types involved in the cycle as recursive. // - for (Path::ReverseIterator i (path_.rbegin ()); *i != &c; ++i) + for (Path::reverse_iterator i (path_.rbegin ()); *i != &c; ++i) { (*i)->context ().set ("recursive", true); } @@ -354,7 +352,7 @@ namespace CXX ctx.set ("recurse", true); path_.push_back (&c); - Boolean fixed = true; + bool fixed = true; // First check our base. // @@ -373,7 +371,7 @@ namespace CXX // if (c.contains_compositor_p ()) { - Boolean poly (false); + bool poly (false); Particle particle (fixed, poly, *this); Compositor compositor (fixed, poly, *this); @@ -424,8 +422,8 @@ namespace CXX } private: - Void - set (SemanticGraph::Type& t, Boolean v) + void + set (SemanticGraph::Type& t, bool v) { using SemanticGraph::Complex; @@ -441,7 +439,7 @@ namespace CXX { // If our base is polymorphic then we are as well. // - Boolean pb (false); + bool pb (false); if (Complex* c = dynamic_cast<Complex*> (&t)) { pb = c->inherits_p () && @@ -460,7 +458,7 @@ namespace CXX // Check if this is a custom type. // - CustomTypeMap::Iterator i = custom_type_map_.find (name); + CustomTypeMap::iterator i = custom_type_map_.find (name); if (i != custom_type_map_.end ()) { @@ -481,15 +479,15 @@ namespace CXX } private: - Boolean& valid_; + bool& valid_; TypeSet& custom_data_; CustomTypeMap& custom_type_map_; TypeSet& poly_types_; - Boolean stl; - Boolean poly; - Boolean enum_; + bool stl; + bool poly; + bool enum_; - typedef Containers::Vector<SemanticGraph::Complex*> Path; + typedef vector<SemanticGraph::Complex*> Path; Path path_; }; @@ -550,14 +548,14 @@ namespace CXX Traversal::Fundamental::Entities { - FundType (Boolean stl_, TypeSet& poly_types) + FundType (bool stl_, TypeSet& poly_types) : stl (stl_), poly_types_ (poly_types) { } // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set (t, false); @@ -568,7 +566,7 @@ namespace CXX t.context ().set ("polymorphic", true); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set (t, stl); @@ -576,7 +574,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set (t, true); @@ -584,79 +582,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set (t, true); @@ -664,19 +662,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set (t, true); @@ -684,49 +682,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set (t, stl); @@ -735,7 +733,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set (t, stl); @@ -744,19 +742,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set (t, false); @@ -764,7 +762,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set (t, stl); @@ -772,13 +770,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set (t, false); @@ -787,55 +785,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set (t, true); @@ -843,27 +841,27 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set (t, false); } private: - Boolean stl; + bool stl; TypeSet& poly_types_; }; struct GlobalElement: Traversal::Element { GlobalElement (TypeSet& poly_types, - Boolean& valid, + bool& valid, const WarningSet& disabled_warnings) : poly_types_ (poly_types), valid_ (valid), warning_ (true) { @@ -872,7 +870,7 @@ namespace CXX warning_ = false; } - virtual Void + virtual void traverse (Type& e) { using SemanticGraph::Schema; @@ -945,7 +943,7 @@ namespace CXX private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -966,8 +964,8 @@ namespace CXX private: TypeSet& poly_types_; - Boolean& valid_; - Boolean warning_; + bool& valid_; + bool warning_; }; // Go into sourced/included/imported schemas while making sure @@ -977,12 +975,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 ()); @@ -994,7 +992,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1006,7 +1004,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1019,21 +1017,21 @@ namespace CXX } private: - Char const* seen_key_; + char const* seen_key_; }; - Char const* pass_one_key = "cxx-hybrid-size-processor-seen-one"; - Char const* pass_two_key = "cxx-hybrid-size-processor-seen-two"; + char const* pass_one_key = "cxx-hybrid-size-processor-seen-one"; + char const* pass_two_key = "cxx-hybrid-size-processor-seen-two"; - Boolean + bool process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const&, const WarningSet& disabled_warnings) { - Boolean valid (true); - Boolean stl (!ops.no_stl ()); - Boolean poly (ops.generate_polymorphic ()); + bool valid (true); + bool stl (!ops.no_stl ()); + bool poly (ops.generate_polymorphic ()); // Prepare a set of polymorphic types. // @@ -1127,7 +1125,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) continue; @@ -1238,7 +1236,7 @@ namespace CXX } } - Boolean TreeSizeProcessor:: + bool TreeSizeProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, diff --git a/xsde/cxx/hybrid/tree-size-processor.hxx b/xsde/cxx/hybrid/tree-size-processor.hxx index 6f13401..0023904 100644 --- a/xsde/cxx/hybrid/tree-size-processor.hxx +++ b/xsde/cxx/hybrid/tree-size-processor.hxx @@ -6,24 +6,21 @@ #ifndef CXX_HYBRID_TREE_SIZE_PROCESSOR_HXX #define CXX_HYBRID_TREE_SIZE_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> -#include <cxx/hybrid/options.hxx> - #include <xsde.hxx> +#include <types.hxx> + +#include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class TreeSizeProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, diff --git a/xsde/cxx/hybrid/tree-source.cxx b/xsde/cxx/hybrid/tree-source.cxx index dac6528..d6aed3a 100644 --- a/xsde/cxx/hybrid/tree-source.cxx +++ b/xsde/cxx/hybrid/tree-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << strlit (e.name ()); @@ -40,7 +40,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -251,7 +251,7 @@ namespace CXX } } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -273,7 +273,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -284,7 +284,7 @@ namespace CXX if (!name) return; - Boolean poly (polymorphic (l)); + bool poly (polymorphic (l)); SemanticGraph::Context& lc (l.context ()); if (poly || clone) @@ -453,7 +453,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -464,7 +464,7 @@ namespace CXX if (!name) return; - Boolean poly (polymorphic (u)); + bool poly (polymorphic (u)); SemanticGraph::Context& uc (u.context ()); os << "// " << comment (u.name ()) << endl @@ -647,7 +647,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.default_p ()) @@ -722,12 +722,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); - Boolean fund (false); + bool fund (false); { FundamentalType test (fund); test.dispatch (t); @@ -909,7 +909,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { String const& member (emember (c)); @@ -1044,7 +1044,7 @@ namespace CXX struct ChoiceFunc: Traversal::Choice, Context { - ChoiceFunc (Context& c, Boolean in_choice) + ChoiceFunc (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_free_ (c, ChoiceParticle::free), @@ -1054,14 +1054,14 @@ namespace CXX contains_alloc_ >> particle_alloc_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!in_choice_ && c.max () == 1 && c.min () == 1) { String const& arm_tag (earm_tag (c)); String const& arm_member (earm_member (c)); - UnsignedLong bad_tag (arm_tag_count (c)); + size_t bad_tag (arm_tag_count (c)); // void // arm (arm_tag) @@ -1097,7 +1097,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticle particle_free_; Traversal::ContainsParticle contains_free_; @@ -1108,12 +1108,12 @@ namespace CXX struct SequenceFunc: Traversal::Sequence, Context { - SequenceFunc (Context& c, Boolean in_choice) + SequenceFunc (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1124,7 +1124,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; // @@ -1138,13 +1138,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) { - Boolean def (a.default_p ()); - Boolean fl (fixed_length (a.type ())); + bool def (a.default_p ()); + bool fl (fixed_length (a.type ())); if (!fl) { @@ -1170,12 +1170,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1) { - Boolean fl (fixed_length (e.type ())); + bool fl (fixed_length (e.type ())); if (!fl) os << "this->" << emember (e) << " = 0;"; @@ -1193,7 +1193,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1218,7 +1218,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () == 1) @@ -1246,7 +1246,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () == 1) @@ -1275,7 +1275,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1299,7 +1299,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1) @@ -1322,7 +1322,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1356,7 +1356,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () == 1) @@ -1393,7 +1393,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () == 1) @@ -1431,7 +1431,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1458,7 +1458,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& member (emember (e)); @@ -1482,7 +1482,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (a.min () == 0) @@ -1507,7 +1507,7 @@ namespace CXX contains_copy_ >> particle_copy_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.min () == 0) @@ -1547,7 +1547,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.min () == 0) @@ -1575,7 +1575,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1602,7 +1602,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& member (emember (e)); @@ -1626,7 +1626,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (a.min () == 0) @@ -1651,7 +1651,7 @@ namespace CXX contains_assign_ >> particle_assign_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.min () == 0) @@ -1691,7 +1691,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.min () == 0) @@ -1719,7 +1719,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1727,7 +1727,7 @@ namespace CXX String const& name (ename (a)); SemanticGraph::Type& t (a.type ()); - Boolean opt (a.optional_p () && !a.default_p ()); + bool opt (a.optional_p () && !a.default_p ()); if (opt) os << "if (this->" << epresent (a) << " ())"; @@ -1753,7 +1753,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); @@ -1772,7 +1772,7 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean opt (e.min () == 0); + bool opt (e.min () == 0); if (opt) os << "if (this->" << epresent (e) << " ())"; @@ -1797,7 +1797,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1840,7 +1840,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1892,7 +1892,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << etag (e) << ":" @@ -1904,7 +1904,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // In choice there are no inline compositors. @@ -1924,7 +1924,7 @@ namespace CXX } else { - Boolean opt (c.min () == 0); + bool opt (c.min () == 0); if (opt) os << "if (this->" << epresent (c) << " ())"; @@ -1962,7 +1962,7 @@ namespace CXX contains_particle_ >> particle_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -2047,7 +2047,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -2056,7 +2056,7 @@ namespace CXX if (a.min () != 0) return; - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String const& type (etype (a)); String const& scope (Context::scope (a)); @@ -2208,7 +2208,7 @@ namespace CXX struct Choice: Traversal::Choice, Context { Choice (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_func) : Context (c), in_choice_ (in_choice), @@ -2226,7 +2226,7 @@ namespace CXX contains_clone_ >> particle_clone_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -2238,11 +2238,11 @@ namespace CXX String const& arm (earm (c)); String const& arm_tag (earm_tag (c)); String const& arm_member (earm_member (c)); - UnsignedLong bad_tag (arm_tag_count (c)); + size_t bad_tag (arm_tag_count (c)); String const& scope (Context::scope (c)); - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); // c-tor () // @@ -2435,7 +2435,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_func_; ChoiceParticle particle_free_; @@ -2458,7 +2458,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_ctor, Traversal::ContainsParticle& contains_dtor, Traversal::ContainsParticle& contains_copy, @@ -2476,7 +2476,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -2487,7 +2487,7 @@ namespace CXX String const& type (etype (s)); String const& scope (Context::scope (s)); - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); // c-tor () // @@ -2632,7 +2632,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_ctor_; Traversal::ContainsParticle& contains_dtor_; Traversal::ContainsParticle& contains_copy_; @@ -2835,7 +2835,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -2846,9 +2846,9 @@ namespace CXX if (!name) return; - Boolean fl (fixed_length (c)); - Boolean poly (polymorphic (c)); - Boolean restriction (restriction_p (c)); + bool fl (fixed_length (c)); + bool poly (polymorphic (c)); + bool restriction (restriction_p (c)); os << "// " << comment (c.name ()) << endl << "//" << endl @@ -3221,7 +3221,7 @@ namespace CXX }; } - Void + void generate_tree_source (Context& ctx) { // Needed for placement new. diff --git a/xsde/cxx/hybrid/tree-source.hxx b/xsde/cxx/hybrid/tree-source.hxx index 0c017aa..199f4e6 100644 --- a/xsde/cxx/hybrid/tree-source.hxx +++ b/xsde/cxx/hybrid/tree-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_source (Context&); } } diff --git a/xsde/cxx/hybrid/tree-type-map.cxx b/xsde/cxx/hybrid/tree-type-map.cxx index 7825725..3304b7c 100644 --- a/xsde/cxx/hybrid/tree-type-map.cxx +++ b/xsde/cxx/hybrid/tree-type-map.cxx @@ -3,15 +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/elements.hxx> #include <cxx/hybrid/tree-type-map.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> - -#include <iostream> +using namespace std; namespace CXX { @@ -47,7 +48,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& xn (t.name ()); @@ -55,7 +56,7 @@ namespace CXX if (parser_ != 0) { - if (t.context ().get<Boolean> ("fixed")) + if (t.context ().get<bool> ("fixed")) parser_->types_push_back (xn, qn); else parser_->types_push_back (xn, qn + L"*"); @@ -84,7 +85,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { String include; @@ -144,7 +145,7 @@ namespace CXX schema_set_.insert (&root); } - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -158,7 +159,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -170,7 +171,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -183,11 +184,11 @@ namespace CXX } private: - Containers::Set<SemanticGraph::Schema*> schema_set_; + set<SemanticGraph::Schema*> schema_set_; }; } - Void + void generate_tree_type_map (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, XSDFrontend::SemanticGraph::Path const& path, diff --git a/xsde/cxx/hybrid/tree-type-map.hxx b/xsde/cxx/hybrid/tree-type-map.hxx index 0f677cd..186b0d4 100644 --- a/xsde/cxx/hybrid/tree-type-map.hxx +++ b/xsde/cxx/hybrid/tree-type-map.hxx @@ -6,21 +6,17 @@ #ifndef CXX_HYBRID_TREE_TYPE_MAP_HXX #define CXX_HYBRID_TREE_TYPE_MAP_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - - Void + void generate_tree_type_map (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, diff --git a/xsde/cxx/hybrid/validator.cxx b/xsde/cxx/hybrid/validator.cxx index 2b13097..ef1f010 100644 --- a/xsde/cxx/hybrid/validator.cxx +++ b/xsde/cxx/hybrid/validator.cxx @@ -3,16 +3,16 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/hybrid/validator.hxx> +#include <set> +#include <iostream> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> #include <cxx/hybrid/elements.hxx> +#include <cxx/hybrid/validator.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -30,7 +30,7 @@ namespace CXX SemanticGraph::Path const& path, Hybrid::options const& ops, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, ops, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -43,8 +43,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 (); @@ -79,10 +79,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_; }; // @@ -100,7 +100,7 @@ namespace CXX *this >> schema_names_ >> ns_ >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -144,7 +144,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -153,7 +153,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("H001")) @@ -177,7 +177,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -197,7 +197,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -211,12 +211,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -258,18 +258,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -289,12 +289,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -333,9 +333,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -354,19 +354,19 @@ namespace CXX struct GlobalElementCount: Traversal::Element { - GlobalElementCount (UnsignedLong& count) + GlobalElementCount (size_t& count) : count_ (count) { } - virtual Void + virtual void traverse (SemanticGraph::Element&) { count_++; } private: - UnsignedLong& count_; + size_t& count_; }; struct ParserValidation: Traversal::All, @@ -383,7 +383,7 @@ namespace CXX *this >> contains_particle_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -403,7 +403,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!issued_) @@ -421,7 +421,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!issued_) @@ -453,7 +453,7 @@ namespace CXX Traversal::Sequence::traverse (s); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (!issued_ && !restriction_p (c)) @@ -474,20 +474,20 @@ namespace CXX } private: - Boolean issued_; + bool issued_; Traversal::ContainsCompositor contains_compositor_; Traversal::ContainsParticle contains_particle_; }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -502,9 +502,9 @@ namespace CXX // // - Boolean par (ops.generate_parser ()); - Boolean ser (ops.generate_serializer ()); - Boolean agg (ops.generate_aggregate ()); + bool par (ops.generate_parser ()); + bool ser (ops.generate_serializer ()); + bool agg (ops.generate_aggregate ()); if (agg && !par && !ser && !ctx.is_disabled ("H002")) { @@ -524,7 +524,7 @@ namespace CXX ops.root_element ().empty () && !ctx.is_disabled ("H003")) { - UnsignedLong count (0); + size_t count (0); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/validator.hxx b/xsde/cxx/hybrid/validator.hxx index ba4cc80..360ebc0 100644 --- a/xsde/cxx/hybrid/validator.hxx +++ b/xsde/cxx/hybrid/validator.hxx @@ -6,24 +6,21 @@ #ifndef CXX_HYBRID_VALIDATOR_HXX #define CXX_HYBRID_VALIDATOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> -#include <cxx/hybrid/options.hxx> - #include <xsde.hxx> +#include <types.hxx> + +#include <cxx/hybrid/options.hxx> namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, diff --git a/xsde/cxx/options.cli b/xsde/cxx/options.cli index 45425ea..22c4f27 100644 --- a/xsde/cxx/options.cli +++ b/xsde/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>; @@ -15,13 +13,13 @@ namespace CXX { class options: ::options = 0 { - Cult::Types::NarrowString --output-dir + NarrowString --output-dir { "<dir>", "Write generated files to <dir> instead of the current directory." }; - Cult::Types::NarrowString --char-encoding = "utf8" + NarrowString --char-encoding = "utf8" { "<enc>", "Specify the application character encoding. Valid values are \cb{utf8} @@ -99,7 +97,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 @@ -111,7 +109,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 @@ -124,7 +122,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 @@ -181,7 +179,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 @@ -198,7 +196,7 @@ namespace CXX \cb{#include} directives." }; - Cult::Types::NarrowString --include-prefix + NarrowString --include-prefix { "<prefix>", "Add <prefix> to generated \cb{#include} directive paths. @@ -213,7 +211,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 @@ -242,7 +240,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 @@ -254,7 +252,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 @@ -263,28 +261,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. @@ -304,7 +302,7 @@ namespace CXX See also the REGEX 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. @@ -315,7 +313,7 @@ namespace CXX AND 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. @@ -326,7 +324,7 @@ namespace CXX AND SHELL QUOTING section below." }; - Cult::Types::NarrowString --fwd-regex + NarrowString --fwd-regex { "<regex>", "Use the provided expression to construct the name of the forward @@ -337,7 +335,7 @@ namespace CXX // Prologues/epilogues. // - std::vector<Cult::Types::NarrowString> --hxx-prologue + NarrowStrings --hxx-prologue { "<text>", "Insert <text> at the beginning of the header file. @@ -351,7 +349,7 @@ namespace CXX object model files only." }; - std::vector<Cult::Types::NarrowString> --ixx-prologue + NarrowStrings --ixx-prologue { "<text>", "Insert <text> at the beginning of the inline file. For the C++/Hybrid @@ -359,7 +357,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector<Cult::Types::NarrowString> --cxx-prologue + NarrowStrings --cxx-prologue { "<text>", "Insert <text> at the beginning of the source file. For the C++/Hybrid @@ -367,13 +365,13 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - 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 @@ -382,7 +380,7 @@ namespace CXX \cb{--hxx-prologue} option for details." }; - std::vector<Cult::Types::NarrowString> --hxx-epilogue + NarrowStrings --hxx-epilogue { "<text>", "Insert <text> at the end of the header file. For the C++/Hybrid @@ -390,7 +388,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector<Cult::Types::NarrowString> --ixx-epilogue + NarrowStrings --ixx-epilogue { "<text>", "Insert <text> at the end of the inline file. For the C++/Hybrid @@ -398,7 +396,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector<Cult::Types::NarrowString> --cxx-epilogue + NarrowStrings --cxx-epilogue { "<text>", "Insert <text> at the end of the source file. For the C++/Hybrid @@ -406,13 +404,13 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - 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 @@ -421,7 +419,7 @@ namespace CXX \cb{--hxx-prologue} option for details." }; - Cult::Types::NarrowString --hxx-prologue-file + NarrowString --hxx-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the header file. @@ -435,7 +433,7 @@ namespace CXX object model files only." }; - Cult::Types::NarrowString --ixx-prologue-file + NarrowString --ixx-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the inline file. @@ -444,7 +442,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --cxx-prologue-file + NarrowString --cxx-prologue-file { "<file>", "Insert the content of the <file> at the beginning of the source file. @@ -453,14 +451,14 @@ namespace CXX for details." }; - 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 @@ -469,7 +467,7 @@ namespace CXX with a file key. See the \cb{--hxx-prologue-file} option for details." }; - Cult::Types::NarrowString --hxx-epilogue-file + NarrowString --hxx-epilogue-file { "<file>", "Insert the content of the <file> at the end of the header file. @@ -478,7 +476,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --ixx-epilogue-file + NarrowString --ixx-epilogue-file { "<file>", "Insert the content of the <file> at the end of the inline file. @@ -487,7 +485,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --cxx-epilogue-file + NarrowString --cxx-epilogue-file { "<file>", "Insert the content of the <file> at the end of the source file. @@ -496,14 +494,14 @@ namespace CXX for details." }; - 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 diff --git a/xsde/cxx/parser/attribute-validation-source.cxx b/xsde/cxx/parser/attribute-validation-source.cxx index c82e8f0..97fc536 100644 --- a/xsde/cxx/parser/attribute-validation-source.cxx +++ b/xsde/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 == " << L << 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)); @@ -173,7 +173,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "if ("; @@ -201,7 +201,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -219,7 +219,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -254,16 +254,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); @@ -444,7 +444,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/attribute-validation-source.hxx b/xsde/cxx/parser/attribute-validation-source.hxx index fd79ef7..6e6663d 100644 --- a/xsde/cxx/parser/attribute-validation-source.hxx +++ b/xsde/cxx/parser/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsde/cxx/parser/characters-validation-source.cxx b/xsde/cxx/parser/characters-validation-source.cxx index f17b135..b93e280 100644 --- a/xsde/cxx/parser/characters-validation-source.cxx +++ b/xsde/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/xsde/cxx/parser/characters-validation-source.hxx b/xsde/cxx/parser/characters-validation-source.hxx index b302a16..e1692ec 100644 --- a/xsde/cxx/parser/characters-validation-source.hxx +++ b/xsde/cxx/parser/characters-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_characters_validation_source (Context&); } } diff --git a/xsde/cxx/parser/driver-source.cxx b/xsde/cxx/parser/driver-source.cxx index 2e8db21..f46bbe3 100644 --- a/xsde/cxx/parser/driver-source.cxx +++ b/xsde/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); @@ -50,7 +48,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -145,7 +143,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -157,7 +155,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -171,7 +169,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -193,13 +191,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"); @@ -207,7 +205,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -215,79 +213,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"); @@ -295,19 +293,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"); @@ -315,49 +313,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"); @@ -366,7 +364,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -375,19 +373,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"); @@ -395,7 +393,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -403,13 +401,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"); @@ -418,55 +416,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"); @@ -474,20 +472,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 ()) @@ -505,7 +503,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; @@ -543,12 +541,12 @@ namespace CXX // struct ParticleArg: Traversal::Element, Context { - ParticleArg (Context& c, TypeInstanceMap& map, Boolean& first) + ParticleArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!first_) @@ -561,17 +559,17 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (Type& a) { if (!first_) @@ -584,7 +582,7 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct ArgList : Traversal::Complex, @@ -608,7 +606,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -620,7 +618,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -644,7 +642,7 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; + bool first_; }; struct ParserConnect: Traversal::List, @@ -674,7 +672,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -687,7 +685,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -716,7 +714,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -739,7 +737,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set<SemanticGraph::Type*> type_set_; + set<SemanticGraph::Type*> type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -762,7 +760,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options.root_element_first ()) @@ -784,7 +782,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure diff --git a/xsde/cxx/parser/driver-source.hxx b/xsde/cxx/parser/driver-source.hxx index d8b1e28..e19b2da 100644 --- a/xsde/cxx/parser/driver-source.hxx +++ b/xsde/cxx/parser/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_driver_source (Context&); } } diff --git a/xsde/cxx/parser/element-validation-source.cxx b/xsde/cxx/parser/element-validation-source.cxx index e1216f7..a766a59 100644 --- a/xsde/cxx/parser/element-validation-source.cxx +++ b/xsde/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,7 +18,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> Particles; // Find particle that can be absent. // @@ -27,7 +29,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Choice; @@ -49,12 +51,12 @@ namespace CXX Traversal::Element, Traversal::Any { - IsOptional (Boolean& r) + IsOptional (bool& r) : r_ (r) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!r_ && c.min () == 0) @@ -73,7 +75,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!r_ && s.min () == 0) @@ -88,7 +90,7 @@ namespace CXX !r_ && i != s.contains_end (); ++i) { - Boolean r (false); + bool r (false); IsOptional test (r); test.dispatch (i->particle ()); if (!r) @@ -98,14 +100,14 @@ namespace CXX r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!r_ && e.min () == 0) r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (!r_ && a.min () == 0) @@ -113,21 +115,21 @@ namespace CXX } private: - Boolean& r_; + bool& r_; }; private: - Boolean optional_; + bool optional_; IsOptional is_optional_; SemanticGraph::Particle*& result_; }; // // - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx); - Void + void choice_arm_call (SemanticGraph::Particle* p, SemanticGraph::Choice* c, Context* ctx) @@ -158,7 +160,7 @@ namespace CXX } } - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx) { using SemanticGraph::Choice; @@ -207,11 +209,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (e.name ()); - Boolean subst (poly_code && e.global_p ()); + bool subst (poly_code && e.global_p ()); if (subst) os << "("; @@ -247,7 +249,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -294,7 +296,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // This compositor should already have been tested for @@ -302,9 +304,9 @@ namespace CXX // Particles const& p (c.context ().get<Particles> ("p: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) @@ -335,7 +337,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); @@ -343,7 +345,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << strlit (e.name ()); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (*a.namespace_begin ()); @@ -351,7 +353,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << "\"*\""; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { Particles const& p (c.context ().get<Particles> ("p:prefixes")); @@ -374,7 +376,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; @@ -383,7 +385,7 @@ namespace CXX if (Element* e = dynamic_cast<Element*> (&p)) { SemanticGraph::Type& type (e->type ()); - Boolean poly (poly_code && !anonymous (type)); + bool poly (poly_code && !anonymous (type)); String const& name (ename (*e)); String fq_type (fq_name (type)); @@ -522,10 +524,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong state (e.context ().get<UnsignedLong> ("p:state")); + size_t state (e.context ().get<size_t> ("p:state")); SemanticGraph::Compositor& c ( e.contained_particle ().compositor ()); @@ -549,16 +551,15 @@ namespace CXX // Make the call to _present if we haven't seen any // elements yet. // - UnsignedLong state_count ( - c.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (c.context().get<size_t> ("p:state-count")); if (state_count > 1) { os << "if ("; - Boolean sub (false); + bool sub (false); - for (UnsignedLong i (0); i < state_count; ++i) + for (size_t i (0); i < state_count; ++i) { if (i == state) continue; @@ -609,14 +610,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { using SemanticGraph::Element; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state << "UL:" << endl << "{"; @@ -695,20 +696,20 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); - UnsignedLong state (cc.get<UnsignedLong> ("p:state")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); + size_t state (cc.get<size_t> ("p:state")); String func (choice ? "choice_" : "sequence_"); @@ -717,7 +718,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) @@ -730,7 +731,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -755,7 +756,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -766,8 +767,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -784,10 +784,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -908,8 +907,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) @@ -926,10 +925,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 << "{" @@ -1009,19 +1008,19 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1030,7 +1029,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) @@ -1043,7 +1042,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -1068,7 +1067,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1079,8 +1078,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1097,10 +1095,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1253,7 +1250,7 @@ namespace CXX } private: - UnsignedLong state_; + size_t state_; String next_state_; ParticleName particle_name_; @@ -1274,7 +1271,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) // Empty compositor. @@ -1322,7 +1319,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> ("p:state")); + size_t state (e.context ().get<size_t> ("p:state")); os << "if (count[" << state << "UL] == 0)" << "{" @@ -1348,7 +1345,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -1358,7 +1355,7 @@ namespace CXX if (!cc.count ("p:comp-number")) // Empty compositor. return; - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t n (cc.get<size_t> ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "choice_" << n << " (unsigned long& state," << endl @@ -1411,7 +1408,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) // Empty compositor. @@ -1419,7 +1416,7 @@ namespace CXX using SemanticGraph::Compositor; - UnsignedLong n (s.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (s.context ().get<size_t> ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "sequence_" << n << " (unsigned long& state," << endl @@ -1444,7 +1441,7 @@ namespace CXX os << "switch (state)" << "{"; - UnsignedLong state (0); + size_t state (0); for (Compositor::ContainsIterator ci (s.contains_begin ()), ce (s.contains_end ()); ci != ce;) @@ -1467,7 +1464,7 @@ namespace CXX ci->particle ().is_a<Compositor> () && !ci->particle ().context().count ("p: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); @@ -1502,7 +1499,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // Clear the counts and push the initial state. @@ -1514,7 +1511,7 @@ namespace CXX traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "v_state_& vs = *static_cast< v_state_* > (" << @@ -1543,7 +1540,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { // The 'all' state machine reaches the final state only @@ -1562,19 +1559,19 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1606,7 +1603,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. @@ -1622,7 +1619,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -1647,7 +1644,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1658,8 +1655,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1676,10 +1672,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1845,7 +1840,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { os << "all_0 (vd.state, v_all_count_.top (), " << @@ -1853,7 +1848,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "assert (vd.func != 0);" @@ -1881,7 +1876,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Element; @@ -1901,7 +1896,7 @@ namespace CXX (poly_runtime ? "0, " : "") << "true);" << "}"; - if (a.context ().get<UnsignedLong> ("p:effective-min") != 0) + if (a.context ().get<size_t> ("p:effective-min") != 0) { os << "else" << endl << "this->_schema_error (" << @@ -1919,14 +1914,13 @@ namespace CXX << "v_all_count_.pop ();"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; - UnsignedLong min ( - c.context ().get<UnsignedLong> ("p:effective-min")); + size_t min (c.context ().get<size_t> ("p:effective-min")); os << "v_state_& vs = *static_cast< v_state_* > (" << "this->v_state_stack_.top ());" @@ -2019,7 +2013,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { // Nothing to generate if we don't have any elements and wildcards. @@ -2036,7 +2030,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> ()); @@ -2284,7 +2278,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { ctx.os << "#include <assert.h>" << endl diff --git a/xsde/cxx/parser/element-validation-source.hxx b/xsde/cxx/parser/element-validation-source.hxx index 8e40093..23e24f2 100644 --- a/xsde/cxx/parser/element-validation-source.hxx +++ b/xsde/cxx/parser/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx index 2f0c7e3..46518fa 100644 --- a/xsde/cxx/parser/elements.cxx +++ b/xsde/cxx/parser/elements.cxx @@ -171,7 +171,7 @@ namespace CXX return t.context ().get<String> ("p:impl"); } - Boolean Context:: + bool Context:: has_facets (SemanticGraph::Complex& c) { if (restriction_p (c)) @@ -234,20 +234,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/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 179eaec..eaad3f7 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -90,7 +90,7 @@ namespace CXX } public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -164,7 +164,7 @@ namespace CXX public: - Boolean + bool has_facets (SemanticGraph::Complex& c); public: @@ -175,13 +175,13 @@ namespace CXX String& list_base; String& parser_map; - Boolean validation; - Boolean exceptions; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean mixin; - Boolean tiein; + bool validation; + bool exceptions; + bool poly_code; + bool poly_runtime; + bool reset; + bool mixin; + bool tiein; Regex const* hxx_expr; Regex const* ixx_expr; @@ -212,13 +212,13 @@ namespace CXX Traversal::Fundamental::Entity { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -226,74 +226,74 @@ 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; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { r_ = true; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -301,12 +301,12 @@ namespace CXX // struct RequiredAttributeTest: Traversal::Attribute { - RequiredAttributeTest (Boolean& result) + RequiredAttributeTest (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (!result_ && !a.optional_p ()) @@ -314,7 +314,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; @@ -323,9 +323,9 @@ namespace CXX struct ParticleParamDecl: Traversal::Element, Context { ParticleParamDecl (Context& c, - Boolean& first, - Boolean name_arg, - Boolean poly) + bool& first, + bool name_arg, + bool poly) : Context (c), first_ (first), name_arg_ (name_arg), @@ -334,12 +334,12 @@ namespace CXX { } - ParticleParamDecl (Context& c, Boolean* result, Boolean poly) + ParticleParamDecl (Context& c, bool* result, bool poly) : Context (c), first_ (name_arg_), poly_ (poly), result_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -368,15 +368,15 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct AttributeParamDecl: Traversal::Attribute, Context { - AttributeParamDecl (Context& c, Boolean& first, Boolean name_arg) + AttributeParamDecl (Context& c, bool& first, bool name_arg) : Context (c), first_ (first), name_arg_ (name_arg), @@ -384,12 +384,12 @@ namespace CXX { } - AttributeParamDecl (Context& c, Boolean* result) + AttributeParamDecl (Context& c, bool* result) : Context (c), first_ (name_arg_), result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -412,16 +412,16 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool* result_; }; struct ParserParamDecl : Traversal::Complex, Traversal::List, Context { - ParserParamDecl (Context& c, Boolean name_arg, Boolean poly) + ParserParamDecl (Context& c, bool name_arg, bool poly) : Context (c), particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), @@ -440,7 +440,7 @@ namespace CXX names_ >> attribute_; } - ParserParamDecl (Context& c, Boolean* result, Boolean poly) + ParserParamDecl (Context& c, bool* result, bool poly) : Context (c), particle_ (c, result, poly), attribute_ (c, result), @@ -457,7 +457,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -469,7 +469,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -505,20 +505,20 @@ namespace CXX AttributeParamDecl attribute_; Traversal::Names names_; - Boolean first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct ParserParamTest { - ParserParamTest (Context& c, Boolean& result, Boolean poly) + ParserParamTest (Context& c, bool& result, bool poly) : impl_ (c, &result, poly) { } - Void + void traverse (SemanticGraph::Complex& c) { impl_.traverse (c); @@ -532,16 +532,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, @@ -563,20 +563,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: @@ -599,7 +599,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx index b226cb9..f78291e 100644 --- a/xsde/cxx/parser/generator.cxx +++ b/xsde/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> @@ -70,7 +67,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/e, an XML Schema\n" @@ -91,7 +88,7 @@ namespace CXX "//\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/e, an XML Schema to\n" @@ -101,7 +98,7 @@ namespace CXX "// license text for 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/e,\n" @@ -110,14 +107,14 @@ namespace CXX "//\n\n"; } - Void Parser::Generator:: + void Parser::Generator:: usage () { CXX::Parser::options::print_usage (wcout); CXX::options::print_usage (wcout); } - Void Parser::Generator:: + void Parser::Generator:: process_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -129,7 +126,7 @@ namespace CXX namespace { template <typename S> - Void + void open (S& ifs, NarrowString const& path) { try @@ -154,7 +151,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -174,7 +171,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -190,13 +187,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, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) @@ -207,7 +204,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 @@ -223,11 +220,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 ()); @@ -247,7 +244,7 @@ namespace CXX proc.process (ops, schema, file_path, true); } - Boolean validation (!ops.suppress_validation ()); + bool validation (!ops.suppress_validation ()); // Compute state machine info. // @@ -409,8 +406,8 @@ namespace CXX // Generate code. // - 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); NarrowString name (file_path.leaf ()); NarrowString skel_suffix (ops.skel_file_suffix ()); @@ -709,7 +706,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -752,7 +749,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/xsde/cxx/parser/generator.hxx b/xsde/cxx/parser/generator.hxx index c2a0177..5cfed0a 100644 --- a/xsde/cxx/parser/generator.hxx +++ b/xsde/cxx/parser/generator.hxx @@ -6,34 +6,27 @@ #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 <xsde.hxx> - +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/parser/options.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); // Assign names to global declarations. // - static Void + static void process_names (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); @@ -42,13 +35,13 @@ namespace CXX // struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/parser/impl-header.cxx b/xsde/cxx/parser/impl-header.cxx index e909ce5..2ffb493 100644 --- a/xsde/cxx/parser/impl-header.cxx +++ b/xsde/cxx/parser/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -66,7 +66,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -113,7 +113,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -145,7 +145,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& arg (arg_type (e.type ())); @@ -169,7 +169,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -204,12 +204,12 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -277,7 +277,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/impl-header.hxx b/xsde/cxx/parser/impl-header.hxx index d72ab80..e534130 100644 --- a/xsde/cxx/parser/impl-header.hxx +++ b/xsde/cxx/parser/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_header (Context&); } } diff --git a/xsde/cxx/parser/impl-source.cxx b/xsde/cxx/parser/impl-source.cxx index 5ad9a02..35df1b1 100644 --- a/xsde/cxx/parser/impl-source.cxx +++ b/xsde/cxx/parser/impl-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -127,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -205,7 +205,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -272,7 +272,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Complex; @@ -319,7 +319,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Complex; @@ -376,10 +376,10 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); + bool hb (c.inherits_p ()); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -503,7 +503,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { if (ctx.options.generate_print_impl ()) diff --git a/xsde/cxx/parser/impl-source.hxx b/xsde/cxx/parser/impl-source.hxx index 22587bd..7449e97 100644 --- a/xsde/cxx/parser/impl-source.hxx +++ b/xsde/cxx/parser/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_source (Context&); } } diff --git a/xsde/cxx/parser/name-processor.cxx b/xsde/cxx/parser/name-processor.cxx index 2483889..d0cd8b1 100644 --- a/xsde/cxx/parser/name-processor.cxx +++ b/xsde/cxx/parser/name-processor.cxx @@ -3,16 +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/elements.hxx> #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 { @@ -22,7 +24,7 @@ namespace CXX { // // - typedef Cult::Containers::Set<String> NameSet; + typedef set<String> NameSet; class Context: public CXX::Context { @@ -64,7 +66,7 @@ namespace CXX { String name (escape (n + suffix)); - 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; @@ -85,30 +87,30 @@ 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; - Boolean const tiein; + bool const impl; + bool const tiein; String const& skel_suffix; String const& impl_suffix; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; - Boolean validation; - Boolean polymorphic; + bool validation; + bool polymorphic; }; // Primary names. // struct PrimaryParticle: Traversal::Element, Context { - PrimaryParticle (Context& c, NameSet& set, Boolean restriction) + PrimaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -130,17 +132,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct PrimaryAttribute: Traversal::Attribute, Context { - PrimaryAttribute (Context& c, NameSet& set, Boolean restriction) + PrimaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -162,7 +164,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -176,12 +178,12 @@ namespace CXX Traversal::Sequence, Context { - ParticleTag (Context& c, NameSet& set, Boolean restriction) + ParticleTag (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -202,7 +204,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -220,7 +222,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -240,7 +242,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -262,7 +264,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryCompositor: Traversal::All, @@ -270,7 +272,7 @@ namespace CXX Traversal::Sequence, Context { - SecondaryCompositor (Context& c, NameSet& set, Boolean restriction) + SecondaryCompositor (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction), @@ -279,7 +281,7 @@ namespace CXX contain_particle_tag_ >> particle_tag_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -294,7 +296,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -324,7 +326,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { SemanticGraph::Context& sc (s.context ()); @@ -370,7 +372,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; ParticleTag particle_tag_; Traversal::ContainsParticle contain_particle_tag_; @@ -378,15 +380,15 @@ namespace CXX struct SecondaryParticle: Traversal::Element, Context { - SecondaryParticle (Context& c, NameSet& set, Boolean restriction) + SecondaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean poly ( + bool poly ( polymorphic && !e.type ().context ().count ("anonymous")); SemanticGraph::Context& ec (e.context ()); @@ -418,17 +420,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryAttribute: Traversal::Attribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean restriction) + SecondaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -458,7 +460,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -471,7 +473,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -493,7 +495,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 ()) { @@ -607,7 +609,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& c (t.context ()); @@ -679,7 +681,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; @@ -702,7 +704,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -798,13 +800,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_names (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_names (t, "any_simple_type"); @@ -812,7 +814,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_names (t, "boolean"); @@ -820,79 +822,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_names (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_names (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_names (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_names (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_names (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_names (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_names (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_names (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_names (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_names (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_names (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_names (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_names (t, "negative_integer"); @@ -900,19 +902,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_names (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_names (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_names (t, "decimal"); @@ -920,49 +922,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_names (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_names (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_names (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_names (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_names (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_names (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_names (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_names (t, "language"); @@ -971,7 +973,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_names (t, "qname"); @@ -980,19 +982,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_names (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_names (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_names (t, "idrefs"); @@ -1000,7 +1002,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_names (t, "uri"); @@ -1008,13 +1010,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_names (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_names (t, "hex_binary"); @@ -1023,56 +1025,56 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_names (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_names (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_names (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_names (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_names (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_names (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_names (t, "gyear");; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_names (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_names (t, "time"); @@ -1080,13 +1082,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_names (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_names (t, "entities"); @@ -1105,12 +1107,12 @@ namespace CXX return escape (base + impl_suffix); } - Void + void set_names (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); - WideChar const* ns = validation + wchar_t const* ns = validation ? L"::xsde::cxx::parser::validating::" : L"::xsde::cxx::parser::non_validating::"; @@ -1136,7 +1138,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1148,7 +1150,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1160,7 +1162,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1178,7 +1180,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1191,11 +1193,11 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -1289,11 +1291,11 @@ namespace CXX } } - Void NameProcessor:: + void NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { process_impl (ops, tu, file, deep); } diff --git a/xsde/cxx/parser/name-processor.hxx b/xsde/cxx/parser/name-processor.hxx index 25aceaa..1a28e47 100644 --- a/xsde/cxx/parser/name-processor.hxx +++ b/xsde/cxx/parser/name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_PARSER_NAME_PROCESSOR_HXX #define CXX_PARSER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/parser/options.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class NameProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/parser/options.cli b/xsde/cxx/parser/options.cli index 552b473..9b07011 100644 --- a/xsde/cxx/parser/options.cli +++ b/xsde/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>. @@ -116,7 +114,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "<element>", "Indicate that <element> is the document root. This information is @@ -125,21 +123,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 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 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 @@ -147,7 +145,7 @@ namespace CXX XML Schema types and 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/xsde/cxx/parser/parser-forward.cxx b/xsde/cxx/parser/parser-forward.cxx index f2ee20b..4687fdc 100644 --- a/xsde/cxx/parser/parser-forward.cxx +++ b/xsde/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/xsde/cxx/parser/parser-forward.hxx b/xsde/cxx/parser/parser-forward.hxx index c96f063..b93b638 100644 --- a/xsde/cxx/parser/parser-forward.hxx +++ b/xsde/cxx/parser/parser-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_forward (Context&); } } diff --git a/xsde/cxx/parser/parser-header.cxx b/xsde/cxx/parser/parser-header.cxx index f9abf09..9986e87 100644 --- a/xsde/cxx/parser/parser-header.cxx +++ b/xsde/cxx/parser/parser-header.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/parser/parser-header.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/parser/parser-header.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Parser @@ -23,21 +25,21 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); SemanticGraph::Type& base (e.inherits ().base ()); String fq_base (fq_name (base)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << fq_base @@ -54,7 +56,7 @@ namespace CXX String const& ret (ret_type (e)); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); + bool same (ret == base_ret); os << "virtual " << ret << endl << post_name (e) << " ()" << @@ -91,7 +93,7 @@ namespace CXX // If our base has pure virtual post, override it here. // - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -110,8 +112,7 @@ namespace CXX // Some schemas have duplicate enumerators so we have to create // a set out of them in order get the accurate count. // - typedef Cult::Containers::Set<String> Enums; - Enums enums; + set<String> enums; for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -137,7 +138,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -253,7 +254,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -322,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& p) { if (first_) @@ -334,7 +335,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct CompositorCallback: Traversal::All, @@ -347,7 +348,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -365,7 +366,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -392,7 +393,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -440,7 +441,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -467,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -494,7 +495,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& parser (eparser (e)); @@ -519,7 +520,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "void" << endl @@ -538,7 +539,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String type (fq_name (e.type ())); @@ -560,7 +561,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << fq_name (a.type ()) << "* " << emember (a) << ";"; @@ -581,14 +582,13 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (a.context().get<size_t> ("p:state-count")); os << "void" << endl << "all_0 (unsigned long&," << endl @@ -606,13 +606,13 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!c.context().count ("p:comp-number")) return; - UnsignedLong n (c.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (c.context ().get<size_t> ("p:comp-number")); os << "void" << endl << "choice_" << n << " (unsigned long&," << endl @@ -629,13 +629,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) return; - UnsignedLong n (s.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (s.context ().get<size_t> ("p:comp-number")); os << "void" << endl << "sequence_" << n << " (unsigned long&," << endl @@ -666,7 +666,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -733,7 +733,7 @@ namespace CXX names_attribute_validation_state_ >> attribute_validation_state_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -742,17 +742,17 @@ namespace CXX // generate parser callbacks, etc. since they are the same as // in the base. We only need the parsing/validation code. // - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool facets (has_facets (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); @@ -809,7 +809,7 @@ namespace CXX // post // String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); os << "virtual " << ret << endl << post_name (c) << " ()" << @@ -840,7 +840,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -932,7 +932,7 @@ namespace CXX String const& base_ret (ret_type (base)); - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -1040,7 +1040,7 @@ namespace CXX if (validation && (he || hae)) { - UnsignedLong depth (c.context ().get<UnsignedLong> ("p:depth")); + size_t depth (c.context ().get<size_t> ("p:depth")); // Has to be public for some broken compilers (e.g., GH C++). // @@ -1245,13 +1245,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { gen_typedef (t, "void"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_typedef (t, string_type_); @@ -1259,7 +1259,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool"); @@ -1267,79 +1267,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_typedef (t, "signed char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_typedef (t, "unsigned char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_typedef (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_typedef (t, "unsigned short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_typedef (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_typedef (t, "unsigned int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { gen_typedef (t, long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { gen_typedef (t, unsigned_long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { gen_typedef (t, "unsigned long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { gen_typedef (t, "unsigned long"); @@ -1347,19 +1347,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_typedef (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_typedef (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_typedef (t, "double"); @@ -1367,31 +1367,31 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { // NMTOKENS uses NMTOKEN implementation to parse individual items. @@ -1402,19 +1402,19 @@ namespace CXX gen_typedef (t, string_seq_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_typedef (t, string_type_); @@ -1422,7 +1422,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, qname_type_); @@ -1430,19 +1430,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { // IDREFS uses IDREF implementation to parse individual items. @@ -1455,7 +1455,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_); @@ -1463,13 +1463,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_typedef (t, buffer_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_typedef (t, buffer_type_); @@ -1478,55 +1478,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { gen_typedef (t, xs_ns_ + L"::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { gen_typedef (t, xs_ns_ + L"::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { gen_typedef (t, xs_ns_ + L"::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { gen_typedef (t, xs_ns_ + L"::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { gen_typedef (t, xs_ns_ + L"::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { gen_typedef (t, xs_ns_ + L"::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { gen_typedef (t, xs_ns_ + L"::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { gen_typedef (t, xs_ns_ + L"::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { gen_typedef (t, xs_ns_ + L"::time"); @@ -1534,18 +1534,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) { if (ret_type (t) == type) @@ -1584,8 +1584,8 @@ namespace CXX String long_type_; String unsigned_long_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace : Namespace, Context @@ -1740,8 +1740,8 @@ namespace CXX }; } - Void - generate_parser_header (Context& ctx, Boolean generate_xml_schema) + void + generate_parser_header (Context& ctx, bool generate_xml_schema) { NarrowString extern_xml_schema; @@ -1759,12 +1759,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("p:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -1844,12 +1844,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("p: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/xsde/cxx/parser/parser-header.hxx b/xsde/cxx/parser/parser-header.hxx index 2337b64..a58ae76 100644 --- a/xsde/cxx/parser/parser-header.hxx +++ b/xsde/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/xsde/cxx/parser/parser-inline.cxx b/xsde/cxx/parser/parser-inline.cxx index 557a81e..fd1e6d4 100644 --- a/xsde/cxx/parser/parser-inline.cxx +++ b/xsde/cxx/parser/parser-inline.cxx @@ -14,7 +14,7 @@ namespace CXX { namespace { - Void + void facet_calls (SemanticGraph::Complex& c, Context& ctx) { using SemanticGraph::Restricts; @@ -123,19 +123,19 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - UnsignedLong enum_count (0); + size_t enum_count (0); if (enum_facets) { for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); @@ -143,7 +143,7 @@ namespace CXX ++enum_count; } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); if (facets || tiein) os << "// " << name << endl @@ -197,8 +197,8 @@ namespace CXX } private: - Void - facet_calls (Type& e, UnsignedLong enum_count) + void + facet_calls (Type& e, size_t enum_count) { Parser::facet_calls (e, *this); @@ -217,7 +217,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -285,7 +285,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { if (tiein) @@ -328,7 +328,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& scope (ename (e.scope ())); @@ -360,7 +360,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << inl @@ -376,12 +376,12 @@ namespace CXX // struct ParticleMemberSet: Traversal::Element, Context { - ParticleMemberSet (Context& c, Boolean poly) + ParticleMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_) @@ -394,7 +394,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; }; struct AttributeMemberSet: Traversal::Attribute, Context @@ -404,7 +404,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "this->" << emember (a) << " = &" << ename (a) << ";"; @@ -415,13 +415,13 @@ namespace CXX Traversal::List, Context { - BaseMemberSet (Context& c, Boolean poly) + BaseMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -433,7 +433,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -447,19 +447,19 @@ namespace CXX private: Traversal::Inherits inherits_; - Boolean poly_; + bool poly_; }; // // struct ParticleMemberInit: Traversal::Element, Context { - ParticleMemberInit (Context& c, Boolean comma) + ParticleMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (first_) @@ -476,24 +476,24 @@ namespace CXX } } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; struct AttributeMemberInit: Traversal::Attribute, Context { - AttributeMemberInit (Context& c, Boolean comma) + AttributeMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (Type& a) { if (first_) @@ -504,14 +504,14 @@ namespace CXX os << emember (a) << " (0)"; } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; // @@ -523,14 +523,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (a.context().get<size_t> ("p:state-count")); os << "," << endl << " v_all_count_ (" << state_count << "UL, v_all_first_)"; @@ -586,17 +585,17 @@ namespace CXX contains_particle_set_poly_ >> particle_set_poly_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean facets (has_facets (c)); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool facets (has_facets (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); @@ -604,7 +603,7 @@ namespace CXX names (c, names_test); } - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); if (!(tiein || facets || (!restriction && (he || ha)) || @@ -657,7 +656,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -705,7 +704,7 @@ namespace CXX (validation && (he || hae || hra))) os << ": "; - Boolean comma (false); + bool comma (false); if (hb && tiein) { @@ -798,7 +797,7 @@ namespace CXX os << " " << etiein (c) << " (impl)"; - Boolean comma (true); + bool comma (true); if (!restriction && (he || ha)) { @@ -902,7 +901,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/xsde/cxx/parser/parser-inline.hxx b/xsde/cxx/parser/parser-inline.hxx index 46b0f39..76c1ef2 100644 --- a/xsde/cxx/parser/parser-inline.hxx +++ b/xsde/cxx/parser/parser-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_inline (Context&); } } diff --git a/xsde/cxx/parser/parser-source.cxx b/xsde/cxx/parser/parser-source.cxx index 868998f..dcb7c26 100644 --- a/xsde/cxx/parser/parser-source.cxx +++ b/xsde/cxx/parser/parser-source.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/parser/parser-source.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/parser/parser-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Parser @@ -23,7 +25,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -31,12 +33,12 @@ namespace CXX SemanticGraph::Type& base (e.inherits ().base ()); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); - Boolean base_same ( + bool same (ret == base_ret); + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); @@ -106,7 +108,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 @@ -162,7 +164,7 @@ namespace CXX if (enum_facets) { - typedef Cult::Containers::Set<String> Enums; + typedef set<String> Enums; Enums enums; for (Type::NamesIterator i (e.names_begin ()), @@ -173,7 +175,7 @@ namespace CXX "_enums_[" << enums.size () << "UL] = " << "{"; - for (Enums::Iterator b (enums.begin ()), i (b), end (enums.end ()); + for (Enums::iterator b (enums.begin ()), i (b), end (enums.end ()); i != end; ++i) os << (i != b ? ",\n" : "") << strlit (*i); @@ -191,7 +193,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -375,7 +377,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -441,7 +443,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& m (emember (e)); @@ -468,7 +470,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& m (emember (a)); @@ -488,11 +490,11 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -592,12 +594,12 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -706,7 +708,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -802,7 +804,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -834,7 +836,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -865,7 +867,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -969,7 +971,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -1009,7 +1011,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -1101,17 +1103,17 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (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); @@ -1121,10 +1123,10 @@ namespace CXX String const& name (ename (c)); String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); String base_ret; - Boolean base_same (true); + bool base_same (true); if (tiein && hb) { @@ -1294,7 +1296,7 @@ namespace CXX if (hb && 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 @@ -1555,7 +1557,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -1595,7 +1597,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx) { if (ctx.tiein) diff --git a/xsde/cxx/parser/parser-source.hxx b/xsde/cxx/parser/parser-source.hxx index d2f7157..5d3bd4c 100644 --- a/xsde/cxx/parser/parser-source.hxx +++ b/xsde/cxx/parser/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_source (Context&); } } diff --git a/xsde/cxx/parser/print-impl-common.hxx b/xsde/cxx/parser/print-impl-common.hxx index df379fa..c9fca22 100644 --- a/xsde/cxx/parser/print-impl-common.hxx +++ b/xsde/cxx/parser/print-impl-common.hxx @@ -76,13 +76,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -90,7 +90,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { if (default_type (t, "bool")) @@ -108,7 +108,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { if (default_type (t, "signed char")) @@ -124,7 +124,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { if (default_type (t, "unsigned char")) @@ -140,7 +140,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { if (default_type (t, "short")) @@ -156,7 +156,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { if (default_type (t, "unsigned short")) @@ -172,7 +172,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { if (default_type (t, "int")) @@ -188,7 +188,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { if (default_type (t, "unsigned int")) @@ -204,7 +204,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { if (options.no_long_long ()) @@ -237,7 +237,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { if (options.no_long_long ()) @@ -270,7 +270,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { if (default_type (t, "long")) @@ -286,7 +286,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { if (default_type (t, "long")) @@ -302,7 +302,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { if (default_type (t, "long")) @@ -318,7 +318,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { if (default_type (t, "unsigned long")) @@ -334,7 +334,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { if (default_type (t, "unsigned long")) @@ -352,7 +352,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { if (default_type (t, "float")) @@ -368,7 +368,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { if (default_type (t, "double")) @@ -384,7 +384,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { if (default_type (t, "double")) @@ -402,61 +402,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); @@ -465,13 +465,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); @@ -480,7 +480,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl ()) @@ -535,13 +535,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); @@ -549,7 +549,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { if (default_type (t, xs_ns_name () + L"::date")) @@ -571,7 +571,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")) @@ -600,7 +600,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { if (default_type (t, xs_ns_name () + L"::duration")) @@ -637,7 +637,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { if (default_type (t, xs_ns_name () + L"::gday")) @@ -655,7 +655,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { if (default_type (t, xs_ns_name () + L"::gmonth")) @@ -673,7 +673,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")) @@ -693,7 +693,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { if (default_type (t, xs_ns_name () + L"::gyear")) @@ -711,7 +711,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")) @@ -731,7 +731,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { if (default_type (t, xs_ns_name () + L"::time")) @@ -922,7 +922,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -930,61 +930,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); @@ -993,13 +993,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); @@ -1008,7 +1008,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl () && @@ -1026,13 +1026,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); diff --git a/xsde/cxx/parser/state-processor.cxx b/xsde/cxx/parser/state-processor.cxx index 3caeb00..6e079d7 100644 --- a/xsde/cxx/parser/state-processor.cxx +++ b/xsde/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,17 +21,14 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> Particles; void print (Particles const& p) { - using std::wcerr; - using std::endl; - 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 +50,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 +61,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +76,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,8 +99,7 @@ namespace CXX { a.context ().set ("p:comp-number", choice_++); a.context ().set ("p:prefixes", prefixes_); - a.context ().set ("p:state-count", - UnsignedLong (prefixes_.size ())); + a.context ().set ("p:state-count", size_t (prefixes_.size ())); // effective-min = min * actual-min // @@ -115,7 +112,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -127,8 +124,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) @@ -145,7 +142,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -160,7 +157,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get<UnsignedLong> ("p:effective-min") == 0) + p.context ().get<size_t> ("p:effective-min") == 0) min = 0; } @@ -184,7 +181,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -196,9 +193,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) @@ -218,7 +215,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -234,7 +231,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get<UnsignedLong> ("p:effective-min") != 0) + if (p.context ().get<size_t> ("p:effective-min") != 0) min = 1; } } @@ -267,11 +264,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_; }; @@ -279,12 +276,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 ()); @@ -297,7 +294,7 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/state-processor.hxx b/xsde/cxx/parser/state-processor.hxx index 9a1bca6..58ca460 100644 --- a/xsde/cxx/parser/state-processor.hxx +++ b/xsde/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/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx index eacede8..3513aed 100644 --- a/xsde/cxx/parser/type-processor.cxx +++ b/xsde/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 @@ -23,14 +25,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; @@ -48,7 +50,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 ("p:ret-type")) { @@ -69,12 +71,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 ()) { @@ -135,7 +137,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. @@ -162,7 +164,7 @@ namespace CXX { if (n->includes_begin () != n->includes_end ()) { - typedef Cult::Containers::Set<String> Includes; + typedef std::set<String> Includes; SemanticGraph::Context& sc (schema_.context ()); @@ -189,14 +191,14 @@ namespace CXX private: SemanticGraph::Schema& schema_; TypeMap::Namespaces& type_map_; - Boolean add_includes_; + bool add_includes_; }; // // struct BaseType: Traversal::Complex { - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c); @@ -214,8 +216,8 @@ namespace CXX { GlobalType (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes, - Boolean tiein) + bool add_includes, + bool tiein) : type_ (schema, type_map, add_includes) { inherits_ >> type_; @@ -231,20 +233,20 @@ namespace CXX } } - 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); @@ -253,7 +255,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -272,12 +274,12 @@ namespace CXX Traversal::Argumented argumented_; }; - Void + void process_impl (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, TypeMap::Namespaces& type_map) { - Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); + bool tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); if (tu.names_begin ()->named ().name () == L"http://www.w3.org/2001/XMLSchema") @@ -300,7 +302,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 ()); // Besides types defined in this schema, also process those // referenced by global elements in case we are generating @@ -341,7 +343,7 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, TypeMap::Namespaces& tm) diff --git a/xsde/cxx/parser/type-processor.hxx b/xsde/cxx/parser/type-processor.hxx index de16a82..a3ccbf9 100644 --- a/xsde/cxx/parser/type-processor.hxx +++ b/xsde/cxx/parser/type-processor.hxx @@ -6,24 +6,20 @@ #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> namespace CXX { namespace Parser { - using namespace Cult::Types; - class TypeProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, TypeMap::Namespaces&); diff --git a/xsde/cxx/parser/validator.cxx b/xsde/cxx/parser/validator.cxx index bf5dffb..636dba4 100644 --- a/xsde/cxx/parser/validator.cxx +++ b/xsde/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& options, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -40,8 +41,8 @@ namespace CXX } public: - Boolean - is_disabled (Char const* w) + bool + is_disabled (char const* w) { return disabled_warnings_all_ || disabled_warnings_.find (w) != disabled_warnings_.end (); @@ -76,10 +77,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -100,18 +101,18 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { 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; @@ -279,7 +280,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -325,7 +326,7 @@ namespace CXX Complex::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -334,7 +335,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("P002")) @@ -358,7 +359,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -378,7 +379,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -399,12 +400,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -446,18 +447,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -477,12 +478,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -521,9 +522,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -547,7 +548,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -590,14 +591,14 @@ namespace CXX }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -624,9 +625,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)) { diff --git a/xsde/cxx/parser/validator.hxx b/xsde/cxx/parser/validator.hxx index 2cd7931..c17c048 100644 --- a/xsde/cxx/parser/validator.hxx +++ b/xsde/cxx/parser/validator.hxx @@ -6,28 +6,25 @@ #ifndef CXX_PARSER_VALIDATOR_HXX #define CXX_PARSER_VALIDATOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> #include <cxx/parser/options.hxx> #include <xsde.hxx> +#include <types.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings); }; } diff --git a/xsde/cxx/serializer/attribute-validation-source.cxx b/xsde/cxx/serializer/attribute-validation-source.cxx index 699d4c9..f66eff0 100644 --- a/xsde/cxx/serializer/attribute-validation-source.cxx +++ b/xsde/cxx/serializer/attribute-validation-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& ns (a.definition_namespace ().name ()); @@ -97,7 +97,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -230,7 +230,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "while (this->" << enext (a) << " ())" @@ -394,7 +394,7 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { if (!has<Traversal::Attribute> (c) && @@ -404,7 +404,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> ()); @@ -447,7 +447,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/attribute-validation-source.hxx b/xsde/cxx/serializer/attribute-validation-source.hxx index 94b7617..5951262 100644 --- a/xsde/cxx/serializer/attribute-validation-source.hxx +++ b/xsde/cxx/serializer/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsde/cxx/serializer/driver-source.cxx b/xsde/cxx/serializer/driver-source.cxx index 3ec2207..6f609c2 100644 --- a/xsde/cxx/serializer/driver-source.cxx +++ b/xsde/cxx/serializer/driver-source.cxx @@ -3,15 +3,16 @@ // 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/serializer/driver-source.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 { @@ -19,11 +20,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. @@ -37,7 +35,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -49,7 +47,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -144,7 +142,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -156,7 +154,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -170,7 +168,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -192,13 +190,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"); @@ -206,7 +204,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -214,79 +212,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"); @@ -294,19 +292,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"); @@ -314,49 +312,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"); @@ -365,7 +363,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -374,19 +372,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"); @@ -394,7 +392,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -402,13 +400,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"); @@ -417,55 +415,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"); @@ -473,20 +471,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 ()) @@ -504,7 +502,7 @@ namespace CXX String base_name (escape (raw_name + L"_s")); 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; @@ -542,12 +540,12 @@ namespace CXX // struct ParticleArg: Traversal::Element, Context { - ParticleArg (Context& c, TypeInstanceMap& map, Boolean& first) + ParticleArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!first_) @@ -560,17 +558,17 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (Type& a) { if (!first_) @@ -583,7 +581,7 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct ArgList : Traversal::Complex, @@ -607,7 +605,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -619,7 +617,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -643,7 +641,7 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; + bool first_; }; struct SerializerConnect: Traversal::List, @@ -673,7 +671,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -686,7 +684,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -715,7 +713,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -738,7 +736,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set<SemanticGraph::Type*> type_set_; + set<SemanticGraph::Type*> type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -761,7 +759,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options.root_element_first ()) @@ -783,7 +781,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure diff --git a/xsde/cxx/serializer/driver-source.hxx b/xsde/cxx/serializer/driver-source.hxx index f96b4b8..5f87857 100644 --- a/xsde/cxx/serializer/driver-source.hxx +++ b/xsde/cxx/serializer/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_driver_source (Context&); } } diff --git a/xsde/cxx/serializer/element-validation-source.cxx b/xsde/cxx/serializer/element-validation-source.cxx index 4be8db9..329c7b9 100644 --- a/xsde/cxx/serializer/element-validation-source.cxx +++ b/xsde/cxx/serializer/element-validation-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -98,12 +98,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. // - UnsignedLong min (a.min ()); + size_t min (a.min ()); if (min == 0) os << "if (this->" << epresent (a) << " ())" @@ -122,12 +122,12 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -234,10 +234,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -312,10 +312,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& name (ename (e)); @@ -351,7 +351,7 @@ namespace CXX String const& arg (arg_type (e.type ())); String fq_type (fq_name (e.type ())); - Boolean poly (poly_code && !anonymous (e.type ())); + bool poly (poly_code && !anonymous (e.type ())); String inst (poly ? String (L"s") : L"this->" + emember (e)); if (poly) @@ -613,10 +613,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -833,7 +833,7 @@ namespace CXX contains_particle_ >> particle_; } - virtual Void + virtual void traverse (Type& c) { if (!has<Traversal::Element> (c) && @@ -843,7 +843,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> ()); @@ -888,7 +888,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/element-validation-source.hxx b/xsde/cxx/serializer/element-validation-source.hxx index 55c9b3f..b2c24e2 100644 --- a/xsde/cxx/serializer/element-validation-source.hxx +++ b/xsde/cxx/serializer/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx index 7cbdbcf..061a1ae 100644 --- a/xsde/cxx/serializer/elements.cxx +++ b/xsde/cxx/serializer/elements.cxx @@ -197,7 +197,7 @@ namespace CXX return t.context ().get<String> ("s:impl"); } - Boolean Context:: + bool Context:: has_facets (SemanticGraph::Complex& c) { if (validation && restriction_p (c)) @@ -257,20 +257,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/xsde/cxx/serializer/elements.hxx b/xsde/cxx/serializer/elements.hxx index 694abd8..65a7c00 100644 --- a/xsde/cxx/serializer/elements.hxx +++ b/xsde/cxx/serializer/elements.hxx @@ -92,7 +92,7 @@ namespace CXX } public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -177,7 +177,7 @@ namespace CXX eimpl (SemanticGraph::Type&); public: - Boolean + bool has_facets (SemanticGraph::Complex& c); public: @@ -188,14 +188,14 @@ namespace CXX String& complex_base; String& serializer_map; - Boolean validation; - Boolean exceptions; - Boolean stl; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean mixin; - Boolean tiein; + bool validation; + bool exceptions; + bool stl; + bool poly_code; + bool poly_runtime; + bool reset; + bool mixin; + bool tiein; Regex const* hxx_expr; Regex const* ixx_expr; @@ -227,13 +227,13 @@ namespace CXX Traversal::Fundamental::Entity { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -241,74 +241,74 @@ 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; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { r_ = true; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -317,12 +317,12 @@ namespace CXX // struct RequiredAttributeTest: Traversal::Attribute { - RequiredAttributeTest (Boolean& result) + RequiredAttributeTest (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (!result_ && !a.optional_p ()) @@ -330,7 +330,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; @@ -339,9 +339,9 @@ namespace CXX struct ParticleParamDecl: Traversal::Element, Context { ParticleParamDecl (Context& c, - Boolean& first, - Boolean name_arg, - Boolean poly) + bool& first, + bool name_arg, + bool poly) : Context (c), first_ (first), name_arg_ (name_arg), @@ -350,12 +350,12 @@ namespace CXX { } - ParticleParamDecl (Context& c, Boolean* result, Boolean poly) + ParticleParamDecl (Context& c, bool* result, bool poly) : Context (c), first_ (name_arg_), poly_ (poly), result_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -384,15 +384,15 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct AttributeParamDecl: Traversal::Attribute, Context { - AttributeParamDecl (Context& c, Boolean& first, Boolean name_arg) + AttributeParamDecl (Context& c, bool& first, bool name_arg) : Context (c), first_ (first), name_arg_ (name_arg), @@ -400,12 +400,12 @@ namespace CXX { } - AttributeParamDecl (Context& c, Boolean* result) + AttributeParamDecl (Context& c, bool* result) : Context (c), first_ (name_arg_), result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -428,16 +428,16 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool* result_; }; struct SerializerParamDecl : Traversal::Complex, Traversal::List, Context { - SerializerParamDecl (Context& c, Boolean name_arg, Boolean poly) + SerializerParamDecl (Context& c, bool name_arg, bool poly) : Context (c), particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), @@ -456,7 +456,7 @@ namespace CXX names_ >> attribute_; } - SerializerParamDecl (Context& c, Boolean* result, Boolean poly) + SerializerParamDecl (Context& c, bool* result, bool poly) : Context (c), particle_ (c, result, poly), attribute_ (c, result), @@ -473,7 +473,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -485,7 +485,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -521,20 +521,20 @@ namespace CXX AttributeParamDecl attribute_; Traversal::Names names_; - Boolean first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct SerializerParamTest { - SerializerParamTest (Context& c, Boolean& result, Boolean poly) + SerializerParamTest (Context& c, bool& result, bool poly) : impl_ (c, &result, poly) { } - Void + void traverse (SemanticGraph::Complex& c) { impl_.traverse (c); @@ -548,16 +548,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, @@ -579,20 +579,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: @@ -615,7 +615,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx index 479293c..1b1a468 100644 --- a/xsde/cxx/serializer/generator.cxx +++ b/xsde/cxx/serializer/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> @@ -68,7 +65,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/e, an XML Schema\n" @@ -89,7 +86,7 @@ namespace CXX "//\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/e, an XML Schema to\n" @@ -99,7 +96,7 @@ namespace CXX "// license text for conditions.\n" "//\n\n"; - Char const copyright_impl[] = + char const copyright_impl[] = "// Not copyrighted - public domain.\n" "//\n" "// This sample serializer implementation was generated by CodeSynthesis XSD/e,\n" @@ -108,14 +105,14 @@ namespace CXX "//\n\n"; } - Void Serializer::Generator:: + void Serializer::Generator:: usage () { CXX::Serializer::options::print_usage (wcout); CXX::options::print_usage (wcout); } - Void Serializer::Generator:: + void Serializer::Generator:: process_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -127,7 +124,7 @@ namespace CXX namespace { template <typename S> - Void + void open (S& ifs, NarrowString const& path) { try @@ -152,7 +149,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -172,7 +169,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -188,13 +185,13 @@ namespace CXX } - UnsignedLong Serializer::Generator:: + size_t Serializer::Generator:: generate (Serializer::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) @@ -205,7 +202,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 @@ -221,8 +218,8 @@ namespace CXX } } - Boolean impl (!generate_xml_schema && ops.generate_empty_impl ()); - Boolean driver (gen_driver && !generate_xml_schema && + bool impl (!generate_xml_schema && ops.generate_empty_impl ()); + bool driver (gen_driver && !generate_xml_schema && ops.generate_test_driver ()); // Evaluate the graph for possibility of generating something useful. @@ -243,7 +240,7 @@ namespace CXX // // - Boolean validation (!ops.suppress_validation ()); + bool validation (!ops.suppress_validation ()); // Read-in type maps. // @@ -397,8 +394,8 @@ namespace CXX // Generate code. // - 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); NarrowString name (file_path.leaf ()); NarrowString skel_suffix (ops.skel_file_suffix ()); @@ -698,7 +695,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -741,7 +738,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/xsde/cxx/serializer/generator.hxx b/xsde/cxx/serializer/generator.hxx index e9601be..4df1540 100644 --- a/xsde/cxx/serializer/generator.hxx +++ b/xsde/cxx/serializer/generator.hxx @@ -6,14 +6,12 @@ #ifndef CXX_SERIALIZER_GENERATOR_HXX #define CXX_SERIALIZER_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 <xsde.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> @@ -23,17 +21,15 @@ namespace CXX { namespace Serializer { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); // Assign names to global declarations. // - static Void + static void process_names (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); @@ -42,13 +38,13 @@ namespace CXX // struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/serializer/impl-header.cxx b/xsde/cxx/serializer/impl-header.cxx index 93cd982..bacfbc1 100644 --- a/xsde/cxx/serializer/impl-header.cxx +++ b/xsde/cxx/serializer/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -71,7 +71,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -115,7 +115,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -155,7 +155,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -170,12 +170,12 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -198,10 +198,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -229,10 +229,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (min == 0 && max == 1) { @@ -254,10 +254,10 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -302,7 +302,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -319,7 +319,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "virtual bool" << endl @@ -364,21 +364,21 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { // In case of an inheritance-by-restriction, we don't need to // generate serializer callbacks, etc. since they are the same // as in the base. We only need the serialization/validation code. // - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + 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)); String const& name (eimpl (c)); String const& arg (arg_type (c)); @@ -456,7 +456,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/impl-header.hxx b/xsde/cxx/serializer/impl-header.hxx index ffbf761..8420ccc 100644 --- a/xsde/cxx/serializer/impl-header.hxx +++ b/xsde/cxx/serializer/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_impl_header (Context&); } } diff --git a/xsde/cxx/serializer/impl-source.cxx b/xsde/cxx/serializer/impl-source.cxx index f03768d..33193fe 100644 --- a/xsde/cxx/serializer/impl-source.cxx +++ b/xsde/cxx/serializer/impl-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -99,7 +99,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -167,7 +167,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -223,7 +223,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -244,12 +244,12 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); SemanticGraph::Complex& t (scope (c)); String const& s (eimpl (t)); @@ -287,10 +287,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); String const& sc (eimpl (scope (s))); @@ -342,10 +342,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& s ( eimpl (dynamic_cast<SemanticGraph::Complex&> (e.scope ()))); @@ -381,10 +381,10 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); String const& s ( eimpl (dynamic_cast<SemanticGraph::Complex&> (a.scope ()))); @@ -449,7 +449,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s ( @@ -475,7 +475,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& s ( @@ -535,10 +535,10 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); + bool hb (c.inherits_p ()); String const& name (eimpl (c)); String const& arg (arg_type (c)); @@ -634,7 +634,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/impl-source.hxx b/xsde/cxx/serializer/impl-source.hxx index 0135c39..33376b3 100644 --- a/xsde/cxx/serializer/impl-source.hxx +++ b/xsde/cxx/serializer/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_impl_source (Context&); } } diff --git a/xsde/cxx/serializer/name-processor.cxx b/xsde/cxx/serializer/name-processor.cxx index 6d60c37..dc24f91 100644 --- a/xsde/cxx/serializer/name-processor.cxx +++ b/xsde/cxx/serializer/name-processor.cxx @@ -3,16 +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/elements.hxx> #include <cxx/serializer/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 { @@ -22,7 +24,7 @@ namespace CXX { // // - typedef Cult::Containers::Set<String> NameSet; + typedef set<String> NameSet; class Context: public CXX::Context { @@ -62,7 +64,7 @@ namespace CXX { String name (escape (n + suffix)); - 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; @@ -83,18 +85,18 @@ 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; - Boolean const tiein; + bool const impl; + bool const tiein; String const& skel_suffix; String const& impl_suffix; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; - Boolean validation; - Boolean polymorphic; + bool validation; + bool polymorphic; }; // Primary names. @@ -103,12 +105,12 @@ namespace CXX Traversal::Any, Context { - PrimaryParticle (Context& c, NameSet& set, Boolean restriction) + PrimaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -126,7 +128,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -148,19 +150,19 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct PrimaryAttribute: Traversal::Attribute, Traversal::AnyAttribute, Context { - PrimaryAttribute (Context& c, NameSet& set, Boolean restriction) + PrimaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -180,7 +182,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { using SemanticGraph::AnyAttribute; @@ -202,7 +204,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; // Secondary names. @@ -214,12 +216,12 @@ namespace CXX Traversal::Sequence, Context { - ParticleTag (Context& c, NameSet& set, Boolean restriction) + ParticleTag (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -240,7 +242,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -261,7 +263,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -281,7 +283,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -303,7 +305,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryCompositor: Traversal::All, @@ -311,7 +313,7 @@ namespace CXX Traversal::Sequence, Context { - SecondaryCompositor (Context& c, NameSet& set, Boolean restriction) + SecondaryCompositor (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction), @@ -320,7 +322,7 @@ namespace CXX contain_particle_tag_ >> particle_tag_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -335,7 +337,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -388,7 +390,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { SemanticGraph::Context& sc (s.context ()); @@ -434,7 +436,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; ParticleTag particle_tag_; Traversal::ContainsParticle contain_particle_tag_; @@ -444,22 +446,22 @@ namespace CXX Traversal::Any, Context { - SecondaryParticle (Context& c, NameSet& set, Boolean restriction) + SecondaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean poly ( + bool poly ( polymorphic && !e.type ().context ().count ("anonymous")); SemanticGraph::Context& ec (e.context ()); if (!restriction_) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& base (ec.get<String> ("s:name")); @@ -482,7 +484,7 @@ namespace CXX "xsd-frontend-restriction-correspondence")); SemanticGraph::Context& bc (b.context ()); - UnsignedLong min (b.min ()), max (b.max ()); + size_t min (b.min ()), max (b.max ()); if (min == 0 && max == 1) ec.set ("s:present", bc.get<String> ("s:present")); @@ -508,7 +510,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -517,7 +519,7 @@ namespace CXX if (!restriction_) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); String const& base (ac.get<String> ("s:name")); if (min == 0 && max == 1) @@ -537,7 +539,7 @@ namespace CXX *ac.get<Any*> ("xsd-frontend-restriction-correspondence")); SemanticGraph::Context& bc (b.context ()); - UnsignedLong min (b.min ()), max (b.max ()); + size_t min (b.min ()), max (b.max ()); if (min == 0 && max == 1) { @@ -563,19 +565,19 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryAttribute: Traversal::Attribute, Traversal::AnyAttribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean restriction) + SecondaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -606,7 +608,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { using SemanticGraph::AnyAttribute; @@ -634,7 +636,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; // @@ -646,7 +648,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -668,7 +670,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 ()) { @@ -762,7 +764,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& n (t.name ()); @@ -793,7 +795,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -889,13 +891,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_names (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_names (t, "any_simple_type"); @@ -903,7 +905,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_names (t, "boolean"); @@ -911,79 +913,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_names (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_names (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_names (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_names (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_names (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_names (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_names (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_names (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_names (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_names (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_names (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_names (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_names (t, "negative_integer"); @@ -991,19 +993,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_names (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_names (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_names (t, "decimal"); @@ -1011,49 +1013,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_names (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_names (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_names (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_names (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_names (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_names (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_names (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_names (t, "language"); @@ -1062,7 +1064,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_names (t, "qname"); @@ -1071,19 +1073,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_names (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_names (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_names (t, "idrefs"); @@ -1091,7 +1093,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_names (t, "uri"); @@ -1099,13 +1101,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_names (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_names (t, "hex_binary"); @@ -1114,55 +1116,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_names (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_names (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_names (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_names (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_names (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_names (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_names (t, "gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_names (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_names (t, "time"); @@ -1170,13 +1172,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_names (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_names (t, "entities"); @@ -1195,12 +1197,12 @@ namespace CXX return escape (base + impl_suffix); } - Void + void set_names (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); - WideChar const* ns = validation + wchar_t const* ns = validation ? L"::xsde::cxx::serializer::validating::" : L"::xsde::cxx::serializer::non_validating::"; @@ -1226,7 +1228,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1238,7 +1240,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1250,7 +1252,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1268,7 +1270,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1281,11 +1283,11 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -1379,11 +1381,11 @@ namespace CXX } } - Void NameProcessor:: + void NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { process_impl (ops, tu, file, deep); } diff --git a/xsde/cxx/serializer/name-processor.hxx b/xsde/cxx/serializer/name-processor.hxx index b170705..6a33fe8 100644 --- a/xsde/cxx/serializer/name-processor.hxx +++ b/xsde/cxx/serializer/name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_SERIALIZER_NAME_PROCESSOR_HXX #define CXX_SERIALIZER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - using namespace Cult::Types; - class NameProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/serializer/options.cli b/xsde/cxx/serializer/options.cli index ddb6c60..e4e35a1 100644 --- a/xsde/cxx/serializer/options.cli +++ b/xsde/cxx/serializer/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>. @@ -105,7 +103,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "<element>", "Indicate that <element> is the document root. This information is @@ -114,21 +112,21 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --skel-type-suffix = "_sskel" + NarrowString --skel-type-suffix = "_sskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_sskel} to construct the names of generated serializer skeletons." }; - Cult::Types::NarrowString --skel-file-suffix = "-sskel" + NarrowString --skel-file-suffix = "-sskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-sskel} to construct the names of generated serializer skeleton files." }; - Cult::Types::NarrowString --impl-type-suffix = "_simpl" + NarrowString --impl-type-suffix = "_simpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_simpl} to @@ -136,7 +134,7 @@ namespace CXX XML Schema types and sample serializer implementations." }; - Cult::Types::NarrowString --impl-file-suffix = "-simpl" + NarrowString --impl-file-suffix = "-simpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-simpl} to diff --git a/xsde/cxx/serializer/serializer-forward.cxx b/xsde/cxx/serializer/serializer-forward.cxx index 1ee7f9a..076eb97 100644 --- a/xsde/cxx/serializer/serializer-forward.cxx +++ b/xsde/cxx/serializer/serializer-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_serializer_forward (Context& ctx) { ctx.os << "// Forward declarations" << endl diff --git a/xsde/cxx/serializer/serializer-forward.hxx b/xsde/cxx/serializer/serializer-forward.hxx index c3cf17d..26b441d 100644 --- a/xsde/cxx/serializer/serializer-forward.hxx +++ b/xsde/cxx/serializer/serializer-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_forward (Context&); } } diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx index 930ce72..ef59c25 100644 --- a/xsde/cxx/serializer/serializer-header.cxx +++ b/xsde/cxx/serializer/serializer-header.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/serializer/serializer-header.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/serializer/serializer-header.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -30,12 +32,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (max != 1 && min != 0) { @@ -55,10 +57,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max != 1 && min != 0) { @@ -80,10 +82,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (max != 1 && min != 0) { @@ -102,10 +104,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min != 0 && !a.contained_particle ().compositor ().is_a< @@ -146,7 +148,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& ret (ret_type (a.type ())); @@ -181,7 +183,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // pre @@ -196,14 +198,14 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { SemanticGraph::Type& t (e); traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l); @@ -221,7 +223,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Type& t (u); @@ -234,7 +236,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Type& t (c); @@ -270,21 +272,21 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); SemanticGraph::Type& base (e.inherits ().base ()); String fq_base (fq_name (base)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << fq_base @@ -371,8 +373,7 @@ namespace CXX // Some schemas have duplicate enumerators so we have to create // a set out of them in order get the accurate count. // - typedef Cult::Containers::Set<String> Enums; - Enums enums; + set<String> enums; for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -397,7 +398,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -517,7 +518,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -598,7 +599,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& p) { if (first_) @@ -610,7 +611,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct CompositorCallback: Traversal::All, @@ -623,7 +624,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context ().count ("xsd-frontend-restriction-correspondence")) @@ -641,7 +642,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) @@ -651,7 +652,7 @@ namespace CXX // Add the *_present callback if this is a restriction // of sequence to optional. // - UnsignedLong cmin (c.min ()), bmax (b->max ()); + size_t cmin (c.min ()), bmax (b->max ()); if (bmax != 1 && cmin == 0) { @@ -662,7 +663,7 @@ namespace CXX } else { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -699,7 +700,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -713,8 +714,8 @@ namespace CXX // Add the *_present callback if this is a restriction // of sequence to optional. // - UnsignedLong smin (s.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (s.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -725,7 +726,7 @@ namespace CXX } else { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -754,7 +755,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (SemanticGraph::Element* b = correspondent (e)) @@ -771,7 +772,7 @@ namespace CXX } else { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (min == 0 && max == 1) { @@ -796,7 +797,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (SemanticGraph::Any* b = correspondent (a)) @@ -813,12 +814,12 @@ namespace CXX } else { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); // Generate pure virtual callbacks unless we are optional // or in choice. // - Boolean pv ( + bool pv ( min != 0 && !a.contained_particle ().compositor ().is_a< SemanticGraph::Choice> ()); @@ -867,7 +868,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -886,7 +887,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "virtual bool" << endl @@ -923,7 +924,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& serializer (eserializer (e)); @@ -948,7 +949,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "void" << endl @@ -967,7 +968,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String type (fq_name (e.type ())); @@ -989,7 +990,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << fq_name (a.type ()) << "* " << emember (a) << ";"; @@ -1039,7 +1040,7 @@ namespace CXX names_attribute_member_ >> attribute_member_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -1048,17 +1049,17 @@ namespace CXX // generate serializer callbacks, etc. since they are the same // as in the base. We only need the serialization/validation code. // - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool restriction (restriction_p (c)); + bool facets (has_facets (c)); - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + 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); @@ -1085,7 +1086,7 @@ namespace CXX // pre // String const& arg (arg_type (c)); - Boolean same (hb && arg == arg_type (c.inherits ().base ())); + bool same (hb && arg == arg_type (c.inherits ().base ())); if (same) { @@ -1164,7 +1165,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); SerializerParamTest test (*this, r, true); test.traverse (c); @@ -1408,13 +1409,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { gen_typedef (t, "void"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_typedef (t, string_type_); @@ -1422,7 +1423,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool"); @@ -1430,79 +1431,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_typedef (t, "signed char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_typedef (t, "unsigned char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_typedef (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_typedef (t, "unsigned short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_typedef (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_typedef (t, "unsigned int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { gen_typedef (t, long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { gen_typedef (t, unsigned_long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { gen_typedef (t, "unsigned long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { gen_typedef (t, "unsigned long"); @@ -1510,19 +1511,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_typedef (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_typedef (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_typedef (t, "double"); @@ -1530,31 +1531,31 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { // NMTOKENS uses NMTOKEN implementation to serialize individual @@ -1566,19 +1567,19 @@ namespace CXX gen_typedef (t, string_seq_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_typedef (t, string_type_); @@ -1586,7 +1587,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, qname_type_); @@ -1594,19 +1595,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { // IDREFS uses IDREF implementation to serialize individual items. @@ -1619,7 +1620,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_); @@ -1627,13 +1628,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_typedef (t, buffer_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_typedef (t, buffer_type_); @@ -1642,55 +1643,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { gen_typedef (t, xs_ns_ + L"::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { gen_typedef (t, xs_ns_ + L"::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { gen_typedef (t, xs_ns_ + L"::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { gen_typedef (t, xs_ns_ + L"::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { gen_typedef (t, xs_ns_ + L"::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { gen_typedef (t, xs_ns_ + L"::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { gen_typedef (t, xs_ns_ + L"::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { gen_typedef (t, xs_ns_ + L"::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { gen_typedef (t, xs_ns_ + L"::time"); @@ -1698,18 +1699,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) { if (ret_type (t) == type) @@ -1748,8 +1749,8 @@ namespace CXX String long_type_; String unsigned_long_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace : Namespace, Context @@ -1896,8 +1897,8 @@ namespace CXX }; } - Void - generate_serializer_header (Context& ctx, Boolean generate_xml_schema) + void + generate_serializer_header (Context& ctx, bool generate_xml_schema) { NarrowString extern_xml_schema; @@ -1915,12 +1916,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("s:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("s:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -2007,12 +2008,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("s:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("s: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/xsde/cxx/serializer/serializer-header.hxx b/xsde/cxx/serializer/serializer-header.hxx index bd359d3..5f98d26 100644 --- a/xsde/cxx/serializer/serializer-header.hxx +++ b/xsde/cxx/serializer/serializer-header.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Serializer { - Void - generate_serializer_header (Context&, Boolean generate_xml_schema); + void + generate_serializer_header (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/serializer/serializer-inline.cxx b/xsde/cxx/serializer/serializer-inline.cxx index 9ef7fc0..47feafc 100644 --- a/xsde/cxx/serializer/serializer-inline.cxx +++ b/xsde/cxx/serializer/serializer-inline.cxx @@ -14,7 +14,7 @@ namespace CXX { namespace { - Void + void facet_calls (SemanticGraph::Complex& c, Context& ctx) { using SemanticGraph::Restricts; @@ -108,19 +108,19 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - UnsignedLong enum_count (0); + size_t enum_count (0); if (enum_facets) { for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); @@ -128,7 +128,7 @@ namespace CXX ++enum_count; } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); if (facets || tiein) os << "// " << name << endl @@ -182,8 +182,8 @@ namespace CXX } private: - Void - facet_calls (Type& e, UnsignedLong enum_count) + void + facet_calls (Type& e, size_t enum_count) { Serializer::facet_calls (e, *this); @@ -203,7 +203,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -271,7 +271,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { if (tiein) @@ -314,7 +314,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& scope (ename (e.scope ())); @@ -346,7 +346,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -365,12 +365,12 @@ namespace CXX // struct ParticleMemberSet: Traversal::Element, Context { - ParticleMemberSet (Context& c, Boolean poly) + ParticleMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_) @@ -383,7 +383,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; }; struct AttributeMemberSet: Traversal::Attribute, Context @@ -393,7 +393,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "this->" << emember (a) << " = &" << ename (a) << ";"; @@ -404,13 +404,13 @@ namespace CXX Traversal::List, Context { - BaseMemberSet (Context& c, Boolean poly) + BaseMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -422,7 +422,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -436,19 +436,19 @@ namespace CXX private: Traversal::Inherits inherits_; - Boolean poly_; + bool poly_; }; // // struct ParticleMemberInit: Traversal::Element, Context { - ParticleMemberInit (Context& c, Boolean comma) + ParticleMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (first_) @@ -466,17 +466,17 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct AttributeMemberInit: Traversal::Attribute, Context { - AttributeMemberInit (Context& c, Boolean comma) + AttributeMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (Type& a) { if (first_) @@ -487,14 +487,14 @@ namespace CXX os << emember (a) << " (0)"; } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; @@ -545,14 +545,14 @@ namespace CXX contains_particle_set_poly_ >> particle_set_poly_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); + bool restriction (restriction_p (c)); + bool facets (has_facets (c)); if (!(tiein || facets || (!restriction && (he || ha)))) return; @@ -601,7 +601,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); SerializerParamTest test (*this, r, true); test.traverse (c); @@ -647,7 +647,7 @@ namespace CXX if (tiein || (!restriction && (he || ha))) os << ": "; - Boolean comma (false); + bool comma (false); if (hb && tiein) { @@ -717,7 +717,7 @@ namespace CXX os << " " << etiein (c) << " (impl)"; - Boolean comma (true); + bool comma (true); if (!restriction && (he || ha)) { @@ -794,7 +794,7 @@ namespace CXX }; } - Void + void generate_serializer_inline (Context& ctx) { // Emit "weak" header includes that are used in the file-per-type diff --git a/xsde/cxx/serializer/serializer-inline.hxx b/xsde/cxx/serializer/serializer-inline.hxx index 4fdbcbc..370772a 100644 --- a/xsde/cxx/serializer/serializer-inline.hxx +++ b/xsde/cxx/serializer/serializer-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_inline (Context&); } } diff --git a/xsde/cxx/serializer/serializer-source.cxx b/xsde/cxx/serializer/serializer-source.cxx index 227005d..70d0235 100644 --- a/xsde/cxx/serializer/serializer-source.cxx +++ b/xsde/cxx/serializer/serializer-source.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/serializer/serializer-source.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/serializer/serializer-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -30,12 +32,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min != 0) { @@ -71,10 +73,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max != 1 && min != 0) { @@ -120,10 +122,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& impl ( etiein (dynamic_cast<SemanticGraph::Type&> (e.scope ()))); @@ -155,10 +157,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min != 0 && !a.contained_particle ().compositor ().is_a< @@ -223,7 +225,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& ret (ret_type (a.type ())); @@ -270,7 +272,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // pre @@ -290,14 +292,14 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { SemanticGraph::Type& t (e); traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l); @@ -321,7 +323,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Type& t (u); @@ -339,7 +341,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Type& t (c); @@ -377,14 +379,14 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); String const& arg (arg_type (e)); SemanticGraph::Type& base (e.inherits ().base ()); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); @@ -436,7 +438,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 @@ -487,7 +489,7 @@ namespace CXX if (enum_facets) { - typedef Cult::Containers::Set<String> Enums; + typedef set<String> Enums; Enums enums; for (Type::NamesIterator i (e.names_begin ()), @@ -498,7 +500,7 @@ namespace CXX "_enums_[" << enums.size () << "UL] = " << "{"; - for (Enums::Iterator b (enums.begin ()), i (b), end (enums.end ()); + for (Enums::iterator b (enums.begin ()), i (b), end (enums.end ()); i != end; ++i) os << (i != b ? ",\n" : "") << strlit (*i); @@ -516,7 +518,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -758,7 +760,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -822,7 +824,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& m (emember (e)); @@ -849,7 +851,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& m (emember (a)); @@ -872,12 +874,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. // - UnsignedLong min (a.min ()); + size_t min (a.min ()); if (min == 0) os << "if (this->" << epresent (a) << " ())" @@ -898,12 +900,12 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -972,10 +974,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -1014,10 +1016,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& name (ename (e)); @@ -1039,7 +1041,7 @@ namespace CXX String const& arg (arg_type (e.type ())); String fq_type (fq_name (e.type ())); - Boolean poly (poly_code && !anonymous (e.type ())); + bool poly (poly_code && !anonymous (e.type ())); String inst (poly ? String (L"s") : L"this->" + emember (e)); if (poly) @@ -1295,10 +1297,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -1437,7 +1439,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -1566,7 +1568,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "while (this->" << enext (a) << " ())" @@ -1699,7 +1701,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context ().count ("xsd-frontend-restriction-correspondence")) @@ -1733,13 +1735,13 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (SemanticGraph::Compositor* b = correspondent (c)) { - UnsignedLong smin (c.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (c.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -1768,7 +1770,7 @@ namespace CXX } else { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0) { @@ -1833,13 +1835,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (SemanticGraph::Compositor* b = correspondent (s)) { - UnsignedLong smin (s.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (s.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -1868,7 +1870,7 @@ namespace CXX } else { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0) { @@ -1940,7 +1942,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (SemanticGraph::Element* b = correspondent (e)) @@ -1970,7 +1972,7 @@ namespace CXX } else { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& s (ename (e.scope ())); String impl; @@ -2034,7 +2036,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (SemanticGraph::Any* b = correspondent (a)) @@ -2064,7 +2066,7 @@ namespace CXX } else { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 || a.contained_particle ().compositor ().is_a< @@ -2169,7 +2171,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s (ename (a.scope ())); @@ -2215,7 +2217,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& s (ename (a.scope ())); @@ -2330,18 +2332,18 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + 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)); String const& arg (arg_type (c)); - Boolean same (hb && arg == arg_type (c.inherits ().base ())); + bool same (hb && arg == arg_type (c.inherits ().base ())); String const& name (ename (c)); @@ -2456,7 +2458,7 @@ namespace CXX if (hb && 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 @@ -2515,7 +2517,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( hb && c.inherits ().is_a<SemanticGraph::Restricts> ()); // _serialize_attributes @@ -2641,7 +2643,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -2680,7 +2682,7 @@ namespace CXX }; } - Void + void generate_serializer_source (Context& ctx) { if (ctx.tiein) diff --git a/xsde/cxx/serializer/serializer-source.hxx b/xsde/cxx/serializer/serializer-source.hxx index 6369182..71fd63e 100644 --- a/xsde/cxx/serializer/serializer-source.hxx +++ b/xsde/cxx/serializer/serializer-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_source (Context&); } } diff --git a/xsde/cxx/serializer/type-processor.cxx b/xsde/cxx/serializer/type-processor.cxx index c331309..16d5760 100644 --- a/xsde/cxx/serializer/type-processor.cxx +++ b/xsde/cxx/serializer/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/serializer/elements.hxx> #include <cxx/serializer/type-processor.hxx> @@ -11,6 +11,8 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -23,14 +25,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; @@ -48,7 +50,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 ("s:ret-type")) { @@ -69,12 +71,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 ()) { @@ -135,7 +137,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. @@ -162,8 +164,7 @@ namespace CXX { if (n->includes_begin () != n->includes_end ()) { - typedef Cult::Containers::Set<String> Includes; - + typedef std::set<String> Includes; SemanticGraph::Context& sc (schema_.context ()); if (!sc.count ("s:includes")) @@ -189,14 +190,14 @@ namespace CXX private: SemanticGraph::Schema& schema_; TypeMap::Namespaces& type_map_; - Boolean add_includes_; + bool add_includes_; }; // // struct BaseType: Traversal::Complex { - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::names (c); @@ -215,7 +216,7 @@ namespace CXX *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { type_.dispatch (c); @@ -238,8 +239,8 @@ namespace CXX { GlobalType (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes, - Boolean tiein) + bool add_includes, + bool tiein) : type_ (schema, type_map, add_includes), base_hierarchy_ (type_) { inherits_ >> type_; @@ -260,20 +261,20 @@ namespace CXX } } - 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); @@ -282,7 +283,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -301,12 +302,12 @@ namespace CXX Traversal::Argumented argumented_; }; - Void + void process_impl (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, TypeMap::Namespaces& type_map) { - Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); + bool tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); if (tu.names_begin ()->named ().name () == L"http://www.w3.org/2001/XMLSchema") @@ -329,7 +330,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 ()); // Besides types defined in this schema, also process those // referenced by global elements in case we are generating @@ -370,7 +371,7 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, TypeMap::Namespaces& tm) diff --git a/xsde/cxx/serializer/type-processor.hxx b/xsde/cxx/serializer/type-processor.hxx index f0fceed..46c99da 100644 --- a/xsde/cxx/serializer/type-processor.hxx +++ b/xsde/cxx/serializer/type-processor.hxx @@ -6,24 +6,20 @@ #ifndef CXX_SERIALIZER_TYPE_PROCESSOR_HXX #define CXX_SERIALIZER_TYPE_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - using namespace Cult::Types; - class TypeProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, TypeMap::Namespaces&); diff --git a/xsde/cxx/serializer/validator.cxx b/xsde/cxx/serializer/validator.cxx index af4dfd1..492c192 100644 --- a/xsde/cxx/serializer/validator.cxx +++ b/xsde/cxx/serializer/validator.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <iostream> + #include <cxx/serializer/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -10,9 +13,7 @@ #include <cxx/serializer/elements.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Serializer::options const& ops, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, ops, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -40,8 +41,8 @@ namespace CXX } public: - Boolean - is_disabled (Char const* w) + bool + is_disabled (char const* w) { return disabled_warnings_all_ || disabled_warnings_.find (w) != disabled_warnings_.end (); @@ -76,10 +77,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -97,7 +98,7 @@ namespace CXX *this >> schema_names_ >> ns_ >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -141,7 +142,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -150,7 +151,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("S001")) @@ -174,7 +175,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -194,7 +195,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -208,12 +209,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -255,18 +256,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -286,12 +287,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -330,9 +331,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -356,7 +357,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -399,14 +400,14 @@ namespace CXX }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -422,9 +423,9 @@ namespace CXX // // { - Boolean ref (ops.root_element_first ()); - Boolean rel (ops.root_element_last ()); - Boolean re (ops.root_element ()); + bool ref (ops.root_element_first ()); + bool rel (ops.root_element_last ()); + bool re (ops.root_element ()); if ((ref && rel) || (ref && re) || (rel && re)) { diff --git a/xsde/cxx/serializer/validator.hxx b/xsde/cxx/serializer/validator.hxx index 601ada3..0e59b3d 100644 --- a/xsde/cxx/serializer/validator.hxx +++ b/xsde/cxx/serializer/validator.hxx @@ -6,28 +6,25 @@ #ifndef CXX_SERIALIZER_VALIDATOR_HXX #define CXX_SERIALIZER_VALIDATOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> -#include <cxx/serializer/options.hxx> - #include <xsde.hxx> +#include <types.hxx> + +#include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings); }; } diff --git a/xsde/elements.hxx b/xsde/elements.hxx index 7684484..f37c6f6 100644 --- a/xsde/elements.hxx +++ b/xsde/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/xsde/makefile b/xsde/makefile index 1878209..358ddfd 100644 --- a/xsde/makefile +++ b/xsde/makefile @@ -114,10 +114,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) @@ -127,12 +123,11 @@ $(call import,\ # Build. # -$(xsde): $(cxx_obj) $(xsd_fe.l) $(cult.l) $(cutl.l) $(fs.l) +$(xsde): $(cxx_obj) $(xsd_fe.l) $(cutl.l) $(fs.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) diff --git a/xsde/options-parser.hxx b/xsde/options-parser.hxx index a16cd67..ff746a6 100644 --- a/xsde/options-parser.hxx +++ b/xsde/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/xsde/options.cli b/xsde/options.cli index 976ddee..316b5da 100644 --- a/xsde/options.cli +++ b/xsde/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 @@ -87,7 +85,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 @@ -130,7 +128,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 @@ -142,7 +140,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 @@ -184,7 +182,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 @@ -214,7 +212,7 @@ 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 @@ -261,7 +259,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 @@ -270,7 +268,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 @@ -279,7 +277,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 @@ -287,7 +285,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/xsde/processing/inheritance/processor.cxx b/xsde/processing/inheritance/processor.cxx index 76172fa..79dced1 100644 --- a/xsde/processing/inheritance/processor.cxx +++ b/xsde/processing/inheritance/processor.cxx @@ -3,28 +3,23 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <processing/inheritance/processor.hxx> +#include <set> +#include <iostream> -#include <elements.hxx> +#include <processing/inheritance/processor.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> +#include <elements.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,14 +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 @@ -82,26 +77,26 @@ namespace Processing Traversal::Complex, Traversal::Member { - Type (DepSet& dep_set, Char const* by_value_key) + Type (DepSet& dep_set, char const* by_value_key) : by_value_key_ (by_value_key), dep_set_ (dep_set), last_ (0) { *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l.argumented ().type ()); if (by_value_key_ != 0 && t.context ().count (by_value_key_) && - t.context ().get<Boolean> (by_value_key_)) + t.context ().get<bool> (by_value_key_)) { dep_set_.insert (Dep (t)); } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -116,7 +111,7 @@ namespace Processing names (c); } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -149,7 +144,7 @@ namespace Processing { if (by_value_key_ != 0 && t.context ().count (by_value_key_) && - t.context ().get<Boolean> (by_value_key_)) + t.context ().get<bool> (by_value_key_)) { dep_set_.insert (Dep (t)); } @@ -157,7 +152,7 @@ namespace Processing } private: - Char const* by_value_key_; + char const* by_value_key_; DepSet& dep_set_; TypeSet types_seen_; @@ -184,14 +179,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_); @@ -212,8 +207,8 @@ namespace Processing { Global (SemanticGraph::Schema& root, SemanticGraph::Schema& schema, - Char const* by_value_key, - Boolean& failed) + char const* by_value_key, + bool& failed) : root_ (root), schema_ (schema), by_value_key_ (by_value_key), @@ -221,28 +216,28 @@ namespace Processing { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) types_seen_.insert (&t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { check_dep (l, l); types_seen_.insert (&l); }; - 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 ()); @@ -256,7 +251,7 @@ namespace Processing }; private: - Void + void check_dep (SemanticGraph::Nameable& global, SemanticGraph::Type& type) { @@ -273,7 +268,7 @@ namespace Processing t.dispatch (type); } - for (DepSet::ConstIterator i (prereqs.begin ()); + for (DepSet::const_iterator i (prereqs.begin ()); i != prereqs.end (); ++i) { Dep const& dep (*i); @@ -394,7 +389,7 @@ namespace Processing private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -416,9 +411,9 @@ namespace Processing private: SemanticGraph::Schema& root_; SemanticGraph::Schema& schema_; - Char const* by_value_key_; + char const* by_value_key_; TypeSet types_seen_; - Boolean& failed_; + bool& failed_; }; @@ -434,7 +429,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 @@ -443,26 +438,26 @@ namespace Processing struct Uses: Traversal::Includes, Traversal::Imports { Uses (SemanticGraph::Schema& root, - Char const* by_value_key, - Boolean& failed) + char const* by_value_key, + bool& failed) : root_ (root), by_value_key_ (by_value_key), 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")) @@ -490,17 +485,17 @@ namespace Processing private: SemanticGraph::Schema& root_; - Char const* by_value_key_; - Boolean& failed_; + char const* by_value_key_; + bool& failed_; }; } - Void Processor:: + void Processor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&, - Char const* by_value_key) + char const* by_value_key) { - 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/xsde/processing/inheritance/processor.hxx b/xsde/processing/inheritance/processor.hxx index 716bdb2..6002c5e 100644 --- a/xsde/processing/inheritance/processor.hxx +++ b/xsde/processing/inheritance/processor.hxx @@ -6,17 +6,15 @@ #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: @@ -27,10 +25,10 @@ namespace Processing // is rearranged to appear before the type containing this // element/attribute. // - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Char const* by_value_key = 0); + char const* by_value_key = 0); }; } } diff --git a/xsde/type-map/lexer.cxx b/xsde/type-map/lexer.cxx index 1b27d68..7c882f7 100644 --- a/xsde/type-map/lexer.cxx +++ b/xsde/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/xsde/type-map/lexer.hxx b/xsde/type-map/lexer.hxx index ede9faa..69235f9 100644 --- a/xsde/type-map/lexer.hxx +++ b/xsde/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 // XSDE_TYPE_MAP_LEXER_HXX - diff --git a/xsde/type-map/parser.cxx b/xsde/type-map/parser.cxx index 16bb7ec..262d600 100644 --- a/xsde/type-map/parser.cxx +++ b/xsde/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/xsde/type-map/parser.hxx b/xsde/type-map/parser.hxx index bafdac3..08ba3f4 100644 --- a/xsde/type-map/parser.hxx +++ b/xsde/type-map/parser.hxx @@ -6,16 +6,13 @@ #ifndef XSDE_TYPE_MAP_PARSER_HXX #define XSDE_TYPE_MAP_PARSER_HXX -#include <cult/types.hxx> - #include <type-map/type-map.hxx> #include <type-map/lexer.hxx> +#include <types.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/xsde/type-map/type-map.hxx b/xsde/type-map/type-map.hxx index 3218c5e..7bcaf56 100644 --- a/xsde/type-map/type-map.hxx +++ b/xsde/type-map/type-map.hxx @@ -6,15 +6,14 @@ #ifndef XSDE_TYPE_MAP_TYPE_MAP_HXX #define XSDE_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 // XSDE_TYPE_MAP_TYPE_MAP_HXX diff --git a/xsde/types.hxx b/xsde/types.hxx index 75bd0e2..4ba69c5 100644 --- a/xsde/types.hxx +++ b/xsde/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/xsde/usage.hxx b/xsde/usage.hxx deleted file mode 100644 index 154d6ab..0000000 --- a/xsde/usage.hxx +++ /dev/null @@ -1,226 +0,0 @@ -// file : xsde/usage.hxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef USAGE_HXX -#define USAGE_HXX - -#include <cult/types.hxx> - -#include <backend-elements/indentation/buffer.hxx> -#include <backend-elements/indentation/clip.hxx> - -namespace CLI -{ - using namespace Cult::Types; - - template <typename C> - class OptionsUsage: public BackendElements::Indentation::Buffer<C> - { - typedef BackendElements::Indentation::Buffer<C> Buffer; - - public: - typedef - typename Buffer::Traits - Traits; - - typedef - typename Buffer::AsChar - AsChar; - - typedef - typename Buffer::AsInt - AsInt; - - typedef - typename Buffer::Write - Write; - - public: - OptionsUsage (Buffer& out) - : out_ (out), - option_length_ (0), - construct_ (Construct::newline) - { - } - - public: - virtual AsInt - put (AsChar c) - { - AsInt result (Traits::to_int_type (c)); - - try - { - switch (c) - { - case '\n': - { - switch (construct_) - { - case Construct::newline: - { - result = out_.put (c); - break; - } - case Construct::option: - { - construct_ = Construct::newline; - break; - } - case Construct::description: - { - result = out_.put (c); - construct_ = Construct::newline; - break; - } - default: - { - abort (); - } - } - - break; - } - case '-': - { - switch (construct_) - { - case Construct::newline: - { - construct_ = Construct::option; - - option_length_ = 0; - - output_indentation (); - result = out_.put (c); - - ++option_length_; - - break; - } - case Construct::option: - { - ++option_length_; - //fall through - } - case Construct::description: - { - result = out_.put (c); - break; - } - default: - { - abort (); - } - } - - break; - } - default: - { - switch (construct_) - { - case Construct::newline: - { - construct_ = Construct::description; - - output_indentation (); - - result = out_.put (c); - break; - } - case Construct::option: - { - ++option_length_; - //fall through - } - default: - { - result = out_.put (c); - break; - } - } - - break; - } - } - } - catch (Write const&) - { - result = Traits::eof (); - } - - return result; - } - - virtual Void - unbuffer () - { - } - - private: - Void - output_indentation () - { - UnsignedLong spaces; - - switch (construct_) - { - case Construct::option: - { - spaces = 2; - option_length_ += 2; - break; - } - case Construct::description: - { - spaces = 29; - - if (option_length_) - { - if (option_length_ > spaces) - spaces = 1; - else - spaces -= option_length_; - - option_length_ = 0; - } - - break; - } - default: - { - abort (); - } - } - - while (spaces--) - out_.put (' '); - } - - private: - Buffer& out_; - UnsignedLong option_length_; - - struct Construct - { - enum Value - { - newline, - option, - description - }; - }; - - typename Construct::Value construct_; - }; - - //@@ rename Indentation to Indent in be? - // - namespace Indent = BackendElements::Indentation; -} - -#endif // USAGE_HXX - diff --git a/xsde/xsde.cxx b/xsde/xsde.cxx index 9d05a70..566ce61 100644 --- a/xsde/xsde.cxx +++ b/xsde/xsde.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <map> #include <vector> #include <memory> // std::auto_ptr #include <cstddef> // std::size_t @@ -12,13 +14,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.hxx> @@ -44,8 +39,6 @@ #include "../libxsde/xsde/cxx/version.hxx" -using namespace Cult::Types; - namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Transformations = XSDFrontend::Transformations; @@ -59,24 +52,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_; }; // @@ -85,21 +78,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_; }; @@ -110,12 +103,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); @@ -123,30 +116,28 @@ 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_; }; // 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 { @@ -159,7 +150,7 @@ main (Int argc, Char* argv[]) if (help_ops.version () || cmd == "version") { - std::wostream& o (wcout); + wostream& o (wcout); o << "CodeSynthesis XSD/e XML Schema to C++ compiler " << "for embedded systems " << XSDE_STR_VERSION << endl @@ -191,7 +182,7 @@ main (Int argc, Char* argv[]) if (help_ops.help () || cmd == "help") { - std::wostream& o (wcout); + wostream& o (wcout); if (cmd == "help" && args.more ()) { @@ -305,7 +296,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 ()); // Collect all the files to compile in a vector. // @@ -320,7 +311,7 @@ main (Int argc, Char* argv[]) return 1; } - Boolean fpt (common_ops.file_per_type ()); + bool fpt (common_ops.file_per_type ()); // Generate/extern XML Schema checks. // @@ -396,17 +387,17 @@ main (Int argc, Char* argv[]) common_ops.anonymous_regex (), common_ops.anonymous_regex_trace ()); - Boolean gen_hybrid (cmd == "cxx-hybrid"); + bool gen_hybrid (cmd == "cxx-hybrid"); - Boolean gen_parser ( + bool gen_parser ( cmd == "cxx-parser" || (gen_hybrid && h_ops->generate_parser ())); - Boolean gen_serializer ( + bool gen_serializer ( cmd == "cxx-serializer" || (gen_hybrid && h_ops->generate_serializer ())); - Boolean poly_aggr ( + bool poly_aggr ( gen_hybrid && h_ops->generate_polymorphic () && h_ops->generate_aggregate ()); @@ -465,13 +456,13 @@ main (Int argc, Char* argv[]) // define derived polymorphic types, except for the fake XML // Schema file. // - Boolean multi (poly_aggr && !gen_xml_schema); + bool multi (poly_aggr && !gen_xml_schema); if (multi) { paths.push_back (tu); - Size ai (0); + size_t ai (0); try { for (; ai < files.size (); ++ai) @@ -815,7 +806,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 { @@ -911,7 +902,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 (), @@ -1079,7 +1070,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 ()) { @@ -1096,7 +1087,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; @@ -1172,7 +1163,7 @@ main (Int argc, Char* argv[]) LocationTranslator:: LocationTranslator (NarrowStrings const& map, NarrowStrings const& regex, - Boolean trace) + bool trace) : trace_ (trace) { // Map. @@ -1181,7 +1172,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) { @@ -1218,14 +1209,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 ()) { @@ -1238,7 +1229,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_) @@ -1269,14 +1260,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) { @@ -1288,18 +1279,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_) @@ -1307,7 +1298,7 @@ translate (WideString const& file, if (i->match (s)) { - WideString r (i->replace (s)); + String r (i->replace (s)); if (trace_) wcerr << "'" << r << "' : +" << endl; @@ -1329,9 +1320,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 ()); @@ -1339,7 +1330,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) { @@ -1367,15 +1358,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_) @@ -1383,7 +1374,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; @@ -1406,7 +1397,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_) @@ -1433,10 +1424,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/xsde/xsde.hxx b/xsde/xsde.hxx index efc4c06..41b0cba 100644 --- a/xsde/xsde.hxx +++ b/xsde/xsde.hxx @@ -6,25 +6,18 @@ #ifndef XSDE_HXX #define XSDE_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_; }; |