From: <vac...@us...> - 2009-12-20 12:48:50
|
Revision: 164 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=164&view=rev Author: vaclavslavik Date: 2009-12-20 12:48:18 +0000 (Sun, 20 Dec 2009) Log Message: ----------- Increased version number to 0.6.2. Modified Paths: -------------- trunk/NEWS trunk/configure.ac Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-12-20 12:47:30 UTC (rev 163) +++ trunk/NEWS 2009-12-20 12:48:18 UTC (rev 164) @@ -1,4 +1,6 @@ +Version 0.6.2 + Fixed xml::tree_parser to fail on non-fatal parser errors. Added XMLWRAPP_CHECK_VERSION macro. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-12-20 12:47:30 UTC (rev 163) +++ trunk/configure.ac 2009-12-20 12:48:18 UTC (rev 164) @@ -36,7 +36,7 @@ AC_REVISION($Id$)dnl AC_PREREQ(2.61) -AC_INIT(xmlwrapp, 0.6.1, [xml...@li...]) +AC_INIT(xmlwrapp, 0.6.2, [xml...@li...]) AC_CONFIG_SRCDIR([xmlwrapp.pc.in]) AC_CONFIG_AUX_DIR([admin]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-02-17 16:15:17
|
Revision: 170 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=170&view=rev Author: vaclavslavik Date: 2010-02-17 16:15:08 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Added xml::exception class, derived from std::runtime_error. This makes it possible to distinguish XML exceptions from other runtime errors. xmlwrapp will throw only this or derived exception, with the exception of std::bad_alloc(), which is still thrown when appropriate. Modified Paths: -------------- trunk/NEWS trunk/include/Makefile.am trunk/include/xmlwrapp/tree_parser.h trunk/include/xmlwrapp/xmlwrapp.h trunk/include/xsltwrapp/stylesheet.h trunk/platform/Win32/xmlwrapp.bkl trunk/src/libxml/ait_impl.cxx trunk/src/libxml/document.cxx trunk/src/libxml/node.cxx trunk/src/libxml/node_manip.cxx trunk/src/libxml/tree_parser.cxx trunk/src/libxslt/stylesheet.cxx Added Paths: ----------- trunk/include/xmlwrapp/exception.h Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/NEWS 2010-02-17 16:15:08 UTC (rev 170) @@ -1,4 +1,8 @@ + Added xml::exception class, derived from std::runtime_error. Xmlwrapp + will throw only this or derived exception, with the exception of + std::bad_alloc(), which is still thrown when appropriate. + Fixed compilation with Sun Studio compiler. Version 0.6.2 Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/Makefile.am 2010-02-17 16:15:08 UTC (rev 170) @@ -5,6 +5,7 @@ xmlwrapp/_cbfo.h \ xmlwrapp/document.h \ xmlwrapp/event_parser.h \ + xmlwrapp/exception.h \ xmlwrapp/init.h \ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ Copied: trunk/include/xmlwrapp/exception.h (from rev 169, trunk/include/xmlwrapp/xmlwrapp.h) =================================================================== --- trunk/include/xmlwrapp/exception.h (rev 0) +++ trunk/include/xmlwrapp/exception.h 2010-02-17 16:15:08 UTC (rev 170) @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/** + @file + + This file contains the definition of the xml::exception class. + */ + +#ifndef _xmlwrapp_exception_h_ +#define _xmlwrapp_exception_h_ + +#include <stdexcept> +#include <string> + +/// XML library namespace +namespace xml +{ + +/** + This exception class is thrown by xmlwrapp for all runtime XML-related + errors. + + @note C++ runtime may still thrown other errors when used from xmlwrapp. + Also, std::bad_alloc() is thrown in out-of-memory situations. + + @since 0.7.0 + */ +class exception : public std::runtime_error +{ +public: + explicit exception(const std::string& what) : std::runtime_error(what) + { + } +}; + +} // namespace xml + +#endif // _xmlwrapp_exception_h_ Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xmlwrapp/tree_parser.h 2010-02-17 16:15:08 UTC (rev 170) @@ -74,7 +74,7 @@ constructor will parse that file. There are two options for dealing with XML parsing errors. The - default it to throw an exception (std::runtime_error). The other + default it to throw an exception (xml::exception). The other option is to pass false for the allow_exceptions flag. This will prevent an exception from being thrown, instead, a flag will be set that you can test with the operator! member function. Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xmlwrapp/xmlwrapp.h 2010-02-17 16:15:08 UTC (rev 170) @@ -41,5 +41,6 @@ #include "xmlwrapp/document.h" #include "xmlwrapp/tree_parser.h" #include "xmlwrapp/event_parser.h" +#include "xmlwrapp/exception.h" #endif // _xmlwrapp_xmlwrapp_h_ Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xsltwrapp/stylesheet.h 2010-02-17 16:15:08 UTC (rev 170) @@ -118,7 +118,7 @@ /** Apply this stylesheet to the given XML document. The results document is returned. If there is an error during transformation, this - function will throw a std::runtime_error exception. + function will throw a xml::exception exception. Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of @@ -133,7 +133,7 @@ /** Apply this stylesheet to the given XML document. The results document is returned. If there is an error during transformation, this - function will throw a std::runtime_error exception. + function will throw a xml::exception exception. Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of @@ -153,7 +153,7 @@ If you are using one of the apply member functions that throws exceptions, this function should not be used. The text message for - the transformation error will be given to the std::runtime_error + the transformation error will be given to the xml::exception constructor. @return The last error message. Modified: trunk/platform/Win32/xmlwrapp.bkl =================================================================== --- trunk/platform/Win32/xmlwrapp.bkl 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/platform/Win32/xmlwrapp.bkl 2010-02-17 16:15:08 UTC (rev 170) @@ -16,6 +16,7 @@ include/xmlwrapp/_cbfo.h include/xmlwrapp/document.h include/xmlwrapp/event_parser.h + include/xmlwrapp/exception.h include/xmlwrapp/init.h include/xmlwrapp/node.h include/xmlwrapp/nodes_view.h Modified: trunk/src/libxml/ait_impl.cxx =================================================================== --- trunk/src/libxml/ait_impl.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/ait_impl.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -34,10 +34,10 @@ #include "ait_impl.h" #include "utility.h" #include "xmlwrapp/attributes.h" +#include "xmlwrapp/exception.h" // standard includes #include <algorithm> -#include <stdexcept> // libxml2 includes #include <libxml/tree.h> @@ -354,7 +354,7 @@ return name_.c_str(); // we were given a name not a node if (!node_ || !prop_) - throw std::runtime_error("access to invalid attributes::attr object!"); + throw xml::exception("access to invalid attributes::attr object!"); return reinterpret_cast<const char*>(static_cast<xmlAttrPtr>(prop_)->name); } @@ -366,7 +366,7 @@ return value_.c_str(); // we were given a value, not a node if (!node_ || !prop_) - throw std::runtime_error("access to invalid attributes::attr object!"); + throw xml::exception("access to invalid attributes::attr object!"); xmlChar *tmpstr = xmlNodeListGetString(reinterpret_cast<xmlNodePtr>(node_)->doc, reinterpret_cast<xmlAttrPtr>(prop_)->children, 1); if (tmpstr == 0) Modified: trunk/src/libxml/document.cxx =================================================================== --- trunk/src/libxml/document.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/document.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -33,6 +33,8 @@ // xmlwrapp includes #include "xmlwrapp/document.h" #include "xmlwrapp/node.h" +#include "xmlwrapp/exception.h" + #include "utility.h" #include "dtd_impl.h" #include "node_manip.h" @@ -367,7 +369,7 @@ void document::push_back(const node& child) { if (child.get_type() == node::type_element) - throw std::runtime_error("xml::document::push_back can't take element type nodes"); + throw xml::exception("xml::document::push_back can't take element type nodes"); impl::node_insert ( @@ -381,7 +383,7 @@ node::iterator document::insert(const node& n) { if (n.get_type() == node::type_element) - throw std::runtime_error("xml::document::insert can't take element type nodes"); + throw xml::exception("xml::document::insert can't take element type nodes"); return node::iterator(xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data()))); } @@ -390,7 +392,7 @@ node::iterator document::insert(node::iterator position, const node& n) { if (n.get_type() == node::type_element) - throw std::runtime_error("xml::document::insert can't take element type nodes"); + throw xml::exception("xml::document::insert can't take element type nodes"); return node::iterator(xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), static_cast<xmlNodePtr>(position.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data()))); } @@ -400,7 +402,7 @@ { if (old_node->get_type() == node::type_element || new_node.get_type() == node::type_element) { - throw std::runtime_error("xml::document::replace can't replace element type nodes"); + throw xml::exception("xml::document::replace can't replace element type nodes"); } return node::iterator(xml::impl::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(new_node).get_node_data()))); @@ -410,7 +412,7 @@ node::iterator document::erase(node::iterator to_erase) { if (to_erase->get_type() == node::type_element) - throw std::runtime_error("xml::document::erase can't erase element type nodes"); + throw xml::exception("xml::document::erase can't erase element type nodes"); return node::iterator(xml::impl::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node()))); } Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/node.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -35,6 +35,7 @@ #include "xmlwrapp/node.h" #include "xmlwrapp/nodes_view.h" #include "xmlwrapp/attributes.h" +#include "xmlwrapp/exception.h" #include "utility.h" #include "ait_impl.h" #include "node_manip.h" @@ -477,7 +478,7 @@ { if (pimpl_->xmlnode_->type != XML_ELEMENT_NODE) { - throw std::runtime_error("get_attributes called on non-element node"); + throw xml::exception("get_attributes called on non-element node"); } pimpl_->attrs_.set_data(pimpl_->xmlnode_); @@ -489,7 +490,7 @@ { if (pimpl_->xmlnode_->type != XML_ELEMENT_NODE) { - throw std::runtime_error("get_attributes called on non-element node"); + throw xml::exception("get_attributes called on non-element node"); } pimpl_->attrs_.set_data(pimpl_->xmlnode_); Modified: trunk/src/libxml/node_manip.cxx =================================================================== --- trunk/src/libxml/node_manip.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/node_manip.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -31,6 +31,8 @@ */ // xmlwrapp includes +#include "xmlwrapp/exception.h" + #include "node_manip.h" // standard includes @@ -53,7 +55,7 @@ if ( xmlAddChild(parent, new_xml_node) == 0 ) { xmlFreeNode(new_xml_node); - throw std::runtime_error("failed to insert xml::node; xmlAddChild failed"); + throw xml::exception("failed to insert xml::node; xmlAddChild failed"); } } else @@ -61,7 +63,7 @@ if ( xmlAddPrevSibling(before, new_xml_node) == 0 ) { xmlFreeNode(new_xml_node); - throw std::runtime_error("failed to insert xml::node; xmlAddPrevSibling failed"); + throw xml::exception("failed to insert xml::node; xmlAddPrevSibling failed"); } } @@ -83,7 +85,7 @@ if ( copied_node->doc == reinterpret_cast<xmlDocPtr>(old_node) ) { xmlFreeNode(copied_node); - throw std::runtime_error("failed to replace xml::node; xmlReplaceNode() failed"); + throw xml::exception("failed to replace xml::node; xmlReplaceNode() failed"); } xmlFreeNode(old_node); Modified: trunk/src/libxml/tree_parser.cxx =================================================================== --- trunk/src/libxml/tree_parser.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/tree_parser.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -33,6 +33,7 @@ // xmlwrapp includes #include "xmlwrapp/tree_parser.h" #include "xmlwrapp/document.h" +#include "xmlwrapp/exception.h" #include "utility.h" // libxml includes @@ -160,7 +161,7 @@ xmlFreeDoc(tmpdoc); if (allow_exceptions) - throw std::runtime_error(pimpl_->last_error_); + throw xml::exception(pimpl_->last_error_); } ap.release(); @@ -194,7 +195,7 @@ pimpl_->okay_ = false; if (allow_exceptions) - throw std::runtime_error(pimpl_->last_error_); + throw xml::exception(pimpl_->last_error_); ap.release(); return; // handle non-exception case Modified: trunk/src/libxslt/stylesheet.cxx =================================================================== --- trunk/src/libxslt/stylesheet.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxslt/stylesheet.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -40,6 +40,7 @@ #include "xsltwrapp/stylesheet.h" #include "xmlwrapp/document.h" #include "xmlwrapp/tree_parser.h" +#include "xmlwrapp/exception.h" #include "result.h" #include "../libxml/utility.h" @@ -51,7 +52,6 @@ #include <libxslt/xsltutils.h> // standard includes -#include <stdexcept> #include <memory> #include <string> #include <vector> @@ -207,7 +207,7 @@ // TODO error_ can't get set yet. Need changes from libxslt first if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT parser error"; - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); } // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is @@ -227,7 +227,7 @@ // TODO error_ can't get set yet. Need changes from libxslt first if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT parser error"; - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); } // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is @@ -282,7 +282,7 @@ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input); if ( !xmldoc ) - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_)); return pimpl_->doc_; @@ -296,7 +296,7 @@ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input, &with_params); if ( !xmldoc ) - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_)); return pimpl_->doc_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-09 17:34:04
|
Revision: 172 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=172&view=rev Author: vaclavslavik Date: 2010-03-09 17:33:58 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Removed @author tags from documentation. This information is of no interest to *documentation* reader. It can be found in copyright notices, VCS history and the AUTHORS file. Modified Paths: -------------- trunk/AUTHORS trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xsltwrapp/init.h trunk/include/xsltwrapp/stylesheet.h trunk/src/libxml/node_manip.h trunk/src/libxslt/result.h Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/AUTHORS 2010-03-09 17:33:58 UTC (rev 172) @@ -15,3 +15,4 @@ Frank Grimm Gary Passero Michael Grundberg <mgr...@us...> + Dmitriy Nikitinskiy Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/attributes.h 2010-03-09 17:33:58 UTC (rev 172) @@ -75,8 +75,6 @@ /** Create a new xml::attributes object with no attributes. - - @author Peter Jones */ attributes(); @@ -84,7 +82,6 @@ Copy construct a xml::attributes object. @param other The xml::attributes object to copy from. - @author Peter Jones */ attributes(const attributes& other); @@ -92,8 +89,7 @@ Copy the given xml::attributes object into this one. @param other The xml::attributes object to copy from. - @return this. - @author Peter Jones + @return *this. */ attributes& operator=(const attributes& other); @@ -101,7 +97,6 @@ Swap this xml::attributes object with another one. @param other The other xml::attributes object to swap with. - @author Peter Jones */ void swap(attributes& other); @@ -121,7 +116,6 @@ Get the name of this attribute. @return The name for this attribute. - @author Peter Jones */ const char *get_name() const; @@ -129,7 +123,6 @@ Get the value of this attribute. @return The value for this attribute. - @author Peter Jones */ const char* get_value() const; @@ -239,7 +232,6 @@ @return An iterator equal to end() if there are no attributes. @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator begin(); @@ -250,7 +242,6 @@ @return A const_iterator equal to end() if there are no attributes. @see xml::attributes::const_iterator @see xml::attributes::attr - @author Peter Jones */ const_iterator begin() const; @@ -258,7 +249,6 @@ Get an iterator that points one past the the last attribute. @return An "end" iterator. - @author Peter Jones */ iterator end(); @@ -266,7 +256,6 @@ Get a const_iterator that points one past the last attribute. @return An "end" const_iterator. - @author Peter Jones */ const_iterator end() const; @@ -276,7 +265,6 @@ @param name The name of the attribute to add. @param value The value of the attribute to add. - @author Peter Jones */ void insert(const char *name, const char *value); @@ -290,7 +278,6 @@ @return If the attribute was not found, find will return end(). @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator find(const char *name); @@ -304,7 +291,6 @@ @return If the attribute was not found, find will return end(). @see xml::attributes::const_iterator @see xml::attributes::attr - @author Peter Jones */ const_iterator find(const char *name) const; @@ -317,7 +303,6 @@ @return An iterator that points to the attribute after the one to be erased. @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator erase(iterator to_erase); @@ -327,7 +312,6 @@ pointers or references to that attribute. @param name The name of the attribute to erase. - @author Peter Jones */ void erase(const char *name); @@ -336,7 +320,6 @@ @return True if there are no attributes. @return False if there is at least one attribute. - @author Peter Jones */ bool empty() const; @@ -345,7 +328,6 @@ object. @return The number of attributes in this xml::attributes object. - @author Peter Jones */ size_type size() const; Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/document.h 2010-03-09 17:33:58 UTC (rev 172) @@ -84,8 +84,6 @@ /** Create a new XML document with the default settings. The new document will contain a root node with a name of "blank". - - @author Peter Jones */ document(); @@ -94,7 +92,6 @@ given text. @param root_name What to set the name of the root element to. - @author Peter Jones */ explicit document(const char *root_name); @@ -102,7 +99,6 @@ Create a new XML document and set the root node. @param n The node to use as the root node. n will be copied. - @author Peter Jones */ explicit document(const node& n); @@ -111,7 +107,6 @@ copy of the original. @param other The other document object to copy from. - @author Peter Jones */ document(const document& other); @@ -122,7 +117,6 @@ @param other The document to copy from. @return *this. - @author Peter Jones */ document& operator=(const document& other); @@ -130,14 +124,11 @@ Swap one xml::document object for another. @param other The other document to swap - @author Peter Jones */ void swap(document& other); /** Clean up after an XML document object. - - @author Peter Jones */ ~document(); @@ -148,7 +139,6 @@ tree! @return A const reference to the root node. - @author Peter Jones */ const node& get_root_node() const; @@ -159,7 +149,6 @@ tree! @return A reference to the root node. - @author Peter Jones */ node& get_root_node(); @@ -168,7 +157,6 @@ in the document object. @param n The new root node to use. - @author Peter Jones */ void set_root_node(const node& n); @@ -178,7 +166,6 @@ version from the XML processing instruction. @return The XML version string for this document. - @author Peter Jones */ const std::string& get_version() const; @@ -187,7 +174,6 @@ will be used when generating the XML output. @param version The version string to use, like "1.0". - @author Peter Jones */ void set_version(const char *version); @@ -196,7 +182,6 @@ ISO-8859-1. @return The encoding string. - @author Peter Jones */ const std::string& get_encoding() const; @@ -205,8 +190,6 @@ to ISO-8859-1. @param encoding The XML encoding to use. - @author Peter Jones - @author Dmitriy Nikitinskiy */ void set_encoding(const char *encoding); @@ -217,7 +200,6 @@ @return True if this document is standalone. @return False if this document is not standalone. - @author Peter Jones */ bool get_is_standalone() const; @@ -226,7 +208,6 @@ correct processing instruction. @param sa What to set the standalone flag to. - @author Peter Jones */ void set_is_standalone(bool sa); @@ -240,8 +221,6 @@ @return False if there was an error with substitutions. @return True if there were no errors (with or without substitutions). - @author Peter Jones - @author Daniel Evison */ bool process_xinclude(); @@ -251,7 +230,6 @@ @return True if this document has an internal subset. @return False otherwise. - @author Peter Jones */ bool has_internal_subset() const; @@ -261,7 +239,6 @@ @return True if this document has an external subset. @return False otherwise. - @author Peter Jones */ bool has_external_subset() const; @@ -276,7 +253,6 @@ @return True if the document is valid. @return False if there was a problem with the DTD or XML doc. - @author Peter Jones */ bool validate(); @@ -295,7 +271,6 @@ @param dtdname A filename or URL for the DTD to use. @return True if the document is valid. @return False if there was a problem with the DTD or XML doc. - @author Peter Jones */ bool validate(const char *dtdname); @@ -306,7 +281,6 @@ there are, including processing instructions, comments, etc. @return The number of children nodes that this document has. - @author Peter Jones */ size_type size() const; @@ -317,7 +291,6 @@ @return A xml::node::iterator that points to the first child node. @return An end iterator if there are no children in this document - @author Peter Jones */ node::iterator begin(); @@ -328,7 +301,6 @@ @return A xml::node::const_iterator that points to the first child node. @return An end const_iterator if there are no children in this document. - @author Peter Jones */ node::const_iterator begin() const; @@ -337,7 +309,6 @@ document. @return An end xml::node::iterator. - @author Peter Jones */ node::iterator end(); @@ -346,7 +317,6 @@ this document. @return An end xml::node::const_iterator. - @author Peter Jones */ node::const_iterator end() const; @@ -358,7 +328,6 @@ be thrown. @param child The child xml::node to add. - @author Peter Jones */ void push_back (const node &child); @@ -373,7 +342,6 @@ @param n The node to insert as a child of this document. @return An iterator that points to the newly inserted node. @see xml::document::push_back - @author Peter Jones */ node::iterator insert (const node &n); @@ -388,7 +356,6 @@ @param n The node to insert as a child of this document. @return An iterator that points to the newly inserted node. @see xml::document::push_back - @author Peter Jones */ node::iterator insert(node::iterator position, const node &n); @@ -407,7 +374,6 @@ @param new_node The node to put in old_node's place. @return An iterator that points to the new node. @see xml::document::push_back - @author Peter Jones */ node::iterator replace(node::iterator old_node, const node& new_node); @@ -424,7 +390,6 @@ @param to_erase An iterator that points to the node to be erased. @return An iterator that points to the node after the one being erased. @see xml::document::push_back - @author Peter Jones */ node::iterator erase(node::iterator to_erase); @@ -441,7 +406,6 @@ @param last An iterator that points one past the last node to erase. Think xml::node::end(). @return An iterator that points to the node after the last one being erased. @see xml::document::push_back - @author Peter Jones */ node::iterator erase(node::iterator first, node::iterator last); @@ -450,7 +414,6 @@ the given string. @param s The string to place the XML text data. - @author Peter Jones */ void save_to_string(std::string& s) const; @@ -463,7 +426,6 @@ for better speed, and 9 is for smaller size @return True if the data was saved successfully. @return False otherwise. - @author Peter Jones */ bool save_to_file(const char *filename, int compression_level = 0) const; @@ -474,7 +436,6 @@ @param stream The stream to insert the XML into. @param doc The document to insert. @return The stream from the first parameter. - @author Peter Jones */ friend std::ostream& operator<< (std::ostream &stream, const document &doc); Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:33:58 UTC (rev 172) @@ -80,7 +80,6 @@ @param filename The name of the file to parse. @return True if the file was successfully parsed; false otherwise. - @author Peter Jones */ bool parse_file(const char *filename); @@ -89,7 +88,6 @@ @param stream The stream to read data from. @return True if the stream was successfully parsed; false otherwise. - @author Peter Jones */ bool parse_stream(std::istream& stream); @@ -101,7 +99,6 @@ @param chunk The xml data chuck to parse. @param length The size of the given data chunk @return True if the chunk was parsed sucessfully; false otherwise. - @author Peter Jones */ bool parse_chunk(const char *chunk, size_type length); @@ -111,7 +108,6 @@ member function. @return True if all parsing was successful; false otherwise. - @author Peter Jones */ bool parse_finish(); @@ -121,7 +117,6 @@ a message describing the error. @return A description of the XML parsing error. - @author Peter Jones */ const std::string& get_error_message() const; @@ -134,7 +129,6 @@ @param name The name of the element @param attrs The element's attributes @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool start_element(const std::string& name, const attrs_type& attrs) = 0; @@ -145,7 +139,6 @@ @param name The name of the element that was closed. @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool end_element(const std::string& name) = 0; @@ -155,7 +148,6 @@ @param contents The contents of the text node. @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool text(const std::string& contents) = 0; @@ -170,7 +162,6 @@ @param contents The contents of the CDATA section. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool cdata(const std::string& contents); @@ -186,7 +177,6 @@ @param data The data of the processing instruction. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool processing_instruction(const std::string& target, const std::string& data); @@ -200,7 +190,6 @@ @param contents The contents of the XML comment. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool comment(const std::string& contents); @@ -211,7 +200,6 @@ @param message The warning message from the compiler. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool warning(const std::string& message); @@ -222,7 +210,6 @@ function, "Unknown Error" will be returned from get_error_message(). @param message The message to return from get_error_message(). - @author Peter Jones */ void set_error_message(const char *message); Modified: trunk/include/xmlwrapp/init.h =================================================================== --- trunk/include/xmlwrapp/init.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) @@ -69,7 +69,6 @@ node tree. The default is true. @param flag True to turn on indenting, false to turn it off. - @author Peter Jones */ static void indent_output(bool flag); @@ -79,7 +78,6 @@ is false. @param flag True to remove whitespace, false to leave alone. - @author Peter Jones */ static void remove_whitespace(bool flag); @@ -88,7 +86,6 @@ substitute entities while parsing. The default is true. @param flag True to turn on substitution, false to turn off. - @author Peter Jones */ static void substitute_entities(bool flag); @@ -99,7 +96,6 @@ default is true. @param flag True to turn on loading, false to turn it off. - @author Peter Jones */ static void load_external_subsets(bool flag); @@ -109,7 +105,6 @@ is false. @return flag True to turn on validation, false to turn it off. - @author Peter Jones */ static void validate_xml(bool flag); Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/node.h 2010-03-09 17:33:58 UTC (rev 172) @@ -165,8 +165,6 @@ /** Construct a new blank xml::node. - - @author Peter Jones */ node(); @@ -174,7 +172,6 @@ Construct a new xml::node and set the name of the node. @param name The name of the new node. - @author Peter Jones */ explicit node(const char *name); @@ -184,7 +181,6 @@ @param name The name of the new element. @param content The text that will be used to create a child node. - @author Peter Jones */ node(const char *name, const char *content); @@ -199,7 +195,6 @@ @param cdata_info A cdata struct that tells xml::node what the content will be. - @author Peter Jones */ explicit node(cdata cdata_info); @@ -213,7 +208,6 @@ @endcode @param comment_info A comment struct that tells xml::node what the comment will be. - @author Peter Jones */ explicit node(comment comment_info); @@ -228,7 +222,6 @@ @endcode @param pi_info A pi struct that tells xml::node what the name and contents of the XML PI are. - @author Peter Jones */ explicit node(pi pi_info); @@ -242,7 +235,6 @@ @endcode @param text_info A text struct that tells xml::node what the text will be. - @author Vaclav Slavik */ explicit node(text text_info); @@ -250,7 +242,6 @@ Construct a new xml::node by copying another xml::node. @param other The other node to copy. - @author Peter Jones */ node(const node& other); @@ -259,14 +250,11 @@ @param other The other node to copy. @return A reference to this node. - @author Peter Jones */ node& operator=(const node& other); /** Class destructor - - @author Peter Jones */ ~node(); @@ -274,7 +262,6 @@ Set the name of this xml::node. @param name The new name for this xml::node. - @author Peter Jones */ void set_name(const char *name); @@ -285,7 +272,6 @@ Feedback is welcome. @return The name of this node. - @author Peter Jones */ const char* get_name() const; @@ -295,7 +281,6 @@ with one text node set to the given string. @param content The content of the text node. - @author Peter Jones */ void set_content(const char *content); @@ -309,7 +294,6 @@ Feedback is welcome. @return The content or 0. - @author Peter Jones */ const char* get_content() const; @@ -318,7 +302,6 @@ can and cannot do with it. @return The node's type. - @author Peter Jones */ node_type get_type() const; @@ -328,7 +311,6 @@ to this returned object, to prevent a copy. @return The xml::attributes object for this node. - @author Peter Jones */ xml::attributes& get_attributes(); @@ -338,7 +320,6 @@ returned object, to prevent a copy. @return The xml::attributes object for this node. - @author Peter Jones */ const xml::attributes& get_attributes() const; @@ -347,7 +328,6 @@ @return The namespace of this node or NULL if no namespace is associated. - @author Vaclav Slavik @since 0.6.0 */ const char* get_namespace() const; @@ -357,7 +337,6 @@ CDATA for example. @return True if this node is a text node; false otherwise. - @author Peter Jones */ bool is_text() const; @@ -365,7 +344,6 @@ Add a child xml::node to this node. @param child The child xml::node to add. - @author Peter Jones */ void push_back(const node& child); @@ -373,7 +351,6 @@ Swap this node with another one. @param other The other node to swap with. - @author Peter Jones */ void swap(node& other); @@ -475,7 +452,6 @@ xml::node::empty() instead. @return The number of children this node has. - @author Peter Jones */ size_type size() const; @@ -485,7 +461,6 @@ @return True if this node DOES NOT have any children. @return False if this node does have children. - @author Peter Jones */ bool empty() const; @@ -493,7 +468,6 @@ Get an iterator that points to the beginning of this node's children. @return An iterator that points to the beginning of the children. - @author Peter Jones */ iterator begin(); @@ -502,7 +476,6 @@ children. @return A const_iterator that points to the beginning of the children. - @author Peter Jones */ const_iterator begin() const; @@ -510,7 +483,6 @@ Get an iterator that points one past the last child for this node. @return A "one past the end" iterator. - @author Peter Jones */ iterator end() { return iterator(); } @@ -519,7 +491,6 @@ node. @return A "one past the end" const_iterator - @author Peter Jones */ const_iterator end() const { return const_iterator(); } @@ -527,7 +498,6 @@ Get an iterator that points back at this node. @return An iterator that points at this node. - @author Peter Jones */ iterator self(); @@ -535,7 +505,6 @@ Get a const_iterator that points back at this node. @return A const_iterator that points at this node. - @author Peter Jones */ const_iterator self() const; @@ -546,7 +515,6 @@ @return An iterator that points to this nodes parent. @return If no parent, returns the same iterator that xml::node::end() returns. - @author Peter Jones */ iterator parent(); @@ -557,7 +525,6 @@ @return A const_iterator that points to this nodes parent. @return If no parent, returns the same const_iterator that xml::node::end() returns. - @author Peter Jones */ const_iterator parent() const; @@ -573,7 +540,6 @@ @param name The name of the node you want to find. @return An iterator that points to the node if found. @return An end() iterator if the node was not found. - @author Peter Jones @see elements(const char*), find(const char*, iterator) */ @@ -591,7 +557,6 @@ @param name The name of the node you want to find. @return A const_iterator that points to the node if found. @return An end() const_iterator if the node was not found. - @author Peter Jones @see elements(const char*) const, find(const char*, const_iterator) const @@ -612,7 +577,6 @@ @param start Where to begin the search. @return An iterator that points to the node if found. @return An end() iterator if the node was not found. - @author Peter Jones @see elements(const char*) */ @@ -632,7 +596,6 @@ @param start Where to begin the search. @return A const_iterator that points to the node if found. @return An end() const_iterator if the node was not found. - @author Peter Jones @see elements(const char*) const */ @@ -652,7 +615,6 @@ @endcode @return View with all child elements or empty view if there aren't any. - @author Vaclav Slavik @since 0.6.0 @see nodes_view @@ -675,7 +637,6 @@ @endcode @return View with all child elements or empty view if there aren't any. - @author Vaclav Slavik @since 0.6.0 @see const_nodes_view @@ -697,7 +658,6 @@ @param name Name of the elements to return. @return View that contains only elements @a name. - @author Vaclav Slavik @since 0.6.0 */ nodes_view elements(const char *name); @@ -719,7 +679,6 @@ @param name Name of the elements to return. @return View that contains only elements @a name. - @author Vaclav Slavik @since 0.6.0 */ const_nodes_view elements(const char *name) const; @@ -731,7 +690,6 @@ @param n The node to insert as a child of this node. @return An iterator that points to the newly inserted node. - @author Peter Jones */ iterator insert(const node& n); @@ -742,7 +700,6 @@ @param position An iterator that points to the location where the new node should be inserted (before it). @param n The node to insert as a child of this node. @return An iterator that points to the newly inserted node. - @author Peter Jones */ iterator insert(const iterator& position, const node& n); @@ -756,7 +713,6 @@ @param old_node An iterator that points to the node that should be removed. @param new_node The node to put in old_node's place. @return An iterator that points to the new node. - @author Peter Jones */ iterator replace(const iterator& old_node, const node& new_node); @@ -768,8 +724,6 @@ @param to_erase An iterator that points to the node to be erased. @return An iterator that points to the node after the one being erased. - @author Peter Jones - @author Gary A. Passero */ iterator erase(const iterator& to_erase); @@ -781,7 +735,6 @@ @param first The first node in the range to be removed. @param last An iterator that points one past the last node to erase. Think xml::node::end(). @return An iterator that points to the node after the last one being erased. - @author Peter Jones */ iterator erase(iterator first, const iterator& last); @@ -793,7 +746,6 @@ @param name The name of nodes to remove. @return The number of nodes removed. - @author Peter Jones */ size_type erase(const char *name); @@ -807,7 +759,6 @@ @param node_name The name of the nodes to sort. @param attr_name The attribute to sort on. - @author Peter Jones */ void sort(const char *node_name, const char *attr_name); @@ -817,7 +768,6 @@ sorting. @param compare The binary function object to call in order to sort all child nodes. - @author Peter Jones */ template <typename T> void sort (T compare) { impl::sort_callback<T> cb(compare); sort_fo(cb); } @@ -827,7 +777,6 @@ string to that text. @param xml The string to set the node's XML data to. - @author Peter Jones */ void node_to_string(std::string& xml) const; @@ -837,7 +786,6 @@ @param stream The stream to write the node as XML. @param n The node to write to the stream. @return The stream. - @author Peter Jones */ friend std::ostream& operator<< (std::ostream &stream, const node &n); Modified: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:33:58 UTC (rev 172) @@ -69,7 +69,6 @@ The nodes_view class implements the same container interface that xml::node does: it has begin() and end() methods. - @author Vaclav Slavik @since 0.6.0 @see xml::node::elements(), xml::node::elements(const char *) @@ -234,7 +233,6 @@ @see nodes_view - @author Vaclav Slavik @since 0.6.0 */ class const_nodes_view Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:33:58 UTC (rev 172) @@ -84,7 +84,6 @@ @param filename The name of the file to parse. @param allow_exceptions Whether or not you want an exception for parsing errors. - @author Peter Jones */ tree_parser(const char *filename, bool allow_exceptions = true); @@ -97,7 +96,6 @@ @param size The size of the XML data to parse. @param allow_exceptions Whether or not you want an exception for parsing errors. - @author Peter Jones */ tree_parser(const char *data, size_type size, bool allow_exceptions = true); @@ -109,7 +107,6 @@ good XML node tree. @return True if the tree_parser is NOT VAILD; false if it is vaild. - @author Peter Jones */ bool operator!() const; @@ -119,7 +116,6 @@ generated during parsing. @return The error message generated durring XML parsing. - @author Peter Jones */ const std::string& get_error_message() const; @@ -131,7 +127,6 @@ @return True if there were any warnings. @return False if there were no warnings. - @author Peter Jones */ bool had_warnings() const; @@ -141,7 +136,6 @@ document to avoid a deep copy. @return A reference to the xml::document. - @author Peter Jones */ xml::document& get_document(); @@ -151,7 +145,6 @@ document to avoid a deep copy. @return A const reference to the xml::document. - @author Peter Jones */ const xml::document& get_document() const; Modified: trunk/include/xsltwrapp/init.h =================================================================== --- trunk/include/xsltwrapp/init.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xsltwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) @@ -71,7 +71,6 @@ true. @param flag True to enable XInclusing processing; False otherwise. - @author Peter Jones */ static void process_xincludes(bool flag); Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:33:58 UTC (rev 172) @@ -68,7 +68,6 @@ stylesheet in the given filename. @param filename The name of the file that contains the stylesheet. - @author Peter Jones */ explicit stylesheet(const char *filename); @@ -79,14 +78,11 @@ document and free it. @param doc The parsed stylesheet. - @author Peter Jones */ explicit stylesheet(xml::document doc); /** Clean up after an xslt::stylesheet. - - @author Peter Jones */ ~stylesheet(); @@ -98,7 +94,6 @@ @param result The result tree after applying this stylesheet. @return True if the transformation was successful and the results placed in result. @return False if there was an error, result is not modified. - @author Peter Jones */ bool apply(const xml::document& doc, xml::document& result); @@ -111,7 +106,6 @@ @param with_params Override xsl:param elements using the given key/value map @return True if the transformation was successful and the results placed in result. @return False if there was an error, result is not modified. - @author Peter Jones */ bool apply(const xml::document& doc, xml::document& result, const param_type& with_params); @@ -126,7 +120,6 @@ @param doc The XML document to transform. @return A reference to the result tree. - @author Peter Jones */ xml::document& apply(const xml::document& doc); @@ -142,7 +135,6 @@ @param doc The XML document to transform. @param with_params Override xsl:param elements using the given key/value map @return A reference to the result tree. - @author Peter Jones */ xml::document& apply(const xml::document& doc, const param_type& with_params); @@ -157,7 +149,6 @@ constructor. @return The last error message. - @author Peter Jones */ const std::string& get_error_message() const; Modified: trunk/src/libxml/node_manip.h =================================================================== --- trunk/src/libxml/node_manip.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/src/libxml/node_manip.h 2010-03-09 17:33:58 UTC (rev 172) @@ -59,7 +59,6 @@ @param to_add The node to be copied and then inserted into the child list. @return The new node that was inserted into the child list. - @author Peter Jones */ xmlNodePtr node_insert(xmlNodePtr parent, xmlNodePtr before, xmlNodePtr to_add); @@ -74,7 +73,6 @@ @return The new node that was crated from copying @a new_node and inserted into the child list where @a old_node was. - @author Peter Jones */ xmlNodePtr node_replace(xmlNodePtr old_node, xmlNodePtr new_node); @@ -87,7 +85,6 @@ @return The node that was after to_erase (may be 0 (null) if @a to_erase was the last node in the list) - @author Peter Jones */ xmlNodePtr node_erase(xmlNodePtr to_erase); Modified: trunk/src/libxslt/result.h =================================================================== --- trunk/src/libxslt/result.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/src/libxslt/result.h 2010-03-09 17:33:58 UTC (rev 172) @@ -62,8 +62,6 @@ libxmlwrapp, on libxslt which should be only a dependency of libxsltwrapp as this precludes calling the XSLT functions which must be used with such "result" documents directly from xml::document code. - - @author Vadim Zeitlin */ class result { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-11 15:30:20
|
Revision: 176 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=176&view=rev Author: vaclavslavik Date: 2010-03-11 15:30:14 +0000 (Thu, 11 Mar 2010) Log Message: ----------- Add xml::node::set_text_content(). Unlike set_content(), this method expects unescaped text and escapes it properly itself. Modified Paths: -------------- trunk/NEWS trunk/include/xmlwrapp/node.h trunk/src/libxml/node.cxx Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-03-11 15:29:43 UTC (rev 175) +++ trunk/NEWS 2010-03-11 15:30:14 UTC (rev 176) @@ -1,4 +1,7 @@ + Added xml::node::set_text_content() for setting unescaped textual + content. + Added xml::exception class, derived from std::runtime_error. Xmlwrapp will throw only this or derived exception, with the exception of std::bad_alloc(), which is still thrown when appropriate. Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-11 15:29:43 UTC (rev 175) +++ trunk/include/xmlwrapp/node.h 2010-03-11 15:30:14 UTC (rev 176) @@ -287,11 +287,32 @@ entity references, but XML special chars need to be escaped first. In particular, the '&' character @em must be escaped as "&" unless it's part of entity reference. Not escaping - @a content may result in truncation of data. + @a content may result in truncation of data. Use + set_text_content() if @a content may contain special characters. + + @see set_text_content() */ void set_content(const char *content); /** + Set the content of a node to given text. + + In contrast to set_content(), @a content is raw text, so unescaped XML + special chars are allowed and entity references are not supported. + + If this node is an element node, this function will remove all of its + children nodes and replace them with one text node set to the given + string. + + @param content The content text. + + @see set_content() + + @since 0.7.0 + */ + void set_text_content(const char *content); + + /** Get the content for this text node. If this node is not a text node but it has children nodes that are text nodes, the contents of those child nodes will be returned. If there is no content or these Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-03-11 15:29:43 UTC (rev 175) +++ trunk/src/libxml/node.cxx 2010-03-11 15:30:14 UTC (rev 176) @@ -436,6 +436,16 @@ } +void node::set_text_content(const char *content) +{ + xmlChar *escaped = xmlEncodeSpecialChars(pimpl_->xmlnode_->doc, + reinterpret_cast<const xmlChar*>(content)); + xmlNodeSetContent(pimpl_->xmlnode_, escaped); + if ( escaped ) + xmlFree(escaped); +} + + const char* node::get_content() const { xmlchar_helper content(xmlNodeGetContent(pimpl_->xmlnode_)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-17 12:26:48
|
Revision: 178 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=178&view=rev Author: vaclavslavik Date: 2010-03-17 12:26:33 +0000 (Wed, 17 Mar 2010) Log Message: ----------- Add xml::node::clear(). Modified Paths: -------------- trunk/NEWS trunk/include/xmlwrapp/node.h trunk/src/libxml/node.cxx trunk/tests/node/test_node.cxx Added Paths: ----------- trunk/tests/node/data/04c.out Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-03-11 15:30:57 UTC (rev 177) +++ trunk/NEWS 2010-03-17 12:26:33 UTC (rev 178) @@ -8,6 +8,8 @@ Fixed compilation with Sun Studio compiler. + Added xml::node::clear() method. + Version 0.6.2 Fixed xml::tree_parser to fail on non-fatal parser errors. Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-11 15:30:57 UTC (rev 177) +++ trunk/include/xmlwrapp/node.h 2010-03-17 12:26:33 UTC (rev 178) @@ -778,6 +778,13 @@ size_type erase(const char *name); /** + Erases all children nodes. + + @since 0.7.0 + */ + void clear(); + + /** Sort all the children nodes of this node using one of thier attributes. Only nodes that are of xml::node::type_element will be sorted, and they must have the given node_name. Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-03-11 15:30:57 UTC (rev 177) +++ trunk/src/libxml/node.cxx 2010-03-17 12:26:33 UTC (rev 178) @@ -700,6 +700,19 @@ } +void node::clear() +{ + xmlNodePtr n = pimpl_->xmlnode_; + + if ( !n->children ) + return; + + xmlFreeNodeList(n->children); + n->children = + n->last = NULL; +} + + void node::sort(const char *node_name, const char *attr_name) { xmlNodePtr i(pimpl_->xmlnode_->children), next(0); Added: trunk/tests/node/data/04c.out =================================================================== --- trunk/tests/node/data/04c.out (rev 0) +++ trunk/tests/node/data/04c.out 2010-03-17 12:26:33 UTC (rev 178) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root/> Modified: trunk/tests/node/test_node.cxx =================================================================== --- trunk/tests/node/test_node.cxx 2010-03-11 15:30:57 UTC (rev 177) +++ trunk/tests/node/test_node.cxx 2010-03-17 12:26:33 UTC (rev 178) @@ -329,6 +329,21 @@ } +BOOST_AUTO_TEST_CASE( clear ) +{ + xml::tree_parser parser(test_file_path("node/data/04.xml").c_str()); + + xml::node &root = parser.get_document().get_root_node(); + + BOOST_REQUIRE( root.size() > 0 ); + + root.clear(); + + BOOST_CHECK( root.empty() ); + BOOST_CHECK( is_same_as_file(root, "node/data/04c.out") ); +} + + /* * These tests check xml::node::insert() */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-04-10 08:39:45
|
Revision: 180 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=180&view=rev Author: vaclavslavik Date: 2010-04-10 08:39:38 +0000 (Sat, 10 Apr 2010) Log Message: ----------- Fix error handling in tree_parser without exceptions. If libxml2 returned NULL document without errors (e.g. because a missing file is just a warning in it), pimpl_->okay_ was left as true. This was not only clearly wrong, but also inconsistent with exceptions handling: if exceptions were allowed, an exception _would_ be thrown in this situation. Modified Paths: -------------- trunk/src/libxml/tree_parser.cxx trunk/tests/tree/test_tree.cxx Modified: trunk/src/libxml/tree_parser.cxx =================================================================== --- trunk/src/libxml/tree_parser.cxx 2010-04-10 08:39:16 UTC (rev 179) +++ trunk/src/libxml/tree_parser.cxx 2010-04-10 08:39:38 UTC (rev 180) @@ -160,6 +160,8 @@ if (tmpdoc) xmlFreeDoc(tmpdoc); + pimpl_->okay_ = false; + if (allow_exceptions) throw xml::exception(pimpl_->last_error_); } @@ -192,6 +194,7 @@ ctxt->myDoc = 0; ctxt->sax = 0; xmlFreeParserCtxt(ctxt); + pimpl_->okay_ = false; if (allow_exceptions) Modified: trunk/tests/tree/test_tree.cxx =================================================================== --- trunk/tests/tree/test_tree.cxx 2010-04-10 08:39:16 UTC (rev 179) +++ trunk/tests/tree/test_tree.cxx 2010-04-10 08:39:38 UTC (rev 180) @@ -140,6 +140,23 @@ } +// test reporting of nonexistent files +BOOST_AUTO_TEST_CASE( nonexistent_file ) +{ + xml::tree_parser parser("doesnt_exist.xml", false); + BOOST_CHECK( !parser ); // failed +} + +BOOST_AUTO_TEST_CASE( nonexistent_file_throw ) +{ + BOOST_CHECK_THROW + ( + xml::tree_parser parser("doesnt_exist.xml"), + xml::exception + ); +} + + /* * this test should print out an outline of the input xml doc */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-04-10 08:40:05
|
Revision: 181 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=181&view=rev Author: vaclavslavik Date: 2010-04-10 08:39:59 +0000 (Sat, 10 Apr 2010) Log Message: ----------- Better error reporting when input file doesn't exist. Previously, tree_parser would return a generic "unknown XML parsing error" message if it failed because the specific XML file didn't exist or otherwise couldn't be read. We now treat this all too common special case specially and emit clear diagnostics. Modified Paths: -------------- trunk/NEWS trunk/src/libxml/tree_parser.cxx trunk/tests/tree/test_tree.cxx Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-04-10 08:39:38 UTC (rev 180) +++ trunk/NEWS 2010-04-10 08:39:59 UTC (rev 181) @@ -10,6 +10,8 @@ Added xml::node::clear() method. + Better error reporting when xml::tree_parser input file doesn't exist. + Version 0.6.2 Fixed xml::tree_parser to fail on non-fatal parser errors. Modified: trunk/src/libxml/tree_parser.cxx =================================================================== --- trunk/src/libxml/tree_parser.cxx 2010-04-10 08:39:38 UTC (rev 180) +++ trunk/src/libxml/tree_parser.cxx 2010-04-10 08:39:59 UTC (rev 181) @@ -45,6 +45,7 @@ // standard includes #include <stdexcept> #include <cstring> +#include <cstdio> #include <string> #include <memory> @@ -156,6 +157,25 @@ } else { + if ( pimpl_->last_error_ == DEFAULT_ERROR ) + { + // Try to describe the problem better. A common issue is that + // a file couldn't be found, in which case "unknown XML parsing + // error" is more than unhelpful. + FILE *test = fopen(name, "r"); + if ( !test ) + { + pimpl_->last_error_ = "failed to open file \""; + pimpl_->last_error_ += name; + pimpl_->last_error_ += "\""; + } + else + { + // no such luck, the error is something else + fclose(test); + } + } + // a problem appeared if (tmpdoc) xmlFreeDoc(tmpdoc); Modified: trunk/tests/tree/test_tree.cxx =================================================================== --- trunk/tests/tree/test_tree.cxx 2010-04-10 08:39:38 UTC (rev 180) +++ trunk/tests/tree/test_tree.cxx 2010-04-10 08:39:59 UTC (rev 181) @@ -144,6 +144,8 @@ BOOST_AUTO_TEST_CASE( nonexistent_file ) { xml::tree_parser parser("doesnt_exist.xml", false); + BOOST_CHECK_EQUAL( parser.get_error_message(), + "failed to open file \"doesnt_exist.xml\"" ); BOOST_CHECK( !parser ); // failed } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 01:38:52
|
Revision: 197 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=197&view=rev Author: tbrowder2 Date: 2012-03-20 01:38:42 +0000 (Tue, 20 Mar 2012) Log Message: ----------- more C++ source file suffix changes from .cxx to .cc Modified Paths: -------------- trunk/examples/02-event_parsing/Makefile.am trunk/examples/03-xml_generation/Makefile.am trunk/examples/04-xslt/Makefile.am trunk/tests/Makefile.am Added Paths: ----------- trunk/examples/01-tree_parsing/example.cc trunk/examples/02-event_parsing/example.cc trunk/examples/03-xml_generation/example.cc trunk/examples/04-xslt/example.cc trunk/tests/attributes/test_attributes.cc trunk/tests/document/test_document.cc trunk/tests/event/test_event.cc trunk/tests/node/test_node.cc trunk/tests/test_main.cc trunk/tests/tree/test_tree.cc trunk/tests/xslt/test_xslt.cc Removed Paths: ------------- trunk/examples/01-tree_parsing/example.cxx trunk/examples/02-event_parsing/example.cxx trunk/examples/03-xml_generation/example.cxx trunk/examples/04-xslt/example.cxx trunk/tests/attributes/test_attributes.cxx trunk/tests/document/test_document.cxx trunk/tests/event/test_event.cxx trunk/tests/node/test_node.cxx trunk/tests/test_main.cxx trunk/tests/tree/test_tree.cxx trunk/tests/xslt/test_xslt.cxx Copied: trunk/examples/01-tree_parsing/example.cc (from rev 186, trunk/examples/01-tree_parsing/example.cxx) =================================================================== --- trunk/examples/01-tree_parsing/example.cc (rev 0) +++ trunk/examples/01-tree_parsing/example.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file demonstrates how to use the xml::tree_parser class to parse XML + * data and create a tree of xml::node objects. It also shows how you can + * walk the tree using xml::node iterators. + */ + +// xmlwrapp include +#include <xmlwrapp/xmlwrapp.h> + +// standard includes +#include <iostream> +#include <exception> + +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << argv[0] << ": you must give one and only one XML file name\n"; + return 1; + } + + try { + + xml::tree_parser parser(argv[1]); + + xml::node &root = parser.get_document().get_root_node(); + std::cout << "root node is '" << root.get_name() << "'\n"; + + xml::node::const_iterator child(root.begin()), child_end(root.end()); + for (; child != child_end; ++child) { + if (child->is_text()) continue; + std::cout << "child node '" << child->get_name() << "'\n"; + } + + } catch (std::exception &e) { + std::cerr << argv[0] << ": " << e.what() << "\n"; + return 1; + } + + return 0; +} Deleted: trunk/examples/01-tree_parsing/example.cxx =================================================================== --- trunk/examples/01-tree_parsing/example.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/01-tree_parsing/example.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * This file demonstrates how to use the xml::tree_parser class to parse XML - * data and create a tree of xml::node objects. It also shows how you can - * walk the tree using xml::node iterators. - */ - -// xmlwrapp include -#include <xmlwrapp/xmlwrapp.h> - -// standard includes -#include <iostream> -#include <exception> - -int main (int argc, char *argv[]) { - if (argc != 2) { - std::cerr << argv[0] << ": you must give one and only one XML file name\n"; - return 1; - } - - try { - - xml::tree_parser parser(argv[1]); - - xml::node &root = parser.get_document().get_root_node(); - std::cout << "root node is '" << root.get_name() << "'\n"; - - xml::node::const_iterator child(root.begin()), child_end(root.end()); - for (; child != child_end; ++child) { - if (child->is_text()) continue; - std::cout << "child node '" << child->get_name() << "'\n"; - } - - } catch (std::exception &e) { - std::cerr << argv[0] << ": " << e.what() << "\n"; - return 1; - } - - return 0; -} Modified: trunk/examples/02-event_parsing/Makefile.am =================================================================== --- trunk/examples/02-event_parsing/Makefile.am 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/02-event_parsing/Makefile.am 2012-03-20 01:38:42 UTC (rev 197) @@ -1,6 +1,6 @@ noinst_PROGRAMS = example -example_SOURCES = example.cxx +example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxmlwrapp.la Copied: trunk/examples/02-event_parsing/example.cc (from rev 186, trunk/examples/02-event_parsing/example.cxx) =================================================================== --- trunk/examples/02-event_parsing/example.cc (rev 0) +++ trunk/examples/02-event_parsing/example.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The following code demonstrates the usage of the xml::event_parser class. + * This class must be derived from and the new subclass must implement the + * pure virtual member functions from xml::event_parser. These member + * functions are called when parsing events occur. + */ + +// xmlwrapp include +#include <xmlwrapp/xmlwrapp.h> + +// standard includes +#include <iostream> +#include <exception> + +/* + * Here we create a class that will receive the parsing events. + */ +class myparser : public xml::event_parser { +public: + myparser (void) + { std::cout << "myparser constructor\n"; } + + ~myparser (void) + { std::cout << "myparser destructor\n"; } +private: + bool start_element (const std::string &name, const attrs_type&) + { std::cout << "begin tag '" << name << "'\n"; return true; } + + bool end_element (const std::string &name) + { std::cout << "end tag '" << name << "'\n"; return true; } + + bool text (const std::string&) + { return true; } +}; + +/* + * And here is good ol' main. + */ +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << argv[0] << ": you must give one and only one XML file name\n"; + return 1; + } + + myparser parser; + + if (!parser.parse_file(argv[1])) { + std::cerr << argv[0] << ": error parsing XML file\n"; + return 1; + } + + return 0; +} Deleted: trunk/examples/02-event_parsing/example.cxx =================================================================== --- trunk/examples/02-event_parsing/example.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/02-event_parsing/example.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * The following code demonstrates the usage of the xml::event_parser class. - * This class must be derived from and the new subclass must implement the - * pure virtual member functions from xml::event_parser. These member - * functions are called when parsing events occur. - */ - -// xmlwrapp include -#include <xmlwrapp/xmlwrapp.h> - -// standard includes -#include <iostream> -#include <exception> - -/* - * Here we create a class that will receive the parsing events. - */ -class myparser : public xml::event_parser { -public: - myparser (void) - { std::cout << "myparser constructor\n"; } - - ~myparser (void) - { std::cout << "myparser destructor\n"; } -private: - bool start_element (const std::string &name, const attrs_type&) - { std::cout << "begin tag '" << name << "'\n"; return true; } - - bool end_element (const std::string &name) - { std::cout << "end tag '" << name << "'\n"; return true; } - - bool text (const std::string&) - { return true; } -}; - -/* - * And here is good ol' main. - */ -int main (int argc, char *argv[]) { - if (argc != 2) { - std::cerr << argv[0] << ": you must give one and only one XML file name\n"; - return 1; - } - - myparser parser; - - if (!parser.parse_file(argv[1])) { - std::cerr << argv[0] << ": error parsing XML file\n"; - return 1; - } - - return 0; -} Modified: trunk/examples/03-xml_generation/Makefile.am =================================================================== --- trunk/examples/03-xml_generation/Makefile.am 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/03-xml_generation/Makefile.am 2012-03-20 01:38:42 UTC (rev 197) @@ -1,6 +1,6 @@ noinst_PROGRAMS = example -example_SOURCES = example.cxx +example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxmlwrapp.la Copied: trunk/examples/03-xml_generation/example.cc (from rev 186, trunk/examples/03-xml_generation/example.cxx) =================================================================== --- trunk/examples/03-xml_generation/example.cc (rev 0) +++ trunk/examples/03-xml_generation/example.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The following code demonstrates how to use the xml::node class to build + * an XML tree and then convert it to XML text. + * + * Here is what we want to create: + * + * <abook> + * <person id="01" name="Peter Jones"> + * <email>pj...@pm...</email> + * <!-- Fake Phone Number --> + * <phone type="home">555-1212</phone> + * </person> + * </abook> + */ + +// xmlwrapp include +#include <xmlwrapp/xmlwrapp.h> + +// standard includes +#include <iostream> +#include <exception> + +int main (void) { + // create a new XML document and set the root node + xml::document xmldoc("abook"); + xml::node &root = xmldoc.get_root_node(); + + // add a child to the root node, <person> + xml::node::iterator it = root.insert(root.begin(), xml::node("person")); + + /* + * set the attributes for this new <person> element using the + * xml::attributes object returned from xml::node::get_attributes + */ + it->get_attributes().insert("id", "01"); + it->get_attributes().insert("name", "Peter Jones"); + + // add a node and set the content for that new node + it->push_back(xml::node("email", "pj...@pm...")); + + // add an XML comment + it->push_back(xml::node(xml::node::comment(" Fake Phone Number "))); + + // build a node one member function at a time + it = it->insert(xml::node("phone")); + it->get_attributes().insert("type", "home"); + it->set_content("555-1212"); + + // set some document settings + xmldoc.set_is_standalone(true); + xmldoc.set_encoding("ISO-8859-1"); + + // convert the document to XML + std::cout << xmldoc; + return 0; +} Deleted: trunk/examples/03-xml_generation/example.cxx =================================================================== --- trunk/examples/03-xml_generation/example.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/03-xml_generation/example.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * The following code demonstrates how to use the xml::node class to build - * an XML tree and then convert it to XML text. - * - * Here is what we want to create: - * - * <abook> - * <person id="01" name="Peter Jones"> - * <email>pj...@pm...</email> - * <!-- Fake Phone Number --> - * <phone type="home">555-1212</phone> - * </person> - * </abook> - */ - -// xmlwrapp include -#include <xmlwrapp/xmlwrapp.h> - -// standard includes -#include <iostream> -#include <exception> - -int main (void) { - // create a new XML document and set the root node - xml::document xmldoc("abook"); - xml::node &root = xmldoc.get_root_node(); - - // add a child to the root node, <person> - xml::node::iterator it = root.insert(root.begin(), xml::node("person")); - - /* - * set the attributes for this new <person> element using the - * xml::attributes object returned from xml::node::get_attributes - */ - it->get_attributes().insert("id", "01"); - it->get_attributes().insert("name", "Peter Jones"); - - // add a node and set the content for that new node - it->push_back(xml::node("email", "pj...@pm...")); - - // add an XML comment - it->push_back(xml::node(xml::node::comment(" Fake Phone Number "))); - - // build a node one member function at a time - it = it->insert(xml::node("phone")); - it->get_attributes().insert("type", "home"); - it->set_content("555-1212"); - - // set some document settings - xmldoc.set_is_standalone(true); - xmldoc.set_encoding("ISO-8859-1"); - - // convert the document to XML - std::cout << xmldoc; - return 0; -} Modified: trunk/examples/04-xslt/Makefile.am =================================================================== --- trunk/examples/04-xslt/Makefile.am 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/04-xslt/Makefile.am 2012-03-20 01:38:42 UTC (rev 197) @@ -3,7 +3,7 @@ noinst_PROGRAMS = example -example_SOURCES = example.cxx +example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxsltwrapp.la ../../src/libxmlwrapp.la Copied: trunk/examples/04-xslt/example.cc (from rev 186, trunk/examples/04-xslt/example.cxx) =================================================================== --- trunk/examples/04-xslt/example.cc (rev 0) +++ trunk/examples/04-xslt/example.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The following code demonstrates how to use the xsltwrapp code to trasform + * an XML document into something else using XSLT. + */ + +// xsltwrapp include +#include <xsltwrapp/xsltwrapp.h> + +// standard includes +#include <iostream> +#include <exception> + +int main (void) { + try { + // parse the input XML document + xml::tree_parser parser("example.xml"); + xml::document &doc = parser.get_document(); + + // parse the stylesheet + xslt::stylesheet style("example.xsl"); + + // transform the XML document using the stylesheet + xml::document &result = style.apply(doc); + + std::cout << result; + + } catch (const std::exception &e) { + std::cerr << e.what() << "\n"; + return 1; + } + + return 0; +} Deleted: trunk/examples/04-xslt/example.cxx =================================================================== --- trunk/examples/04-xslt/example.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/examples/04-xslt/example.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * The following code demonstrates how to use the xsltwrapp code to trasform - * an XML document into something else using XSLT. - */ - -// xsltwrapp include -#include <xsltwrapp/xsltwrapp.h> - -// standard includes -#include <iostream> -#include <exception> - -int main (void) { - try { - // parse the input XML document - xml::tree_parser parser("example.xml"); - xml::document &doc = parser.get_document(); - - // parse the stylesheet - xslt::stylesheet style("example.xsl"); - - // transform the XML document using the stylesheet - xml::document &result = style.apply(doc); - - std::cout << result; - - } catch (const std::exception &e) { - std::cerr << e.what() << "\n"; - return 1; - } - - return 0; -} Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/tests/Makefile.am 2012-03-20 01:38:42 UTC (rev 197) @@ -10,16 +10,16 @@ test_SOURCES = \ test.h \ - test_main.cxx \ - attributes/test_attributes.cxx \ - document/test_document.cxx \ - event/test_event.cxx \ - node/test_node.cxx \ - tree/test_tree.cxx + test_main.cc \ + attributes/test_attributes.cc \ + document/test_document.cc \ + event/test_event.cc \ + node/test_node.cc \ + tree/test_tree.cc if WITH_XSLT LIBS += $(top_builddir)/src/libxsltwrapp.la -test_SOURCES += xslt/test_xslt.cxx +test_SOURCES += xslt/test_xslt.cc endif EXTRA_DIST = \ Copied: trunk/tests/attributes/test_attributes.cc (from rev 188, trunk/tests/attributes/test_attributes.cxx) =================================================================== --- trunk/tests/attributes/test_attributes.cc (rev 0) +++ trunk/tests/attributes/test_attributes.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,288 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "../test.h" + + +BOOST_AUTO_TEST_SUITE( attributes ) + +/* + * Test to see if the xml::attributes function can see all the attributes of + * a node. + */ + +static void do_attr_read(const std::string& prefix) +{ + std::ostringstream ostr; + + xml::tree_parser parser(test_file_path(prefix + ".xml").c_str()); + + const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::const_iterator i=attrs.begin(), end=attrs.end(); + for (; i!=end; ++i) + { + ostr << i->get_name() << "=" << i->get_value() << "\n"; + } + + BOOST_CHECK( is_same_as_file(ostr, prefix + ".out") ); +} + +BOOST_AUTO_TEST_CASE( read ) +{ + do_attr_read("attributes/data/01a"); + do_attr_read("attributes/data/01b"); + do_attr_read("attributes/data/01c"); +} + + +/* + * Test to see if the xml::attributes::insert function works. + */ + +BOOST_AUTO_TEST_CASE( insert ) +{ + xml::tree_parser parser(test_file_path("attributes/data/02.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + attrs.insert("b", "b"); + + BOOST_CHECK( is_same_as_file(parser.get_document(), "attributes/data/02.out") ); +} + + +/* + * Test to see if the xml::attributes::find works. + */ + +static bool do_attr_find(const xml::document& doc, + const char *to_find, + const char *expected_value) +{ + const xml::attributes &attrs = doc.get_root_node().get_attributes(); + xml::attributes::const_iterator i = attrs.find(to_find); + + if ( i == attrs.end() ) + return false; + + BOOST_CHECK_EQUAL( i->get_name(), to_find ); + BOOST_CHECK_EQUAL( i->get_value(), expected_value ); + + return true; +} + +BOOST_AUTO_TEST_CASE( find ) +{ + xml::tree_parser parser(test_file_path("attributes/data/03.xml").c_str()); + const xml::document& doc = parser.get_document(); + + BOOST_CHECK( do_attr_find(doc, "one", "1") == true ); + BOOST_CHECK( do_attr_find(doc, "two", "2") == true ); + BOOST_CHECK( do_attr_find(doc, "three", "3") == true ); + BOOST_CHECK( do_attr_find(doc, "missing", NULL) == false ); + BOOST_CHECK( do_attr_find(doc, "also_missing", NULL) == false ); +} + + +/* + * Test to see if the xml::attributes::remove(iterator) works. + */ + +static void do_remove_by_iter(const char *name, const char *outfile) +{ + xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::iterator i = attrs.find(name); + + BOOST_REQUIRE( i != attrs.end() ); + attrs.erase(i); + + BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); +} + +BOOST_AUTO_TEST_CASE( remove_by_iter ) +{ + do_remove_by_iter("attr_one", "attributes/data/04a.out"); + do_remove_by_iter("attr_two", "attributes/data/04b.out"); + do_remove_by_iter("attr_three", "attributes/data/04c.out"); + do_remove_by_iter("attr_four", "attributes/data/04d.out"); +} + + +/* + * Test to see if the xml::attributes::remove(const char*) works. + */ + +static void do_remove_by_name(const char *name, const char *outfile) +{ + xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + attrs.erase(name); + + BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); +} + +BOOST_AUTO_TEST_CASE( remove_by_name ) +{ + do_remove_by_name("attr_one", "attributes/data/04a.out"); + do_remove_by_name("attr_two", "attributes/data/04b.out"); + do_remove_by_name("attr_three", "attributes/data/04c.out"); + do_remove_by_name("attr_four", "attributes/data/04d.out"); +} + + +/* + * Test to see if xml::attributes::find() can see DTD default attributes + */ + +BOOST_AUTO_TEST_CASE( find_dtd_default_attr ) +{ + xml::tree_parser parser(test_file_path("attributes/data/09.xml").c_str()); + + BOOST_CHECK( parser.get_document().has_internal_subset() ); + BOOST_CHECK( parser.get_document().validate() ); + + const xml::attributes &attrs = + parser.get_document().get_root_node().get_attributes(); + + { + xml::attributes::const_iterator i = attrs.find("one"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "1" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } + + { + xml::attributes::const_iterator i = attrs.find("two"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "two" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } + + { + xml::attributes::const_iterator i = attrs.find("three"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "three" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } +} + + +/* + * Test to see if xml::attributes::find() will die when DTD default + * attributes are really implied. + */ + +BOOST_AUTO_TEST_CASE( dtd_implied ) +{ + xml::tree_parser parser(test_file_path("attributes/data/10.xml").c_str()); + + BOOST_CHECK( parser.get_document().has_internal_subset() ); + BOOST_CHECK( parser.get_document().validate() ); + + const xml::attributes &attrs = + parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( attrs.find("optional") == attrs.end() ); +} + + +/* + * Test to see if the xml::attributes copy constructor works. + */ + +BOOST_AUTO_TEST_CASE( attr_copy_ctor ) +{ + std::ostringstream ostr; + xml::tree_parser parser(test_file_path("attributes/data/08.xml").c_str()); + + // make a copy + xml::attributes attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::const_iterator i = attrs.begin(), end = attrs.end(); + + for ( ; i != end; ++i ) + ostr << i->get_name() << "=" << i->get_value() << "\n"; + + BOOST_CHECK( is_same_as_file(ostr, "attributes/data/08.out") ); +} + +BOOST_AUTO_TEST_SUITE_END() + + +/* + * Test to see if the xml::attributes::empty() works. + */ + +BOOST_AUTO_TEST_CASE( attr_empty_a ) +{ + xml::tree_parser parser(test_file_path("attributes/data/06a.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( attrs.empty() ); +} + +BOOST_AUTO_TEST_CASE( attr_empty_b ) +{ + xml::tree_parser parser(test_file_path("attributes/data/06b.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( !attrs.empty() ); +} + + +/* + * Test to see if xml::attributes::size() works. + */ + +static int do_get_attr_size(const char *testfile) +{ + xml::tree_parser parser(test_file_path(testfile).c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + return attrs.size(); +} + +BOOST_AUTO_TEST_CASE( attr_size ) +{ + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07a.xml"), 0 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07b.xml"), 1 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07c.xml"), 2 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07d.xml"), 3 ); +} Deleted: trunk/tests/attributes/test_attributes.cxx =================================================================== --- trunk/tests/attributes/test_attributes.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/tests/attributes/test_attributes.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "../test.h" - - -BOOST_AUTO_TEST_SUITE( attributes ) - -/* - * Test to see if the xml::attributes function can see all the attributes of - * a node. - */ - -static void do_attr_read(const std::string& prefix) -{ - std::ostringstream ostr; - - xml::tree_parser parser(test_file_path(prefix + ".xml").c_str()); - - const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.begin(), end=attrs.end(); - for (; i!=end; ++i) - { - ostr << i->get_name() << "=" << i->get_value() << "\n"; - } - - BOOST_CHECK( is_same_as_file(ostr, prefix + ".out") ); -} - -BOOST_AUTO_TEST_CASE( read ) -{ - do_attr_read("attributes/data/01a"); - do_attr_read("attributes/data/01b"); - do_attr_read("attributes/data/01c"); -} - - -/* - * Test to see if the xml::attributes::insert function works. - */ - -BOOST_AUTO_TEST_CASE( insert ) -{ - xml::tree_parser parser(test_file_path("attributes/data/02.xml").c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - attrs.insert("b", "b"); - - BOOST_CHECK( is_same_as_file(parser.get_document(), "attributes/data/02.out") ); -} - - -/* - * Test to see if the xml::attributes::find works. - */ - -static bool do_attr_find(const xml::document& doc, - const char *to_find, - const char *expected_value) -{ - const xml::attributes &attrs = doc.get_root_node().get_attributes(); - xml::attributes::const_iterator i = attrs.find(to_find); - - if ( i == attrs.end() ) - return false; - - BOOST_CHECK_EQUAL( i->get_name(), to_find ); - BOOST_CHECK_EQUAL( i->get_value(), expected_value ); - - return true; -} - -BOOST_AUTO_TEST_CASE( find ) -{ - xml::tree_parser parser(test_file_path("attributes/data/03.xml").c_str()); - const xml::document& doc = parser.get_document(); - - BOOST_CHECK( do_attr_find(doc, "one", "1") == true ); - BOOST_CHECK( do_attr_find(doc, "two", "2") == true ); - BOOST_CHECK( do_attr_find(doc, "three", "3") == true ); - BOOST_CHECK( do_attr_find(doc, "missing", NULL) == false ); - BOOST_CHECK( do_attr_find(doc, "also_missing", NULL) == false ); -} - - -/* - * Test to see if the xml::attributes::remove(iterator) works. - */ - -static void do_remove_by_iter(const char *name, const char *outfile) -{ - xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::iterator i = attrs.find(name); - - BOOST_REQUIRE( i != attrs.end() ); - attrs.erase(i); - - BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); -} - -BOOST_AUTO_TEST_CASE( remove_by_iter ) -{ - do_remove_by_iter("attr_one", "attributes/data/04a.out"); - do_remove_by_iter("attr_two", "attributes/data/04b.out"); - do_remove_by_iter("attr_three", "attributes/data/04c.out"); - do_remove_by_iter("attr_four", "attributes/data/04d.out"); -} - - -/* - * Test to see if the xml::attributes::remove(const char*) works. - */ - -static void do_remove_by_name(const char *name, const char *outfile) -{ - xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - - attrs.erase(name); - - BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); -} - -BOOST_AUTO_TEST_CASE( remove_by_name ) -{ - do_remove_by_name("attr_one", "attributes/data/04a.out"); - do_remove_by_name("attr_two", "attributes/data/04b.out"); - do_remove_by_name("attr_three", "attributes/data/04c.out"); - do_remove_by_name("attr_four", "attributes/data/04d.out"); -} - - -/* - * Test to see if xml::attributes::find() can see DTD default attributes - */ - -BOOST_AUTO_TEST_CASE( find_dtd_default_attr ) -{ - xml::tree_parser parser(test_file_path("attributes/data/09.xml").c_str()); - - BOOST_CHECK( parser.get_document().has_internal_subset() ); - BOOST_CHECK( parser.get_document().validate() ); - - const xml::attributes &attrs = - parser.get_document().get_root_node().get_attributes(); - - { - xml::attributes::const_iterator i = attrs.find("one"); - BOOST_REQUIRE( i != attrs.end() ); - BOOST_CHECK_EQUAL( i->get_value(), "1" ); - ++i; - BOOST_CHECK( i == attrs.end() ); - } - - { - xml::attributes::const_iterator i = attrs.find("two"); - BOOST_REQUIRE( i != attrs.end() ); - BOOST_CHECK_EQUAL( i->get_value(), "two" ); - ++i; - BOOST_CHECK( i == attrs.end() ); - } - - { - xml::attributes::const_iterator i = attrs.find("three"); - BOOST_REQUIRE( i != attrs.end() ); - BOOST_CHECK_EQUAL( i->get_value(), "three" ); - ++i; - BOOST_CHECK( i == attrs.end() ); - } -} - - -/* - * Test to see if xml::attributes::find() will die when DTD default - * attributes are really implied. - */ - -BOOST_AUTO_TEST_CASE( dtd_implied ) -{ - xml::tree_parser parser(test_file_path("attributes/data/10.xml").c_str()); - - BOOST_CHECK( parser.get_document().has_internal_subset() ); - BOOST_CHECK( parser.get_document().validate() ); - - const xml::attributes &attrs = - parser.get_document().get_root_node().get_attributes(); - - BOOST_CHECK( attrs.find("optional") == attrs.end() ); -} - - -/* - * Test to see if the xml::attributes copy constructor works. - */ - -BOOST_AUTO_TEST_CASE( attr_copy_ctor ) -{ - std::ostringstream ostr; - xml::tree_parser parser(test_file_path("attributes/data/08.xml").c_str()); - - // make a copy - xml::attributes attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i = attrs.begin(), end = attrs.end(); - - for ( ; i != end; ++i ) - ostr << i->get_name() << "=" << i->get_value() << "\n"; - - BOOST_CHECK( is_same_as_file(ostr, "attributes/data/08.out") ); -} - -BOOST_AUTO_TEST_SUITE_END() - - -/* - * Test to see if the xml::attributes::empty() works. - */ - -BOOST_AUTO_TEST_CASE( attr_empty_a ) -{ - xml::tree_parser parser(test_file_path("attributes/data/06a.xml").c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - - BOOST_CHECK( attrs.empty() ); -} - -BOOST_AUTO_TEST_CASE( attr_empty_b ) -{ - xml::tree_parser parser(test_file_path("attributes/data/06b.xml").c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - - BOOST_CHECK( !attrs.empty() ); -} - - -/* - * Test to see if xml::attributes::size() works. - */ - -static int do_get_attr_size(const char *testfile) -{ - xml::tree_parser parser(test_file_path(testfile).c_str()); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - return attrs.size(); -} - -BOOST_AUTO_TEST_CASE( attr_size ) -{ - BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07a.xml"), 0 ); - BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07b.xml"), 1 ); - BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07c.xml"), 2 ); - BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07d.xml"), 3 ); -} Copied: trunk/tests/document/test_document.cc (from rev 186, trunk/tests/document/test_document.cxx) =================================================================== --- trunk/tests/document/test_document.cc (rev 0) +++ trunk/tests/document/test_document.cc 2012-03-20 01:38:42 UTC (rev 197) @@ -0,0 +1,439 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "../test.h" + +#include <boost/iostreams/filtering_stream.hpp> +#include <boost/iostreams/filter/gzip.hpp> + +BOOST_AUTO_TEST_SUITE( document ) + +/* + * This test checks xml::document iteration. + */ + +BOOST_AUTO_TEST_CASE( dump_type ) +{ + xml::init::substitute_entities(false); + + xml::tree_parser parser(test_file_path("document/data/01.xml").c_str()); + + std::ostringstream ostr; + xml::node::iterator i = parser.get_document().begin(), + end = parser.get_document().end(); + for (; i!=end; ++i) + dump_node_type(ostr, *i); + + BOOST_CHECK( is_same_as_file(ostr, "document/data/01.out") ); +} + + +/* + * This test checks xml::document default constructor. + */ + +BOOST_AUTO_TEST_CASE( default_ctor ) +{ + xml::document doc; + BOOST_CHECK( is_same_as_file( doc, "document/data/02.out") ); +} + + +/* + * This test checks xml::document constructor that takes the name of the root + * node. + */ + +BOOST_AUTO_TEST_CASE( ctor_root_name ) +{ + xml::document doc("root"); + BOOST_CHECK( is_same_as_file( doc, "document/data/03.out") ); +} + + +/* + * This test checks xml::document constructor that takes a node. + */ + +BOOST_AUTO_TEST_CASE( ctor_root_node ) +{ + xml::node n("root", "pcdata"); + xml::document doc(n); + BOOST_CHECK( is_same_as_file( doc, "document/data/04.out") ); +} + + +/* + * This test checks xml::document copy constructor. + */ + +BOOST_AUTO_TEST_CASE( copy_ctor ) +{ + xml::node n("root", "pcdata"); + xml::document doc(n); + + xml::document doc_copy(doc); + + BOOST_CHECK( is_same_as_file( doc_copy, "document/data/04.out") ); +} + + +/* + * This test checks xml::document assignment operator. + */ + +BOOST_AUTO_TEST_CASE( assignment_operator ) +{ + xml::node n("root", "pcdata"); + xml::document doc(n); + + xml::document doc_copy; + doc_copy = doc; + + BOOST_CHECK( is_same_as_file( doc_copy, "document/data/04.out") ); +} + + +/* + * This test checks xml::document::get_root_node. + */ + +BOOST_AUTO_TEST_CASE( get_root_node ) +{ + xml::node n("root", "pcdata"); + xml::document doc(n); + + BOOST_CHECK( is_same_as_file( doc.get_root_node(), "document/data/04.out") ); +} + + +/* + * This test checks xml::document::set_root_node(). + */ + +BOOST_AUTO_TEST_CASE( set_root_node ) +{ + std::ostringstream ostr; + + xml::node n("root", "pcdata"); + + xml::document doc; + ostr << doc; // blank document + + doc.set_root_node(n); + ostr << doc; + + BOOST_CHECK( is_same_as_file( ostr, "document/data/08.out") ); +} + + +/* + * This test checks xml::document::get_version(). + */ + +BOOST_AUTO_TEST_CASE( get_version ) +{ + xml::tree_parser parser(test_file_path("document/data/09.xml").c_str()); + + BOOST_CHECK_EQUAL( parser.get_document().get_version(), "1.1" ); +} + + +/* + * This test checks xml::document::set_version(). + */ + +BOOST_AUTO_TEST_CASE( set_version ) +{ + xml::document doc("root"); + doc.set_version("1.1"); + + BOOST_CHECK( is_same_as_file( doc, "document/data/10.out") ); +} + + +/* + * This test checks xml::document::get_encoding(). + */ + +BOOST_AUTO_TEST_CASE( get_encoding ) +{ + xml::tree_parser parser(test_file_path("document/data/11.xml").c_str()); + + BOOST_CHECK_EQUAL( parser.get_document().get_encoding(), "UTF-8" ); +} + + +/* + * This test checks xml::document::set_encoding(). + */ + +BOOST_AUTO_TEST_CASE( set_encoding ) +{ + xml::document doc("root"); + doc.set_encoding("UTF-8"); + + BOOST_CHECK( is_same_as_file( doc, "document/data/12.out") ); +} + + +/* + * This test checks xml::document::get_is_standalone(). + */ + +BOOST_AUTO_TEST_CASE( get_is_standalone ) +{ + xml::tree_parser parser1(test_file_path("document/data/13a.xml").c_str()); + BOOST_CHECK_EQUAL( parser1.get_document().get_is_standalone(), false ); + + xml::tree_parser parser2(test_file_path("document/data/13b.xml").c_str()); + BOOST_CHECK_EQUAL( parser2.get_document().get_is_standalone(), true ); +} + + +/* + * This test checks xml::document::set_is_standalone(). + */ + +BOOST_AUTO_TEST_CASE( set_is_standalone ) +{ + xml::document doc1("root"); + doc1.set_is_standalone(true); + BOOST_CHECK( is_same_as_file( doc1, "document/data/13a.out") ); + + xml::document doc2("root"); + doc2.set_is_standalone(false); + BOOST_CHECK( is_same_as_file( doc2, "document/data/13b.out") ); +} + + +/* + * This test checks xml::document::process_xinclude() + */ +BOOST_AUTO_TEST_CASE( process_xinclude ) +{ + xml::tree_parser parser(test_file_path("document/data/14.xml").c_str()); + + BOOST_CHECK( parser.get_document().process_xinclude() ); + BOOST_CHECK( is_same_as_file( parser.get_document(), "document/data/14.out") ); +} + + +/* + * This test checks xml::document::size() + */ + +BOOST_AUTO_TEST_CASE( size ) +{ + xml::document doc_01("root"); + BOOST_CHECK_EQUAL( doc_01.size(), 1 ); + + doc_01.push_back(xml::node(xml::node::comment("This is a comment"))); + BOOST_CHECK_EQUAL( doc_01.size(), 2 ); + + xml::document doc_02(doc_01); + BOOST_CHECK_EQUAL( doc_02.size(), 2 ); + + xml::document doc_03; + BOOST_CHECK_EQUAL( doc_03.size(), 1 ); + + xml::node n("root"); + xml::document doc_04(n); + BOOST_CHECK_EQUAL( doc_04.size(), 1 ); +} + + +/* + * This test checks xml::document::push_back and insert + */ + +BOOST_AUTO_TEST_CASE( push_back_and_insert ) +{ + xml::document doc("root"); + + doc.push_back(xml::node(xml::node::comment(" Comment From push_back "))); + + xml::node::iterator n(doc.insert(xml::node(xml::node::comment("This Will Be Changed")))); + n->set_content(" Comment From insert "); + + n = doc.insert(doc.begin(), xml::node(xml::node::pi("test"))); + n->set_content("one=\"1\""); + + BOOST_CHECK( is_same_as_file( doc, "document/data/17.out") ); +} + + +/* + * This test checks xml::document::push_back and insert to make sure they + * throw exceptions + */ + +BOOST_AUTO_TEST_CASE( push_back_and_insert_throw ) +{ + xml::document doc("root"); + + BOOST_CHECK_THROW + ( + doc.push_back(xml::node("noway")), + xml::exception + ); + + BOOST_CHECK_THROW + ( + doc.insert(xml::node("noway")), + xml::exception + ); + + BOOST_CHECK_THROW + ( + doc.insert(doc.end(), xml::node("noway")), + xml::exception + ); +} + + +/* + * This test checks xml::document::replace() + */ + +BOOST_AUTO_TEST_CASE( replace ) +{ + xml::document doc("root"); + + xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced ")))); + doc.replace(n, xml::node(xml::node::comment(" This is the replacement comment "))); + + BOOST_CHECK( is_same_as_file( doc, "document/data/19.out") ); +} + + +/* + * This test checks xml::document::replace() to make sure it throws exceptions + */ + +BOOST_AUTO_TEST_CASE( replace_throw ) +{ + xml::document doc("root"); + xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced ")))); + + BOOST_CHECK_THROW + ( + doc.replace(n, xml::node("noway")), + xml::exception + ); + + BOOST_CHECK_THROW + ( + doc.replace(doc.begin(), xml::node(xml::node::comment(" no way "))), + xml::exception + ); +} + + +/* + * This test checks xml::document::erase(). + */ + +BOOST_AUTO_TEST_CASE( erase ) +{ + xml::document doc("root"); + doc.push_back(xml::node(xml::node::comment(" Comment from push_back "))); + + xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" You should not see me ")))); + doc.erase(n); + + BOOST_CHECK( is_same_as_file(doc, "document/data/21.out") ); +} + +/* + * This test checks xml::document::erase() to make sure it throws an + * exception. + */ + +BOOST_AUTO_TEST_CASE( cant_erase_root ) +{ + xml::document doc("root"); + doc.push_back(xml::node(xml::node::comment(" Comment from push_back "))); + + BOOST_CHECK_THROW + ( + doc.erase(doc.begin(), doc.end()), + xml::exception + ); +} + + +static const char *TEST_FILE = "test_temp_file"; + +/* + * These tests check xml::docment::save_to_file() + */ + +BOOST_AUTO_TEST_CASE( save_to_file ) +{ + xml::document doc("root"); + doc.get_root_node().push_back(xml::node("child")); + + doc.save_to_file(TEST_FILE); + + std::ifstream stream(TEST_FILE); + BOOST_CHECK( is_same_as_file(read_file_into_string(stream), "document/data/15.out") ); + + remove(TEST_FILE); +} + + +#ifndef __SUNPRO_CC // SunCC can't compile gzip_decompressor +BOOST_AUTO_TEST_CASE( save_to_file_gzip ) +{ + xml::document doc("root"); + doc.get_root_node().push_back(xml::node("child")); + + doc.save_to_file(TEST_FILE, 9); + + // verify that the file was can be read back as compressed + std::ifstream stream(TEST_FILE); + boost::iostreams::filtering_stream<boost::iostreams::input> filter; + filter.push(boost::iostreams::gzip_decompressor()); + filter.push(stream); + BOOST_CHECK( is_same_as_file(read_file_into_string(filter), "document/data/15.out") ); + + // ...and by libxml2 directly too + xml::tree_parser parser(TEST_FILE); + + remove(TEST_FILE); +} +#endif // !__SUNPRO_CC + + +BOOST_AUTO_TEST_SUITE_END() Deleted: trunk/tests/document/test_document.cxx =================================================================== --- trunk/tests/document/test_document.cxx 2012-03-20 01:20:13 UTC (rev 196) +++ trunk/tests/document/test_document.cxx 2012-03-20 01:38:42 UTC (rev 197) @@ -1,439 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "../test.h" - -#include <boost/iostreams/filtering_stream.hpp> -#include <boost/iostreams/filter/gzip.hpp> - -BOOST_AUTO_TEST_SUITE( document ) - -/* - * This test checks xml::document iteration. - */ - -BOOST_AUTO_TEST_CASE( dump_type ) -... [truncated message content] |
From: <tbr...@us...> - 2012-03-20 13:49:17
|
Revision: 203 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=203&view=rev Author: tbrowder2 Date: 2012-03-20 13:49:06 +0000 (Tue, 20 Mar 2012) Log Message: ----------- add ignores Added Paths: ----------- trunk/.svnignore Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in xmlwrapp-config xmlwrapp.pc xsltwrapp.pc config.log config.status stamp-h1 libtool configure autom4te.cache aclocal.m4 + Added: trunk/.svnignore =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 14:16:27
|
Revision: 206 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=206&view=rev Author: tbrowder2 Date: 2012-03-20 14:16:16 +0000 (Tue, 20 Mar 2012) Log Message: ----------- provisions for new string class Modified Paths: -------------- trunk/Makefile.am Added Paths: ----------- trunk/xmlwrappstring.pc.in Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2012-03-20 14:10:29 UTC (rev 205) +++ trunk/Makefile.am 2012-03-20 14:16:16 UTC (rev 206) @@ -4,9 +4,9 @@ pkgconfigdir=$(libdir)/pkgconfig if WITH_XSLT -pkgconfig_DATA = xmlwrapp.pc xsltwrapp.pc +pkgconfig_DATA = xmlwrapp.pc xmlwrappstring.pc xsltwrapp.pc else -pkgconfig_DATA = xmlwrapp.pc +pkgconfig_DATA = xmlwrapp.pc xmlwrappstring.pc endif bin_SCRIPTS = xmlwrapp-config Added: trunk/xmlwrappstring.pc.in =================================================================== --- trunk/xmlwrappstring.pc.in (rev 0) +++ trunk/xmlwrappstring.pc.in 2012-03-20 14:16:16 UTC (rev 206) @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: xmlwrappstring +Version: @VERSION@ +Description: A C++ UTF-8 string class +Requires: xmlwrapp = @VERSION@ +Libs: -L${libdir} -lxmlwrapp +Cflags: -I${includedir} Property changes on: trunk/xmlwrappstring.pc.in ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 14:35:28
|
Revision: 213 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=213&view=rev Author: tbrowder2 Date: 2012-03-20 14:35:16 +0000 (Tue, 20 Mar 2012) Log Message: ----------- correct autotools errors Modified Paths: -------------- trunk/src/Makefile.am trunk/tests/Makefile.am Removed Paths: ------------- trunk/src/libxmlwrappstring/xmlwrappstring.h Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2012-03-20 14:33:34 UTC (rev 212) +++ trunk/src/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) @@ -13,7 +13,7 @@ libxmlwrappstring_la_SOURCES = \ libxmlwrappstring/xmlwrappstring.cc \ - libxmlwrappstring/xmlwrappstring.h \ + libxmlwrappstring/xmlwrappstring.h libxmlwrapp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBXML_CFLAGS) libxmlwrapp_la_LIBADD = $(LIBXML_LIBS) Deleted: trunk/src/libxmlwrappstring/xmlwrappstring.h =================================================================== --- trunk/src/libxmlwrappstring/xmlwrappstring.h 2012-03-20 14:33:34 UTC (rev 212) +++ trunk/src/libxmlwrappstring/xmlwrappstring.h 2012-03-20 14:35:16 UTC (rev 213) @@ -1,1615 +0,0 @@ -// -*- c++ -*- -#ifndef _GLIBMM_USTRING_H -#define _GLIBMM_USTRING_H - -/* $Id$ */ - -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <glibmmconfig.h> -#include <glibmm/unicode.h> -#include <glib.h> - -#include <iosfwd> -#include <iterator> -#include <sstream> -#include <string> -#ifndef GLIBMM_HAVE_STD_ITERATOR_TRAITS -#include <cstddef> /* for ptrdiff_t */ -#endif - -namespace Glib -{ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -#ifndef GLIBMM_HAVE_STD_ITERATOR_TRAITS - -template <class T> -struct IteratorTraits -{ - typedef typename T::iterator_category iterator_category; - typedef typename T::value_type value_type; - typedef typename T::difference_type difference_type; - typedef typename T::pointer pointer; - typedef typename T::reference reference; -}; - -template <class T> -struct IteratorTraits<T*> -{ - typedef std::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; -}; - -template <class T> -struct IteratorTraits<const T*> -{ - typedef std::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef const T* pointer; - typedef const T& reference; -}; - -#endif /* GLIBMM_HAVE_STD_ITERATOR_TRAITS */ -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -/** The iterator type of Glib::ustring. - * Note this is not a random access iterator but a bidirectional one, - * since all index operations need to iterate over the UTF-8 data. Use - * std::advance() to move to a certain position. However, all of the - * relational operators are available: - * <tt>== != < > <= >=</tt> - * - * A writeable iterator isn't provided because: The number of bytes of - * the old UTF-8 character and the new one to write could be different. - * Therefore, any write operation would invalidate all other iterators - * pointing into the same string. - */ -template <class T> -class ustring_Iterator -{ -public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef gunichar value_type; - typedef std::string::difference_type difference_type; - typedef value_type reference; - typedef void pointer; - - inline ustring_Iterator(); - inline ustring_Iterator(const ustring_Iterator<std::string::iterator>& other); - - inline value_type operator*() const; - - inline ustring_Iterator<T> & operator++(); - inline const ustring_Iterator<T> operator++(int); - inline ustring_Iterator<T> & operator--(); - inline const ustring_Iterator<T> operator--(int); - - explicit inline ustring_Iterator(T pos); - inline T base() const; - -private: - T pos_; -}; - - -/** Extract a UCS-4 character from UTF-8 data. - * Convert a single UTF-8 (multibyte) character starting at @p pos to - * a UCS-4 wide character. This may read up to 6 bytes after the start - * position, depending on the UTF-8 character width. You have to make - * sure the source contains at least one valid UTF-8 character. - * - * This is mainly used by the implementation of Glib::ustring::iterator, - * but it might be useful as utility function if you prefer using - * std::string even for UTF-8 encoding. - */ -gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_PURE; - - -/** Glib::ustring has much the same interface as std::string, but contains - * %Unicode characters encoded as UTF-8. - * - * @par About UTF-8 and ASCII - * @par - * The standard character set ANSI_X3.4-1968 -- more commonly known as - * ASCII -- is a subset of UTF-8. So, if you want to, you can use - * Glib::ustring without even thinking about UTF-8. - * @par - * Whenever ASCII is mentioned in this manual, we mean the @em real ASCII - * (i.e. as defined in ANSI_X3.4-1968), which contains only 7-bit characters. - * Glib::ustring can @em not be used with ASCII-compatible extended 8-bit - * charsets like ISO-8859-1. It's a good idea to avoid string literals - * containing non-ASCII characters (e.g. German umlauts) in source code, - * or at least you should use UTF-8 literals. - * @par - * You can find a detailed UTF-8 and %Unicode FAQ here: - * http://www.cl.cam.ac.uk/~mgk25/unicode.html - * - * @par Glib::ustring vs. std::string - * @par - * Glib::ustring has implicit type conversions to and from std::string. - * These conversions do @em not convert to/from the current locale (see - * Glib::locale_from_utf8() and Glib::locale_to_utf8() if you need that). You - * can always use std::string instead of Glib::ustring -- however, using - * std::string with multi-byte characters is quite hard. For instance, - * <tt>std::string::operator[]</tt> might return a byte in the middle of a - * character, and <tt>std::string::length()</tt> returns the number of bytes - * rather than characters. So don't do that without a good reason. - * @par - * In a perfect world the C++ Standard Library would contain a UTF-8 string - * class. Unfortunately, the C++ standard doesn't mention UTF-8 at all. Note - * that std::wstring is not a UTF-8 string class because it contains only - * fixed-width characters (where width could be 32, 16, or even 8 bits). - * - * @par Glib::ustring and stream input/output - * @par - * The stream I/O operators, that is operator<<() and operator>>(), perform - * implicit charset conversion to/from the current locale. If that's not - * what you intented (e.g. when writing to a configuration file that should - * always be UTF-8 encoded) use ustring::raw() to override this behaviour. - * @par - * If you're using std::ostringstream to build strings for display in the - * user interface, you must convert the result back to UTF-8 as shown below: - * @code - * std::ostringstream output; - * output.imbue(std::locale("")); // use the user's locale for this stream - * output << percentage << " % done"; - * label->set_text(Glib::locale_to_utf8(output.str())); - * @endcode - * - * @par Formatted output and internationalization - * @par - * The methods ustring::compose() and ustring::format() provide a convenient - * and powerful alternative to string streams, as shown in the example below. - * Refer to the method documentation of compose() and format() for details. - * @code - * using Glib::ustring; - * - * ustring message = ustring::compose("%1 is lower than 0x%2.", - * 12, ustring::format(std::hex, 16)); - * @endcode - * - * @par Implementation notes - * @par - * Glib::ustring does not inherit from std::string, because std::string was - * intended to be a final class. For instance, it does not have a virtual - * destructor. Also, a HAS-A relationship is more appropriate because - * ustring can't just enhance the std::string interface. Rather, it has to - * reimplement the interface so that all operations are based on characters - * instead of bytes. - */ -class ustring -{ -public: - typedef std::string::size_type size_type; - typedef std::string::difference_type difference_type; - - typedef gunichar value_type; - typedef gunichar & reference; - typedef const gunichar & const_reference; - - typedef ustring_Iterator<std::string::iterator> iterator; - typedef ustring_Iterator<std::string::const_iterator> const_iterator; - -#ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR - - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - -#else - - typedef std::reverse_iterator<iterator, - iterator::iterator_category, - iterator::value_type, - iterator::reference, - iterator::pointer, - iterator::difference_type> reverse_iterator; - typedef std::reverse_iterator<const_iterator, - const_iterator::iterator_category, - const_iterator::value_type, - const_iterator::reference, - const_iterator::pointer, - const_iterator::difference_type> const_reverse_iterator; - -#endif /* GLIBMM_HAVE_SUN_REVERSE_ITERATOR */ - -#ifdef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS - static GLIBMM_API const size_type npos = std::string::npos; -#else - //The IRIX MipsPro compiler says "The indicated constant value is not known", - //so we need to initalize the static member data elsewhere. - static GLIBMM_API const size_type npos; -#endif - - /*! Default constructor, which creates an empty string. - */ - ustring(); - - ~ustring(); - - /*! Construct a ustring as a copy of another ustring. - * @param other A source string. - */ - ustring(const ustring& other); - - /*! Assign the value of another string to this string. - * @param other A source string. - */ - ustring& operator=(const ustring& other); - - /*! Swap contents with another string. - * @param other String to swap with. - */ - void swap(ustring& other); - - /*! Construct a ustring as a copy of another std::string. - * @param src A source <tt>std::string</tt> containing text encoded as UTF-8. - */ - ustring(const std::string& src); - - /*! Construct a ustring as a copy of a substring. - * @param src %Source ustring. - * @param i Index of first character to copy from. - * @param n Number of UTF-8 characters to copy (defaults to copying the remainder). - */ - ustring(const ustring& src, size_type i, size_type n=npos); - - /*! Construct a ustring as a partial copy of a C string. - * @param src %Source C string encoded as UTF-8. - * @param n Number of UTF-8 characters to copy. - */ - ustring(const char* src, size_type n); - - /*! Construct a ustring as a copy of a C string. - * @param src %Source C string encoded as UTF-8. - */ - ustring(const char* src); - - /*! Construct a ustring as multiple characters. - * @param n Number of characters. - * @param uc UCS-4 code point to use. - */ - ustring(size_type n, gunichar uc); - - /*! Construct a ustring as multiple characters. - * @param n Number of characters. - * @param c ASCII character to use. - */ - ustring(size_type n, char c); - - /*! Construct a ustring as a copy of a range. - * @param pbegin Start of range. - * @param pend End of range. - */ - template <class In> ustring(In pbegin, In pend); - - -//! @name Assign new contents. -//! @{ - - ustring& operator=(const std::string& src); - ustring& operator=(const char* src); - ustring& operator=(gunichar uc); - ustring& operator=(char c); - - ustring& assign(const ustring& src); - ustring& assign(const ustring& src, size_type i, size_type n); - ustring& assign(const char* src, size_type n); - ustring& assign(const char* src); - ustring& assign(size_type n, gunichar uc); - ustring& assign(size_type n, char c); - template <class In> ustring& assign(In pbegin, In pend); - -//! @} -//! @name Append to the string. -//! @{ - - ustring& operator+=(const ustring& src); - ustring& operator+=(const char* src); - ustring& operator+=(gunichar uc); - ustring& operator+=(char c); - void push_back(gunichar uc); - void push_back(char c); - - ustring& append(const ustring& src); - ustring& append(const ustring& src, size_type i, size_type n); - ustring& append(const char* src, size_type n); - ustring& append(const char* src); - ustring& append(size_type n, gunichar uc); - ustring& append(size_type n, char c); - template <class In> ustring& append(In pbegin, In pend); - -//! @} -//! @name Insert into the string. -//! @{ - - ustring& insert(size_type i, const ustring& src); - ustring& insert(size_type i, const ustring& src, size_type i2, size_type n); - ustring& insert(size_type i, const char* src, size_type n); - ustring& insert(size_type i, const char* src); - ustring& insert(size_type i, size_type n, gunichar uc); - ustring& insert(size_type i, size_type n, char c); - - iterator insert(iterator p, gunichar uc); - iterator insert(iterator p, char c); - void insert(iterator p, size_type n, gunichar uc); - void insert(iterator p, size_type n, char c); - template <class In> void insert(iterator p, In pbegin, In pend); - -//! @} -//! @name Replace sub-strings. -//! @{ - - ustring& replace(size_type i, size_type n, const ustring& src); - ustring& replace(size_type i, size_type n, const ustring& src, size_type i2, size_type n2); - ustring& replace(size_type i, size_type n, const char* src, size_type n2); - ustring& replace(size_type i, size_type n, const char* src); - ustring& replace(size_type i, size_type n, size_type n2, gunichar uc); - ustring& replace(size_type i, size_type n, size_type n2, char c); - - ustring& replace(iterator pbegin, iterator pend, const ustring& src); - ustring& replace(iterator pbegin, iterator pend, const char* src, size_type n); - ustring& replace(iterator pbegin, iterator pend, const char* src); - ustring& replace(iterator pbegin, iterator pend, size_type n, gunichar uc); - ustring& replace(iterator pbegin, iterator pend, size_type n, char c); - template <class In> ustring& replace(iterator pbegin, iterator pend, In pbegin2, In pend2); - -//! @} -//! @name Erase sub-strings. -//! @{ - - void clear(); - ustring& erase(size_type i, size_type n=npos); - ustring& erase(); - iterator erase(iterator p); - iterator erase(iterator pbegin, iterator pend); - -//! @} -//! @name Compare and collate. -//! @{ - - int compare(const ustring& rhs) const; - int compare(const char* rhs) const; - int compare(size_type i, size_type n, const ustring& rhs) const; - int compare(size_type i, size_type n, const ustring& rhs, size_type i2, size_type n2) const; - int compare(size_type i, size_type n, const char* rhs, size_type n2) const; - int compare(size_type i, size_type n, const char* rhs) const; - - /*! Create a unique sorting key for the UTF-8 string. If you need to - * compare UTF-8 strings regularly, e.g. for sorted containers such as - * <tt>std::set<></tt>, you should consider creating a collate key first - * and compare this key instead of the actual string. - * - * The ustring::compare() methods as well as the relational operators - * <tt>== != < > <= >=</tt> are quite costly - * because they have to deal with %Unicode and the collation rules defined by - * the current locale. Converting both operands to UCS-4 is just the first - * of several costly steps involved when comparing ustrings. So be careful. - */ - std::string collate_key() const; - - /*! Create a unique key for the UTF-8 string that can be used for caseless - * sorting. <tt>ustr.casefold_collate_key()</tt> results in the same string - * as <tt>ustr.casefold().collate_key()</tt>, but the former is likely more - * efficient. - */ - std::string casefold_collate_key() const; - -//! @} -//! @name Extract characters and sub-strings. -//! @{ - - /*! No reference return; use replace() to write characters. */ - value_type operator[](size_type i) const; - - /*! No reference return; use replace() to write characters. @throw std::out_of_range */ - value_type at(size_type i) const; - - inline ustring substr(size_type i=0, size_type n=npos) const; - -//! @} -//! @name Access a sequence of characters. -//! @{ - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - reverse_iterator rbegin(); - reverse_iterator rend(); - const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; - -//! @} -//! @name Find sub-strings. -//! @{ - - size_type find(const ustring& str, size_type i=0) const; - size_type find(const char* str, size_type i, size_type n) const; - size_type find(const char* str, size_type i=0) const; - size_type find(gunichar uc, size_type i=0) const; - size_type find(char c, size_type i=0) const; - - size_type rfind(const ustring& str, size_type i=npos) const; - size_type rfind(const char* str, size_type i, size_type n) const; - size_type rfind(const char* str, size_type i=npos) const; - size_type rfind(gunichar uc, size_type i=npos) const; - size_type rfind(char c, size_type i=npos) const; - -//! @} -//! @name Match against a set of characters. -//! @{ - - size_type find_first_of(const ustring& match, size_type i=0) const; - size_type find_first_of(const char* match, size_type i, size_type n) const; - size_type find_first_of(const char* match, size_type i=0) const; - size_type find_first_of(gunichar uc, size_type i=0) const; - size_type find_first_of(char c, size_type i=0) const; - - size_type find_last_of(const ustring& match, size_type i=npos) const; - size_type find_last_of(const char* match, size_type i, size_type n) const; - size_type find_last_of(const char* match, size_type i=npos) const; - size_type find_last_of(gunichar uc, size_type i=npos) const; - size_type find_last_of(char c, size_type i=npos) const; - - size_type find_first_not_of(const ustring& match, size_type i=0) const; - size_type find_first_not_of(const char* match, size_type i, size_type n) const; - size_type find_first_not_of(const char* match, size_type i=0) const; - size_type find_first_not_of(gunichar uc, size_type i=0) const; - size_type find_first_not_of(char c, size_type i=0) const; - - size_type find_last_not_of(const ustring& match, size_type i=npos) const; - size_type find_last_not_of(const char* match, size_type i, size_type n) const; - size_type find_last_not_of(const char* match, size_type i=npos) const; - size_type find_last_not_of(gunichar uc, size_type i=npos) const; - size_type find_last_not_of(char c, size_type i=npos) const; - -//! @} -//! @name Retrieve the string's size. -//! @{ - - /** Returns true if the string is empty. Equivalent to *this == "". - * @result Whether the string is empty. - */ - bool empty() const; - - /** Returns the number of characters in the string, not including any null-termination. - * @result The number of UTF-8 characters. - * - * @see bytes(), empty() - */ - size_type size() const; - - //We have length() as well as size(), because std::string has both. - - /** This is the same as size(). - */ - size_type length() const; - - /** Returns the number of bytes in the string, not including any null-termination. - * @result The number of bytes. - * - * @see size(), empty() - */ - size_type bytes() const; - -//! @} -//! @name Change the string's size. -//! @{ - - void resize(size_type n, gunichar uc); - void resize(size_type n, char c='\0'); - -//! @} -//! @name Control the allocated memory. -//! @{ - - size_type capacity() const; - size_type max_size() const; - void reserve(size_type n=0); - -//! @} -//! @name Get a per-byte representation of the string. -//! @{ - - inline operator std::string() const; // e.g. std::string str = ustring(); - inline const std::string& raw() const; - - // Not necessarily an ASCII char*. Use g_utf8_*() where necessary. - const char* data() const; - const char* c_str() const; - - /*! @return Number of copied @em bytes, not characters. */ - size_type copy(char* dest, size_type n, size_type i=0) const; - -//! @} -//! @name UTF-8 utilities. -//! @{ - - /*! Check whether the string is valid UTF-8. */ - bool validate() const; - - /*! Check whether the string is valid UTF-8. */ - bool validate(iterator& first_invalid); - - /*! Check whether the string is valid UTF-8. */ - bool validate(const_iterator& first_invalid) const; - - /*! Check whether the string is plain 7-bit ASCII. @par - * Unlike any other ustring method, is_ascii() is safe to use on invalid - * UTF-8 strings. If the string isn't valid UTF-8, it cannot be valid - * ASCII either, therefore is_ascii() will just return @c false then. - * @return Whether the string contains only ASCII characters. - */ - bool is_ascii() const; - - /*! "Normalize" the %Unicode character representation of the string. */ - ustring normalize(NormalizeMode mode = NORMALIZE_DEFAULT_COMPOSE) const; - -//! @} -//! @name Character case conversion. -//! @{ - - /*! Returns a new UTF-8 string with all characters characters converted to - * their uppercase equivalent, while honoring the current locale. The - * resulting string may change in the number of bytes as well as in the - * number of characters. For instance, the German sharp s - * <tt>"ß"</tt> will be replaced by two characters - * <tt>"SS"</tt> because there is no capital <tt>"ß"</tt>. - */ - ustring uppercase() const; - - /*! Returns a new UTF-8 string with all characters characters converted to - * their lowercase equivalent, while honoring the current locale. The - * resulting string may change in the number of bytes as well as in the - * number of characters. - */ - ustring lowercase() const; - - /*! Returns a caseless representation of the UTF-8 string. The resulting - * string doesn't correspond to any particular case, therefore the result - * is only useful to compare strings and should never be displayed to the - * user. - */ - ustring casefold() const; - -//! @} -//! @name Message formatting. -//! @{ - - /* Returns fmt as is, but checks for invalid references in the format string. - * @newin{2,18} - */ - template <class T1> - static inline - ustring compose(const ustring& fmt); - - /*! Substitute placeholders in a format string with the referenced arguments. - * The template string should be in <tt>qt-format</tt>, that is - * <tt>"%1"</tt>, <tt>"%2"</tt>, ..., <tt>"%9"</tt> are used as placeholders - * and <tt>"%%"</tt> denotes a literal <tt>"%"</tt>. Substitutions may be - * reordered. - * @par Example: - * @code - * using Glib::ustring; - * const int percentage = 50; - * const ustring text = ustring::compose("%1%% done", percentage); - * @endcode - * @param fmt A template string in <tt>qt-format</tt>. - * @param a1 The argument to substitute for <tt>"%1"</tt>. - * @return The substituted message string. - * @throw Glib::ConvertError - * - * @newin{2,16} - */ - template <class T1> - static inline - ustring compose(const ustring& fmt, const T1& a1); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2> - static inline - ustring compose(const ustring& fmt, const T1& a1, const T2& a2); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5, class T6> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, - const T7& a7); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, - const T7& a7, const T8& a8); - - /* See the documentation for compose(const ustring& fmt, const T1& a1). - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5, - class T6, class T7, class T8, class T9> - static inline - ustring compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, - const T7& a7, const T8& a8, const T9& a9); - - /*! Format the argument to its string representation. - * Applies the arguments in order to an std::wostringstream and returns the - * resulting string. I/O manipulators may also be used as arguments. This - * greatly simplifies the common task of converting a number to a string, as - * demonstrated by the example below. The format() methods can also be used - * in conjunction with compose() to facilitate localization of user-visible - * messages. - * @code - * using Glib::ustring; - * double value = 22.0 / 7.0; - * ustring text = ustring::format(std::fixed, std::setprecision(2), value); - * @endcode - * @note The use of a wide character stream in the implementation of format() - * is almost completely transparent. However, one of the instances where the - * use of wide streams becomes visible is when the std::setfill() stream - * manipulator is used. In order for std::setfill() to work the argument - * must be of type <tt>wchar_t</tt>. This can be achieved by using the - * <tt>L</tt> prefix with a character literal, as shown in the example. - * @code - * using Glib::ustring; - * // Insert leading zeroes to fill in at least six digits - * ustring text = ustring::format(std::setfill(L'0'), std::setw(6), 123); - * @endcode - * - * @param a1 A streamable value or an I/O manipulator. - * @return The string representation of the argument stream. - * @throw Glib::ConvertError - * - * @newin{2,16} - */ - template <class T1> - static inline - ustring format(const T1& a1); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2> - static inline - ustring format(const T1& a1, const T2& a2); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, class T5, class T6> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, - const T5& a5, const T6& a6, const T7& a7); - - /* See the documentation for format(const T1& a1). - * - * @newin{2,16} - */ - template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8> - static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, - const T5& a5, const T6& a6, const T7& a7, const T8& a8); -//! @} - -private: - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -#ifdef GLIBMM_HAVE_STD_ITERATOR_TRAITS - template <class In, class ValueType = typename std::iterator_traits<In>::value_type> -#else - template <class In, class ValueType = typename Glib::IteratorTraits<In>::value_type> -#endif - struct SequenceToString; - - //The Tru64 compiler needs these partial specializations to be declared here, - //as well as defined later. That's probably correct. murrayc. - template <class In> struct SequenceToString<In, char>; - template <class In> struct SequenceToString<In, gunichar>; - - template <class T> class Stringify; - class FormatStream; - - static ustring compose_argv(const ustring& fmt, int argc, const ustring* const* argv); - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - std::string string_; -}; - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -template <class In, class ValueType> -struct ustring::SequenceToString -{}; - -template <class In> -struct ustring::SequenceToString<In, char> : public std::string -{ - SequenceToString(In pbegin, In pend); -}; - -template <class In> -struct ustring::SequenceToString<In, gunichar> : public std::string -{ - SequenceToString(In pbegin, In pend); -}; - -template <> -struct ustring::SequenceToString<Glib::ustring::iterator, gunichar> : public std::string -{ - SequenceToString(Glib::ustring::iterator pbegin, Glib::ustring::iterator pend); -}; - -template <> -struct ustring::SequenceToString<Glib::ustring::const_iterator, gunichar> : public std::string -{ - SequenceToString(Glib::ustring::const_iterator pbegin, Glib::ustring::const_iterator pend); -}; - -class ustring::FormatStream -{ -private: -#ifdef GLIBMM_HAVE_WIDE_STREAM - typedef std::wostringstream StreamType; -#else - typedef std::ostringstream StreamType; -#endif - StreamType stream_; - - // noncopyable - FormatStream(const ustring::FormatStream&); - FormatStream& operator=(const ustring::FormatStream&); - -public: - FormatStream(); - ~FormatStream(); - - template <class T> inline void stream(const T& value); - - inline void stream(const char* value); - - //This overload exists to avoid the templated stream() being called for non-const char*. - inline void stream(char* value); - - ustring to_string() const; -}; - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -/** Stream input operator. - * @relates Glib::ustring - * @throw Glib::ConvertError - */ -std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string); - -/** Stream output operator. - * @relates Glib::ustring - * @throw Glib::ConvertError - */ -std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string); - -#ifdef GLIBMM_HAVE_WIDE_STREAM - -/** Wide stream input operator. - * @relates Glib::ustring - * @throw Glib::ConvertError - */ -std::wistream& operator>>(std::wistream& is, ustring& utf8_string); - -/** Wide stream output operator. - * @relates Glib::ustring - * @throw Glib::ConvertError - */ -std::wostream& operator<<(std::wostream& os, const ustring& utf8_string); - -#endif /* GLIBMM_HAVE_WIDE_STREAM */ - -/***************************************************************************/ -/* Inline implementation */ -/***************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/**** Glib::ustring_Iterator<> *********************************************/ - -template <class T> inline -ustring_Iterator<T>::ustring_Iterator(T pos) -: - pos_ (pos) -{} - -template <class T> inline -T ustring_Iterator<T>::base() const -{ - return pos_; -} - -template <class T> inline -ustring_Iterator<T>::ustring_Iterator() -: - pos_ () -{} - -template <class T> inline -ustring_Iterator<T>::ustring_Iterator(const ustring_Iterator<std::string::iterator>& other) -: - pos_ (other.base()) -{} - -template <class T> inline -typename ustring_Iterator<T>::value_type ustring_Iterator<T>::operator*() const -{ - return Glib::get_unichar_from_std_iterator(pos_); -} - -template <class T> inline -ustring_Iterator<T>& ustring_Iterator<T>::operator++() -{ - pos_ += g_utf8_skip[static_cast<unsigned char>(*pos_)]; - return *this; -} - -template <class T> inline -const ustring_Iterator<T> ustring_Iterator<T>::operator++(int) -{ - const ustring_Iterator<T> temp (*this); - this->operator++(); - return temp; -} - -template <class T> inline -ustring_Iterator<T>& ustring_Iterator<T>::operator--() -{ - do --pos_; while((static_cast<unsigned char>(*pos_) & 0xC0u) == 0x80); - return *this; -} - -template <class T> inline -const ustring_Iterator<T> ustring_Iterator<T>::operator--(int) -{ - const ustring_Iterator<T> temp (*this); - this->operator--(); - return temp; -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -/** @relates Glib::ustring_Iterator */ -inline -bool operator==(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() == rhs.base()); -} - -/** @relates Glib::ustring_Iterator */ -inline -bool operator!=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() != rhs.base()); -} - -/** @relates Glib::ustring_Iterator */ -inline -bool operator<(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() < rhs.base()); -} - -/** @relates Glib::ustring_Iterator */ -inline -bool operator>(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() > rhs.base()); -} - -/** @relates Glib::ustring_Iterator */ -inline -bool operator<=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() <= rhs.base()); -} - -/** @relates Glib::ustring_Iterator */ -inline -bool operator>=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) -{ - return (lhs.base() >= rhs.base()); -} - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/**** Glib::ustring::SequenceToString **************************************/ - -template <class In> -ustring::SequenceToString<In,char>::SequenceToString(In pbegin, In pend) -: - std::string(pbegin, pend) -{} - -template <class In> -ustring::SequenceToString<In,gunichar>::SequenceToString(In pbegin, In pend) -{ - char utf8_buf[6]; // stores a single UTF-8 character - - for(; pbegin != pend; ++pbegin) - { - const std::string::size_type utf8_len = g_unichar_to_utf8(*pbegin, utf8_buf); - this->append(utf8_buf, utf8_len); - } -} - -/**** Glib::ustring::FormatStream ******************************************/ - -template <class T> inline -void ustring::FormatStream::stream(const T& value) -{ - stream_ << value; -} - -inline -void ustring::FormatStream::stream(const char* value) -{ - stream_ << ustring(value); -} - -inline -void ustring::FormatStream::stream(char* value) -{ - stream_ << ustring(value); -} - -/**** Glib::ustring ********************************************************/ - -template <class In> -ustring::ustring(In pbegin, In pend) -: - string_ (Glib::ustring::SequenceToString<In>(pbegin, pend)) -{} - -template <class In> -ustring& ustring::assign(In pbegin, In pend) -{ - Glib::ustring::SequenceToString<In> temp_string (pbegin, pend); - string_.swap(temp_string); // constant-time operation - return *this; -} - -template <class In> -ustring& ustring::append(In pbegin, In pend) -{ - string_.append(Glib::ustring::SequenceToString<In>(pbegin, pend)); - return *this; -} - -template <class In> -void ustring::insert(ustring::iterator p, In pbegin, In pend) -{ - string_.insert(p.base(), Glib::ustring::SequenceToString<In>(pbegin, pend)); -} - -template <class In> -ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, In pbegin2, In pend2) -{ - string_.replace( - pbegin.base(), pend.base(), - Glib::ustring::SequenceToString<In>(pbegin2, pend2)); - return *this; -} - -// The ustring methods substr() and operator std::string() are inline, -// so that the compiler has a fair chance to optimize the copy ctor away. - -inline -ustring ustring::substr(ustring::size_type i, ustring::size_type n) const -{ - return ustring(*this, i, n); -} - -inline -ustring::operator std::string() const -{ - return string_; -} - -inline -const std::string& ustring::raw() const -{ - return string_; -} - -template <class T1> -inline // static -ustring ustring::format(const T1& a1) -{ - ustring::FormatStream buf; - buf.stream(a1); - return buf.to_string(); -} - -template <class T1, class T2> -inline // static -ustring ustring::format(const T1& a1, const T2& a2) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - return buf.to_string(); -} - -template <class T1, class T2, class T3> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - return buf.to_string(); -} - -template <class T1, class T2, class T3, class T4> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - buf.stream(a4); - return buf.to_string(); -} - -template <class T1, class T2, class T3, class T4, class T5> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - buf.stream(a4); - buf.stream(a5); - return buf.to_string(); -} - -template <class T1, class T2, class T3, class T4, class T5, class T6> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - buf.stream(a4); - buf.stream(a5); - buf.stream(a6); - return buf.to_string(); -} - -template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, - const T5& a5, const T6& a6, const T7& a7) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - buf.stream(a4); - buf.stream(a5); - buf.stream(a6); - buf.stream(a7); - return buf.to_string(); -} - -template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8> -inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, - const T5& a5, const T6& a6, const T7& a7, const T8& a8) -{ - ustring::FormatStream buf; - buf.stream(a1); - buf.stream(a2); - buf.stream(a3); - buf.stream(a4); - buf.stream(a5); - buf.stream(a6); - buf.stream(a7); - buf.stream(a8); - return buf.to_string(); -} - -/** An inner class used by ustring. - */ -template <class T> -class ustring::Stringify -{ -private: - ustring string_; - - // noncopyable - Stringify(const ustring::Stringify<T>&); - Stringify<T>& operator=(const ustring::Stringify<T>&); - -public: - explicit inline Stringify(const T& arg) : string_ (ustring::format(arg)) {} - - //TODO: Why is this here? See the template specialization: - explicit inline Stringify(const char* arg) : string_(arg) {} - - inline const ustring* ptr() const { return &string_; } -}; - -/// A template specialization for Stringify<ustring>: -template <> -class ustring::Stringify<ustring> -{ -private: - const ustring& string_; - - // noncopyable - Stringify(const ustring::Stringify<ustring>&); - Stringify<ustring>& operator=(const ustring::Stringify<ustring>&); - -public: - explicit inline Stringify(const ustring& arg) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } -}; - -/** A template specialization for Stringify<const char*>, - * because the regular template has ambiguous constructor overloads for char*. - */ -template <> -class ustring::Stringify<const char*> -{ -private: - const ustring string_; - - // noncopyable - Stringify(const ustring::Stringify<const char*>&); - Stringify<ustring>& operator=(const ustring::Stringify<const char*>&); - -public: - explicit inline Stringify(const char* arg) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } -}; - -/** A template specialization for Stringify<char[N]> (for string literals), - * because the regular template has ambiguous constructor overloads for char*. - */ -template <std::size_t N> -class ustring::Stringify<char[N]> -{ -private: - const ustring string_; - - // noncopyable - Stringify(const ustring::Stringify<char[N]>&); - Stringify<ustring>& operator=(const ustring::Stringify<char[N]>&); - -public: - explicit inline Stringify(const char arg[N]) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } -}; - -template <class T1> -inline // static -ustring ustring::compose(const ustring& fmt) -{ - return ustring::compose_argv(fmt, 0, 0); -} - -template <class T1> -inline // static -ustring ustring::compose(const ustring& fmt, const T1& a1) -{ - const ustring::Stringify<T1> s1(a1); - - const ustring *const argv[] = { s1.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2> -inline // static -ustring ustring::compose(const ustring& fmt, const T1& a1, const T2& a2) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - - const ustring *const argv[] = { s1.ptr(), s2.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, const T4& a4) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4, class T5> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4, class T5, class T6> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), - s5.ptr(), s6.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, const T7& a7) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), - s5.ptr(), s6.ptr(), s7.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, - const T7& a7, const T8& a8) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); - const ustring::Stringify<T8> s8(a8); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), - s5.ptr(), s6.ptr(), s7.ptr(), s8.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -template <class T1, class T2, class T3, class T4, class T5, - class T6, class T7, class T8, class T9> -inline // static -ustring ustring::compose(const ustring& fmt, - const T1& a1, const T2& a2, const T3& a3, - const T4& a4, const T5& a5, const T6& a6, - const T7& a7, const T8& a8, const T9& a9) -{ - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); - const ustring::Stringify<T8> s8(a8); - const ustring::Stringify<T9> s9(a9); - - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), - s5.ptr(), s6.ptr(), s7.ptr(), s8.ptr(), s9.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -/** @relates Glib::ustring */ -inline -void swap(ustring& lhs, ustring& rhs) -{ - lhs.swap(rhs); -} - - -/**** Glib::ustring -- comparison operators ********************************/ - -/** @relates Glib::ustring */ -inline bool operator==(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) == 0); } - -/** @relates Glib::ustring */ -inline bool operator==(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) == 0); } - -/** @relates Glib::ustring */ -inline bool operator==(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) == 0); } - - -/** @relates Glib::ustring */ -inline bool operator!=(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) != 0); } - -/** @relates Glib::ustring */ -inline bool operator!=(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) != 0); } - -/** @relates Glib::ustring */ -inline bool operator!=(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) != 0); } - - -/** @relates Glib::ustring */ -inline bool operator<(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) < 0); } - -/** @relates Glib::ustring */ -inline bool operator<(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) < 0); } - -/** @relates Glib::ustring */ -inline bool operator<(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) > 0); } - - -/** @relates Glib::ustring */ -inline bool operator>(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) > 0); } - -/** @relates Glib::ustring */ -inline bool operator>(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) > 0); } - -/** @relates Glib::ustring */ -inline bool operator>(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) < 0); } - - -/** @relates Glib::ustring */ -inline bool operator<=(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) <= 0); } - -/** @relates Glib::ustring */ -inline bool operator<=(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) <= 0); } - -/** @relates Glib::ustring */ -inline bool operator<=(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) >= 0); } - - -/** @relates Glib::ustring */ -inline bool operator>=(const ustring& lhs, const ustring& rhs) - { return (lhs.compare(rhs) >= 0); } - -/** @relates Glib::ustring */ -inline bool operator>=(const ustring& lhs, const char* rhs) - { return (lhs.compare(rhs) >= 0); } - -/** @relates Glib::ustring */ -inline bool operator>=(const char* lhs, const ustring& rhs) - { return (rhs.compare(lhs) <= 0); } - - -/**** Glib::ustring -- concatenation operators *****************************/ - -/** @relates Glib::ustring */ -inline ustring operator+(const ustring& lhs, const ustring& rhs) -{ - ustring temp(lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(const ustring& lhs, const char* rhs) -{ - ustring temp(lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(const char* lhs, const ustring& rhs) -{ - ustring temp(lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(const ustring& lhs, gunichar rhs) -{ - ustring temp(lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(gunichar lhs, const ustring& rhs) -{ - ustring temp(1, lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(const ustring& lhs, char rhs) -{ - ustring temp(lhs); - temp += rhs; - return temp; -} - -/** @relates Glib::ustring */ -inline ustring operator+(char lhs, const ustring& rhs) -{ - ustring temp(1, lhs); - temp += rhs; - return temp; -} - -} // namespace Glib - - -#endif /* _GLIBMM_USTRING_H */ Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2012-03-20 14:33:34 UTC (rev 212) +++ trunk/tests/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) @@ -18,7 +18,7 @@ node/test_node.cc \ tree/test_tree.cc \ xmlwrappstring/test_xmlwrappstring_compose.cc \ - xmlwrappstring/test_xmlwrappstring_format.cc \ + xmlwrappstring/test_xmlwrappstring_format.cc if WITH_XSLT LIBS += $(top_builddir)/src/libxsltwrapp.la This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 14:49:51
|
Revision: 214 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=214&view=rev Author: tbrowder2 Date: 2012-03-20 14:49:40 +0000 (Tue, 20 Mar 2012) Log Message: ----------- ensure Makefile.in files are removed with distclean target Modified Paths: -------------- trunk/Makefile.am trunk/docs/Makefile.am trunk/examples/01-tree_parsing/Makefile.am trunk/examples/02-event_parsing/Makefile.am trunk/examples/03-xml_generation/Makefile.am trunk/examples/04-xslt/Makefile.am trunk/examples/Makefile.am trunk/include/Makefile.am trunk/src/Makefile.am trunk/tests/Makefile.am Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -21,3 +21,5 @@ dist-hook: (cd $(distdir)/platform/Win32 ; bakefile_gen) rm -f $(distdir)/platform/Win32/.bakefile_gen.state + +DISTCLEANFILES = Makefile.in Modified: trunk/docs/Makefile.am =================================================================== --- trunk/docs/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/docs/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -5,3 +5,5 @@ dist-hook: cd $(distdir) && doxygen + +DISTCLEANFILES = Makefile.in Modified: trunk/examples/01-tree_parsing/Makefile.am =================================================================== --- trunk/examples/01-tree_parsing/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/examples/01-tree_parsing/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -4,3 +4,5 @@ example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxmlwrapp.la + +DISTCLEANFILES = Makefile.in Modified: trunk/examples/02-event_parsing/Makefile.am =================================================================== --- trunk/examples/02-event_parsing/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/examples/02-event_parsing/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -4,3 +4,5 @@ example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxmlwrapp.la + +DISTCLEANFILES = Makefile.in Modified: trunk/examples/03-xml_generation/Makefile.am =================================================================== --- trunk/examples/03-xml_generation/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/examples/03-xml_generation/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -4,3 +4,5 @@ example_SOURCES = example.cc example_CPPFLAGS = -I$(top_srcdir)/include example_LDADD = ../../src/libxmlwrapp.la + +DISTCLEANFILES = Makefile.in Modified: trunk/examples/04-xslt/Makefile.am =================================================================== --- trunk/examples/04-xslt/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/examples/04-xslt/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -10,3 +10,5 @@ endif EXTRA_DIST = example.xml example.xsl + +DISTCLEANFILES = Makefile.in Modified: trunk/examples/Makefile.am =================================================================== --- trunk/examples/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/examples/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -4,3 +4,5 @@ 02-event_parsing \ 03-xml_generation \ 04-xslt + +DISTCLEANFILES = Makefile.in Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/include/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -14,6 +14,10 @@ xmlwrapp/version.h \ xmlwrapp/xmlwrapp.h +xmlwrappstring_includedir= $(includedir)/xmlwrappstring +xmlwrappstring_include_HEADERS = \ + xmlwrappstring/xmlwrappstring.h + if WITH_XSLT xsltwrapp_includedir= $(includedir)/xsltwrapp xsltwrapp_include_HEADERS = \ @@ -21,3 +25,5 @@ xsltwrapp/stylesheet.h \ xsltwrapp/xsltwrapp.h endif + +DISTCLEANFILES = Makefile.in Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/src/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -52,3 +52,5 @@ libxslt/stylesheet.cc endif + +DISTCLEANFILES = Makefile.in Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2012-03-20 14:35:16 UTC (rev 213) +++ trunk/tests/Makefile.am 2012-03-20 14:49:40 UTC (rev 214) @@ -31,3 +31,5 @@ $(srcdir)/*/data/*.xsl \ $(srcdir)/*/data/*.dtd \ $(srcdir)/*/data/output + +DISTCLEANFILES = Makefile.in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 16:12:18
|
Revision: 217 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=217&view=rev Author: tbrowder2 Date: 2012-03-20 16:12:08 +0000 (Tue, 20 Mar 2012) Log Message: ----------- add license info for all parts Modified Paths: -------------- trunk/LICENSE Added Paths: ----------- trunk/licenses/ trunk/licenses/ustring.license trunk/licenses/utf8string.license Modified: trunk/LICENSE =================================================================== --- trunk/LICENSE 2012-03-20 15:59:36 UTC (rev 216) +++ trunk/LICENSE 2012-03-20 16:12:08 UTC (rev 217) @@ -1,5 +1,25 @@ -Copyright (C) 2001-2003 Peter J Jones <pj...@pm...> +This project is licensed as two separate parts: + +(1) xmlwrappstring +================== + +See: + + licenses/ustring.license + GNU LESSER GENERAL PUBLIC LICENSE (LGPL): Version 2.1, February 1999 + + licenses/utf8string.license + +Copyright (C) 2012 Thomas M. Browder, Jr. <tom...@gm...> + + +(2) xmlwrapp, xsltwrapp +======================= + +Copyright (C) 2001-2003 Peter J. Jones <pj...@pm...> +Copyright (C) 2005-2008 Thomas M. Browder, Jr. <tom...@gm...> Copyright (C) 2009-2010 Vaclav Slavik <vs...@gm...> +Copyright (C) 2012 Thomas M. Browder, Jr. <tom...@gm...> All Rights Reserved Redistribution and use in source and binary forms, with or without Added: trunk/licenses/ustring.license =================================================================== --- trunk/licenses/ustring.license (rev 0) +++ trunk/licenses/ustring.license 2012-03-20 16:12:08 UTC (rev 217) @@ -0,0 +1,521 @@ +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +License follows: + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! Added: trunk/licenses/utf8string.license =================================================================== --- trunk/licenses/utf8string.license (rev 0) +++ trunk/licenses/utf8string.license 2012-03-20 16:12:08 UTC (rev 217) @@ -0,0 +1,25 @@ +// Copyright 2006 Nemanja Trifunovic + +/* +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-20 16:50:12
|
Revision: 222 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=222&view=rev Author: tbrowder2 Date: 2012-03-20 16:49:59 +0000 (Tue, 20 Mar 2012) Log Message: ----------- change ustring to xmlwrappstring; change Glib namespace to xmlws namespace; remove glib headers; add utf8 headers Modified Paths: -------------- trunk/include/xmlwrappstring/xmlwrappstring.h trunk/src/libxmlwrappstring/xmlwrappstring.cc Modified: trunk/include/xmlwrappstring/xmlwrappstring.h =================================================================== --- trunk/include/xmlwrappstring/xmlwrappstring.h 2012-03-20 16:18:57 UTC (rev 221) +++ trunk/include/xmlwrappstring/xmlwrappstring.h 2012-03-20 16:49:59 UTC (rev 222) @@ -20,10 +20,6 @@ #include "utf8.h" -#include <glibmmconfig.h> -#include <glibmm/unicode.h> -#include <glib.h> - #include <iosfwd> #include <iterator> #include <sstream> @@ -32,7 +28,7 @@ #include <cstddef> /* for ptrdiff_t */ #endif -namespace Glib +namespace xmlws { #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -72,7 +68,7 @@ #endif /* DOXYGEN_SHOULD_SKIP_THIS */ -/** The iterator type of Glib::ustring. +/** The iterator type of xmlws::xmlwrappstring. * Note this is not a random access iterator but a bidirectional one, * since all index operations need to iterate over the UTF-8 data. Use * std::advance() to move to a certain position. However, all of the @@ -85,7 +81,7 @@ * pointing into the same string. */ template <class T> -class ustring_Iterator +class xmlwrappstring_Iterator { public: typedef std::bidirectional_iterator_tag iterator_category; @@ -94,17 +90,17 @@ typedef value_type reference; typedef void pointer; - inline ustring_Iterator(); - inline ustring_Iterator(const ustring_Iterator<std::string::iterator>& other); + inline xmlwrappstring_Iterator(); + inline xmlwrappstring_Iterator(const xmlwrappstring_Iterator<std::string::iterator>& other); inline value_type operator*() const; - inline ustring_Iterator<T> & operator++(); - inline const ustring_Iterator<T> operator++(int); - inline ustring_Iterator<T> & operator--(); - inline const ustring_Iterator<T> operator--(int); + inline xmlwrappstring_Iterator<T> & operator++(); + inline const xmlwrappstring_Iterator<T> operator++(int); + inline xmlwrappstring_Iterator<T> & operator--(); + inline const xmlwrappstring_Iterator<T> operator--(int); - explicit inline ustring_Iterator(T pos); + explicit inline xmlwrappstring_Iterator(T pos); inline T base() const; private: @@ -118,25 +114,25 @@ * position, depending on the UTF-8 character width. You have to make * sure the source contains at least one valid UTF-8 character. * - * This is mainly used by the implementation of Glib::ustring::iterator, + * This is mainly used by the implementation of xmlws::xmlwrappstring::iterator, * but it might be useful as utility function if you prefer using * std::string even for UTF-8 encoding. */ gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_PURE; -/** Glib::ustring has much the same interface as std::string, but contains +/** xmlws::xmlwrappstring has much the same interface as std::string, but contains * %Unicode characters encoded as UTF-8. * * @par About UTF-8 and ASCII * @par * The standard character set ANSI_X3.4-1968 -- more commonly known as * ASCII -- is a subset of UTF-8. So, if you want to, you can use - * Glib::ustring without even thinking about UTF-8. + * xmlws::xmlwrappstring without even thinking about UTF-8. * @par * Whenever ASCII is mentioned in this manual, we mean the @em real ASCII * (i.e. as defined in ANSI_X3.4-1968), which contains only 7-bit characters. - * Glib::ustring can @em not be used with ASCII-compatible extended 8-bit + * xmlws::xmlwrappstring can @em not be used with ASCII-compatible extended 8-bit * charsets like ISO-8859-1. It's a good idea to avoid string literals * containing non-ASCII characters (e.g. German umlauts) in source code, * or at least you should use UTF-8 literals. @@ -144,12 +140,12 @@ * You can find a detailed UTF-8 and %Unicode FAQ here: * http://www.cl.cam.ac.uk/~mgk25/unicode.html * - * @par Glib::ustring vs. std::string + * @par xmlws::xmlwrappstring vs. std::string * @par - * Glib::ustring has implicit type conversions to and from std::string. + * xmlws::xmlwrappstring has implicit type conversions to and from std::string. * These conversions do @em not convert to/from the current locale (see - * Glib::locale_from_utf8() and Glib::locale_to_utf8() if you need that). You - * can always use std::string instead of Glib::ustring -- however, using + * xmlws::locale_from_utf8() and xmlws::locale_to_utf8() if you need that). You + * can always use std::string instead of xmlws::xmlwrappstring -- however, using * std::string with multi-byte characters is quite hard. For instance, * <tt>std::string::operator[]</tt> might return a byte in the middle of a * character, and <tt>std::string::length()</tt> returns the number of bytes @@ -160,12 +156,12 @@ * that std::wstring is not a UTF-8 string class because it contains only * fixed-width characters (where width could be 32, 16, or even 8 bits). * - * @par Glib::ustring and stream input/output + * @par xmlws::xmlwrappstring and stream input/output * @par * The stream I/O operators, that is operator<<() and operator>>(), perform * implicit charset conversion to/from the current locale. If that's not * what you intented (e.g. when writing to a configuration file that should - * always be UTF-8 encoded) use ustring::raw() to override this behaviour. + * always be UTF-8 encoded) use xmlwrappstring::raw() to override this behaviour. * @par * If you're using std::ostringstream to build strings for display in the * user interface, you must convert the result back to UTF-8 as shown below: @@ -173,31 +169,31 @@ * std::ostringstream output; * output.imbue(std::locale("")); // use the user's locale for this stream * output << percentage << " % done"; - * label->set_text(Glib::locale_to_utf8(output.str())); + * label->set_text(xmlws::locale_to_utf8(output.str())); * @endcode * * @par Formatted output and internationalization * @par - * The methods ustring::compose() and ustring::format() provide a convenient + * The methods xmlwrappstring::compose() and xmlwrappstring::format() provide a convenient * and powerful alternative to string streams, as shown in the example below. * Refer to the method documentation of compose() and format() for details. * @code - * using Glib::ustring; + * using xmlws::xmlwrappstring; * - * ustring message = ustring::compose("%1 is lower than 0x%2.", - * 12, ustring::format(std::hex, 16)); + * xmlwrappstring message = xmlwrappstring::compose("%1 is lower than 0x%2.", + * 12, xmlwrappstring::format(std::hex, 16)); * @endcode * * @par Implementation notes * @par - * Glib::ustring does not inherit from std::string, because std::string was + * xmlws::xmlwrappstring does not inherit from std::string, because std::string was * intended to be a final class. For instance, it does not have a virtual * destructor. Also, a HAS-A relationship is more appropriate because - * ustring can't just enhance the std::string interface. Rather, it has to + * xmlwrappstring can't just enhance the std::string interface. Rather, it has to * reimplement the interface so that all operations are based on characters * instead of bytes. */ -class ustring +class xmlwrappstring { public: typedef std::string::size_type size_type; @@ -207,8 +203,8 @@ typedef gunichar & reference; typedef const gunichar & const_reference; - typedef ustring_Iterator<std::string::iterator> iterator; - typedef ustring_Iterator<std::string::const_iterator> const_iterator; + typedef xmlwrappstring_Iterator<std::string::iterator> iterator; + typedef xmlwrappstring_Iterator<std::string::const_iterator> const_iterator; #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR @@ -242,112 +238,112 @@ /*! Default constructor, which creates an empty string. */ - ustring(); + xmlwrappstring(); - ~ustring(); + ~xmlwrappstring(); - /*! Construct a ustring as a copy of another ustring. + /*! Construct a xmlwrappstring as a copy of another xmlwrappstring. * @param other A source string. */ - ustring(const ustring& other); + xmlwrappstring(const xmlwrappstring& other); /*! Assign the value of another string to this string. * @param other A source string. */ - ustring& operator=(const ustring& other); + xmlwrappstring& operator=(const xmlwrappstring& other); /*! Swap contents with another string. * @param other String to swap with. */ - void swap(ustring& other); + void swap(xmlwrappstring& other); - /*! Construct a ustring as a copy of another std::string. + /*! Construct a xmlwrappstring as a copy of another std::string. * @param src A source <tt>std::string</tt> containing text encoded as UTF-8. */ - ustring(const std::string& src); + xmlwrappstring(const std::string& src); - /*! Construct a ustring as a copy of a substring. - * @param src %Source ustring. + /*! Construct a xmlwrappstring as a copy of a substring. + * @param src %Source xmlwrappstring. * @param i Index of first character to copy from. * @param n Number of UTF-8 characters to copy (defaults to copying the remainder). */ - ustring(const ustring& src, size_type i, size_type n=npos); + xmlwrappstring(const xmlwrappstring& src, size_type i, size_type n=npos); - /*! Construct a ustring as a partial copy of a C string. + /*! Construct a xmlwrappstring as a partial copy of a C string. * @param src %Source C string encoded as UTF-8. * @param n Number of UTF-8 characters to copy. */ - ustring(const char* src, size_type n); + xmlwrappstring(const char* src, size_type n); - /*! Construct a ustring as a copy of a C string. + /*! Construct a xmlwrappstring as a copy of a C string. * @param src %Source C string encoded as UTF-8. */ - ustring(const char* src); + xmlwrappstring(const char* src); - /*! Construct a ustring as multiple characters. + /*! Construct a xmlwrappstring as multiple characters. * @param n Number of characters. * @param uc UCS-4 code point to use. */ - ustring(size_type n, gunichar uc); + xmlwrappstring(size_type n, gunichar uc); - /*! Construct a ustring as multiple characters. + /*! Construct a xmlwrappstring as multiple characters. * @param n Number of characters. * @param c ASCII character to use. */ - ustring(size_type n, char c); + xmlwrappstring(size_type n, char c); - /*! Construct a ustring as a copy of a range. + /*! Construct a xmlwrappstring as a copy of a range. * @param pbegin Start of range. * @param pend End of range. */ - template <class In> ustring(In pbegin, In pend); + template <class In> xmlwrappstring(In pbegin, In pend); //! @name Assign new contents. //! @{ - ustring& operator=(const std::string& src); - ustring& operator=(const char* src); - ustring& operator=(gunichar uc); - ustring& operator=(char c); + xmlwrappstring& operator=(const std::string& src); + xmlwrappstring& operator=(const char* src); + xmlwrappstring& operator=(gunichar uc); + xmlwrappstring& operator=(char c); - ustring& assign(const ustring& src); - ustring& assign(const ustring& src, size_type i, size_type n); - ustring& assign(const char* src, size_type n); - ustring& assign(const char* src); - ustring& assign(size_type n, gunichar uc); - ustring& assign(size_type n, char c); - template <class In> ustring& assign(In pbegin, In pend); + xmlwrappstring& assign(const xmlwrappstring& src); + xmlwrappstring& assign(const xmlwrappstring& src, size_type i, size_type n); + xmlwrappstring& assign(const char* src, size_type n); + xmlwrappstring& assign(const char* src); + xmlwrappstring& assign(size_type n, gunichar uc); + xmlwrappstring& assign(size_type n, char c); + template <class In> xmlwrappstring& assign(In pbegin, In pend); //! @} //! @name Append to the string. //! @{ - ustring& operator+=(const ustring& src); - ustring& operator+=(const char* src); - ustring& operator+=(gunichar uc); - ustring& operator+=(char c); + xmlwrappstring& operator+=(const xmlwrappstring& src); + xmlwrappstring& operator+=(const char* src); + xmlwrappstring& operator+=(gunichar uc); + xmlwrappstring& operator+=(char c); void push_back(gunichar uc); void push_back(char c); - ustring& append(const ustring& src); - ustring& append(const ustring& src, size_type i, size_type n); - ustring& append(const char* src, size_type n); - ustring& append(const char* src); - ustring& append(size_type n, gunichar uc); - ustring& append(size_type n, char c); - template <class In> ustring& append(In pbegin, In pend); + xmlwrappstring& append(const xmlwrappstring& src); + xmlwrappstring& append(const xmlwrappstring& src, size_type i, size_type n); + xmlwrappstring& append(const char* src, size_type n); + xmlwrappstring& append(const char* src); + xmlwrappstring& append(size_type n, gunichar uc); + xmlwrappstring& append(size_type n, char c); + template <class In> xmlwrappstring& append(In pbegin, In pend); //! @} //! @name Insert into the string. //! @{ - ustring& insert(size_type i, const ustring& src); - ustring& insert(size_type i, const ustring& src, size_type i2, size_type n); - ustring& insert(size_type i, const char* src, size_type n); - ustring& insert(size_type i, const char* src); - ustring& insert(size_type i, size_type n, gunichar uc); - ustring& insert(size_type i, size_type n, char c); + xmlwrappstring& insert(size_type i, const xmlwrappstring& src); + xmlwrappstring& insert(size_type i, const xmlwrappstring& src, size_type i2, size_type n); + xmlwrappstring& insert(size_type i, const char* src, size_type n); + xmlwrappstring& insert(size_type i, const char* src); + xmlwrappstring& insert(size_type i, size_type n, gunichar uc); + xmlwrappstring& insert(size_type i, size_type n, char c); iterator insert(iterator p, gunichar uc); iterator insert(iterator p, char c); @@ -359,27 +355,27 @@ //! @name Replace sub-strings. //! @{ - ustring& replace(size_type i, size_type n, const ustring& src); - ustring& replace(size_type i, size_type n, const ustring& src, size_type i2, size_type n2); - ustring& replace(size_type i, size_type n, const char* src, size_type n2); - ustring& replace(size_type i, size_type n, const char* src); - ustring& replace(size_type i, size_type n, size_type n2, gunichar uc); - ustring& replace(size_type i, size_type n, size_type n2, char c); + xmlwrappstring& replace(size_type i, size_type n, const xmlwrappstring& src); + xmlwrappstring& replace(size_type i, size_type n, const xmlwrappstring& src, size_type i2, size_type n2); + xmlwrappstring& replace(size_type i, size_type n, const char* src, size_type n2); + xmlwrappstring& replace(size_type i, size_type n, const char* src); + xmlwrappstring& replace(size_type i, size_type n, size_type n2, gunichar uc); + xmlwrappstring& replace(size_type i, size_type n, size_type n2, char c); - ustring& replace(iterator pbegin, iterator pend, const ustring& src); - ustring& replace(iterator pbegin, iterator pend, const char* src, size_type n); - ustring& replace(iterator pbegin, iterator pend, const char* src); - ustring& replace(iterator pbegin, iterator pend, size_type n, gunichar uc); - ustring& replace(iterator pbegin, iterator pend, size_type n, char c); - template <class In> ustring& replace(iterator pbegin, iterator pend, In pbegin2, In pend2); + xmlwrappstring& replace(iterator pbegin, iterator pend, const xmlwrappstring& src); + xmlwrappstring& replace(iterator pbegin, iterator pend, const char* src, size_type n); + xmlwrappstring& replace(iterator pbegin, iterator pend, const char* src); + xmlwrappstring& replace(iterator pbegin, iterator pend, size_type n, gunichar uc); + xmlwrappstring& replace(iterator pbegin, iterator pend, size_type n, char c); + template <class In> xmlwrappstring& replace(iterator pbegin, iterator pend, In pbegin2, In pend2); //! @} //! @name Erase sub-strings. //! @{ void clear(); - ustring& erase(size_type i, size_type n=npos); - ustring& erase(); + xmlwrappstring& erase(size_type i, size_type n=npos); + xmlwrappstring& erase(); iterator erase(iterator p); iterator erase(iterator pbegin, iterator pend); @@ -387,10 +383,10 @@ //! @name Compare and collate. //! @{ - int compare(const ustring& rhs) const; + int compare(const xmlwrappstring& rhs) const; int compare(const char* rhs) const; - int compare(size_type i, size_type n, const ustring& rhs) const; - int compare(size_type i, size_type n, const ustring& rhs, size_type i2, size_type n2) const; + int compare(size_type i, size_type n, const xmlwrappstring& rhs) const; + int compare(size_type i, size_type n, const xmlwrappstring& rhs, size_type i2, size_type n2) const; int compare(size_type i, size_type n, const char* rhs, size_type n2) const; int compare(size_type i, size_type n, const char* rhs) const; @@ -399,11 +395,11 @@ * <tt>std::set<></tt>, you should consider creating a collate key first * and compare this key instead of the actual string. * - * The ustring::compare() methods as well as the relational operators + * The xmlwrappstring::compare() methods as well as the relational operators * <tt>== != < > <= >=</tt> are quite costly * because they have to deal with %Unicode and the collation rules defined by * the current locale. Converting both operands to UCS-4 is just the first - * of several costly steps involved when comparing ustrings. So be careful. + * of several costly steps involved when comparing xmlwrappstrings. So be careful. */ std::string collate_key() const; @@ -424,7 +420,7 @@ /*! No reference return; use replace() to write characters. @throw std::out_of_range */ value_type at(size_type i) const; - inline ustring substr(size_type i=0, size_type n=npos) const; + inline xmlwrappstring substr(size_type i=0, size_type n=npos) const; //! @} //! @name Access a sequence of characters. @@ -443,13 +439,13 @@ //! @name Find sub-strings. //! @{ - size_type find(const ustring& str, size_type i=0) const; + size_type find(const xmlwrappstring& str, size_type i=0) const; size_type find(const char* str, size_type i, size_type n) const; size_type find(const char* str, size_type i=0) const; size_type find(gunichar uc, size_type i=0) const; size_type find(char c, size_type i=0) const; - size_type rfind(const ustring& str, size_type i=npos) const; + size_type rfind(const xmlwrappstring& str, size_type i=npos) const; size_type rfind(const char* str, size_type i, size_type n) const; size_type rfind(const char* str, size_type i=npos) const; size_type rfind(gunichar uc, size_type i=npos) const; @@ -459,25 +455,25 @@ //! @name Match against a set of characters. //! @{ - size_type find_first_of(const ustring& match, size_type i=0) const; + size_type find_first_of(const xmlwrappstring& match, size_type i=0) const; size_type find_first_of(const char* match, size_type i, size_type n) const; size_type find_first_of(const char* match, size_type i=0) const; size_type find_first_of(gunichar uc, size_type i=0) const; size_type find_first_of(char c, size_type i=0) const; - size_type find_last_of(const ustring& match, size_type i=npos) const; + size_type find_last_of(const xmlwrappstring& match, size_type i=npos) const; size_type find_last_of(const char* match, size_type i, size_type n) const; size_type find_last_of(const char* match, size_type i=npos) const; size_type find_last_of(gunichar uc, size_type i=npos) const; size_type find_last_of(char c, size_type i=npos) const; - size_type find_first_not_of(const ustring& match, size_type i=0) const; + size_type find_first_not_of(const xmlwrappstring& match, size_type i=0) const; size_type find_first_not_of(const char* match, size_type i, size_type n) const; size_type find_first_not_of(const char* match, size_type i=0) const; size_type find_first_not_of(gunichar uc, size_type i=0) const; size_type find_first_not_of(char c, size_type i=0) const; - size_type find_last_not_of(const ustring& match, size_type i=npos) const; + size_type find_last_not_of(const xmlwrappstring& match, size_type i=npos) const; size_type find_last_not_of(const char* match, size_type i, size_type n) const; size_type find_last_not_of(const char* match, size_type i=npos) const; size_type find_last_not_of(gunichar uc, size_type i=npos) const; @@ -531,7 +527,7 @@ //! @name Get a per-byte representation of the string. //! @{ - inline operator std::string() const; // e.g. std::string str = ustring(); + inline operator std::string() const; // e.g. std::string str = xmlwrappstring(); inline const std::string& raw() const; // Not necessarily an ASCII char*. Use g_utf8_*() where necessary. @@ -555,7 +551,7 @@ bool validate(const_iterator& first_invalid) const; /*! Check whether the string is plain 7-bit ASCII. @par - * Unlike any other ustring method, is_ascii() is safe to use on invalid + * Unlike any other xmlwrappstring method, is_ascii() is safe to use on invalid * UTF-8 strings. If the string isn't valid UTF-8, it cannot be valid * ASCII either, therefore is_ascii() will just return @c false then. * @return Whether the string contains only ASCII characters. @@ -563,7 +559,7 @@ bool is_ascii() const; /*! "Normalize" the %Unicode character representation of the string. */ - ustring normalize(NormalizeMode mode = NORMALIZE_DEFAULT_COMPOSE) const; + xmlwrappstring normalize(NormalizeMode mode = NORMALIZE_DEFAULT_COMPOSE) const; //! @} //! @name Character case conversion. @@ -576,21 +572,21 @@ * <tt>"ß"</tt> will be replaced by two characters * <tt>"SS"</tt> because there is no capital <tt>"ß"</tt>. */ - ustring uppercase() const; + xmlwrappstring uppercase() const; /*! Returns a new UTF-8 string with all characters characters converted to * their lowercase equivalent, while honoring the current locale. The * resulting string may change in the number of bytes as well as in the * number of characters. */ - ustring lowercase() const; + xmlwrappstring lowercase() const; /*! Returns a caseless representation of the UTF-8 string. The resulting * string doesn't correspond to any particular case, therefore the result * is only useful to compare strings and should never be displayed to the * user. */ - ustring casefold() const; + xmlwrappstring casefold() const; //! @} //! @name Message formatting. @@ -601,7 +597,7 @@ */ template <class T1> static inline - ustring compose(const ustring& fmt); + xmlwrappstring compose(const xmlwrappstring& fmt); /*! Substitute placeholders in a format string with the referenced arguments. * The template string should be in <tt>qt-format</tt>, that is @@ -610,91 +606,91 @@ * reordered. * @par Example: * @code - * using Glib::ustring; + * using xmlws::xmlwrappstring; * const int percentage = 50; - * const ustring text = ustring::compose("%1%% done", percentage); + * const xmlwrappstring text = xmlwrappstring::compose("%1%% done", percentage); * @endcode * @param fmt A template string in <tt>qt-format</tt>. * @param a1 The argument to substitute for <tt>"%1"</tt>. * @return The substituted message string. - * @throw Glib::ConvertError + * @throw xmlws::ConvertError * * @newin{2,16} */ template <class T1> static inline - ustring compose(const ustring& fmt, const T1& a1); + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2> static inline - ustring compose(const ustring& fmt, const T1& a1, const T2& a2); + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4, class T5> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4, class T5, class T6> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8); - /* See the documentation for compose(const ustring& fmt, const T1& a1). + /* See the documentation for compose(const xmlwrappstring& fmt, const T1& a1). * @newin{2,16} */ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9> static inline - ustring compose(const ustring& fmt, + xmlwrappstring compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9); @@ -707,9 +703,9 @@ * in conjunction with compose() to facilitate localization of user-visible * messages. * @code - * using Glib::ustring; + * using xmlws::xmlwrappstring; * double value = 22.0 / 7.0; - * ustring text = ustring::format(std::fixed, std::setprecision(2), value); + * xmlwrappstring text = xmlwrappstring::format(std::fixed, std::setprecision(2), value); * @endcode * @note The use of a wide character stream in the implementation of format() * is almost completely transparent. However, one of the instances where the @@ -718,20 +714,20 @@ * must be of type <tt>wchar_t</tt>. This can be achieved by using the * <tt>L</tt> prefix with a character literal, as shown in the example. * @code - * using Glib::ustring; + * using xmlws::xmlwrappstring; * // Insert leading zeroes to fill in at least six digits - * ustring text = ustring::format(std::setfill(L'0'), std::setw(6), 123); + * xmlwrappstring text = xmlwrappstring::format(std::setfill(L'0'), std::setw(6), 123); * @endcode * * @param a1 A streamable value or an I/O manipulator. * @return The string representation of the argument stream. - * @throw Glib::ConvertError + * @throw xmlws::ConvertError * * @newin{2,16} */ template <class T1> static inline - ustring format(const T1& a1); + xmlwrappstring format(const T1& a1); /* See the documentation for format(const T1& a1). * @@ -739,7 +735,7 @@ */ template <class T1, class T2> static inline - ustring format(const T1& a1, const T2& a2); + xmlwrappstring format(const T1& a1, const T2& a2); /* See the documentation for format(const T1& a1). * @@ -747,7 +743,7 @@ */ template <class T1, class T2, class T3> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3); + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3); /* See the documentation for format(const T1& a1). * @@ -755,7 +751,7 @@ */ template <class T1, class T2, class T3, class T4> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4); + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4); /* See the documentation for format(const T1& a1). * @@ -763,7 +759,7 @@ */ template <class T1, class T2, class T3, class T4, class T5> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5); /* See the documentation for format(const T1& a1). @@ -772,7 +768,7 @@ */ template <class T1, class T2, class T3, class T4, class T5, class T6> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6); /* See the documentation for format(const T1& a1). @@ -782,7 +778,7 @@ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7); /* See the documentation for format(const T1& a1). @@ -792,7 +788,7 @@ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> static inline - ustring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, + xmlwrappstring format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8); //! @} @@ -803,7 +799,7 @@ #ifdef GLIBMM_HAVE_STD_ITERATOR_TRAITS template <class In, class ValueType = typename std::iterator_traits<In>::value_type> #else - template <class In, class ValueType = typename Glib::IteratorTraits<In>::value_type> + template <class In, class ValueType = typename xmlws::IteratorTraits<In>::value_type> #endif struct SequenceToString; @@ -815,7 +811,7 @@ template <class T> class Stringify; class FormatStream; - static ustring compose_argv(const ustring& fmt, int argc, const ustring* const* argv); + static xmlwrappstring compose_argv(const xmlwrappstring& fmt, int argc, const xmlwrappstring* const* argv); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ @@ -826,34 +822,34 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS template <class In, class ValueType> -struct ustring::SequenceToString +struct xmlwrappstring::SequenceToString {}; template <class In> -struct ustring::SequenceToString<In, char> : public std::string +struct xmlwrappstring::SequenceToString<In, char> : public std::string { SequenceToString(In pbegin, In pend); }; template <class In> -struct ustring::SequenceToString<In, gunichar> : public std::string +struct xmlwrappstring::SequenceToString<In, gunichar> : public std::string { SequenceToString(In pbegin, In pend); }; template <> -struct ustring::SequenceToString<Glib::ustring::iterator, gunichar> : public std::string +struct xmlwrappstring::SequenceToString<xmlws::xmlwrappstring::iterator, gunichar> : public std::string { - SequenceToString(Glib::ustring::iterator pbegin, Glib::ustring::iterator pend); + SequenceToString(xmlws::xmlwrappstring::iterator pbegin, xmlws::xmlwrappstring::iterator pend); }; template <> -struct ustring::SequenceToString<Glib::ustring::const_iterator, gunichar> : public std::string +struct xmlwrappstring::SequenceToString<xmlws::xmlwrappstring::const_iterator, gunichar> : public std::string { - SequenceToString(Glib::ustring::const_iterator pbegin, Glib::ustring::const_iterator pend); + SequenceToString(xmlws::xmlwrappstring::const_iterator pbegin, xmlws::xmlwrappstring::const_iterator pend); }; -class ustring::FormatStream +class xmlwrappstring::FormatStream { private: #ifdef GLIBMM_HAVE_WIDE_STREAM @@ -864,8 +860,8 @@ StreamType stream_; // noncopyable - FormatStream(const ustring::FormatStream&); - FormatStream& operator=(const ustring::FormatStream&); + FormatStream(const xmlwrappstring::FormatStream&); + FormatStream& operator=(const xmlwrappstring::FormatStream&); public: FormatStream(); @@ -878,37 +874,37 @@ //This overload exists to avoid the templated stream() being called for non-const char*. inline void stream(char* value); - ustring to_string() const; + xmlwrappstring to_string() const; }; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ /** Stream input operator. - * @relates Glib::ustring - * @throw Glib::ConvertError + * @relates xmlws::xmlwrappstring + * @throw xmlws::ConvertError */ -std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string); +std::istream& operator>>(std::istream& is, xmlws::xmlwrappstring& utf8_string); /** Stream output operator. - * @relates Glib::ustring - * @throw Glib::ConvertError + * @relates xmlws::xmlwrappstring + * @throw xmlws::ConvertError */ -std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string); +std::ostream& operator<<(std::ostream& os, const xmlws::xmlwrappstring& utf8_string); #ifdef GLIBMM_HAVE_WIDE_STREAM /** Wide stream input operator. - * @relates Glib::ustring - * @throw Glib::ConvertError + * @relates xmlws::xmlwrappstring + * @throw xmlws::ConvertError */ -std::wistream& operator>>(std::wistream& is, ustring& utf8_string); +std::wistream& operator>>(std::wistream& is, xmlwrappstring& utf8_string); /** Wide stream output operator. - * @relates Glib::ustring - * @throw Glib::ConvertError + * @relates xmlws::xmlwrappstring + * @throw xmlws::ConvertError */ -std::wostream& operator<<(std::wostream& os, const ustring& utf8_string); +std::wostream& operator<<(std::wostream& os, const xmlwrappstring& utf8_string); #endif /* GLIBMM_HAVE_WIDE_STREAM */ @@ -918,64 +914,64 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS -/**** Glib::ustring_Iterator<> *********************************************/ +/**** xmlws::xmlwrappstring_Iterator<> *********************************************/ template <class T> inline -ustring_Iterator<T>::ustring_Iterator(T pos) +xmlwrappstring_Iterator<T>::xmlwrappstring_Iterator(T pos) : pos_ (pos) {} template <class T> inline -T ustring_Iterator<T>::base() const +T xmlwrappstring_Iterator<T>::base() const { return pos_; } template <class T> inline -ustring_Iterator<T>::ustring_Iterator() +xmlwrappstring_Iterator<T>::xmlwrappstring_Iterator() : pos_ () {} template <class T> inline -ustring_Iterator<T>::ustring_Iterator(const ustring_Iterator<std::string::iterator>& other) +xmlwrappstring_Iterator<T>::xmlwrappstring_Iterator(const xmlwrappstring_Iterator<std::string::iterator>& other) : pos_ (other.base()) {} template <class T> inline -typename ustring_Iterator<T>::value_type ustring_Iterator<T>::operator*() const +typename xmlwrappstring_Iterator<T>::value_type xmlwrappstring_Iterator<T>::operator*() const { - return Glib::get_unichar_from_std_iterator(pos_); + return xmlws::get_unichar_from_std_iterator(pos_); } template <class T> inline -ustring_Iterator<T>& ustring_Iterator<T>::operator++() +xmlwrappstring_Iterator<T>& xmlwrappstring_Iterator<T>::operator++() { pos_ += g_utf8_skip[static_cast<unsigned char>(*pos_)]; return *this; } template <class T> inline -const ustring_Iterator<T> ustring_Iterator<T>::operator++(int) +const xmlwrappstring_Iterator<T> xmlwrappstring_Iterator<T>::operator++(int) { - const ustring_Iterator<T> temp (*this); + const xmlwrappstring_Iterator<T> temp (*this); this->operator++(); return temp; } template <class T> inline -ustring_Iterator<T>& ustring_Iterator<T>::operator--() +xmlwrappstring_Iterator<T>& xmlwrappstring_Iterator<T>::operator--() { do --pos_; while((static_cast<unsigned char>(*pos_) & 0xC0u) == 0x80); return *this; } template <class T> inline -const ustring_Iterator<T> ustring_Iterator<T>::operator--(int) +const xmlwrappstring_Iterator<T> xmlwrappstring_Iterator<T>::operator--(int) { - const ustring_Iterator<T> temp (*this); + const xmlwrappstring_Iterator<T> temp (*this); this->operator--(); return temp; } @@ -983,44 +979,44 @@ #endif /* DOXYGEN_SHOULD_SKIP_THIS */ -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator==(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator==(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() == rhs.base()); } -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator!=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator!=(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() != rhs.base()); } -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator<(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator<(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() < rhs.base()); } -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator>(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator>(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() > rhs.base()); } -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator<=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator<=(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() <= rhs.base()); } -/** @relates Glib::ustring_Iterator */ +/** @relates xmlws::xmlwrappstring_Iterator */ inline -bool operator>=(const Glib::ustring::const_iterator& lhs, const Glib::ustring::const_iterator& rhs) +bool operator>=(const xmlws::xmlwrappstring::const_iterator& lhs, const xmlws::xmlwrappstring::const_iterator& rhs) { return (lhs.base() >= rhs.base()); } @@ -1028,16 +1024,16 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS -/**** Glib::ustring::SequenceToString **************************************/ +/**** xmlws::xmlwrappstring::SequenceToString **************************************/ template <class In> -ustring::SequenceToString<In,char>::SequenceToString(In pbegin, In pend) +xmlwrappstring::SequenceToString<In,char>::SequenceToString(In pbegin, In pend) : std::string(pbegin, pend) {} template <class In> -ustring::SequenceToString<In,gunichar>::SequenceToString(In pbegin, In pend) +xmlwrappstring::SequenceToString<In,gunichar>::SequenceToString(In pbegin, In pend) { char utf8_buf[6]; // stores a single UTF-8 character @@ -1048,99 +1044,99 @@ } } -/**** Glib::ustring::FormatStream ******************************************/ +/**** xmlws::xmlwrappstring::FormatStream ******************************************/ template <class T> inline -void ustring::FormatStream::stream(const T& value) +void xmlwrappstring::FormatStream::stream(const T& value) { stream_ << value; } inline -void ustring::FormatStream::stream(const char* value) +void xmlwrappstring::FormatStream::stream(const char* value) { - stream_ << ustring(value); + stream_ << xmlwrappstring(value); } inline -void ustring::FormatStream::stream(char* value) +void xmlwrappstring::FormatStream::stream(char* value) { - stream_ << ustring(value); + stream_ << xmlwrappstring(value); } -/**** Glib::ustring ********************************************************/ +/**** xmlws::xmlwrappstring ********************************************************/ template <class In> -ustring::ustring(In pbegin, In pend) +xmlwrappstring::xmlwrappstring(In pbegin, In pend) : - string_ (Glib::ustring::SequenceToString<In>(pbegin, pend)) + string_ (xmlws::xmlwrappstring::SequenceToString<In>(pbegin, pend)) {} template <class In> -ustring& ustring::assign(In pbegin, In pend) +xmlwrappstring& xmlwrappstring::assign(In pbegin, In pend) { - Glib::ustring::SequenceToString<In> temp_string (pbegin, pend); + xmlws::xmlwrappstring::SequenceToString<In> temp_string (pbegin, pend); string_.swap(temp_string); // constant-time operation return *this; } template <class In> -ustring& ustring::append(In pbegin, In pend) +xmlwrappstring& xmlwrappstring::append(In pbegin, In pend) { - string_.append(Glib::ustring::SequenceToString<In>(pbegin, pend)); + string_.append(xmlws::xmlwrappstring::SequenceToString<In>(pbegin, pend)); return *this; } template <class In> -void ustring::insert(ustring::iterator p, In pbegin, In pend) +void xmlwrappstring::insert(xmlwrappstring::iterator p, In pbegin, In pend) { - string_.insert(p.base(), Glib::ustring::SequenceToString<In>(pbegin, pend)); + string_.insert(p.base(), xmlws::xmlwrappstring::SequenceToString<In>(pbegin, pend)); } template <class In> -ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, In pbegin2, In pend2) +xmlwrappstring& xmlwrappstring::replace(xmlwrappstring::iterator pbegin, xmlwrappstring::iterator pend, In pbegin2, In pend2) { string_.replace( pbegin.base(), pend.base(), - Glib::ustring::SequenceToString<In>(pbegin2, pend2)); + xmlws::xmlwrappstring::SequenceToString<In>(pbegin2, pend2)); return *this; } -// The ustring methods substr() and operator std::string() are inline, +// The xmlwrappstring methods substr() and operator std::string() are inline, // so that the compiler has a fair chance to optimize the copy ctor away. inline -ustring ustring::substr(ustring::size_type i, ustring::size_type n) const +xmlwrappstring xmlwrappstring::substr(xmlwrappstring::size_type i, xmlwrappstring::size_type n) const { - return ustring(*this, i, n); + return xmlwrappstring(*this, i, n); } inline -ustring::operator std::string() const +xmlwrappstring::operator std::string() const { return string_; } inline -const std::string& ustring::raw() const +const std::string& xmlwrappstring::raw() const { return string_; } template <class T1> inline // static -ustring ustring::format(const T1& a1) +xmlwrappstring xmlwrappstring::format(const T1& a1) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); return buf.to_string(); } template <class T1, class T2> inline // static -ustring ustring::format(const T1& a1, const T2& a2) +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); return buf.to_string(); @@ -1148,9 +1144,9 @@ template <class T1, class T2, class T3> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3) +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1159,9 +1155,9 @@ template <class T1, class T2, class T3, class T4> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4) +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1171,10 +1167,10 @@ template <class T1, class T2, class T3, class T4, class T5> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1185,10 +1181,10 @@ template <class T1, class T2, class T3, class T4, class T5, class T6> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1201,10 +1197,10 @@ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1218,10 +1214,10 @@ template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> inline // static -ustring ustring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, +xmlwrappstring xmlwrappstring::format(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8) { - ustring::FormatStream buf; + xmlwrappstring::FormatStream buf; buf.stream(a1); buf.stream(a2); buf.stream(a3); @@ -1233,382 +1229,382 @@ return buf.to_string(); } -/** An inner class used by ustring. +/** An inner class used by xmlwrappstring. */ template <class T> -class ustring::Stringify +class xmlwrappstring::Stringify { private: - ustring string_; + xmlwrappstring string_; // noncopyable - Stringify(const ustring::Stringify<T>&); - Stringify<T>& operator=(const ustring::Stringify<T>&); + Stringify(const xmlwrappstring::Stringify<T>&); + Stringify<T>& operator=(const xmlwrappstring::Stringify<T>&); public: - explicit inline Stringify(const T& arg) : string_ (ustring::format(arg)) {} + explicit inline Stringify(const T& arg) : string_ (xmlwrappstring::format(arg)) {} //TODO: Why is this here? See the template specialization: explicit inline Stringify(const char* arg) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } + inline const xmlwrappstring* ptr() const { return &string_; } }; -/// A template specialization for Stringify<ustring>: +/// A template specialization for Stringify<xmlwrappstring>: template <> -class ustring::Stringify<ustring> +class xmlwrappstring::Stringify<xmlwrappstring> { private: - const ustring& string_; + const xmlwrappstring& string_; // noncopyable - Stringify(const ustring::Stringify<ustring>&); - Stringify<ustring>& operator=(const ustring::Stringify<ustring>&); + Stringify(const xmlwrappstring::Stringify<xmlwrappstring>&); + Stringify<xmlwrappstring>& operator=(const xmlwrappstring::Stringify<xmlwrappstring>&); public: - explicit inline Stringify(const ustring& arg) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } + explicit inline Stringify(const xmlwrappstring& arg) : string_(arg) {} + inline const xmlwrappstring* ptr() const { return &string_; } }; /** A template specialization for Stringify<const char*>, * because the regular template has ambiguous constructor overloads for char*. */ template <> -class ustring::Stringify<const char*> +class xmlwrappstring::Stringify<const char*> { private: - const ustring string_; + const xmlwrappstring string_; // noncopyable - Stringify(const ustring::Stringify<const char*>&); - Stringify<ustring>& operator=(const ustring::Stringify<const char*>&); + Stringify(const xmlwrappstring::Stringify<const char*>&); + Stringify<xmlwrappstring>& operator=(const xmlwrappstring::Stringify<const char*>&); public: explicit inline Stringify(const char* arg) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } + inline const xmlwrappstring* ptr() const { return &string_; } }; /** A template specialization for Stringify<char[N]> (for string literals), * because the regular template has ambiguous constructor overloads for char*. */ template <std::size_t N> -class ustring::Stringify<char[N]> +class xmlwrappstring::Stringify<char[N]> { private: - const ustring string_; + const xmlwrappstring string_; // noncopyable - Stringify(const ustring::Stringify<char[N]>&); - Stringify<ustring>& operator=(const ustring::Stringify<char[N]>&); + Stringify(const xmlwrappstring::Stringify<char[N]>&); + Stringify<xmlwrappstring>& operator=(const xmlwrappstring::Stringify<char[N]>&); public: explicit inline Stringify(const char arg[N]) : string_(arg) {} - inline const ustring* ptr() const { return &string_; } + inline const xmlwrappstring* ptr() const { return &string_; } }; template <class T1> inline // static -ustring ustring::compose(const ustring& fmt) +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt) { - return ustring::compose_argv(fmt, 0, 0); + return xmlwrappstring::compose_argv(fmt, 0, 0); } template <class T1> inline // static -ustring ustring::compose(const ustring& fmt, const T1& a1) +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1) { - const ustring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T1> s1(a1); - const ustring *const argv[] = { s1.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + const xmlwrappstring *const argv[] = { s1.ptr() }; + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2> inline // static -ustring ustring::compose(const ustring& fmt, const T1& a1, const T2& a2) +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); - const ustring *const argv[] = { s1.ptr(), s2.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr() }; + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr() }; + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr() }; + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4, class T5> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); + const xmlwrappstring::Stringify<T5> s5(a5); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr() }; + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4, class T5, class T6> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); + const xmlwrappstring::Stringify<T5> s5(a5); + const xmlwrappstring::Stringify<T6> s6(a6); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr(), s6.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4, class T5, class T6, class T7> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); + const xmlwrappstring::Stringify<T5> s5(a5); + const xmlwrappstring::Stringify<T6> s6(a6); + const xmlwrappstring::Stringify<T7> s7(a7); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr(), s6.ptr(), s7.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); - const ustring::Stringify<T8> s8(a8); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); + const xmlwrappstring::Stringify<T5> s5(a5); + const xmlwrappstring::Stringify<T6> s6(a6); + const xmlwrappstring::Stringify<T7> s7(a7); + const xmlwrappstring::Stringify<T8> s8(a8); - const ustring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), + const xmlwrappstring *const argv[] = { s1.ptr(), s2.ptr(), s3.ptr(), s4.ptr(), s5.ptr(), s6.ptr(), s7.ptr(), s8.ptr() }; - return ustring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); + return xmlwrappstring::compose_argv(fmt, G_N_ELEMENTS(argv), argv); } template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9> inline // static -ustring ustring::compose(const ustring& fmt, +xmlwrappstring xmlwrappstring::compose(const xmlwrappstring& fmt, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9) { - const ustring::Stringify<T1> s1(a1); - const ustring::Stringify<T2> s2(a2); - const ustring::Stringify<T3> s3(a3); - const ustring::Stringify<T4> s4(a4); - const ustring::Stringify<T5> s5(a5); - const ustring::Stringify<T6> s6(a6); - const ustring::Stringify<T7> s7(a7); - const ustring::Stringify<T8> s8(a8); - const ustring::Stringify<T9> s9(a9); + const xmlwrappstring::Stringify<T1> s1(a1); + const xmlwrappstring::Stringify<T2> s2(a2); + const xmlwrappstring::Stringify<T3> s3(a3); + const xmlwrappstring::Stringify<T4> s4(a4); + ... [truncated message content] |
From: <vac...@us...> - 2008-12-01 19:41:08
|
Revision: 105 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=105&view=rev Author: vaclavslavik Date: 2008-12-01 19:40:58 +0000 (Mon, 01 Dec 2008) Log Message: ----------- Input document to xslt::stylesheet::apply() is now passed as const reference instead of non-const one. Modified Paths: -------------- trunk/ChangeLog trunk/docs/manual/xslt.texi trunk/docs/manual_xml/xslt.xml trunk/include/xmlwrapp/document.h trunk/include/xsltwrapp/stylesheet.h trunk/src/Makefile.am trunk/src/libxml/document.cxx trunk/src/libxslt/stylesheet.cxx Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/ChangeLog 2008-12-01 19:40:58 UTC (rev 105) @@ -9,6 +9,9 @@ xsltwrapp.pc. Applications that use libxsltwrapp need to be updated to use the latter (too). + Input document to xslt::stylesheet::apply() is now passed as + const reference instead of non-const one. + Version 0.5.1 Various compilation fixes. Modified: trunk/docs/manual/xslt.texi =================================================================== --- trunk/docs/manual/xslt.texi 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/docs/manual/xslt.texi 2008-12-01 19:40:58 UTC (rev 105) @@ -60,8 +60,8 @@ @example -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result); -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result, const param_type &with_params); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result, const param_type &with_params); @end example @@ -81,8 +81,8 @@ @example -xml::document& xslt::stylesheet::apply (xml::document &doc); -xml::document& xslt::stylesheet::apply (xml::document &doc, const param_type &with_params); +xml::document& xslt::stylesheet::apply (const xml::document &doc); +xml::document& xslt::stylesheet::apply (const xml::document &doc, const param_type &with_params); @end example Modified: trunk/docs/manual_xml/xslt.xml =================================================================== --- trunk/docs/manual_xml/xslt.xml 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/docs/manual_xml/xslt.xml 2008-12-01 19:40:58 UTC (rev 105) @@ -66,8 +66,8 @@ <screen> <![CDATA[ -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result); -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result, const param_type &with_params); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result, const param_type &with_params); ]]> </screen> </section> @@ -87,8 +87,8 @@ </para> <screen> <![CDATA[ -xml::document& xslt::stylesheet::apply (xml::document &doc); -xml::document& xslt::stylesheet::apply (xml::document &doc, const param_type &with_params); +xml::document& xslt::stylesheet::apply (const xml::document &doc); +xml::document& xslt::stylesheet::apply (const xml::document &doc, const param_type &with_params); ]]> </screen> </section> Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/include/xmlwrapp/document.h 2008-12-01 19:40:58 UTC (rev 105) @@ -537,6 +537,7 @@ void set_doc_data (void *data); void set_doc_data_from_xslt (void *data, xslt::result *xr); void* get_doc_data (void); + void* get_doc_data_read_only (void) const; void* release_doc_data (void); friend class tree_parser; Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/include/xsltwrapp/stylesheet.h 2008-12-01 19:40:58 UTC (rev 105) @@ -101,7 +101,7 @@ * @author Peter Jones **/ //#################################################################### - bool apply (xml::document &doc, xml::document &result); + bool apply (const xml::document &doc, xml::document &result); //#################################################################### /** @@ -116,7 +116,7 @@ * @author Peter Jones **/ //#################################################################### - bool apply (xml::document &doc, xml::document &result, const param_type &with_params); + bool apply (const xml::document &doc, xml::document &result, const param_type &with_params); //#################################################################### /** @@ -133,7 +133,7 @@ * @author Peter Jones **/ //#################################################################### - xml::document& apply (xml::document &doc); + xml::document& apply (const xml::document &doc); //#################################################################### /** @@ -151,7 +151,7 @@ * @author Peter Jones **/ //#################################################################### - xml::document& apply (xml::document &doc, const param_type &with_params); + xml::document& apply (const xml::document &doc, const param_type &with_params); //#################################################################### /** Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/src/Makefile.am 2008-12-01 19:40:58 UTC (rev 105) @@ -34,7 +34,7 @@ libxsltwrapp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBEXSLT_CFLAGS) $(LIBXSLT_CFLAGS) libxsltwrapp_la_LIBADD = libxmlwrapp.la $(LIBEXSLT_LIBS) $(LIBXSLT_LIBS) -libxsltwrapp_la_LDFLAGS = -version-info 2:1:0 +libxsltwrapp_la_LDFLAGS = -version-info 3:0:0 libxsltwrapp_la_SOURCES = \ libxslt/init.cxx \ Modified: trunk/src/libxml/document.cxx =================================================================== --- trunk/src/libxml/document.cxx 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/src/libxml/document.cxx 2008-12-01 19:40:58 UTC (rev 105) @@ -340,6 +340,10 @@ return pimpl_->doc_; } //#################################################################### +void* xml::document::get_doc_data_read_only (void) const { + return pimpl_->doc_; +} +//#################################################################### void* xml::document::release_doc_data (void) { xmlDocPtr xmldoc = pimpl_->doc_; pimpl_->doc_ = 0; Modified: trunk/src/libxslt/stylesheet.cxx =================================================================== --- trunk/src/libxslt/stylesheet.cxx 2008-11-30 22:22:06 UTC (rev 104) +++ trunk/src/libxslt/stylesheet.cxx 2008-12-01 19:40:58 UTC (rev 105) @@ -148,8 +148,8 @@ delete pimpl_; } //#################################################################### -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result) { - xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data()); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result) { + xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only()); xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input); if (xmldoc) { @@ -160,8 +160,8 @@ return false; } //#################################################################### -bool xslt::stylesheet::apply (xml::document &doc, xml::document &result, const param_type &with_params) { - xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data()); +bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result, const param_type &with_params) { + xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only()); xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params); if (xmldoc) { @@ -172,8 +172,8 @@ return false; } //#################################################################### -xml::document& xslt::stylesheet::apply (xml::document &doc) { - xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data()); +xml::document& xslt::stylesheet::apply (const xml::document &doc) { + xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only()); xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input); if (xmldoc == 0) { @@ -185,8 +185,8 @@ return pimpl_->doc_; } //#################################################################### -xml::document& xslt::stylesheet::apply (xml::document &doc, const param_type &with_params) { - xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data()); +xml::document& xslt::stylesheet::apply (const xml::document &doc, const param_type &with_params) { + xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only()); xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params); if (xmldoc == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2008-12-13 13:39:58
|
Revision: 107 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=107&view=rev Author: vaclavslavik Date: 2008-12-13 13:39:53 +0000 (Sat, 13 Dec 2008) Log Message: ----------- removed the need for explicit use of xml/xslt::init: use nifty counters technique to do the initialization at app startup time Modified Paths: -------------- trunk/ChangeLog trunk/examples/01-tree_parsing/example.cxx trunk/examples/02-event_parsing/example.cxx trunk/examples/03-xml_generation/example.cxx trunk/examples/04-xslt/example.cxx trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xmlwrapp/xmlwrapp.h trunk/include/xsltwrapp/init.h trunk/include/xsltwrapp/stylesheet.h trunk/include/xsltwrapp/xsltwrapp.h trunk/src/libxml/init.cxx trunk/src/libxslt/init.cxx trunk/tests/attributes/test_attr-01.cxx trunk/tests/attributes/test_attr-02.cxx trunk/tests/attributes/test_attr-03.cxx trunk/tests/attributes/test_attr-04.cxx trunk/tests/attributes/test_attr-05.cxx trunk/tests/attributes/test_attr-06.cxx trunk/tests/attributes/test_attr-07.cxx trunk/tests/attributes/test_attr-08.cxx trunk/tests/attributes/test_attr-09.cxx trunk/tests/attributes/test_attr-10.cxx trunk/tests/document/test_document-01.cxx trunk/tests/document/test_document-02.cxx trunk/tests/document/test_document-03.cxx trunk/tests/document/test_document-04.cxx trunk/tests/document/test_document-05.cxx trunk/tests/document/test_document-06.cxx trunk/tests/document/test_document-07.cxx trunk/tests/document/test_document-08.cxx trunk/tests/document/test_document-09.cxx trunk/tests/document/test_document-10.cxx trunk/tests/document/test_document-11.cxx trunk/tests/document/test_document-12.cxx trunk/tests/document/test_document-13.cxx trunk/tests/document/test_document-14.cxx trunk/tests/document/test_document-15.cxx trunk/tests/document/test_document-16.cxx trunk/tests/document/test_document-17.cxx trunk/tests/document/test_document-18.cxx trunk/tests/document/test_document-19.cxx trunk/tests/document/test_document-20.cxx trunk/tests/document/test_document-21.cxx trunk/tests/document/test_document-22.cxx trunk/tests/event/test_event-01.cxx trunk/tests/event/test_event-02.cxx trunk/tests/event/test_event-03.cxx trunk/tests/node/test_node-01.cxx trunk/tests/node/test_node-02a.cxx trunk/tests/node/test_node-02b.cxx trunk/tests/node/test_node-02c.cxx trunk/tests/node/test_node-02d.cxx trunk/tests/node/test_node-03a.cxx trunk/tests/node/test_node-03b.cxx trunk/tests/node/test_node-04a.cxx trunk/tests/node/test_node-04b.cxx trunk/tests/node/test_node-05a.cxx trunk/tests/node/test_node-05b.cxx trunk/tests/node/test_node-05c.cxx trunk/tests/node/test_node-05d.cxx trunk/tests/node/test_node-06.cxx trunk/tests/node/test_node-07.cxx trunk/tests/node/test_node-08.cxx trunk/tests/node/test_node-09.cxx trunk/tests/node/test_node-10.cxx trunk/tests/node/test_node-11.cxx trunk/tests/node/test_node-12.cxx trunk/tests/node/test_node-13.cxx trunk/tests/tree/test_tree-01.cxx trunk/tests/tree/test_tree-02.cxx trunk/tests/tree/test_tree-03.cxx trunk/tests/tree/test_tree-04.cxx trunk/tests/tree/test_tree-05.cxx trunk/tests/tree/test_tree-06.cxx trunk/tests/xslt/test_xslt-01.cxx trunk/tests/xslt/test_xslt-02.cxx trunk/tests/xslt/test_xslt-03.cxx trunk/tests/xslt/test_xslt-04.cxx trunk/tests/xslt/test_xslt-05.cxx Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/ChangeLog 2008-12-13 13:39:53 UTC (rev 107) @@ -12,6 +12,14 @@ Input document to xslt::stylesheet::apply() is now passed as const reference instead of non-const one. + It is no longer necessary to instantiate xml/xslt::init object before + using the library; this is now done automatically (thread safety is + preserved) and new code shouldn't do it. Moreover, creating multiple + xml/xslt::init object instances is now possible and doesn't result in + multiple initialization/shutdown of the library. + + Configuration methods of xml/xslt::init classes are now static. + Version 0.5.1 Various compilation fixes. Modified: trunk/examples/01-tree_parsing/example.cxx =================================================================== --- trunk/examples/01-tree_parsing/example.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/examples/01-tree_parsing/example.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -51,7 +51,6 @@ try { - xml::init init; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/examples/02-event_parsing/example.cxx =================================================================== --- trunk/examples/02-event_parsing/example.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/examples/02-event_parsing/example.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -74,7 +74,6 @@ return 1; } - xml::init init; myparser parser; if (!parser.parse_file(argv[1])) { Modified: trunk/examples/03-xml_generation/example.cxx =================================================================== --- trunk/examples/03-xml_generation/example.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/examples/03-xml_generation/example.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -53,9 +53,6 @@ #include <exception> int main (void) { - // prepare the XML parser - xml::init init; - // create a new XML document and set the root node xml::document xmldoc("abook"); xml::node &root = xmldoc.get_root_node(); Modified: trunk/examples/04-xslt/example.cxx =================================================================== --- trunk/examples/04-xslt/example.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/examples/04-xslt/example.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -44,9 +44,6 @@ int main (void) { try { - // prepare the XSLT engine and XML parser - xslt::init init; - // parse the input XML document xml::tree_parser parser("example.xml"); xml::document &doc = parser.get_document(); Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/attributes.h 2008-12-13 13:39:53 UTC (rev 107) @@ -37,6 +37,9 @@ #ifndef _xmlwrapp_attributes_h_ #define _xmlwrapp_attributes_h_ +// xmlwrapp includes +#include "xmlwrapp/init.h" + // standard includes #include <cstddef> #include <iosfwd> Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/document.h 2008-12-13 13:39:53 UTC (rev 107) @@ -38,7 +38,8 @@ #define _xmlwrapp_document_h_ // xmlwrapp includes -#include <xmlwrapp/node.h> +#include "xmlwrapp/init.h" +#include "xmlwrapp/node.h" // standard includes #include <iosfwd> Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/event_parser.h 2008-12-13 13:39:53 UTC (rev 107) @@ -37,6 +37,9 @@ #ifndef _xmlwrapp_event_parser_h_ #define _xmlwrapp_event_parser_h_ +// xmlwrapp includes +#include "xmlwrapp/init.h" + // standard includes #include <cstddef> #include <string> Modified: trunk/include/xmlwrapp/init.h =================================================================== --- trunk/include/xmlwrapp/init.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/init.h 2008-12-13 13:39:53 UTC (rev 107) @@ -40,107 +40,100 @@ namespace xml { /** - * The xml::init class is used to initialize the XML parser. For thread - * safety it should be instantiated one time in the main thread before any - * other threads use xmlwrapp. Non-threaded programs should instantiate a - * xml::init class before using xmlwrapp as well, at least for - * consistency. + * The xml::init class is used to configure the XML parser. * * If you want to use and of the xml::init member functions, do so before * you start any threads or use any other part of xmlwrapp. The member - * functions may alter global and/or static variables. In other words, this - * class is not thread safe. + * functions may alter global and/or static variables and affect the behavior + * of subsequently created classes (and the parser in particular). + * In other words, this class is not thread safe. + * + * @note In xmlwrapp versions prior to 0.6.0, this class was used to initialize + * the library and exactly one instance had to be created before first + * use. This is no longer true: user code doesn't have to create any + * instances, but it @em can create as many instances as it wants. **/ class init { public: - //#################################################################### - /** - * Create a new xml::init object. This constructor will prepare the XML - * parser and set some default values for the parsers global variables. - * - * @author Peter Jones - **/ - //#################################################################### init (void); - - //#################################################################### - /** - * Clean up the XML parser. Don't let the xml::init object go out of - * scope before you are done using the xmlwrapp library! - * - * @note The destructor is intentionally not virtual, this class and - * derived classes are meant to be used in RAII manner. - * - * @author Peter Jones - **/ - //#################################################################### ~init (void); //#################################################################### /** * This member function controls whether or not the XML parser should * add text nodes for indenting when generating XML text output from a - * node tree. The default, set in the xml::init constructor, is true. + * node tree. The default is true. * * @param flag True to turn on indenting, false to turn it off. * @author Peter Jones **/ //#################################################################### - void indent_output (bool flag); + static void indent_output (bool flag); //#################################################################### /** * This member function controls whether or not the XML parser should - * remove ignorable whitespace around XML elements. The default, set in - * the xml::init constructor, is false. + * remove ignorable whitespace around XML elements. The default + * is false. * * @param flag True to remove whitespace, false to leave alone. * @author Peter Jones **/ //#################################################################### - void remove_whitespace (bool flag); + static void remove_whitespace (bool flag); //#################################################################### /** * This member function controls whether or not the XML parser should - * substitute entities while parsing. The default, set in the xml::init - * constructor, is true. + * substitute entities while parsing. The default is true. * * @param flag True to turn on substitution, false to turn off. * @author Peter Jones **/ //#################################################################### - void substitute_entities (bool flag); + static void substitute_entities (bool flag); //#################################################################### /** * This member function controls whether or not the XML parser should * load external (DTD) subsets while parsing. This will only affect the * loading of the subsets, it does not cause files to be validated. The - * default, set in the xml::init constructor, is true. + * default is true. * * @param flag True to turn on loading, false to turn it off. * @author Peter Jones **/ //#################################################################### - void load_external_subsets (bool flag); + static void load_external_subsets (bool flag); //#################################################################### /** * This member function controls whether or not the XML parser should - * validate every XML document that is parses with its DTD. The default, - * set in the xml::init constructor, is false. + * validate every XML document that is parses with its DTD. The default + * is false. * * @return flag True to turn on validation, false to turn it off. * @author Peter Jones **/ //#################################################################### - void validate_xml (bool flag); + static void validate_xml (bool flag); private: init (const init&); init& operator= (const init&); + + void init_library(); + void shutdown_library(); + + static int ms_counter; }; // end xml::init class - + } // end xml namespace + +// use a "nifty counter" to ensure that any source file that uses xmlwrapp +// will initialize the library prior to its first use +namespace { + xml::init g_xmlwrapp_initializer; +} + #endif Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/node.h 2008-12-13 13:39:53 UTC (rev 107) @@ -37,8 +37,11 @@ #ifndef _xmlwrapp_node_h_ #define _xmlwrapp_node_h_ +// xmlwrapp includes +#include "xmlwrapp/init.h" + // hidden stuff -#include <xmlwrapp/_cbfo.h> +#include "xmlwrapp/_cbfo.h" // standard includes #include <cstddef> Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/tree_parser.h 2008-12-13 13:39:53 UTC (rev 107) @@ -37,6 +37,9 @@ #ifndef _xmlwrapp_tree_parser_h_ #define _xmlwrapp_tree_parser_h_ +// xmlwrapp includes +#include "xmlwrapp/init.h" + // standard includes #include <cstddef> #include <string> Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xmlwrapp/xmlwrapp.h 2008-12-13 13:39:53 UTC (rev 107) @@ -33,11 +33,11 @@ #ifndef _xmlwrapp_xmlwrapp_h_ #define _xmlwrapp_xmlwrapp_h_ -#include <xmlwrapp/init.h> -#include <xmlwrapp/node.h> -#include <xmlwrapp/attributes.h> -#include <xmlwrapp/document.h> -#include <xmlwrapp/tree_parser.h> -#include <xmlwrapp/event_parser.h> +#include "xmlwrapp/init.h" +#include "xmlwrapp/node.h" +#include "xmlwrapp/attributes.h" +#include "xmlwrapp/document.h" +#include "xmlwrapp/tree_parser.h" +#include "xmlwrapp/event_parser.h" #endif Modified: trunk/include/xsltwrapp/init.h =================================================================== --- trunk/include/xsltwrapp/init.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xsltwrapp/init.h 2008-12-13 13:39:53 UTC (rev 107) @@ -38,68 +38,55 @@ #define _xsltwrapp_init_h_ // xmlwrapp includes -#include <xmlwrapp/init.h> +#include "xmlwrapp/init.h" namespace xslt { /** - * The xslt::init class is used to initialize the XSLT engine. For thread - * safety it should be instantiated one time in the main thread before any - * other threads use xsltwrapp. Non-threaded programs should instantiate a - * xslt::init class before using xsltwrapp as well, at least for - * consistency. + * The xslt::init class is used to configure the XSLT engine. * * If you want to use any of the xslt::init member functions, do so before * you start any threads or use any other part of xsltwrapp. The member * functions may alter global and/or static variables. In other words, this * class is not thread safe. * - * Since this class is derived from the xml::init it is not necessary to - * use both classes. If you are going to be using xsltwrapp, you should only - * use this class to initialize both xmlwrapp and xsltwrapp. + * @note In xmlwrapp versions prior to 0.6.0, this class was used to initialize + * the library and exactly one instance had to be created before first + * use. This is no longer true: user code doesn't have to create any + * instances, but it @em can create as many instances as it wants. **/ class init : public xml::init { public: - //#################################################################### - /** - * Create a new xslt::init object. This constructor will prepare the - * XSLT engine parser and set some default values for the engine's - * global variables. - * - * @author Peter Jones - **/ - //#################################################################### init (void); - - //#################################################################### - /** - * Clean up the XSLT engine. Don't let the xslt::init object go out of - * scope before you are done using the xsltwrapp or xmlwrapp libraries! - * - * @note The destructor is intentionally not virtual, this class and - * derived classes are meant to be used in RAII manner. - * - * @author Peter Jones - **/ - //#################################################################### ~init (void); //#################################################################### /** * This function controls whether or not the XSLT engine will process - * XInclusions by default while parsing the stylesheet. The default, set - * in the xslt::init constructor, is true. + * XInclusions by default while parsing the stylesheet. The default is + * true. * * @param flag True to enable XInclusing processing; False otherwise. * @author Peter Jones **/ //#################################################################### - void process_xincludes (bool flag); + static void process_xincludes (bool flag); private: init (const init&); init& operator= (const init&); + + void init_library(); + void shutdown_library(); + + static int ms_counter; }; // end xslt::init class - + +// use a "nifty counter" to ensure that any source file that uses xsltwrapp +// will initialize the library prior to its first use +namespace { + xslt::init g_xsltwrapp_initializer; +} + } // end xslt namespace #endif Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xsltwrapp/stylesheet.h 2008-12-13 13:39:53 UTC (rev 107) @@ -38,7 +38,8 @@ #define _xsltwrapp_stylesheet_h_ // xmlwrapp includes -#include <xmlwrapp/document.h> +#include "xsltwrapp/init.h" +#include "xmlwrapp/document.h" // standard includes #include <map> Modified: trunk/include/xsltwrapp/xsltwrapp.h =================================================================== --- trunk/include/xsltwrapp/xsltwrapp.h 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/include/xsltwrapp/xsltwrapp.h 2008-12-13 13:39:53 UTC (rev 107) @@ -33,8 +33,8 @@ #ifndef _xsltwrapp_xsltwrapp_h_ #define _xsltwrapp_xsltwrapp_h_ -#include <xmlwrapp/xmlwrapp.h> -#include <xsltwrapp/init.h> -#include <xsltwrapp/stylesheet.h> +#include "xmlwrapp/xmlwrapp.h" +#include "xsltwrapp/init.h" +#include "xsltwrapp/stylesheet.h" #endif Modified: trunk/src/libxml/init.cxx =================================================================== --- trunk/src/libxml/init.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/src/libxml/init.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,19 @@ extern "C" void xml_error (void *, const char*, ...); } //#################################################################### +int xml::init::ms_counter = 0; +//#################################################################### xml::init::init (void) { + if ( ms_counter++ == 0 ) + init_library(); +} +//#################################################################### +xml::init::~init (void) { + if ( --ms_counter == 0 ) + shutdown_library(); +} +//#################################################################### +void xml::init::init_library() { // set some libxml global variables indent_output(true); remove_whitespace(false); @@ -62,7 +74,7 @@ xmlInitParser(); } //#################################################################### -xml::init::~init (void) { +void xml::init::shutdown_library() { xmlCleanupParser(); } //#################################################################### Modified: trunk/src/libxslt/init.cxx =================================================================== --- trunk/src/libxslt/init.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/src/libxslt/init.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -49,7 +49,19 @@ extern "C" void xslt_error (void *, const char*, ...); } //#################################################################### +int xslt::init::ms_counter = 0; +//#################################################################### xslt::init::init (void) { + if ( ms_counter++ == 0 ) + init_library(); +} +//#################################################################### +xslt::init::~init (void) { + if ( --ms_counter == 0 ) + shutdown_library(); +} +//#################################################################### +void xslt::init::init_library() { xsltInit(); // set some defautls @@ -63,7 +75,7 @@ exsltRegisterAll(); } //#################################################################### -xslt::init::~init (void) { +void xslt::init::shutdown_library() { xsltCleanupGlobals(); } //#################################################################### Modified: trunk/tests/attributes/test_attr-01.cxx =================================================================== --- trunk/tests/attributes/test_attr-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,7 +42,6 @@ if (argc != 2) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-02.cxx =================================================================== --- trunk/tests/attributes/test_attr-02.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-02.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 2) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-03.cxx =================================================================== --- trunk/tests/attributes/test_attr-03.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-03.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 3) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-04.cxx =================================================================== --- trunk/tests/attributes/test_attr-04.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-04.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 3) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-05.cxx =================================================================== --- trunk/tests/attributes/test_attr-05.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-05.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 3) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-06.cxx =================================================================== --- trunk/tests/attributes/test_attr-06.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-06.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 2) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-07.cxx =================================================================== --- trunk/tests/attributes/test_attr-07.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-07.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 2) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); Modified: trunk/tests/attributes/test_attr-08.cxx =================================================================== --- trunk/tests/attributes/test_attr-08.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-08.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 2) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); /* MAKE A COPY! */ Modified: trunk/tests/attributes/test_attr-09.cxx =================================================================== --- trunk/tests/attributes/test_attr-09.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-09.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ if (argc != 3) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) { Modified: trunk/tests/attributes/test_attr-10.cxx =================================================================== --- trunk/tests/attributes/test_attr-10.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/attributes/test_attr-10.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,7 +42,6 @@ if (argc != 3) return 1; try { - xml::init xml; xml::tree_parser parser(argv[1]); if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) { Modified: trunk/tests/document/test_document-01.cxx =================================================================== --- trunk/tests/document/test_document-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,7 @@ } try { - xml::init xml; xml.substitute_entities(false); + xml::init::substitute_entities(false); xml::tree_parser parser(argv[1]); xml::node::iterator i=parser.get_document().begin(), end=parser.get_document().end(); Modified: trunk/tests/document/test_document-02.cxx =================================================================== --- trunk/tests/document/test_document-02.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-02.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ int main (void) { try { - xml::init xml; xml::document doc; std::cout << doc; Modified: trunk/tests/document/test_document-03.cxx =================================================================== --- trunk/tests/document/test_document-03.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-03.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,7 +42,6 @@ int main (void) { try { - xml::init xml; xml::document doc("root"); std::cout << doc; Modified: trunk/tests/document/test_document-04.cxx =================================================================== --- trunk/tests/document/test_document-04.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-04.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ int main (void) { try { - xml::init xml; xml::node n("root", "pcdata"); xml::document doc(n); std::cout << doc; Modified: trunk/tests/document/test_document-05.cxx =================================================================== --- trunk/tests/document/test_document-05.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-05.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ int main (void) { try { - xml::init xml; xml::node n("root", "pcdata"); xml::document doc(n); Modified: trunk/tests/document/test_document-06.cxx =================================================================== --- trunk/tests/document/test_document-06.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-06.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ int main (void) { try { - xml::init xml; xml::node n("root", "pcdata"); xml::document doc(n); xml::document doc_copy; Modified: trunk/tests/document/test_document-07.cxx =================================================================== --- trunk/tests/document/test_document-07.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-07.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,7 +41,6 @@ int main (void) { try { - xml::init xml; xml::node n("root", "pcdata"); xml::document doc(n); std::cout << doc.get_root_node(); Modified: trunk/tests/document/test_document-08.cxx =================================================================== --- trunk/tests/document/test_document-08.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-08.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -41,8 +41,6 @@ int main (void) { try { - xml::init xml; - xml::node n("root", "pcdata"); xml::document doc; Modified: trunk/tests/document/test_document-09.cxx =================================================================== --- trunk/tests/document/test_document-09.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-09.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); std::cout << parser.get_document().get_version() << "\n"; Modified: trunk/tests/document/test_document-10.cxx =================================================================== --- trunk/tests/document/test_document-10.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-10.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); parser.get_document().set_version("1.1"); std::cout << parser.get_document(); Modified: trunk/tests/document/test_document-11.cxx =================================================================== --- trunk/tests/document/test_document-11.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-11.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); std::cout << parser.get_document().get_encoding() << "\n"; Modified: trunk/tests/document/test_document-12.cxx =================================================================== --- trunk/tests/document/test_document-12.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-12.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); parser.get_document().set_encoding("UTF-8"); std::cout << parser.get_document(); Modified: trunk/tests/document/test_document-13.cxx =================================================================== --- trunk/tests/document/test_document-13.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-13.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -44,7 +44,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); bool sa = parser.get_document().get_is_standalone(); Modified: trunk/tests/document/test_document-14.cxx =================================================================== --- trunk/tests/document/test_document-14.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-14.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); std::cout << parser.get_document().process_xinclude() << "\n"; std::cout << parser.get_document(); Modified: trunk/tests/document/test_document-15.cxx =================================================================== --- trunk/tests/document/test_document-15.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-15.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -44,8 +44,6 @@ try { - xml::init xml; - xml::document doc("root"); doc.get_root_node().push_back(xml::node("child")); doc.save_to_file(argv[1], std::atoi(argv[2])); Modified: trunk/tests/document/test_document-16.cxx =================================================================== --- trunk/tests/document/test_document-16.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-16.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,8 +42,6 @@ int main (void) { try { - xml::init xml; - xml::document doc_01("root"); std::cout << doc_01.size() << "\n"; doc_01.push_back(xml::node(xml::node::comment("This is a comment"))); Modified: trunk/tests/document/test_document-17.cxx =================================================================== --- trunk/tests/document/test_document-17.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-17.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,7 +42,6 @@ int main (void) { try { - xml::init xml; xml::document doc("root"); doc.push_back(xml::node(xml::node::comment(" Comment From push_back "))); Modified: trunk/tests/document/test_document-18.cxx =================================================================== --- trunk/tests/document/test_document-18.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-18.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ try { - xml::init xml; xml::document doc("root"); switch (*argv[1]) { Modified: trunk/tests/document/test_document-19.cxx =================================================================== --- trunk/tests/document/test_document-19.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-19.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ try { - xml::init xml; xml::document doc("root"); xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced ")))); Modified: trunk/tests/document/test_document-20.cxx =================================================================== --- trunk/tests/document/test_document-20.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-20.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ try { - xml::init xml; xml::document doc("root"); xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced ")))); Modified: trunk/tests/document/test_document-21.cxx =================================================================== --- trunk/tests/document/test_document-21.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-21.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -42,7 +42,6 @@ int main (void) { try { - xml::init xml; xml::document doc("root"); doc.push_back(xml::node(xml::node::comment(" Comment from push_back "))); Modified: trunk/tests/document/test_document-22.cxx =================================================================== --- trunk/tests/document/test_document-22.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/document/test_document-22.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -43,7 +43,6 @@ int main (void) { try { - xml::init xml; xml::document doc("root"); doc.push_back(xml::node(xml::node::comment(" Comment from push_back "))); Modified: trunk/tests/event/test_event-01.cxx =================================================================== --- trunk/tests/event/test_event-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/event/test_event-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -80,7 +80,6 @@ return 1; } - xml::init init; test_parser parser; if (!parser.parse_file(argv[1])) { Modified: trunk/tests/event/test_event-02.cxx =================================================================== --- trunk/tests/event/test_event-02.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/event/test_event-02.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -118,7 +118,6 @@ return 1; } - xml::init init; test_parser parser(argv[2],argc == 4); bool status = parser.parse_file(argv[1]); std::cout << "\n"; Modified: trunk/tests/event/test_event-03.cxx =================================================================== --- trunk/tests/event/test_event-03.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/event/test_event-03.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -64,7 +64,6 @@ return 1; } - xml::init init; test_parser parser; if (!parser.parse_file(argv[1])) return 1; return 0; Modified: trunk/tests/node/test_node-01.cxx =================================================================== --- trunk/tests/node/test_node-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -39,8 +39,6 @@ #include <iostream> int main (void) { - xml::init xml; - xml::node root_node("root"); xml::node one("count", "one"); xml::node two("count", "two"); Modified: trunk/tests/node/test_node-02a.cxx =================================================================== --- trunk/tests/node/test_node-02a.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-02a.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-02b.cxx =================================================================== --- trunk/tests/node/test_node-02b.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-02b.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); const xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-02c.cxx =================================================================== --- trunk/tests/node/test_node-02c.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-02c.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-02d.cxx =================================================================== --- trunk/tests/node/test_node-02d.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-02d.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); const xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-03a.cxx =================================================================== --- trunk/tests/node/test_node-03a.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-03a.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-03b.cxx =================================================================== --- trunk/tests/node/test_node-03b.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-03b.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-04a.cxx =================================================================== --- trunk/tests/node/test_node-04a.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-04a.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-04b.cxx =================================================================== --- trunk/tests/node/test_node-04b.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-04b.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-05a.cxx =================================================================== --- trunk/tests/node/test_node-05a.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-05a.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-05b.cxx =================================================================== --- trunk/tests/node/test_node-05b.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-05b.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-05c.cxx =================================================================== --- trunk/tests/node/test_node-05c.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-05c.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-05d.cxx =================================================================== --- trunk/tests/node/test_node-05d.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-05d.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-06.cxx =================================================================== --- trunk/tests/node/test_node-06.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-06.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,7 @@ } try { - xml::init xml; xml.substitute_entities(false); + xml::init::substitute_entities(false); xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-07.cxx =================================================================== --- trunk/tests/node/test_node-07.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-07.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,7 @@ } try { - xml::init xml; xml.remove_whitespace(true); + xml::init::remove_whitespace(true); xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-08.cxx =================================================================== --- trunk/tests/node/test_node-08.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-08.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -57,7 +57,7 @@ } try { - xml::init xml; xml.remove_whitespace(true); + xml::init::remove_whitespace(true); xml::tree_parser parser(argv[1]); xml::node &root = parser.get_document().get_root_node(); Modified: trunk/tests/node/test_node-09.cxx =================================================================== --- trunk/tests/node/test_node-09.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-09.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::node n(xml::node::cdata("This is a CDATA section")); std::cout << n; } catch (const std::exception &e) { Modified: trunk/tests/node/test_node-10.cxx =================================================================== --- trunk/tests/node/test_node-10.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-10.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::node n(xml::node::comment("This is an XML comment")); std::cout << n; } catch (const std::exception &e) { Modified: trunk/tests/node/test_node-11.cxx =================================================================== --- trunk/tests/node/test_node-11.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-11.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,7 +45,6 @@ } try { - xml::init xml; xml::node n(xml::node::pi("xslt", "stylesheet=\"test.xsl\"")); std::cout << n; } catch (const std::exception &e) { Modified: trunk/tests/node/test_node-12.cxx =================================================================== --- trunk/tests/node/test_node-12.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-12.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,8 +45,6 @@ } try { - xml::init xml; - xml::node n("root"); std::cout << n.size() << "\n"; Modified: trunk/tests/node/test_node-13.cxx =================================================================== --- trunk/tests/node/test_node-13.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/node/test_node-13.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -45,8 +45,6 @@ } try { - xml::init xml; - xml::node n("root"); std::cout << n.empty() << "\n"; Modified: trunk/tests/tree/test_tree-01.cxx =================================================================== --- trunk/tests/tree/test_tree-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -49,7 +49,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); dump_node(parser.get_document().get_root_node()); Modified: trunk/tests/tree/test_tree-02.cxx =================================================================== --- trunk/tests/tree/test_tree-02.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-02.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1]); } catch (std::exception &e) { Modified: trunk/tests/tree/test_tree-03.cxx =================================================================== --- trunk/tests/tree/test_tree-03.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-03.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xml::init xml; xml::tree_parser parser(argv[1], false); if (!parser) { Modified: trunk/tests/tree/test_tree-04.cxx =================================================================== --- trunk/tests/tree/test_tree-04.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-04.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -51,7 +51,6 @@ try { - xml::init xml; std::string xmldata = argv[1]; xml::tree_parser parser(xmldata.c_str(), xmldata.size()); dump_node(parser.get_document().get_root_node()); Modified: trunk/tests/tree/test_tree-05.cxx =================================================================== --- trunk/tests/tree/test_tree-05.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-05.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -48,7 +48,6 @@ try { - xml::init xml; std::string xmldata = argv[1]; xml::tree_parser parser(xmldata.c_str(), xmldata.size()); Modified: trunk/tests/tree/test_tree-06.cxx =================================================================== --- trunk/tests/tree/test_tree-06.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/tree/test_tree-06.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -48,7 +48,6 @@ try { - xml::init xml; std::string xmldata = argv[1]; xml::tree_parser parser(xmldata.c_str(), xmldata.size(), false); Modified: trunk/tests/xslt/test_xslt-01.cxx =================================================================== --- trunk/tests/xslt/test_xslt-01.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/xslt/test_xslt-01.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -46,7 +46,6 @@ try { - xslt::init init; xslt::stylesheet style(argv[1]); } catch (std::exception &e) { Modified: trunk/tests/xslt/test_xslt-02.cxx =================================================================== --- trunk/tests/xslt/test_xslt-02.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/xslt/test_xslt-02.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xslt::init init; xslt::stylesheet style(argv[1]); xml::tree_parser parser(argv[2]); xml::document result; Modified: trunk/tests/xslt/test_xslt-03.cxx =================================================================== --- trunk/tests/xslt/test_xslt-03.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/xslt/test_xslt-03.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xslt::init init; xslt::stylesheet style(argv[1]); xml::tree_parser parser(argv[2]); xml::document result; Modified: trunk/tests/xslt/test_xslt-04.cxx =================================================================== --- trunk/tests/xslt/test_xslt-04.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/xslt/test_xslt-04.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xslt::init init; xslt::stylesheet style(argv[1]); xml::tree_parser parser(argv[2]); Modified: trunk/tests/xslt/test_xslt-05.cxx =================================================================== --- trunk/tests/xslt/test_xslt-05.cxx 2008-12-12 23:58:44 UTC (rev 106) +++ trunk/tests/xslt/test_xslt-05.cxx 2008-12-13 13:39:53 UTC (rev 107) @@ -47,7 +47,6 @@ try { - xslt::init init; xslt::stylesheet style(argv[1]); xml::tree_parser parser(argv[2]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2008-12-16 18:12:42
|
Revision: 114 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=114&view=rev Author: vaclavslavik Date: 2008-12-16 18:12:33 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Converted the manual to Doxygen format. Also removed duplicate versions of the manual and made minor updates to reflect recent changes. Removed parts of the manual that exist elsewhere (e.g. contents of NEWS or AUTHORS files) or that were out of date (TODO list). Modified Paths: -------------- trunk/NEWS Added Paths: ----------- trunk/README trunk/docs/Doxyfile trunk/docs/manual/attributes.doxygen trunk/docs/manual/documents.doxygen trunk/docs/manual/intro.doxygen trunk/docs/manual/mainpage.doxygen trunk/docs/manual/node.doxygen trunk/docs/manual/parsing.doxygen trunk/docs/manual/prepare.doxygen trunk/docs/manual/tips.doxygen trunk/docs/manual/whatnext.doxygen trunk/docs/manual/xslt.doxygen Removed Paths: ------------- trunk/README.docs trunk/docs/doxygen/ trunk/docs/manual/Makefile trunk/docs/manual/attributes.texi trunk/docs/manual/bundling.texi trunk/docs/manual/changelog.texi trunk/docs/manual/copyright.texi trunk/docs/manual/credits.texi trunk/docs/manual/documents.texi trunk/docs/manual/intro.texi trunk/docs/manual/license.texi trunk/docs/manual/manual.texi trunk/docs/manual/node.texi trunk/docs/manual/parsing.texi trunk/docs/manual/prepare.texi trunk/docs/manual/quickstart.texi trunk/docs/manual/tips.texi trunk/docs/manual/todo.texi trunk/docs/manual/whatnext.texi trunk/docs/manual/xslt.texi trunk/docs/manual_xml/ trunk/project-xslt/ Property Changed: ---------------- trunk/docs/ trunk/docs/manual/ Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-12-14 15:00:16 UTC (rev 113) +++ trunk/NEWS 2008-12-16 18:12:33 UTC (rev 114) @@ -20,6 +20,11 @@ Configuration methods of xml/xslt::init classes are now static. + The previously separate manual was merged with Doxygen documentation so + that all documentation is available in single place. As a consequence, + PDF version of the manual is no longer provided, use HTML documentation + included with xmlwrapp source distribution. + Version 0.5.1 Various compilation fixes. Added: trunk/README =================================================================== --- trunk/README (rev 0) +++ trunk/README 2008-12-16 18:12:33 UTC (rev 114) @@ -0,0 +1,41 @@ + + +1. Requirements +--------------- + +In order to build xmlwrapp, you need libxml2 version 2.4.28 or newer. When +building with XSLT support, libxslt 1.1.6 or newer is required. Both libraries +are available from http://xmlsoft.org. + + +2. Building on Unix +------------------- + +On Unix, the usual Autotools-based build system is used. Building xmlwrapp is +usually as simple as running the following three commands: + + ./configure + make + make install + +See the output of `./configure --help` for additional settings and options. + + +3. Building on Windows +---------------------- + +At this time, only building with Visual C++ compiler is supported. The required +project files are located in platform/Win32 directory. + + +4. Using xmlwrapp +----------------- + +On Unix, you should use pkg-config to get compiler flags for xmlwrapp or +xsltwrapp libraries: + + c++ -c `pkg-config --cflags xmlwrapp` ... + c++ -o ... `pkg-config --libs xmlwrapp` + +On Windows, you need to link against xmlwrapp libraries and add the include/ +directory to compiler's headers search path. Deleted: trunk/README.docs =================================================================== --- trunk/README.docs 2008-12-14 15:00:16 UTC (rev 113) +++ trunk/README.docs 2008-12-16 18:12:33 UTC (rev 114) @@ -1,22 +0,0 @@ -Things I had to do to be able to "make docs": - -docs/manual - - Collected project-xslt directory. - - Modified project-xslt/docbook.mk file. - - Changed my local /usr/share/texmf/web2c/texmf.cnf file so "save_size" was - increased from 5000 to 90000. - - Use 'pmake' instead of 'make'. - - Went looking for LaTeX font packages (base on WARNINGs in pdf/manual.log): - tipa - Elsevier - mmasym - - Tried to track down LaTeX failure: - -l.43 ...2" hyphenation-remain-character-count="2"> - Chapter^^c2^^a01.^^c2^^a0I... Property changes on: trunk/docs ___________________________________________________________________ Modified: svn:ignore - manual-0.5.0.pdf texi_test + html Copied: trunk/docs/Doxyfile (from rev 106, trunk/docs/doxygen/doxyfile) =================================================================== --- trunk/docs/Doxyfile (rev 0) +++ trunk/docs/Doxyfile 2008-12-16 18:12:33 UTC (rev 114) @@ -0,0 +1,1473 @@ +# Doxyfile 1.5.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = xmlwrapp + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, +# Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = ../include + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = YES + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = NO + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = NO + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= NO + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../include manual + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.h *.doxygen + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = _cbfo.h + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = YES + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>. + +QHP_VIRTUAL_FOLDER = doc + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file . + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, th... [truncated message content] |
From: <vac...@us...> - 2009-01-26 17:00:21
|
Revision: 130 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=130&view=rev Author: vaclavslavik Date: 2009-01-26 17:00:08 +0000 (Mon, 26 Jan 2009) Log Message: ----------- added xml::node::elements() methods for efficient iteration over child elements Modified Paths: -------------- trunk/NEWS trunk/docs/manual/node.doxygen trunk/include/Makefile.am trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/xmlwrapp.h trunk/platform/Win32/xmlwrapp.dsp trunk/src/Makefile.am trunk/src/libxml/node.cxx trunk/src/libxml/node_iterator.cxx trunk/src/libxml/node_iterator.h trunk/tests/node/Makefile.am trunk/tests/node/data/02.xml trunk/tests/node/runtest.pl Added Paths: ----------- trunk/include/xmlwrapp/nodes_view.h trunk/src/libxml/nodes_view.cxx trunk/tests/node/data/02e.out trunk/tests/node/data/02f.out trunk/tests/node/data/02g.out trunk/tests/node/data/02h.out trunk/tests/node/test_node-02e.cxx trunk/tests/node/test_node-02f.cxx trunk/tests/node/test_node-02g.cxx trunk/tests/node/test_node-02h.cxx Property Changed: ---------------- trunk/tests/node/ Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/NEWS 2009-01-26 17:00:08 UTC (rev 130) @@ -32,6 +32,9 @@ Improved iterators performance (only if Boost.Pool is available). + Added xml::node::elements() methods for efficient iteration over child + elements. In most cases, this is a better alternative to find(). + Version 0.5.1 Various compilation fixes. Modified: trunk/docs/manual/node.doxygen =================================================================== --- trunk/docs/manual/node.doxygen 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/docs/manual/node.doxygen 2009-01-26 17:00:08 UTC (rev 130) @@ -179,7 +179,42 @@ } @endcode +@subsection node_children_elements Iterating Over Children Elements +If you need to do something with all child element nodes, you can use +xml::node::elements() method to obtain a @em view of child nodes. The view, +implemented by xml::nodes_view and xml::const_nodes_view classes, behaves like +a standard container in that it lets you iterate over the nodes in the usual +way. The difference between the iterator returned by xml::nodes_view::begin() +and the one from xml::node::begin() is that the latter iterates over all child +nodes, whereas the former iterates only over selected elements. + +The usage is similar to iterating over all child nodes: + +@code +xml::node n; +... +xml::nodes_view all(n.elements()); +for (xml::nodes_view::iterator i = all.begin()); i != all.end(); ++i) +{ + do_something_with_child(*i); +} +@endcode + +Similarly, you can iterate over all child elements with given name using +the xml::node::elements(const char*) method: + +@code +xml::node n; +... +xml::nodes_view persons(n.elements("person")); +for (xml::nodes_view::iterator i = all.begin()); i != all.end(); ++i) +{ + do_something_with_person_child(*i); +} +@endcode + + @section node_add Adding Children There are two ways of adding a child to a Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/include/Makefile.am 2009-01-26 17:00:08 UTC (rev 130) @@ -7,6 +7,7 @@ xmlwrapp/event_parser.h \ xmlwrapp/init.h \ xmlwrapp/node.h \ + xmlwrapp/nodes_view.h \ xmlwrapp/tree_parser.h \ xmlwrapp/xmlwrapp.h Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/include/xmlwrapp/node.h 2009-01-26 17:00:08 UTC (rev 130) @@ -53,16 +53,18 @@ // forward declarations class document; class attributes; +class nodes_view; +class const_nodes_view; namespace impl { class node_iterator; +class iter_advance_functor; struct node_impl; struct doc_impl; struct nipimpl; struct node_cmp; } - /** * The xml::node class is used to hold information about one XML node. This * includes the name of the node, the namespace of the node and attributes @@ -620,6 +622,8 @@ * @return An iterator that points to the node if found. * @return An end() iterator if the node was not found. * @author Peter Jones + * + * @see elements(const char*), find(const char*, iterator) **/ //#################################################################### iterator find (const char *name); @@ -638,6 +642,8 @@ * @return A const_iterator that points to the node if found. * @return An end() const_iterator if the node was not found. * @author Peter Jones + * + * @see elements(const char*) const, find(const char*, const_iterator) const **/ //#################################################################### const_iterator find (const char *name) const; @@ -658,6 +664,8 @@ * @return An iterator that points to the node if found. * @return An end() iterator if the node was not found. * @author Peter Jones + * + * @see elements(const char*) **/ //#################################################################### iterator find (const char *name, iterator start); @@ -670,7 +678,7 @@ * * This function should be given a const_iterator to one of this node's * children. The search will begin with that node and continue with all - * its sibliings. This function will not recurse down the tree, it only + * its siblings. This function will not recurse down the tree, it only * searches in one level. * * @param name The name of the node you want to find. @@ -678,10 +686,98 @@ * @return A const_iterator that points to the node if found. * @return An end() const_iterator if the node was not found. * @author Peter Jones + * + * @see elements(const char*) const **/ //#################################################################### const_iterator find (const char *name, const_iterator start) const; + /** + * Returns view of child nodes of type type_element. If no such node + * can be found, returns empty view. + * + * Example: + * @code + * xml::nodes_view view(root.elements()); + * for (xml::nodes_view::iterator i = view.begin(); i != view.end(); ++i) + * { + * ... + * } + * @endcode + * + * @return View with all child elements or empty view if there aren't any. + * @author Vaclav Slavik + * @since 0.6.0 + * + * @see nodes_view + **/ + nodes_view elements(); + + /** + * Returns view of child nodes of type type_element. If no such node + * can be found, returns empty view. + * + * Example: + * @code + * xml::const_nodes_view view(root.elements()); + * for (xml::const_nodes_view::const_iterator i = view.begin(); + * i != view.end(); + * ++i) + * { + * ... + * } + * @endcode + * + * @return View with all child elements or empty view if there aren't any. + * @author Vaclav Slavik + * @since 0.6.0 + * + * @see const_nodes_view + **/ + const_nodes_view elements() const; + + /** + * Returns view of child nodes of type type_element with name @a name. + * If no such node can be found, returns empty view. + * + * Example: + * @code + * xml::nodes_view persons(root.elements("person")); + * for (xml::nodes_view::iterator i = view.begin(); i != view.end(); ++i) + * { + * ... + * } + * @endcode + * + * @param name Name of the elements to return. + * @return View that contains only elements @a name. + * @author Vaclav Slavik + * @since 0.6.0 + **/ + nodes_view elements(const char *name); + + /** + * Returns view of child nodes of type type_element with name @a name. + * If no such node can be found, returns empty view. + * + * Example: + * @code + * xml::const_nodes_view persons(root.elements("person")); + * for (xml::const_nodes_view::const_iterator i = view.begin(); + * i != view.end(); + * ++i) + * { + * ... + * } + * @endcode + * + * @param name Name of the elements to return. + * @return View that contains only elements @a name. + * @author Vaclav Slavik + * @since 0.6.0 + **/ + const_nodes_view elements(const char *name) const; + //#################################################################### /** * Insert a new child node. The new node will be inserted at the end of Added: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h (rev 0) +++ trunk/include/xmlwrapp/nodes_view.h 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/** @file + * This file contains the definition of the xml::nodes_view and + * xml::const_nodes_view classes. +**/ + +#ifndef _xmlwrapp_nodes_view_h_ +#define _xmlwrapp_nodes_view_h_ + +// xmlwrapp includes +#include "xmlwrapp/init.h" + +// standard includes +#include <iterator> + +namespace xml +{ + +class node; +class const_nodes_view; + +namespace impl +{ +class nipimpl; +class iter_advance_functor; +} + +/** + * This class implements a view of XML nodes. A @em view is a container-like + * class that only allows access to a subset of xml::node's child nodes. The + * exact content depends on how the view was obtained; typical uses are + * e.g. a view of all element children or all elements with a given name. + * + * The nodes_view class implements the same container interface that xml::node + * does: it has begin() and end() methods. + * + * @author Vaclav Slavik + * @since 0.6.0 + * + * @see xml::node::elements(), xml::node::elements(const char*) +**/ +class nodes_view +{ +public: + nodes_view() : data_begin_(0), advance_func_(0) {} + nodes_view(const nodes_view& other); + ~nodes_view(); + + nodes_view& operator=(const nodes_view& other); + + /** + * The iterator provides a way to access nodes in the view + * similar to a standard C++ container. + * + * @see xml::node::iterator + **/ + class iterator + { + public: + typedef node value_type; + typedef int difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::forward_iterator_tag iterator_category; + + iterator(); + iterator(const iterator& other); + iterator& operator=(const iterator& other); + ~iterator(); + + reference operator*() const; + pointer operator->() const; + + iterator& operator++(); + iterator operator++(int); + + bool operator==(const iterator& other) const; + bool operator!=(const iterator& other) const { return !(*this == other); } + + private: + explicit iterator(void *data, impl::iter_advance_functor *advance_func); + void swap(iterator& other); + + impl::nipimpl *pimpl_; + // function for advancing the iterator (note that it is "owned" by the + // parent view object, so we don't have to care about its reference + // count here) + impl::iter_advance_functor *advance_func_; + + friend class nodes_view; + }; + + /** + * The const_iterator provides a way to access nodes in the view + * similar to a standard C++ container. The nodes that are pointed to by + * the iterator cannot be changed. + * + * @see xml::node::const_iterator + **/ + class const_iterator + { + public: + typedef const node value_type; + typedef int difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::forward_iterator_tag iterator_category; + + const_iterator(); + const_iterator(const const_iterator& other); + const_iterator(const iterator& other); + const_iterator& operator=(const const_iterator& other); + const_iterator& operator=(const iterator& other); + ~const_iterator(); + + reference operator*() const; + pointer operator->() const; + + const_iterator& operator++(); + const_iterator operator++(int); + + bool operator==(const const_iterator& other) const; + bool operator!=(const const_iterator& other) const { return !(*this == other); } + + private: + explicit const_iterator(void *data, impl::iter_advance_functor *advance_func); + void swap(const_iterator& other); + + impl::nipimpl *pimpl_; + // function for advancing the iterator (note that it is "owned" by the + // parent view object, so we don't have to care about its reference + // count here) + impl::iter_advance_functor *advance_func_; + + friend class const_nodes_view; + friend class nodes_view; + }; + + /** + * Get an iterator that points to the beginning of this node's + * children. + * + * @return An iterator that points to the beginning of the children. + **/ + iterator begin() { return iterator(data_begin_, advance_func_); } + + /** + * Get an iterator that points to the beginning of this node's + * children. + * + * @return An iterator that points to the beginning of the children. + **/ + const_iterator begin() const { return const_iterator(data_begin_, advance_func_); } + + /** + * Get an iterator that points one past the last child for this node. + * + * @return A "one past the end" iterator. + **/ + iterator end() { return iterator(); } + + /** + * Get an iterator that points one past the last child for this node. + * + * @return A "one past the end" iterator. + **/ + const_iterator end() const { return const_iterator(); } + + /// Is the view empty? + bool empty() const { return !data_begin_; } + +private: + explicit nodes_view(void *data_begin, impl::iter_advance_functor *advance_func) + : data_begin_(data_begin), advance_func_(advance_func) {} + + // begin iterator + void *data_begin_; + // function for advancing the iterator (owned by the view object) + impl::iter_advance_functor *advance_func_; + + friend class node; + friend class const_nodes_view; +}; + + +/** + * This class implements a @em read-only view of XML nodes. The only difference + * from xml::nodes_view is that it doesn't allow modifications of the nodes, + * it is otherwise identical. + * + * @see nodes_view + * + * @author Vaclav Slavik + * @since 0.6.0 +**/ +class const_nodes_view +{ +public: + const_nodes_view() : data_begin_(0), advance_func_(0) {} + const_nodes_view(const const_nodes_view& other); + const_nodes_view(const nodes_view& other); + ~const_nodes_view(); + + const_nodes_view& operator=(const const_nodes_view& other); + const_nodes_view& operator=(const nodes_view& other); + + typedef nodes_view::const_iterator iterator; + typedef nodes_view::const_iterator const_iterator; + + /** + * Get an iterator that points to the beginning of this node's + * children. + * + * @return An iterator that points to the beginning of the children. + **/ + const_iterator begin() const + { return const_iterator(data_begin_, advance_func_); } + + /** + * Get an iterator that points one past the last child for this node. + * + * @return A "one past the end" iterator. + **/ + const_iterator end() const { return const_iterator(); } + + /// Is the view empty? + bool empty() const { return !data_begin_; } + +private: + explicit const_nodes_view(void *data_begin, impl::iter_advance_functor *advance_func) + : data_begin_(data_begin), advance_func_(advance_func) {} + + // begin iterator + void *data_begin_; + // function for advancing the iterator (owned by the view object) + impl::iter_advance_functor *advance_func_; + + friend class node; +}; + +} // end xml namespace + +#endif // _xmlwrapp_nodes_view_h_ Property changes on: trunk/include/xmlwrapp/nodes_view.h ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/include/xmlwrapp/xmlwrapp.h 2009-01-26 17:00:08 UTC (rev 130) @@ -34,6 +34,7 @@ #define _xmlwrapp_xmlwrapp_h_ #include "xmlwrapp/init.h" +#include "xmlwrapp/nodes_view.h" #include "xmlwrapp/node.h" #include "xmlwrapp/attributes.h" #include "xmlwrapp/document.h" Modified: trunk/platform/Win32/xmlwrapp.dsp =================================================================== --- trunk/platform/Win32/xmlwrapp.dsp 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/platform/Win32/xmlwrapp.dsp 2009-01-26 17:00:08 UTC (rev 130) @@ -113,6 +113,10 @@ # End Source File # Begin Source File +SOURCE=..\..\src\libxml\nodes_view.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\libxml\node_iterator.cxx # End Source File # Begin Source File @@ -153,6 +157,10 @@ # End Source File # Begin Source File +SOURCE=..\..\include\xmlwrapp\nodes_view.h +# End Source File +# Begin Source File + SOURCE=..\..\include\xmlwrapp\tree_parser.h # End Source File # Begin Source File Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/src/Makefile.am 2009-01-26 17:00:08 UTC (rev 130) @@ -21,6 +21,7 @@ libxml/event_parser.cxx \ libxml/init.cxx \ libxml/node.cxx \ + libxml/nodes_view.cxx \ libxml/node_iterator.cxx \ libxml/node_iterator.h \ libxml/node_manip.cxx \ Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/src/libxml/node.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -36,11 +36,13 @@ // xmlwrapp includes #include "xmlwrapp/node.h" +#include "xmlwrapp/nodes_view.h" #include "xmlwrapp/attributes.h" #include "utility.h" #include "ait_impl.h" #include "node_manip.h" #include "pimpl_base.h" +#include "node_iterator.h" // standard includes #include <cstring> @@ -175,8 +177,41 @@ xmlNodePtr parent_; }; - // a node finder - xmlNodePtr find_node(const char *name, xmlNodePtr first); + // an element node finder + xmlNodePtr find_element(const char *name, xmlNodePtr first) { + while (first != 0) { + if (first->type == XML_ELEMENT_NODE && xmlStrcmp(first->name, reinterpret_cast<const xmlChar*>(name)) == 0) return first; + first = first->next; + } + + return 0; + } + + xmlNodePtr find_element(xmlNodePtr first) { + while (first != 0) { + if (first->type == XML_ELEMENT_NODE) return first; + first = first->next; + } + + return 0; + } + + class next_element_functor : public iter_advance_functor + { + public: + virtual xmlNodePtr operator()(xmlNodePtr node) const + { return find_element(node->next); } + }; + + class next_named_element_functor : public iter_advance_functor + { + public: + next_named_element_functor(const char *name) : name_(name) {} + virtual xmlNodePtr operator()(xmlNodePtr node) const + { return find_element(name_.c_str(), node->next); } + private: + std::string name_; + }; } //#################################################################### xml::node::node (int) { @@ -411,28 +446,65 @@ } //#################################################################### xml::node::iterator xml::node::find (const char *name) { - xmlNodePtr found = find_node(name, pimpl_->xmlnode_->children); + xmlNodePtr found = find_element(name, pimpl_->xmlnode_->children); if (found) return iterator(found); return end(); } //#################################################################### xml::node::const_iterator xml::node::find (const char *name) const { - xmlNodePtr found = find_node(name, pimpl_->xmlnode_->children); + xmlNodePtr found = find_element(name, pimpl_->xmlnode_->children); if (found) return const_iterator(found); return end(); } //#################################################################### xml::node::iterator xml::node::find (const char *name, iterator start) { xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node()); - if ( (n = find_node(name, n))) return iterator(n); + if ( (n = find_element(name, n))) return iterator(n); return end(); } //#################################################################### xml::node::const_iterator xml::node::find (const char *name, const_iterator start) const { xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node()); - if ( (n = find_node(name, n))) return const_iterator(n); + if ( (n = find_element(name, n))) return const_iterator(n); return end(); } + +xml::nodes_view xml::node::elements() +{ + return nodes_view + ( + find_element(pimpl_->xmlnode_->children), + new next_element_functor + ); +} + +xml::const_nodes_view xml::node::elements() const +{ + return const_nodes_view + ( + find_element(pimpl_->xmlnode_->children), + new next_element_functor + ); +} + +xml::nodes_view xml::node::elements(const char *name) +{ + return nodes_view + ( + find_element(name, pimpl_->xmlnode_->children), + new next_named_element_functor(name) + ); +} + +xml::const_nodes_view xml::node::elements(const char *name) const +{ + return const_nodes_view + ( + find_element(name, pimpl_->xmlnode_->children), + new next_named_element_functor(name) + ); +} + //#################################################################### xml::node::iterator xml::node::insert (const node &n) { return iterator(xml::impl::node_insert(pimpl_->xmlnode_, 0, n.pimpl_->xmlnode_)); @@ -522,17 +594,6 @@ if (xml_string_length) xml.assign(helper.get(), xml_string_length); } //#################################################################### -namespace { - xmlNodePtr find_node(const char *name, xmlNodePtr first) { - while (first != 0) { - if (first->type == XML_ELEMENT_NODE && xmlStrcmp(first->name, reinterpret_cast<const xmlChar*>(name)) == 0) return first; - first = first->next; - } - - return 0; - } -} -//#################################################################### namespace xml { std::ostream& operator<< (std::ostream &stream, const xml::node &n) { std::string xmldata; Modified: trunk/src/libxml/node_iterator.cxx =================================================================== --- trunk/src/libxml/node_iterator.cxx 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/src/libxml/node_iterator.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -40,6 +40,7 @@ // xmlwrapp includes #include "xmlwrapp/node.h" +#include "xmlwrapp/nodes_view.h" // standard includes #include <algorithm> @@ -69,11 +70,6 @@ return &fake_node_; } //#################################################################### -xml::impl::node_iterator& xml::impl::node_iterator::operator++ (void) { - node_ = node_->next; - return *this; -} -//#################################################################### /* * xml::node::iterator wrapper iterator class. @@ -115,7 +111,7 @@ } //#################################################################### xml::node::iterator& xml::node::iterator::operator++ (void) { - ++(pimpl_->it); + pimpl_->it.advance(); return *this; } //#################################################################### @@ -174,7 +170,7 @@ } //#################################################################### xml::node::const_iterator& xml::node::const_iterator::operator++ (void) { - ++(pimpl_->it); + pimpl_->it.advance(); return *this; } //#################################################################### @@ -217,3 +213,169 @@ } } //#################################################################### + + +namespace xml +{ + +// ------------------------------------------------------------------------ +// xml::nodes_view::iterator +// ------------------------------------------------------------------------ + +nodes_view::iterator::iterator() +{ + pimpl_ = new nipimpl; + advance_func_ = 0; +} + +nodes_view::iterator::iterator(const iterator& other) +{ + pimpl_ = new nipimpl(*(other.pimpl_)); + advance_func_ = other.advance_func_; +} + +nodes_view::iterator& +nodes_view::iterator::operator=(const iterator& other) +{ + iterator tmp(other); + swap(tmp); + return *this; +} + +nodes_view::iterator::~iterator() +{ + delete pimpl_; +} + +nodes_view::iterator::reference +nodes_view::iterator::operator*() const +{ + return *(pimpl_->it.get()); +} + +nodes_view::iterator::pointer +nodes_view::iterator::operator->() const +{ + return pimpl_->it.get(); +} + +nodes_view::iterator& nodes_view::iterator::operator++() +{ + assert( advance_func_ ); + pimpl_->it.advance(*advance_func_); + return *this; +} + +nodes_view::iterator nodes_view::iterator::operator++(int) +{ + iterator tmp(*this); + ++(*this); + return tmp; +} + +bool nodes_view::iterator::operator==(const iterator& other) const +{ + return pimpl_->it == other.pimpl_->it; +} + +nodes_view::iterator::iterator(void *data, impl::iter_advance_functor *advance_func) +{ + assert( advance_func ); + pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data)); + advance_func_ = advance_func; +} + +void nodes_view::iterator::swap(iterator& other) +{ + std::swap(pimpl_, other.pimpl_); + std::swap(advance_func_, other.advance_func_); +} + +// ------------------------------------------------------------------------ +// xml::nodes_view::const_iterator +// ------------------------------------------------------------------------ + +nodes_view::const_iterator::const_iterator() +{ + pimpl_ = new nipimpl; + advance_func_ = 0; +} + +nodes_view::const_iterator::const_iterator(const const_iterator& other) +{ + pimpl_ = new nipimpl(*(other.pimpl_)); + advance_func_ = other.advance_func_; +} + +nodes_view::const_iterator::const_iterator(const iterator& other) +{ + pimpl_ = new nipimpl(*(other.pimpl_)); + advance_func_ = other.advance_func_; +} + +nodes_view::const_iterator& +nodes_view::const_iterator::operator=(const const_iterator& other) +{ + const_iterator tmp(other); + swap(tmp); + return *this; +} + +nodes_view::const_iterator& +nodes_view::const_iterator::operator=(const iterator& other) +{ + const_iterator tmp(other); + swap(tmp); + return *this; +} + +nodes_view::const_iterator::~const_iterator() +{ + delete pimpl_; +} + +nodes_view::const_iterator::reference +nodes_view::const_iterator::operator*() const +{ + return *(pimpl_->it.get()); +} + +nodes_view::const_iterator::pointer +nodes_view::const_iterator::operator->() const +{ + return pimpl_->it.get(); +} + +nodes_view::const_iterator& nodes_view::const_iterator::operator++() +{ + assert( advance_func_ ); + pimpl_->it.advance(*advance_func_); + return *this; +} + +nodes_view::const_iterator nodes_view::const_iterator::operator++(int) +{ + const_iterator tmp(*this); + ++(*this); + return tmp; +} + +bool nodes_view::const_iterator::operator==(const const_iterator& other) const +{ + return pimpl_->it == other.pimpl_->it; +} + +nodes_view::const_iterator::const_iterator(void *data, impl::iter_advance_functor *advance_func) +{ + assert( advance_func ); + pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data)); + advance_func_ = advance_func; +} + +void nodes_view::const_iterator::swap(nodes_view::const_iterator& other) +{ + std::swap(pimpl_, other.pimpl_); + std::swap(advance_func_, other.advance_func_); +} + +} // namespace xml Modified: trunk/src/libxml/node_iterator.h =================================================================== --- trunk/src/libxml/node_iterator.h 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/src/libxml/node_iterator.h 2009-01-26 17:00:08 UTC (rev 130) @@ -47,6 +47,38 @@ namespace impl { +// helper to obtain the next node in "filtering" iterators (as used by +// nodes_view and const_nodes_view) +// +// Note: This class is reference-counted; don't delete instance of it, use +// dec_ref() and inc_ref(). Newly created instance has reference count +// of 1. +class iter_advance_functor +{ +public: + iter_advance_functor() : refcnt_(1) {} + + void inc_ref() + { + refcnt_++; + } + + void dec_ref() + { + if ( --refcnt_ == 0 ) + delete this; + } + + virtual xmlNodePtr operator()(xmlNodePtr node) const = 0; + +protected: + // use inc_ref(), dec_ref() instead of using the dtor explicitly + virtual ~iter_advance_functor() {} + +private: + int refcnt_; +}; + // base iterator class class node_iterator { public: @@ -59,10 +91,12 @@ node* get (void) const; xmlNodePtr get_raw_node (void) { return node_; } - node_iterator& operator++ (void); + void advance() { node_ = node_->next; } + void advance(iter_advance_functor& next) { node_ = next(node_); } friend bool operator== (const node_iterator &lhs, const node_iterator &rhs); + private: mutable node fake_node_; xmlNodePtr node_; Added: trunk/src/libxml/nodes_view.cxx =================================================================== --- trunk/src/libxml/nodes_view.cxx (rev 0) +++ trunk/src/libxml/nodes_view.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +// xmlwrapp includes +#include "xmlwrapp/nodes_view.h" + +// definition include +#include "node_iterator.h" +#include "pimpl_base.h" + +namespace xml +{ + +// ------------------------------------------------------------------------ +// xml::const_nodes_view +// ------------------------------------------------------------------------ + +const_nodes_view::const_nodes_view(const const_nodes_view& other) + : data_begin_(other.data_begin_), + advance_func_(other.advance_func_) +{ + if ( advance_func_ ) + advance_func_->inc_ref(); +} + +const_nodes_view::const_nodes_view(const nodes_view& other) + : data_begin_(other.data_begin_), + advance_func_(other.advance_func_) +{ + if ( advance_func_ ) + advance_func_->inc_ref(); +} + +const_nodes_view::~const_nodes_view() +{ + if ( advance_func_ ) + advance_func_->dec_ref(); +} + +const_nodes_view& const_nodes_view::operator=(const const_nodes_view& other) +{ + if ( advance_func_ ) + advance_func_->dec_ref(); + + data_begin_ = other.data_begin_; + advance_func_ = other.advance_func_; + + if ( advance_func_ ) + advance_func_->inc_ref(); + + return *this; +} + +const_nodes_view& const_nodes_view::operator=(const nodes_view& other) +{ + if ( advance_func_ ) + advance_func_->dec_ref(); + + data_begin_ = other.data_begin_; + advance_func_ = other.advance_func_; + + if ( advance_func_ ) + advance_func_->inc_ref(); + + return *this; +} + +// ------------------------------------------------------------------------ +// xml::nodes_view +// ------------------------------------------------------------------------ + +nodes_view::nodes_view(const nodes_view& other) + : data_begin_(other.data_begin_), + advance_func_(other.advance_func_) +{ + if ( advance_func_ ) + advance_func_->inc_ref(); +} + +nodes_view::~nodes_view() +{ + if ( advance_func_ ) + advance_func_->dec_ref(); +} + +nodes_view& nodes_view::operator=(const nodes_view& other) +{ + if ( advance_func_ ) + advance_func_->dec_ref(); + + data_begin_ = other.data_begin_; + advance_func_ = other.advance_func_; + + if ( advance_func_ ) + advance_func_->inc_ref(); + + return *this; +} + +} // namespace xml Property changes on: trunk/tests/node ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in .deps .libs test_node-01 test_node-02a test_node-02b test_node-02c test_node-02d test_node-03a test_node-03b test_node-04a test_node-04b test_node-05a test_node-05b test_node-05c test_node-05d test_node-06 test_node-07 test_node-08 test_node-09 test_node-10 test_node-11 test_node-12 test_node-13 test_node-14 + Makefile Makefile.in .deps .libs test_node-01 test_node-02a test_node-02b test_node-02c test_node-02d test_node-02e test_node-02f test_node-02g test_node-02h test_node-03a test_node-03b test_node-04a test_node-04b test_node-05a test_node-05b test_node-05c test_node-05d test_node-06 test_node-07 test_node-08 test_node-09 test_node-10 test_node-11 test_node-12 test_node-13 test_node-14 Modified: trunk/tests/node/Makefile.am =================================================================== --- trunk/tests/node/Makefile.am 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/tests/node/Makefile.am 2009-01-26 17:00:08 UTC (rev 130) @@ -10,6 +10,10 @@ test_node-02b \ test_node-02c \ test_node-02d \ + test_node-02e \ + test_node-02f \ + test_node-02g \ + test_node-02h \ test_node-03a \ test_node-03b \ test_node-04a \ @@ -33,6 +37,10 @@ test_node_02b_SOURCES = test_node-02b.cxx test_node_02c_SOURCES = test_node-02c.cxx test_node_02d_SOURCES = test_node-02d.cxx +test_node_02e_SOURCES = test_node-02e.cxx +test_node_02f_SOURCES = test_node-02f.cxx +test_node_02g_SOURCES = test_node-02g.cxx +test_node_02h_SOURCES = test_node-02h.cxx test_node_03a_SOURCES = test_node-03a.cxx test_node_03b_SOURCES = test_node-03b.cxx test_node_04a_SOURCES = test_node-04a.cxx Modified: trunk/tests/node/data/02.xml =================================================================== --- trunk/tests/node/data/02.xml 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/tests/node/data/02.xml 2009-01-26 17:00:08 UTC (rev 130) @@ -1 +1 @@ -<root><person><name>Peter</name><state>CO</state></person><person><name>Isaac</name><state>CA</state></person><person><name>Albert</name><state>AZ</state></person></root> +<root><person><name>Peter</name><state>CO</state></person><person><name>Isaac</name><state>CA</state></person><unrelated_element/><person><name>Albert</name><state>AZ</state></person></root> Added: trunk/tests/node/data/02e.out =================================================================== --- trunk/tests/node/data/02e.out (rev 0) +++ trunk/tests/node/data/02e.out 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<person> + <name>Peter</name> + <state>CO</state> +</person> +<?xml version="1.0"?> +<person> + <name>Isaac</name> + <state>CA</state> +</person> +<?xml version="1.0"?> +<person> + <name>Albert</name> + <state>AZ</state> +</person> Added: trunk/tests/node/data/02f.out =================================================================== --- trunk/tests/node/data/02f.out (rev 0) +++ trunk/tests/node/data/02f.out 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<person> + <name>Peter</name> + <state>CO</state> +</person> +<?xml version="1.0"?> +<person> + <name>Isaac</name> + <state>CA</state> +</person> +<?xml version="1.0"?> +<person> + <name>Albert</name> + <state>AZ</state> +</person> Added: trunk/tests/node/data/02g.out =================================================================== --- trunk/tests/node/data/02g.out (rev 0) +++ trunk/tests/node/data/02g.out 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<person> + <name>Peter</name> + <state>CO</state> +</person> +<?xml version="1.0"?> +<person> + <name>Isaac</name> + <state>CA</state> +</person> +<?xml version="1.0"?> +<unrelated_element/> +<?xml version="1.0"?> +<person> + <name>Albert</name> + <state>AZ</state> +</person> Added: trunk/tests/node/data/02h.out =================================================================== --- trunk/tests/node/data/02h.out (rev 0) +++ trunk/tests/node/data/02h.out 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<person> + <name>Peter</name> + <state>CO</state> +</person> +<?xml version="1.0"?> +<person> + <name>Isaac</name> + <state>CA</state> +</person> +<?xml version="1.0"?> +<unrelated_element/> +<?xml version="1.0"?> +<person> + <name>Albert</name> + <state>AZ</state> +</person> Modified: trunk/tests/node/runtest.pl =================================================================== --- trunk/tests/node/runtest.pl 2009-01-25 13:42:49 UTC (rev 129) +++ trunk/tests/node/runtest.pl 2009-01-26 17:00:08 UTC (rev 130) @@ -46,6 +46,9 @@ foreach my $i (qw(02a 02b 02c 02d)) { $test->regression("find ($i)", "./test_node-$i data/02.xml", "data/$i.out"); } + foreach my $i (qw(02e 02f 02g 02h)) { + $test->regression("elements ($i)", "./test_node-$i data/02.xml", "data/$i.out"); + } ########################################################################### foreach my $i (qw(03a 03b)) { $test->regression("replace ($i)", "./test_node-$i data/03.xml", "data/$i.out"); Added: trunk/tests/node/test_node-02e.cxx =================================================================== --- trunk/tests/node/test_node-02e.cxx (rev 0) +++ trunk/tests/node/test_node-02e.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This test checks xml::node::iterator xml::node::elements (const char *name); + */ + +#include <xmlwrapp/xmlwrapp.h> +#include <iostream> +#include <exception> + +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " xmlfile\n"; + return 1; + } + + try { + xml::tree_parser parser(argv[1]); + + xml::node &root = parser.get_document().get_root_node(); + xml::nodes_view persons(root.elements("person")); + for (xml::nodes_view::const_iterator i = persons.begin(); i != persons.end(); ++i) { + std::cout << *i; + } + } catch (const std::exception &e) { + std::cout << e.what() << std::endl; + return 1; + } + + return 0; +} Added: trunk/tests/node/test_node-02f.cxx =================================================================== --- trunk/tests/node/test_node-02f.cxx (rev 0) +++ trunk/tests/node/test_node-02f.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2008 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This test checks xml::node::elements (const char *name); + */ + +#include <xmlwrapp/xmlwrapp.h> +#include <iostream> +#include <exception> +#include <cassert> + +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " xmlfile\n"; + return 1; + } + + try { + xml::tree_parser parser(argv[1]); + + const xml::node &root = parser.get_document().get_root_node(); + xml::const_nodes_view persons(root.elements("person")); + for (xml::const_nodes_view::const_iterator i = persons.begin(); i != persons.end(); ++i) { + std::cout << *i; + } + + // FIXME: make this a proper test after moving to Cppunit or Boost.Unit + xml::const_nodes_view v2(root.elements("nonexistent")); + assert( v2.begin() == v2.end() ); + assert( v2.empty() ); + + } catch (const std::exception &e) { + std::cout << e.what() << std::endl; + return 1; + } + + return 0; +} Added: trunk/tests/node/test_node-02g.cxx =================================================================== --- trunk/tests/node/test_node-02g.cxx (rev 0) +++ trunk/tests/node/test_node-02g.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This test checks xml::node::iterator xml::node::elements (const char *name); + */ + +#include <xmlwrapp/xmlwrapp.h> +#include <iostream> +#include <exception> + +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " xmlfile\n"; + return 1; + } + + try { + xml::tree_parser parser(argv[1]); + + xml::node &root = parser.get_document().get_root_node(); + xml::nodes_view all(root.elements()); + for (xml::nodes_view::const_iterator i = all.begin(); i != all.end(); ++i) { + std::cout << *i; + } + } catch (const std::exception &e) { + std::cout << e.what() << std::endl; + return 1; + } + + return 0; +} Added: trunk/tests/node/test_node-02h.cxx =================================================================== --- trunk/tests/node/test_node-02h.cxx (rev 0) +++ trunk/tests/node/test_node-02h.cxx 2009-01-26 17:00:08 UTC (rev 130) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This test checks xml::node::elements (const char *name); + */ + +#include <xmlwrapp/xmlwrapp.h> +#include <iostream> +#include <exception> + +int main (int argc, char *argv[]) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " xmlfile\n"; + return 1; + } + + try { + xml::tree_parser parser(argv[1]); + + const xml::node &root = parser.get_document().get_root_node(); + xml::const_nodes_view all(root.elements()); + for (xml::const_nodes_view::const_iterator i = all.begin(); i != all.end(); ++i) { + std::cout << *i; + } + } catch (const std::exception &e) { + std::cout << e.what() << std::endl; + return 1; + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-02-22 12:45:21
|
Revision: 138 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=138&view=rev Author: vaclavslavik Date: 2009-02-22 12:45:16 +0000 (Sun, 22 Feb 2009) Log Message: ----------- fixed 'make dist' to work when building from another directory than srcdir Modified Paths: -------------- trunk/Makefile.am trunk/docs/Makefile.am trunk/tests/attributes/Makefile.am trunk/tests/document/Makefile.am trunk/tests/event/Makefile.am trunk/tests/node/Makefile.am trunk/tests/xslt/Makefile.am Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -12,4 +12,4 @@ bin_SCRIPTS = xmlwrapp-config EXTRA_DIST = LICENSE bootstrap \ - platform/Win32/*.dsp platform/Win32/*.dsw + $(srcdir)/platform/Win32/*.dsp $(srcdir)/platform/Win32/*.dsw Modified: trunk/docs/Makefile.am =================================================================== --- trunk/docs/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/docs/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -1,7 +1,7 @@ html_DATA = $(srcdir)/html/*.* -EXTRA_DIST = Doxyfile manual/*.doxygen +EXTRA_DIST = Doxyfile $(srcdir)/manual/*.doxygen dist-hook: cd $(distdir) && doxygen Modified: trunk/tests/attributes/Makefile.am =================================================================== --- trunk/tests/attributes/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/tests/attributes/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -27,4 +27,4 @@ test_attr_09_SOURCES = test_attr-09.cxx test_attr_10_SOURCES = test_attr-10.cxx -EXTRA_DIST = data/*.out data/*.xml data/*.dtd runtest.pl +EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml $(srcdir)/data/*.dtd runtest.pl Modified: trunk/tests/document/Makefile.am =================================================================== --- trunk/tests/document/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/tests/document/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -51,4 +51,4 @@ test_document_21_SOURCES = test_document-21.cxx test_document_22_SOURCES = test_document-22.cxx -EXTRA_DIST = data/*.out data/*.xml runtest.pl +EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl Modified: trunk/tests/event/Makefile.am =================================================================== --- trunk/tests/event/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/tests/event/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -13,4 +13,4 @@ test_event_02_SOURCES = test_event-02.cxx test_event_03_SOURCES = test_event-03.cxx -EXTRA_DIST = data/*.out data/*.xml runtest.pl +EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl Modified: trunk/tests/node/Makefile.am =================================================================== --- trunk/tests/node/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/tests/node/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -59,4 +59,4 @@ test_node_13_SOURCES = test_node-13.cxx test_node_14_SOURCES = test_node-14.cxx -EXTRA_DIST = data/*.out data/*.xml runtest.pl +EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl Modified: trunk/tests/xslt/Makefile.am =================================================================== --- trunk/tests/xslt/Makefile.am 2009-02-22 10:51:28 UTC (rev 137) +++ trunk/tests/xslt/Makefile.am 2009-02-22 12:45:16 UTC (rev 138) @@ -21,4 +21,4 @@ endif -EXTRA_DIST = data/*.xml data/*.xsl data/*.out runtest.pl +EXTRA_DIST = $(srcdir)/data/*.xml $(srcdir)/data/*.xsl $(srcdir)/data/*.out runtest.pl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-05-17 18:56:31
|
Revision: 142 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=142&view=rev Author: vaclavslavik Date: 2009-05-17 18:56:30 +0000 (Sun, 17 May 2009) Log Message: ----------- fixed event_parser::parse_stream() to return false on empty input (patch #2787836 by Michael Grundberg) Modified Paths: -------------- trunk/AUTHORS trunk/NEWS trunk/src/libxml/event_parser.cxx Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/AUTHORS 2009-05-17 18:56:30 UTC (rev 142) @@ -13,3 +13,4 @@ Daniel Evison Frank Grimm Gary Passero + Michael Grundberg <mgr...@us...> Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142) @@ -1,5 +1,8 @@ Added Visual C++ 200x projects and fixed VC6 project. + Fixed xml::event_parser::parse_stream() to return false on empty + input (Michael Grundberg, #2787836). + Version 0.6.0 Fixed libxmlwrapp to not depend on libxslt if XSLT support Modified: trunk/src/libxml/event_parser.cxx =================================================================== --- trunk/src/libxml/event_parser.cxx 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/src/libxml/event_parser.cxx 2009-05-17 18:56:30 UTC (rev 142) @@ -124,6 +124,13 @@ bool xml::event_parser::parse_stream (std::istream &stream) { char buffer[const_buffer_size]; + if (stream && (stream.eof() || stream.peek() == std::istream::traits_type::eof())) + { + pimpl_->parser_status_ = false; + pimpl_->last_error_message_ = "empty xml document"; + return false; + } + while (pimpl_->parser_status_ && (stream.read(buffer, const_buffer_size) || stream.gcount())) pimpl_->parser_status_ = parse_chunk(buffer, stream.gcount()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-05-30 18:56:16
|
Revision: 143 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=143&view=rev Author: vaclavslavik Date: 2009-05-30 18:55:52 +0000 (Sat, 30 May 2009) Log Message: ----------- Converted test suite to Boost Test. Modified Paths: -------------- trunk/NEWS trunk/tests/Makefile.am trunk/tests/document/data/13a.out trunk/tests/document/data/13b.out trunk/tests/document/data/14.out trunk/tests/node/data/07a.out trunk/tests/node/data/07b.out trunk/tests/node/data/08a.out Added Paths: ----------- trunk/tests/attributes/test_attributes.cxx trunk/tests/event/test_event.cxx trunk/tests/node/data/01.out trunk/tests/node/data/empty.xml trunk/tests/node/test_node.cxx trunk/tests/test.h trunk/tests/test_main.cxx trunk/tests/tree/data/ trunk/tests/tree/data/bad.xml trunk/tests/tree/data/good.xml trunk/tests/tree/data/output trunk/tests/tree/test_tree.cxx trunk/tests/xslt/data/input.xml trunk/tests/xslt/test_xslt.cxx Removed Paths: ------------- trunk/tests/attributes/Makefile.am trunk/tests/attributes/data/05.xml trunk/tests/attributes/data/05a.out trunk/tests/attributes/data/05b.out trunk/tests/attributes/data/05c.out trunk/tests/attributes/data/05d.out trunk/tests/attributes/data/06a.out trunk/tests/attributes/data/06b.out trunk/tests/attributes/data/07a.out trunk/tests/attributes/data/07b.out trunk/tests/attributes/data/07c.out trunk/tests/attributes/data/07d.out trunk/tests/attributes/data/09a.out trunk/tests/attributes/data/09b.out trunk/tests/attributes/data/09c.out trunk/tests/attributes/data/10.out trunk/tests/attributes/runtest.pl trunk/tests/attributes/test_attr-01.cxx trunk/tests/attributes/test_attr-02.cxx trunk/tests/attributes/test_attr-03.cxx trunk/tests/attributes/test_attr-04.cxx trunk/tests/attributes/test_attr-05.cxx trunk/tests/attributes/test_attr-06.cxx trunk/tests/attributes/test_attr-07.cxx trunk/tests/attributes/test_attr-08.cxx trunk/tests/attributes/test_attr-09.cxx trunk/tests/attributes/test_attr-10.cxx trunk/tests/document/Makefile.am trunk/tests/document/data/05.out trunk/tests/document/data/06.out trunk/tests/document/data/07.out trunk/tests/document/data/09.out trunk/tests/document/data/10.xml trunk/tests/document/data/11.out trunk/tests/document/data/12.xml trunk/tests/document/data/16.out trunk/tests/document/data/18a.out trunk/tests/document/data/18b.out trunk/tests/document/data/18c.out trunk/tests/document/data/20.out trunk/tests/document/data/22.out trunk/tests/document/runtest.pl trunk/tests/document/test_document-01.cxx trunk/tests/document/test_document-02.cxx trunk/tests/document/test_document-03.cxx trunk/tests/document/test_document-04.cxx trunk/tests/document/test_document-05.cxx trunk/tests/document/test_document-06.cxx trunk/tests/document/test_document-07.cxx trunk/tests/document/test_document-08.cxx trunk/tests/document/test_document-09.cxx trunk/tests/document/test_document-10.cxx trunk/tests/document/test_document-11.cxx trunk/tests/document/test_document-12.cxx trunk/tests/document/test_document-13.cxx trunk/tests/document/test_document-14.cxx trunk/tests/document/test_document-15.cxx trunk/tests/document/test_document-16.cxx trunk/tests/document/test_document-17.cxx trunk/tests/document/test_document-18.cxx trunk/tests/document/test_document-19.cxx trunk/tests/document/test_document-20.cxx trunk/tests/document/test_document-21.cxx trunk/tests/document/test_document-22.cxx trunk/tests/event/Makefile.am trunk/tests/event/runtest.pl trunk/tests/event/test_event-01.cxx trunk/tests/event/test_event-02.cxx trunk/tests/event/test_event-03.cxx trunk/tests/harness/ trunk/tests/node/Makefile.am trunk/tests/node/data/01.xml trunk/tests/node/data/02b.out trunk/tests/node/data/02d.out trunk/tests/node/data/02e.out trunk/tests/node/data/02f.out trunk/tests/node/data/02h.out trunk/tests/node/data/12.out trunk/tests/node/data/13.out trunk/tests/node/runtest.pl trunk/tests/node/test_node-01.cxx trunk/tests/node/test_node-02a.cxx trunk/tests/node/test_node-02b.cxx trunk/tests/node/test_node-02c.cxx trunk/tests/node/test_node-02d.cxx trunk/tests/node/test_node-02e.cxx trunk/tests/node/test_node-02f.cxx trunk/tests/node/test_node-02g.cxx trunk/tests/node/test_node-02h.cxx trunk/tests/node/test_node-03a.cxx trunk/tests/node/test_node-03b.cxx trunk/tests/node/test_node-04a.cxx trunk/tests/node/test_node-04b.cxx trunk/tests/node/test_node-05a.cxx trunk/tests/node/test_node-05b.cxx trunk/tests/node/test_node-05c.cxx trunk/tests/node/test_node-05d.cxx trunk/tests/node/test_node-06.cxx trunk/tests/node/test_node-07.cxx trunk/tests/node/test_node-08.cxx trunk/tests/node/test_node-09.cxx trunk/tests/node/test_node-10.cxx trunk/tests/node/test_node-11.cxx trunk/tests/node/test_node-12.cxx trunk/tests/node/test_node-13.cxx trunk/tests/node/test_node-14.cxx trunk/tests/tree/Makefile.am trunk/tests/tree/runtest.pl trunk/tests/tree/test_tree-01.cxx trunk/tests/tree/test_tree-02.cxx trunk/tests/tree/test_tree-03.cxx trunk/tests/tree/test_tree-04.cxx trunk/tests/tree/test_tree-05.cxx trunk/tests/tree/test_tree-06.cxx trunk/tests/xslt/Makefile.am trunk/tests/xslt/data/02a.xml trunk/tests/xslt/data/03a.xml trunk/tests/xslt/data/04a.out trunk/tests/xslt/data/04a.xml trunk/tests/xslt/data/04a.xsl trunk/tests/xslt/data/05a.out trunk/tests/xslt/data/05a.xml trunk/tests/xslt/data/05a.xsl trunk/tests/xslt/runtest.pl trunk/tests/xslt/test_xslt-01.cxx trunk/tests/xslt/test_xslt-02.cxx trunk/tests/xslt/test_xslt-03.cxx trunk/tests/xslt/test_xslt-04.cxx trunk/tests/xslt/test_xslt-05.cxx Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/NEWS 2009-05-30 18:55:52 UTC (rev 143) @@ -3,6 +3,8 @@ Fixed xml::event_parser::parse_stream() to return false on empty input (Michael Grundberg, #2787836). + Converted test suite to Boost Test. + Version 0.6.0 Fixed libxmlwrapp to not depend on libxslt if XSLT support Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/Makefile.am 2009-05-30 18:55:52 UTC (rev 143) @@ -1,10 +1,22 @@ -SUBDIRS = \ - attributes \ - document \ - event \ - node \ - tree \ - xslt +TESTS = test -EXTRA_DIST = harness/harness.pm +AM_CPPFLAGS = -I$(top_srcdir)/include +LIBS = $(top_builddir)/src/libxmlwrapp.la \ + -lboost_unit_test_framework \ + -lboost_iostreams + +noinst_PROGRAMS = test + +test_SOURCES = \ + test_main.cxx \ + attributes/test_attributes.cxx \ + document/test_document.cxx \ + event/test_event.cxx \ + node/test_node.cxx \ + tree/test_tree.cxx + +if WITH_XSLT +LIBS += $(top_builddir)/src/libxsltwrapp.la +test_SOURCES += xslt/test_xslt.cxx +endif Deleted: trunk/tests/attributes/Makefile.am =================================================================== --- trunk/tests/attributes/Makefile.am 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/Makefile.am 2009-05-30 18:55:52 UTC (rev 143) @@ -1,30 +0,0 @@ - -AM_CPPFLAGS = -I$(top_srcdir)/include -LIBS = ../../src/libxmlwrapp.la - -TESTS = runtest.pl - -noinst_PROGRAMS = \ - test_attr-01 \ - test_attr-02 \ - test_attr-03 \ - test_attr-04 \ - test_attr-05 \ - test_attr-06 \ - test_attr-07 \ - test_attr-08 \ - test_attr-09 \ - test_attr-10 - -test_attr_01_SOURCES = test_attr-01.cxx -test_attr_02_SOURCES = test_attr-02.cxx -test_attr_03_SOURCES = test_attr-03.cxx -test_attr_04_SOURCES = test_attr-04.cxx -test_attr_05_SOURCES = test_attr-05.cxx -test_attr_06_SOURCES = test_attr-06.cxx -test_attr_07_SOURCES = test_attr-07.cxx -test_attr_08_SOURCES = test_attr-08.cxx -test_attr_09_SOURCES = test_attr-09.cxx -test_attr_10_SOURCES = test_attr-10.cxx - -EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml $(srcdir)/data/*.dtd runtest.pl Deleted: trunk/tests/attributes/data/05.xml =================================================================== --- trunk/tests/attributes/data/05.xml 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/05.xml 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -<root attr_one="one" attr_two="two" attr_three="three" attr_four="four"/> Deleted: trunk/tests/attributes/data/05a.out =================================================================== --- trunk/tests/attributes/data/05a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/05a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root attr_two="two" attr_three="three" attr_four="four"/> Deleted: trunk/tests/attributes/data/05b.out =================================================================== --- trunk/tests/attributes/data/05b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/05b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root attr_one="one" attr_three="three" attr_four="four"/> Deleted: trunk/tests/attributes/data/05c.out =================================================================== --- trunk/tests/attributes/data/05c.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/05c.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root attr_one="one" attr_two="two" attr_four="four"/> Deleted: trunk/tests/attributes/data/05d.out =================================================================== --- trunk/tests/attributes/data/05d.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/05d.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root attr_one="one" attr_two="two" attr_three="three"/> Deleted: trunk/tests/attributes/data/06a.out =================================================================== --- trunk/tests/attributes/data/06a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/06a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -1 Deleted: trunk/tests/attributes/data/06b.out =================================================================== --- trunk/tests/attributes/data/06b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/06b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -0 Deleted: trunk/tests/attributes/data/07a.out =================================================================== --- trunk/tests/attributes/data/07a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/07a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -0 Deleted: trunk/tests/attributes/data/07b.out =================================================================== --- trunk/tests/attributes/data/07b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/07b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -1 Deleted: trunk/tests/attributes/data/07c.out =================================================================== --- trunk/tests/attributes/data/07c.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/07c.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -2 Deleted: trunk/tests/attributes/data/07d.out =================================================================== --- trunk/tests/attributes/data/07d.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/07d.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -3 Deleted: trunk/tests/attributes/data/09a.out =================================================================== --- trunk/tests/attributes/data/09a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/09a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,3 +0,0 @@ -1 -notend -end Deleted: trunk/tests/attributes/data/09b.out =================================================================== --- trunk/tests/attributes/data/09b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/09b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,3 +0,0 @@ -two -notend -end Deleted: trunk/tests/attributes/data/09c.out =================================================================== --- trunk/tests/attributes/data/09c.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/09c.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,3 +0,0 @@ -three -notend -end Deleted: trunk/tests/attributes/data/10.out =================================================================== --- trunk/tests/attributes/data/10.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/data/10.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -****END**** Deleted: trunk/tests/attributes/runtest.pl =================================================================== --- trunk/tests/attributes/runtest.pl 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/runtest.pl 2009-05-30 18:55:52 UTC (rev 143) @@ -1,141 +0,0 @@ -#!/usr/bin/perl -########################################################################### -# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) -# All Rights Reserved -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name of the Author nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -########################################################################### - -use strict; -use lib qw(../harness); -use harness; - -my $test = harness->new("xml::attributes"); -runtests(); - -########################################################################### -sub runtests { - my $actual_result; - my $good_result; - - ########################################################################### - foreach (qw(01a 01b 01c)) { - $test->start("iteration ($_)"); - $actual_result = `./test_attr-01 data/$_.xml 2>&1`; - - if ($? != 0) { - $test->fail("test process returned $?"); - } else { - $good_result = $test->slurp_file("data/$_.out"); - - my $hash_a = make_hash($actual_result); - my $hash_b = make_hash($good_result); - - if (not comp_hash($hash_a, $hash_b)) { - $test->fail('output did not match expected value'); - } else { - $test->pass(); - } - } - } - ########################################################################### - $test->regression("insert(name, value) (02)", "./test_attr-02 data/02.xml", "data/02.out"); - ########################################################################### - foreach my $pair ((['one', 0], ['two', 0], ['three', 0], ['missing', 1], ['also_missing', 1])) { - $test->run_test_exit_status("find(name) (03)", "./test_attr-03 data/03.xml $pair->[0]", $pair->[1]); - } - ########################################################################### - foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) { - $test->regression("remove(iterator) (04$pair->[0])", "./test_attr-04 data/04.xml $pair->[1]", "data/04$pair->[0].out"); - } - ########################################################################### - foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) { - $test->regression("remove(const char*) (05$pair->[0])", "./test_attr-05 data/05.xml $pair->[1]", "data/05$pair->[0].out"); - } - ########################################################################### - foreach (qw(a b)) { - $test->regression("empty (06$_)", "./test_attr-06 data/06$_.xml", "data/06$_.out"); - } - ########################################################################### - foreach (qw(a b c d)) { - $test->regression("size (07$_)", "./test_attr-07 data/07$_.xml", "data/07$_.out"); - } - ########################################################################### - $test->start("copy constructor (08)"); - $actual_result = `./test_attr-08 data/08.xml 2>&1`; - - if ($? != 0) { - $test->fail("test process returned $?"); - } else { - $good_result = $test->slurp_file("data/08.out"); - - my $hash_a = make_hash($actual_result); - my $hash_b = make_hash($good_result); - - if (not comp_hash($hash_a, $hash_b)) { - $test->fail('output did not match expected value'); - } else { - $test->pass(); - } - } - ########################################################################### - foreach ((['a', 'one'], ['b', 'two'], ['c', 'three'])) { - $test->regression("dtd attr (09$_->[0])", "./test_attr-09 data/09.xml $_->[1]", "data/09$_->[0].out"); - } - ########################################################################### - $test->regression("dtd implied (10)", "./test_attr-10 data/10.xml optional", "data/10.out"); - ########################################################################### -} -########################################################################### -sub make_hash { - my $data = shift; - my ($key, $value); - my %hash; - - foreach my $line (split(/\n/, $data)) { - my ($key, $value) = split(/=/, $line, 2); - next if not defined $key or not defined $value; - $hash{$key} = $value; - } - - return \%hash; -} -########################################################################### -sub comp_hash { - my $hash_a = shift; - my $hash_b = shift; - - if (scalar keys %$hash_a != scalar keys %$hash_b) { return 0; } - foreach my $key (keys %$hash_a) { - if (not exists $hash_b->{$key}) { return 0; } - if ($hash_a->{$key} ne $hash_b->{$key}) { return 0; } - } - - return 1; -} -########################################################################### Deleted: trunk/tests/attributes/test_attr-01.cxx =================================================================== --- trunk/tests/attributes/test_attr-01.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-01.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes function can see all the attributes of - * a node. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - try { - xml::tree_parser parser(argv[1]); - - const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.begin(), end=attrs.end(); - for (; i!=end; ++i) { std::cout << i->get_name() << "=" << i->get_value() << "\n"; } - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-02.cxx =================================================================== --- trunk/tests/attributes/test_attr-02.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-02.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes::insert function works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - try { - xml::tree_parser parser(argv[1]); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - attrs.insert("b", "b"); - - std::cout << parser.get_document(); - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-03.cxx =================================================================== --- trunk/tests/attributes/test_attr-03.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-03.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes::find works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 3) return 1; - - try { - xml::tree_parser parser(argv[1]); - - const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.find(argv[2]); - - if (i == attrs.end()) return 1; - return 0; - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-04.cxx =================================================================== --- trunk/tests/attributes/test_attr-04.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-04.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes::remove(iterator) works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 3) return 1; - - try { - xml::tree_parser parser(argv[1]); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::iterator i=attrs.find(argv[2]); - - if (i == attrs.end()) return 1; - attrs.erase(i); - - std::cout << parser.get_document(); - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-05.cxx =================================================================== --- trunk/tests/attributes/test_attr-05.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-05.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes::remove(const char*) works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 3) return 1; - - try { - xml::tree_parser parser(argv[1]); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - attrs.erase(argv[2]); - - std::cout << parser.get_document(); - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-06.cxx =================================================================== --- trunk/tests/attributes/test_attr-06.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-06.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes::empty() works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - try { - xml::tree_parser parser(argv[1]); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - std::cout << attrs.empty() << "\n"; - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-07.cxx =================================================================== --- trunk/tests/attributes/test_attr-07.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-07.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if xml::attributes::size() works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - try { - xml::tree_parser parser(argv[1]); - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - std::cout << attrs.size() << "\n"; - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-08.cxx =================================================================== --- trunk/tests/attributes/test_attr-08.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-08.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if the xml::attributes copy constructor works. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - try { - xml::tree_parser parser(argv[1]); - - /* MAKE A COPY! */ - xml::attributes attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.begin(), end=attrs.end(); - for (; i!=end; ++i) std::cout << i->get_name() << "=" << i->get_value() << "\n"; - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-09.cxx =================================================================== --- trunk/tests/attributes/test_attr-09.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-09.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if xml::attributes::find() can see DTD default attributes - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 3) return 1; - - try { - xml::tree_parser parser(argv[1]); - - if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) { - std::cerr << "xml not valid\n"; - return 1; - } - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.find(argv[2]); - - std::cout << i->get_value() << "\n"; - std::cout << (i == attrs.end() ? "end" : "notend") << "\n"; - - ++i; - - std::cout << (i == attrs.end() ? "end" : "notend") << "\n"; - } catch ( ... ) { return 1; } - - return 0; -} Deleted: trunk/tests/attributes/test_attr-10.cxx =================================================================== --- trunk/tests/attributes/test_attr-10.cxx 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/attributes/test_attr-10.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of the Author nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test to see if xml::attributes::find() will die when DTD default - * attributes are really implied. - */ - -#include <xmlwrapp/xmlwrapp.h> -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 3) return 1; - - try { - xml::tree_parser parser(argv[1]); - - if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) { - std::cerr << "xml not valid\n"; - return 1; - } - - xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); - xml::attributes::const_iterator i=attrs.find(argv[2]); - - if (i == attrs.end()) std::cout << "****END****\n"; - else std::cout << i->get_value() << "\n"; - - } catch ( ... ) { return 1; } - - return 0; -} Added: trunk/tests/attributes/test_attributes.cxx =================================================================== --- trunk/tests/attributes/test_attributes.cxx (rev 0) +++ trunk/tests/attributes/test_attributes.cxx 2009-05-30 18:55:52 UTC (rev 143) @@ -0,0 +1,288 @@ +/* + * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) + * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "../test.h" + + +BOOST_AUTO_TEST_SUITE( attributes ) + +/* + * Test to see if the xml::attributes function can see all the attributes of + * a node. + */ + +static void do_attr_read(const std::string& prefix) +{ + std::ostringstream ostr; + + xml::tree_parser parser(test_file_path(prefix + ".xml").c_str()); + + const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::const_iterator i=attrs.begin(), end=attrs.end(); + for (; i!=end; ++i) + { + ostr << i->get_name() << "=" << i->get_value() << "\n"; + } + + BOOST_CHECK( is_same_as_file(ostr, prefix + ".out") ); +} + +BOOST_AUTO_TEST_CASE( read ) +{ + do_attr_read("attributes/data/01a"); + do_attr_read("attributes/data/01b"); + do_attr_read("attributes/data/01c"); +} + + +/* + * Test to see if the xml::attributes::insert function works. + */ + +BOOST_AUTO_TEST_CASE( insert ) +{ + xml::tree_parser parser(test_file_path("attributes/data/02.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + attrs.insert("b", "b"); + + BOOST_CHECK( is_same_as_file(parser.get_document(), "attributes/data/02.out") ); +} + + +/* + * Test to see if the xml::attributes::find works. + */ + +static bool do_attr_find(const xml::document& doc, + const char *to_find, + const char *expected_value) +{ + const xml::attributes &attrs = doc.get_root_node().get_attributes(); + xml::attributes::const_iterator i = attrs.find(to_find); + + if ( i == attrs.end() ) + return false; + + BOOST_CHECK_EQUAL( i->get_name(), to_find ); + BOOST_CHECK_EQUAL( i->get_value(), expected_value ); + + return true; +} + +BOOST_AUTO_TEST_CASE( find ) +{ + xml::tree_parser parser(test_file_path("attributes/data/03.xml").c_str()); + const xml::document& doc = parser.get_document(); + + BOOST_CHECK( do_attr_find(doc, "one", "1") == true ); + BOOST_CHECK( do_attr_find(doc, "two", "2") == true ); + BOOST_CHECK( do_attr_find(doc, "three", "3") == true ); + BOOST_CHECK( do_attr_find(doc, "missing", NULL) == false ); + BOOST_CHECK( do_attr_find(doc, "also_missing", NULL) == false ); +} + + +/* + * Test to see if the xml::attributes::remove(iterator) works. + */ + +static void do_remove_by_iter(const char *name, const char *outfile) +{ + xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::iterator i = attrs.find(name); + + BOOST_REQUIRE( i != attrs.end() ); + attrs.erase(i); + + BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); +} + +BOOST_AUTO_TEST_CASE( remove_by_iter ) +{ + do_remove_by_iter("attr_one", "attributes/data/04a.out"); + do_remove_by_iter("attr_two", "attributes/data/04b.out"); + do_remove_by_iter("attr_three", "attributes/data/04c.out"); + do_remove_by_iter("attr_four", "attributes/data/04d.out"); +} + + +/* + * Test to see if the xml::attributes::remove(const char*) works. + */ + +static void do_remove_by_name(const char *name, const char *outfile) +{ + xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + attrs.erase(name); + + BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) ); +} + +BOOST_AUTO_TEST_CASE( remove_by_name ) +{ + do_remove_by_name("attr_one", "attributes/data/04a.out"); + do_remove_by_name("attr_two", "attributes/data/04b.out"); + do_remove_by_name("attr_three", "attributes/data/04c.out"); + do_remove_by_name("attr_four", "attributes/data/04d.out"); +} + + +/* + * Test to see if xml::attributes::find() can see DTD default attributes + */ + +BOOST_AUTO_TEST_CASE( find_dtd_default_attr ) +{ + xml::tree_parser parser(test_file_path("attributes/data/09.xml").c_str()); + + BOOST_CHECK( parser.get_document().has_internal_subset() ); + BOOST_CHECK( parser.get_document().validate() ); + + const xml::attributes &attrs = + parser.get_document().get_root_node().get_attributes(); + + { + xml::attributes::const_iterator i = attrs.find("one"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "1" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } + + { + xml::attributes::const_iterator i = attrs.find("two"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "two" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } + + { + xml::attributes::const_iterator i = attrs.find("three"); + BOOST_REQUIRE( i != attrs.end() ); + BOOST_CHECK_EQUAL( i->get_value(), "three" ); + ++i; + BOOST_CHECK( i == attrs.end() ); + } +} + + +/* + * Test to see if xml::attributes::find() will die when DTD default + * attributes are really implied. + */ + +BOOST_AUTO_TEST_CASE( dtd_implied ) +{ + xml::tree_parser parser(test_file_path("attributes/data/10.xml").c_str()); + + BOOST_CHECK( parser.get_document().has_internal_subset() ); + BOOST_CHECK( parser.get_document().validate() ); + + const xml::attributes &attrs = + parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( attrs.find("optional") == attrs.end() ); +} + + +/* + * Test to see if the xml::attributes copy constructor works. + */ + +BOOST_AUTO_TEST_CASE( attr_copy_ctor ) +{ + std::ostringstream ostr; + xml::tree_parser parser(test_file_path("attributes/data/08.xml").c_str()); + + // make a copy + xml::attributes attrs = parser.get_document().get_root_node().get_attributes(); + xml::attributes::const_iterator i = attrs.begin(), end = attrs.end(); + + for ( ; i != end; ++i ) + ostr << i->get_name() << "=" << i->get_value() << "\n"; + + BOOST_CHECK( is_same_as_file(ostr, "attributes/data/08.out") ); +} + +BOOST_AUTO_TEST_SUITE_END() + + +/* + * Test to see if the xml::attributes::empty() works. + */ + +BOOST_AUTO_TEST_CASE( attr_empty_a ) +{ + xml::tree_parser parser(test_file_path("attributes/data/06a.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( attrs.empty() ); +} + +BOOST_AUTO_TEST_CASE( attr_empty_b ) +{ + xml::tree_parser parser(test_file_path("attributes/data/06b.xml").c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + + BOOST_CHECK( !attrs.empty() ); +} + + +/* + * Test to see if xml::attributes::size() works. + */ + +static int do_get_attr_size(const char *testfile) +{ + xml::tree_parser parser(test_file_path(testfile).c_str()); + + xml::attributes &attrs = parser.get_document().get_root_node().get_attributes(); + return attrs.size(); +} + +BOOST_AUTO_TEST_CASE( attr_size ) +{ + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07a.xml"), 0 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07b.xml"), 1 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07c.xml"), 2 ); + BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07d.xml"), 3 ); +} Deleted: trunk/tests/document/Makefile.am =================================================================== --- trunk/tests/document/Makefile.am 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/Makefile.am 2009-05-30 18:55:52 UTC (rev 143) @@ -1,54 +0,0 @@ - -AM_CPPFLAGS = -I$(top_srcdir)/include -LIBS = ../../src/libxmlwrapp.la - -TESTS = runtest.pl - -noinst_PROGRAMS = \ - test_document-01 \ - test_document-02 \ - test_document-03 \ - test_document-04 \ - test_document-05 \ - test_document-06 \ - test_document-07 \ - test_document-08 \ - test_document-09 \ - test_document-10 \ - test_document-11 \ - test_document-12 \ - test_document-13 \ - test_document-14 \ - test_document-15 \ - test_document-16 \ - test_document-17 \ - test_document-18 \ - test_document-19 \ - test_document-20 \ - test_document-21 \ - test_document-22 - -test_document_01_SOURCES = test_document-01.cxx -test_document_02_SOURCES = test_document-02.cxx -test_document_03_SOURCES = test_document-03.cxx -test_document_04_SOURCES = test_document-04.cxx -test_document_05_SOURCES = test_document-05.cxx -test_document_06_SOURCES = test_document-06.cxx -test_document_07_SOURCES = test_document-07.cxx -test_document_08_SOURCES = test_document-08.cxx -test_document_09_SOURCES = test_document-09.cxx -test_document_10_SOURCES = test_document-10.cxx -test_document_11_SOURCES = test_document-11.cxx -test_document_12_SOURCES = test_document-12.cxx -test_document_13_SOURCES = test_document-13.cxx -test_document_14_SOURCES = test_document-14.cxx -test_document_15_SOURCES = test_document-15.cxx -test_document_16_SOURCES = test_document-16.cxx -test_document_17_SOURCES = test_document-17.cxx -test_document_18_SOURCES = test_document-18.cxx -test_document_19_SOURCES = test_document-19.cxx -test_document_20_SOURCES = test_document-20.cxx -test_document_21_SOURCES = test_document-21.cxx -test_document_22_SOURCES = test_document-22.cxx - -EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl Deleted: trunk/tests/document/data/05.out =================================================================== --- trunk/tests/document/data/05.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/05.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root>pcdata</root> Deleted: trunk/tests/document/data/06.out =================================================================== --- trunk/tests/document/data/06.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/06.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root>pcdata</root> Deleted: trunk/tests/document/data/07.out =================================================================== --- trunk/tests/document/data/07.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/07.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<root>pcdata</root> Deleted: trunk/tests/document/data/09.out =================================================================== --- trunk/tests/document/data/09.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/09.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -1.1 Deleted: trunk/tests/document/data/10.xml =================================================================== --- trunk/tests/document/data/10.xml 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/10.xml 2009-05-30 18:55:52 UTC (rev 143) @@ -1,2 +0,0 @@ -<?xml version="1.1"?> -<root/> Deleted: trunk/tests/document/data/11.out =================================================================== --- trunk/tests/document/data/11.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/11.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -UTF-8 Deleted: trunk/tests/document/data/12.xml =================================================================== --- trunk/tests/document/data/12.xml 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/12.xml 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -<root/> Modified: trunk/tests/document/data/13a.out =================================================================== --- trunk/tests/document/data/13a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/13a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,3 +1,2 @@ -0 <?xml version="1.0" standalone="yes"?> <root/> Modified: trunk/tests/document/data/13b.out =================================================================== --- trunk/tests/document/data/13b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/13b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,3 +1,2 @@ -1 <?xml version="1.0" standalone="no"?> <root/> Modified: trunk/tests/document/data/14.out =================================================================== --- trunk/tests/document/data/14.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/14.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,4 +1,3 @@ -1 <?xml version="1.0"?> <root xmlns:xi="http://www.w3.org/2001/XInclude"> <child> Deleted: trunk/tests/document/data/16.out =================================================================== --- trunk/tests/document/data/16.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/16.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1,5 +0,0 @@ -1 -2 -2 -1 -1 Deleted: trunk/tests/document/data/18a.out =================================================================== --- trunk/tests/document/data/18a.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/18a.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -xml::document::push_back can't take element type nodes Deleted: trunk/tests/document/data/18b.out =================================================================== --- trunk/tests/document/data/18b.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/18b.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -xml::document::insert can't take element type nodes Deleted: trunk/tests/document/data/18c.out =================================================================== --- trunk/tests/document/data/18c.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/18c.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -xml::document::insert can't take element type nodes Deleted: trunk/tests/document/data/20.out =================================================================== --- trunk/tests/document/data/20.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/20.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -xml::document::replace can't replace element type nodes Deleted: trunk/tests/document/data/22.out =================================================================== --- trunk/tests/document/data/22.out 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/data/22.out 2009-05-30 18:55:52 UTC (rev 143) @@ -1 +0,0 @@ -xml::document::erase can't erase element type nodes Deleted: trunk/tests/document/runtest.pl =================================================================== --- trunk/tests/document/runtest.pl 2009-05-17 18:56:30 UTC (rev 142) +++ trunk/tests/document/runtest.pl 2009-05-30 18:55:52 UTC (rev 143) @@ -1,89 +0,0 @@ -#!/usr/bin/perl -########################################################################### -# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) -# All Rights Reserved -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions ... [truncated message content] |
From: <vac...@us...> - 2009-12-20 12:47:37
|
Revision: 163 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=163&view=rev Author: vaclavslavik Date: 2009-12-20 12:47:30 +0000 (Sun, 20 Dec 2009) Log Message: ----------- Added XMLWRAPP_CHECK_VERSION macro. Modified Paths: -------------- trunk/NEWS trunk/include/Makefile.am trunk/include/xmlwrapp/xmlwrapp.h Added Paths: ----------- trunk/include/xmlwrapp/version.h Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/NEWS 2009-12-20 12:47:30 UTC (rev 163) @@ -1,6 +1,8 @@ Fixed xml::tree_parser to fail on non-fatal parser errors. + Added XMLWRAPP_CHECK_VERSION macro. + Version 0.6.1 Added Visual C++ 200x projects and fixed VC6 project. Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/include/Makefile.am 2009-12-20 12:47:30 UTC (rev 163) @@ -9,6 +9,7 @@ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ xmlwrapp/tree_parser.h \ + xmlwrapp/version.h \ xmlwrapp/xmlwrapp.h if WITH_XSLT Added: trunk/include/xmlwrapp/version.h =================================================================== --- trunk/include/xmlwrapp/version.h (rev 0) +++ trunk/include/xmlwrapp/version.h 2009-12-20 12:47:30 UTC (rev 163) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/** + @file + + This file contains the XMLWRAPP_CHECK_VERSION macro. + */ + +#ifndef _xmlwrapp_version_h_ +#define _xmlwrapp_version_h_ + +#define XMLWRAPP_VERSION_MAJOR 0 +#define XMLWRAPP_VERSION_MINOR 6 +#define XMLWRAPP_VERSION_MICRO 2 + +/** + Checks if xmlwrapp version is at least @a major.@a minor.@a micro. + */ +#define XMLWRAPP_CHECK_VERSION(major, minor, micro) \ + ( \ + XMLWRAPP_VERSION_MAJOR > (major) \ + || \ + (XMLWRAPP_VERSION_MAJOR == (major) && \ + XMLWRAPP_VERSION_MINOR >= (minor)) \ + || \ + (XMLWRAPP_VERSION_MAJOR == (major) && \ + (XMLWRAPP_VERSION_MINOR == (minor) && \ + XMLWRAPP_VERSION_MICRO >= (micro)) \ + ) + +#endif // _xmlwrapp_version_h_ Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/include/xmlwrapp/xmlwrapp.h 2009-12-20 12:47:30 UTC (rev 163) @@ -33,6 +33,7 @@ #ifndef _xmlwrapp_xmlwrapp_h_ #define _xmlwrapp_xmlwrapp_h_ +#include "xmlwrapp/version.h" #include "xmlwrapp/init.h" #include "xmlwrapp/nodes_view.h" #include "xmlwrapp/node.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-02-11 23:13:33
|
Revision: 168 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=168&view=rev Author: vaclavslavik Date: 2010-02-11 23:13:26 +0000 (Thu, 11 Feb 2010) Log Message: ----------- Fix compilation with Sun Studio. When not using -library=stlport4 option, the ancient standard library doesn't conform to the standard. In particular, it doesn't provide std::distance() with correct signature. Work around this by implementing it ourselves. Modified Paths: -------------- trunk/NEWS trunk/src/libxml/document.cxx trunk/src/libxml/node.cxx trunk/src/libxml/utility.h trunk/tests/document/test_document.cxx Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/NEWS 2010-02-11 23:13:26 UTC (rev 168) @@ -1,4 +1,6 @@ + Fixed compilation with Sun Studio compiler. + Version 0.6.2 Fixed xml::tree_parser to fail on non-fatal parser errors. Modified: trunk/src/libxml/document.cxx =================================================================== --- trunk/src/libxml/document.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/document.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -335,7 +335,8 @@ document::size_type document::size() const { - return std::distance(begin(), end()); + using namespace std; + return distance(begin(), end()); } Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/node.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -519,7 +519,8 @@ node::size_type node::size() const { - return std::distance(begin(), end()); + using namespace std; + return distance(begin(), end()); } Modified: trunk/src/libxml/utility.h =================================================================== --- trunk/src/libxml/utility.h 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/utility.h 2010-02-11 23:13:26 UTC (rev 168) @@ -33,6 +33,8 @@ #ifndef _xmlwrapp_utility_h_ #define _xmlwrapp_utility_h_ +#include <xmlwrapp/node.h> + // standard includes #include <string> #include <cstdarg> @@ -65,8 +67,21 @@ void printf2string(std::string& s, const char *message, va_list ap); +// Sun CC uses ancient C++ standard library that doesn't have standard +// std::distance(). Work around it here +#if defined(__SUNPRO_CC) && !defined(_STLPORT_VERSION) +inline size_t distance(xml::node::const_iterator a, xml::node::const_iterator b) +{ + size_t n = 0; + for ( ; a != b; ++a ) + ++n; + return n; +} +#endif // defined(__SUNPRO_CC) && !defined(_STLPORT_VERSION) + } // namespace impl } // namespace xml + #endif // _xmlwrapp_utility_h_ Modified: trunk/tests/document/test_document.cxx =================================================================== --- trunk/tests/document/test_document.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/tests/document/test_document.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -413,6 +413,7 @@ } +#ifndef __SUNPRO_CC // SunCC can't compile gzip_decompressor BOOST_AUTO_TEST_CASE( save_to_file_gzip ) { xml::document doc("root"); @@ -432,6 +433,7 @@ remove(TEST_FILE); } +#endif // !__SUNPRO_CC BOOST_AUTO_TEST_SUITE_END() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-10 18:24:55
|
Revision: 173 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=173&view=rev Author: vaclavslavik Date: 2010-03-10 18:24:44 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Add support for ELF symbols visibility. The libraries are now built so that only public API symbols are exported into shared library. This means fewer symbols to resolve at runtime and smaller risk of any symbols conflicts. Modified Paths: -------------- trunk/bootstrap trunk/configure.ac trunk/include/Makefile.am trunk/include/xmlwrapp/_cbfo.h trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/exception.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xsltwrapp/init.h trunk/include/xsltwrapp/stylesheet.h trunk/src/Makefile.am trunk/src/libxml/utility.cxx Added Paths: ----------- trunk/admin/visibility.m4 trunk/include/xmlwrapp/export.h Added: trunk/admin/visibility.m4 =================================================================== --- trunk/admin/visibility.m4 (rev 0) +++ trunk/admin/visibility.m4 2010-03-10 18:24:44 UTC (rev 173) @@ -0,0 +1,132 @@ +dnl visibility.m4 serial 1 (gettext-0.15) +dnl Copyright (C) 2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Modified for use in wxWidgets by Vaclav Slavik: +dnl - don't define HAVE_VISIBILITY (=0) if not supported +dnl - use -fvisibility-inlines-hidden too +dnl - test in C++ mode + +dnl Tests whether the compiler supports the command-line option +dnl -fvisibility=hidden and the function and variable attributes +dnl __attribute__((__visibility__("hidden"))) and +dnl __attribute__((__visibility__("default"))). +dnl Does *not* test for __visibility__("protected") - which has tricky +dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on +dnl MacOS X. +dnl Does *not* test for __visibility__("internal") - which has processor +dnl dependent semantics. +dnl Does *not* test for #pragma GCC visibility push(hidden) - which is +dnl "really only recommended for legacy code". +dnl Set the variable CFLAG_VISIBILITY. +dnl Defines and sets the variable HAVE_VISIBILITY. + +AC_DEFUN([XMLWRAPP_VISIBILITY], +[ + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then + CFLAGS_VISIBILITY="-fvisibility=hidden" + CXXFLAGS_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden" + AC_MSG_CHECKING([for symbols visibility support]) + AC_CACHE_VAL(wx_cv_cc_visibility, [ + wx_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY" + AC_LANG_PUSH(C++) + AC_TRY_COMPILE( + [ + /* we need gcc >= 4.0, older versions with visibility support + didn't have class visibility: */ + #if defined(__GNUC__) && __GNUC__ < 4 + error this gcc is too old; + #endif + + /* visibility only makes sense for ELF shared libs: */ + #if !defined(__ELF__) && !defined(__APPLE__) + error this platform has no visibility; + #endif + + extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + class __attribute__((__visibility__("default"))) Foo { + Foo() {} + }; + ], + [], + wx_cv_cc_visibility=yes, + wx_cv_cc_visibility=no) + AC_LANG_POP() + CXXFLAGS="$wx_save_CXXFLAGS"]) + AC_MSG_RESULT([$wx_cv_cc_visibility]) + if test $wx_cv_cc_visibility = yes; then + dnl we do have basic visibility support, now check if we can use it: + dnl + dnl Debian/Ubuntu's gcc 4.1 is affected: + dnl https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262 + AC_MSG_CHECKING([for broken libstdc++ visibility]) + AC_CACHE_VAL(wx_cv_cc_broken_libstdcxx_visibility, [ + wx_save_CXXFLAGS="$CXXFLAGS" + wx_save_LDFLAGS="$LDFLAGS" + CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY" + LDFLAGS="$LDFLAGS -shared -fPIC" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [ + #include <string> + ], + [ + std::string s("hello"); + return s.length(); + ], + wx_cv_cc_broken_libstdcxx_visibility=no, + wx_cv_cc_broken_libstdcxx_visibility=yes) + AC_LANG_POP() + CXXFLAGS="$wx_save_CXXFLAGS" + LDFLAGS="$wx_save_LDFLAGS"]) + AC_MSG_RESULT([$wx_cv_cc_broken_libstdcxx_visibility]) + + if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then + AC_MSG_CHECKING([whether we can work around it]) + AC_CACHE_VAL(wx_cv_cc_visibility_workaround, [ + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [ + #pragma GCC visibility push(default) + #include <string> + #pragma GCC visibility pop + ], + [ + std::string s("hello"); + return s.length(); + ], + wx_cv_cc_visibility_workaround=no, + wx_cv_cc_visibility_workaround=yes) + AC_LANG_POP() + ]) + AC_MSG_RESULT([$wx_cv_cc_visibility_workaround]) + + if test $wx_cv_cc_visibility_workaround = no; then + dnl we can't use visibility at all then + wx_cv_cc_visibility=no + fi + fi + fi + + if test $wx_cv_cc_visibility = yes; then + AC_DEFINE([HAVE_VISIBILITY]) + if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then + AC_DEFINE([HAVE_BROKEN_LIBSTDCXX_VISIBILITY]) + fi + else + CFLAGS_VISIBILITY="" + CXXFLAGS_VISIBILITY="" + fi + AC_SUBST([CFLAGS_VISIBILITY]) + AC_SUBST([CXXFLAGS_VISIBILITY]) + fi +]) Modified: trunk/bootstrap =================================================================== --- trunk/bootstrap 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/bootstrap 2010-03-10 18:24:44 UTC (rev 173) @@ -47,7 +47,7 @@ # --copy to allow simultaneous use on windows under mingw and cygwin platforms. # Symlinking of files under mingw does not work out for cygwin and vice-versa. echo "Setting up build system for xmlwrapp:" -echo " - aclocal " && aclocal && \ +echo " - aclocal " && aclocal -I admin && \ echo " - libtoolize " && libtoolize --copy --automake && \ echo " - autoconf " && autoconf && \ echo " - automake " && automake --add-missing --copy --foreign && \ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/configure.ac 2010-03-10 18:24:44 UTC (rev 173) @@ -95,6 +95,8 @@ CXXFLAGS="$CXXFLAGS -W -Wall -Wcast-align -Wwrite-strings" fi +dnl Check if the compiler supports symbols visibility: +XMLWRAPP_VISIBILITY dnl === Generate output files === Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/Makefile.am 2010-03-10 18:24:44 UTC (rev 173) @@ -6,6 +6,7 @@ xmlwrapp/document.h \ xmlwrapp/event_parser.h \ xmlwrapp/exception.h \ + xmlwrapp/export.h \ xmlwrapp/init.h \ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ Modified: trunk/include/xmlwrapp/_cbfo.h =================================================================== --- trunk/include/xmlwrapp/_cbfo.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/_cbfo.h 2010-03-10 18:24:44 UTC (rev 173) @@ -33,6 +33,9 @@ #ifndef _xmlwrapp_cbfo_h_ #define _xmlwrapp_cbfo_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + #include <functional> namespace xml @@ -44,7 +47,7 @@ { // helper for xml::node::sort() - struct cbfo_node_compare + struct XMLWRAPP_API cbfo_node_compare : public std::binary_function<xml::node, xml::node, bool> { virtual ~cbfo_node_compare() {} Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/attributes.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -67,7 +68,7 @@ The iterator classes allow you to access one XML attribute. This is done using the xml::attributes::attr class interface. */ -class attributes +class XMLWRAPP_API attributes { public: /// size type @@ -169,8 +170,8 @@ /// postfix increment (avoid if possible for better performance) iterator operator++(int); - friend bool operator==(const iterator& lhs, const iterator& rhs); - friend bool operator!=(const iterator& lhs, const iterator& rhs); + friend bool XMLWRAPP_API operator==(const iterator& lhs, const iterator& rhs); + friend bool XMLWRAPP_API operator!=(const iterator& lhs, const iterator& rhs); private: impl::ait_impl *pimpl_; @@ -211,8 +212,8 @@ /// postfix increment (avoid if possible better for performance) const_iterator operator++ (int); - friend bool operator== (const const_iterator &lhs, const const_iterator &rhs); - friend bool operator!= (const const_iterator &lhs, const const_iterator &rhs); + friend bool XMLWRAPP_API operator== (const const_iterator &lhs, const const_iterator &rhs); + friend bool XMLWRAPP_API operator!= (const const_iterator &lhs, const const_iterator &rhs); private: impl::ait_impl *pimpl_; Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/document.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" #include "xmlwrapp/node.h" +#include "xmlwrapp/export.h" // standard includes #include <iosfwd> @@ -75,7 +76,7 @@ The xml::document class is used to hold the XML tree and various bits of information about it. */ -class document +class XMLWRAPP_API document { public: /// size type @@ -437,7 +438,7 @@ @param doc The document to insert. @return The stream from the first parameter. */ - friend std::ostream& operator<< (std::ostream &stream, const document &doc); + friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream, const document &doc); private: impl::doc_impl *pimpl_; Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/event_parser.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -62,7 +63,7 @@ use this class you derive a sub-class from it and override the protected virtual functions. */ -class event_parser +class XMLWRAPP_API event_parser { public: /// a type for holding XML node attributes Modified: trunk/include/xmlwrapp/exception.h =================================================================== --- trunk/include/xmlwrapp/exception.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/exception.h 2010-03-10 18:24:44 UTC (rev 173) @@ -39,6 +39,9 @@ #ifndef _xmlwrapp_exception_h_ #define _xmlwrapp_exception_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + #include <stdexcept> #include <string> @@ -55,7 +58,7 @@ @since 0.7.0 */ -class exception : public std::runtime_error +class XMLWRAPP_API exception : public std::runtime_error { public: explicit exception(const std::string& what) : std::runtime_error(what) Copied: trunk/include/xmlwrapp/export.h (from rev 172, trunk/include/xmlwrapp/exception.h) =================================================================== --- trunk/include/xmlwrapp/export.h (rev 0) +++ trunk/include/xmlwrapp/export.h 2010-03-10 18:24:44 UTC (rev 173) @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Vaclav Slavik <vs...@fa...> + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of the Author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _xmlwrapp_export_h_ +#define _xmlwrapp_export_h_ + +#ifdef HAVE_VISIBILITY + #define XMLWRAPP_API __attribute__ ((visibility("default"))) + #define XSLTWRAPP_API __attribute__ ((visibility("default"))) +#else + #define XMLWRAPP_API + #define XSLTWRAPP_API +#endif + +#endif // _xmlwrapp_export_h_ Modified: trunk/include/xmlwrapp/init.h =================================================================== --- trunk/include/xmlwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/init.h 2010-03-10 18:24:44 UTC (rev 173) @@ -39,6 +39,9 @@ #ifndef _xmlwrapp_init_h_ #define _xmlwrapp_init_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + /// XML library namespace namespace xml { @@ -57,7 +60,7 @@ use. This is no longer true: user code doesn't have to create any instances, but it @em can create as many instances as it wants. */ -class init +class XMLWRAPP_API init { public: init(); Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/node.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // hidden stuff #include "xmlwrapp/_cbfo.h" @@ -82,7 +83,7 @@ ANY operation to the xml::node. If you need the data to stick around a little longer you should put it inside a std::string. */ -class node +class XMLWRAPP_API node { public: /// size type @@ -787,7 +788,7 @@ @param n The node to write to the stream. @return The stream. */ - friend std::ostream& operator<< (std::ostream &stream, const node &n); + friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream, const node &n); private: impl::node_impl *pimpl_; Modified: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/nodes_view.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <iterator> @@ -73,7 +74,7 @@ @see xml::node::elements(), xml::node::elements(const char *) */ -class nodes_view +class XMLWRAPP_API nodes_view { public: nodes_view() : data_begin_(0), advance_func_(0) {} @@ -235,7 +236,7 @@ @since 0.6.0 */ -class const_nodes_view +class XMLWRAPP_API const_nodes_view { public: const_nodes_view() : data_begin_(0), advance_func_(0) {} Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/tree_parser.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -64,7 +65,7 @@ After constructing a tree_parser, with either a file to parse or some in memory data to parse, you can walk the tree using the xml::node interface. */ -class tree_parser +class XMLWRAPP_API tree_parser { public: typedef std::size_t size_type; Modified: trunk/include/xsltwrapp/init.h =================================================================== --- trunk/include/xsltwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xsltwrapp/init.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" /// XSLT library namespace namespace xslt @@ -59,7 +60,7 @@ use. This is no longer true: user code doesn't have to create any instances, but it @em can create as many instances as it wants. */ -class init : public xml::init +class XSLTWRAPP_API init : public xml::init { public: init(); Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xsltwrapp/stylesheet.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xsltwrapp/init.h" #include "xmlwrapp/document.h" +#include "xmlwrapp/export.h" // standard includes #include <map> @@ -55,7 +56,7 @@ stylesheet. You can use it to load in a stylesheet and then use that stylesheet to transform an XML document to something else. */ -class stylesheet +class XSLTWRAPP_API stylesheet { public: struct pimpl; Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/src/Makefile.am 2010-03-10 18:24:44 UTC (rev 173) @@ -1,5 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include $(CXXFLAGS_VISIBILITY) if WITH_XSLT lib_LTLIBRARIES = libxmlwrapp.la libxsltwrapp.la Modified: trunk/src/libxml/utility.cxx =================================================================== --- trunk/src/libxml/utility.cxx 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/src/libxml/utility.cxx 2010-03-10 18:24:44 UTC (rev 173) @@ -58,7 +58,8 @@ namespace impl { -void printf2string(std::string& s, const char *message, va_list ap) +// this function is used by libxsltwrapp too, so we must export it +XMLWRAPP_API void printf2string(std::string& s, const char *message, va_list ap) { char buffer[512]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tbr...@us...> - 2012-03-18 19:50:53
|
Revision: 188 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=188&view=rev Author: tbrowder2 Date: 2012-03-18 19:50:46 +0000 (Sun, 18 Mar 2012) Log Message: ----------- incorporate changes from forked version on github Modified Paths: -------------- trunk/LICENSE trunk/bootstrap trunk/include/xmlwrapp/exception.h trunk/include/xmlwrapp/export.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/version.h trunk/platform/Win32/master.proj trunk/src/libxml/node.cxx trunk/src/libxml/node_iterator.cxx trunk/src/libxml/node_iterator.h trunk/src/libxml/nodes_view.cxx trunk/src/libxml/pimpl_base.h trunk/src/libxslt/result.h trunk/tests/Makefile.am trunk/tests/attributes/test_attributes.cxx trunk/tests/event/test_event.cxx trunk/tests/node/test_node.cxx trunk/tests/test.h trunk/tests/test_main.cxx trunk/tests/tree/test_tree.cxx trunk/tests/xslt/test_xslt.cxx Modified: trunk/LICENSE =================================================================== --- trunk/LICENSE 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/LICENSE 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ Copyright (C) 2001-2003 Peter J Jones <pj...@pm...> -Copyright (C) 2009-2010 Vaclav Slavik <vs...@fa...> +Copyright (C) 2009-2010 Vaclav Slavik <vs...@gm...> All Rights Reserved Redistribution and use in source and binary forms, with or without Modified: trunk/bootstrap =================================================================== --- trunk/bootstrap 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/bootstrap 2012-03-18 19:50:46 UTC (rev 188) @@ -42,13 +42,19 @@ exit 2 fi +if [ "${OSTYPE:0:6}" = "darwin" ]; then + LIBTOOLIZE=glibtoolize +else + LIBTOOLIZE=libtoolize +fi + # use --foreign with automake because we lack standard GNU NEWS and AUTHOR # files, if they're added we can "upgrade" to (default) GNU strictness. Use # --copy to allow simultaneous use on windows under mingw and cygwin platforms. # Symlinking of files under mingw does not work out for cygwin and vice-versa. echo "Setting up build system for xmlwrapp:" echo " - aclocal " && aclocal -I admin && \ -echo " - libtoolize " && libtoolize --copy --automake && \ +echo " - libtoolize " && $LIBTOOLIZE --copy --automake && \ echo " - autoconf " && autoconf && \ echo " - automake " && automake --add-missing --copy --foreign && \ echo " - doxygen " && (cd docs && doxygen) && \ Modified: trunk/include/xmlwrapp/exception.h =================================================================== --- trunk/include/xmlwrapp/exception.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/include/xmlwrapp/exception.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Vaclav Slavik <vs...@fa...> + * Copyright (C) 2010 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/include/xmlwrapp/export.h =================================================================== --- trunk/include/xmlwrapp/export.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/include/xmlwrapp/export.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Vaclav Slavik <vs...@fa...> + * Copyright (C) 2010 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/include/xmlwrapp/node.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * 2009 Vaclav Slavik <vs...@fa...> + * 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without @@ -177,9 +177,11 @@ explicit node(const char *name); /** - Construct a new xml::node given a name and content. The content will - be used to create a new child text node. + Construct a new xml::node given a name and content. + The content, if it's not an empty string, will be used to create a new + child text node. + @param name The name of the new element. @param content The text that will be used to create a child node. */ Modified: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/include/xmlwrapp/nodes_view.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * Copyright (C) 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/include/xmlwrapp/version.h =================================================================== --- trunk/include/xmlwrapp/version.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/include/xmlwrapp/version.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * Copyright (C) 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/platform/Win32/master.proj =================================================================== --- trunk/platform/Win32/master.proj 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/platform/Win32/master.proj 2012-03-18 19:50:46 UTC (rev 188) @@ -5,9 +5,9 @@ <PropertyGroup> <VCVersion>9</VCVersion> - <VersionZlib>1.2.3</VersionZlib> + <VersionZlib>1.2.5</VersionZlib> <VersionIconv>1.9.2</VersionIconv> - <VersionLibxml2>2.7.6</VersionLibxml2> + <VersionLibxml2>2.7.8</VersionLibxml2> <VersionLibxslt>1.1.26</VersionLibxslt> </PropertyGroup> Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxml/node.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * 2009 Vaclav Slavik <vs...@fa...> + * 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without @@ -299,14 +299,17 @@ if (!pimpl_->xmlnode_) throw std::bad_alloc(); - xmlNodePtr content_node = xmlNewText(reinterpret_cast<const xmlChar*>(content)); - if (!content_node) - throw std::bad_alloc(); + if (std::strlen(content)) + { + xmlNodePtr content_node = xmlNewText(reinterpret_cast<const xmlChar*>(content)); + if (!content_node) + throw std::bad_alloc(); - if (!xmlAddChild(pimpl_->xmlnode_, content_node)) - { - xmlFreeNode(content_node); - throw std::bad_alloc(); + if (!xmlAddChild(pimpl_->xmlnode_, content_node)) + { + xmlFreeNode(content_node); + throw std::bad_alloc(); + } } ap.release(); Modified: trunk/src/libxml/node_iterator.cxx =================================================================== --- trunk/src/libxml/node_iterator.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxml/node_iterator.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * 2009 Vaclav Slavik <vs...@fa...> + * 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/src/libxml/node_iterator.h =================================================================== --- trunk/src/libxml/node_iterator.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxml/node_iterator.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * 2009 Vaclav Slavik <vs...@fa...> + * 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/src/libxml/nodes_view.cxx =================================================================== --- trunk/src/libxml/nodes_view.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxml/nodes_view.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Vaclav Slavik <vs...@fa...> + * Copyright (C) 2009 Vaclav Slavik <vs...@gm...> * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/src/libxml/pimpl_base.h =================================================================== --- trunk/src/libxml/pimpl_base.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxml/pimpl_base.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2008 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/src/libxslt/result.h =================================================================== --- trunk/src/libxslt/result.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/src/libxslt/result.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Vadim Zeitlin (va...@ze...) + * Copyright (C) 2008 Vadim Zeitlin (vz-...@ze...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/Makefile.am 2012-03-18 19:50:46 UTC (rev 188) @@ -3,8 +3,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include LIBS = $(top_builddir)/src/libxmlwrapp.la \ - -lboost_unit_test_framework \ - -lboost_iostreams + $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) \ + $(BOOST_IOSTREAMS_LIBS) $(BOOST_IOSTREAMS_LDFLAGS) noinst_PROGRAMS = test Modified: trunk/tests/attributes/test_attributes.cxx =================================================================== --- trunk/tests/attributes/test_attributes.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/attributes/test_attributes.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/event/test_event.cxx =================================================================== --- trunk/tests/event/test_event.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/event/test_event.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/node/test_node.cxx =================================================================== --- trunk/tests/node/test_node.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/node/test_node.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009-2010 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009-2010 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/test.h =================================================================== --- trunk/tests/test.h 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/test.h 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/test_main.cxx =================================================================== --- trunk/tests/test_main.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/test_main.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/tree/test_tree.cxx =================================================================== --- trunk/tests/tree/test_tree.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/tree/test_tree.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without Modified: trunk/tests/xslt/test_xslt.cxx =================================================================== --- trunk/tests/xslt/test_xslt.cxx 2012-03-18 19:49:33 UTC (rev 187) +++ trunk/tests/xslt/test_xslt.cxx 2012-03-18 19:50:46 UTC (rev 188) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009 Vaclav Slavik (vs...@gm...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |