|
From: <vac...@us...> - 2008-12-22 00:55:30
|
Revision: 122
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=122&view=rev
Author: vaclavslavik
Date: 2008-12-22 00:55:26 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
move implementation code (helpers, pimpls etc.) into xml::impl namespace; leave only public API in xml namespace
Modified Paths:
--------------
trunk/include/xmlwrapp/_cbfo.h
trunk/include/xmlwrapp/attributes.h
trunk/include/xmlwrapp/document.h
trunk/include/xmlwrapp/event_parser.h
trunk/include/xmlwrapp/node.h
trunk/include/xmlwrapp/tree_parser.h
trunk/src/libxml/ait_impl.cxx
trunk/src/libxml/ait_impl.h
trunk/src/libxml/attributes.cxx
trunk/src/libxml/document.cxx
trunk/src/libxml/dtd_impl.cxx
trunk/src/libxml/dtd_impl.h
trunk/src/libxml/event_parser.cxx
trunk/src/libxml/node.cxx
trunk/src/libxml/node_iterator.cxx
trunk/src/libxml/node_iterator.h
trunk/src/libxml/node_manip.cxx
trunk/src/libxml/node_manip.h
trunk/src/libxml/pimpl_base.h
trunk/src/libxml/tree_parser.cxx
trunk/src/libxml/utility.cxx
trunk/src/libxml/utility.h
trunk/src/libxslt/result.h
trunk/src/libxslt/stylesheet.cxx
Modified: trunk/include/xmlwrapp/_cbfo.h
===================================================================
--- trunk/include/xmlwrapp/_cbfo.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/_cbfo.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -36,8 +36,11 @@
#include <functional>
namespace xml {
- class node;
+class node;
+
+namespace impl {
+
struct cbfo_node_compare : public std::binary_function<xml::node, xml::node, bool> {
virtual ~cbfo_node_compare (void) { }
virtual bool operator() (const xml::node &lhs, const xml::node &rhs) = 0;
@@ -51,5 +54,8 @@
T &t_;
};
-}
+
+} // namespace impl
+
+} // namespace xml
#endif
Modified: trunk/include/xmlwrapp/attributes.h
===================================================================
--- trunk/include/xmlwrapp/attributes.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/attributes.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -49,8 +49,11 @@
// forward declarations
class node;
+
+namespace impl {
class ait_impl;
struct node_impl;
+}
/**
* The xml::attributes class is used to access all the attributes of one
@@ -154,7 +157,7 @@
void set_data (void *node, void *prop);
void set_data (const char *name, const char *value, bool);
- friend class ait_impl;
+ friend class impl::ait_impl;
}; // end xml::attributes::attr class
/**
@@ -185,7 +188,7 @@
friend bool operator== (const iterator &lhs, const iterator &rhs);
friend bool operator!= (const iterator &lhs, const iterator &rhs);
private:
- ait_impl *pimpl_;
+ impl::ait_impl *pimpl_;
iterator (void *node, void *prop);
iterator (const char *name, const char *value, bool);
void swap (iterator &other);
@@ -223,7 +226,7 @@
friend bool operator== (const const_iterator &lhs, const const_iterator &rhs);
friend bool operator!= (const const_iterator &lhs, const const_iterator &rhs);
private:
- ait_impl *pimpl_;
+ impl::ait_impl *pimpl_;
const_iterator (void *node, void *prop);
const_iterator (const char *name, const char *value, bool);
void swap (const_iterator &other);
@@ -378,7 +381,7 @@
void set_data (void *node);
void* get_data (void);
- friend struct node_impl;
+ friend struct impl::node_impl;
friend class node;
}; // end xml::attributes class
Modified: trunk/include/xmlwrapp/document.h
===================================================================
--- trunk/include/xmlwrapp/document.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/document.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -48,15 +48,20 @@
// forward declaration
namespace xslt {
+ class stylesheet;
+ namespace impl {
class result;
- class stylesheet;
+ }
} // end xslt namespace
namespace xml {
// forward declarations
class tree_parser;
+
+namespace impl {
struct doc_impl;
+}
/**
* The xml::document class is used to hold the XML tree and various bits of
@@ -534,9 +539,9 @@
friend std::ostream& operator<< (std::ostream &stream, const document &doc);
private:
- doc_impl *pimpl_;
+ impl::doc_impl *pimpl_;
void set_doc_data (void *data);
- void set_doc_data_from_xslt (void *data, xslt::result *xr);
+ void set_doc_data_from_xslt (void *data, xslt::impl::result *xr);
void* get_doc_data (void);
void* get_doc_data_read_only (void) const;
void* release_doc_data (void);
Modified: trunk/include/xmlwrapp/event_parser.h
===================================================================
--- trunk/include/xmlwrapp/event_parser.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/event_parser.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -47,8 +47,12 @@
#include <map>
namespace xml {
- struct epimpl; // forward declaration of private implementation
+
+namespace impl {
+struct epimpl; // forward declaration of private implementation
+}
+
/**
* The xml::event_parser is used to parse an XML document by calling member
* functions when certain things in the XML document are parsed. In order to
@@ -255,8 +259,8 @@
//####################################################################
void set_error_message (const char *message);
private:
- friend struct epimpl;
- epimpl *pimpl_; // private implementation
+ friend struct impl::epimpl;
+ impl::epimpl *pimpl_; // private implementation
/*
* Don't allow anyone to copy construct an event_parser or to call the
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/node.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -53,10 +53,16 @@
// forward declarations
class document;
class attributes;
+
+namespace impl {
+class node_iterator;
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
@@ -428,7 +434,7 @@
friend bool operator== (const iterator &lhs, const iterator &rhs);
friend bool operator!= (const iterator &lhs, const iterator &rhs);
private:
- nipimpl *pimpl_;
+ impl::nipimpl *pimpl_;
explicit iterator (void *data);
void* get_raw_node (void);
void swap (iterator &other);
@@ -468,7 +474,7 @@
friend bool operator== (const const_iterator &lhs, const const_iterator &rhs);
friend bool operator!= (const const_iterator &lhs, const const_iterator &rhs);
private:
- nipimpl *pimpl_;
+ impl::nipimpl *pimpl_;
explicit const_iterator (void *data);
void* get_raw_node (void);
void swap (const_iterator &other);
@@ -776,7 +782,7 @@
**/
//####################################################################
template <typename T> void sort (T compare)
- { sort_callback<T> cb(compare); sort_fo(cb); }
+ { impl::sort_callback<T> cb(compare); sort_fo(cb); }
//####################################################################
/**
@@ -802,7 +808,7 @@
friend std::ostream& operator<< (std::ostream &stream, const node &n);
private:
- node_impl *pimpl_;
+ impl::node_impl *pimpl_;
// private ctor to create uninitialized instance
explicit node (int);
@@ -811,12 +817,12 @@
void* get_node_data (void);
void* release_node_data (void);
friend class tree_parser;
- friend class node_iterator;
+ friend class impl::node_iterator;
friend class document;
- friend struct doc_impl;
- friend struct node_cmp;
+ friend struct impl::doc_impl;
+ friend struct impl::node_cmp;
- void sort_fo (cbfo_node_compare &fo);
+ void sort_fo (impl::cbfo_node_compare &fo);
}; // end xml::node class
} // end xml namespace
Modified: trunk/include/xmlwrapp/tree_parser.h
===================================================================
--- trunk/include/xmlwrapp/tree_parser.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/include/xmlwrapp/tree_parser.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -47,8 +47,10 @@
namespace xml {
// forward declarations
+class document;
+namespace impl {
struct tree_impl;
-class document;
+}
/**
* The xml::tree_parser class is used to parse an XML document and generate
@@ -166,7 +168,7 @@
//####################################################################
const xml::document& get_document (void) const;
private:
- tree_impl *pimpl_; // private implementation
+ impl::tree_impl *pimpl_; // private implementation
/*
* Don't allow anyone to copy construct a xml::tree_parser or allow the
Modified: trunk/src/libxml/ait_impl.cxx
===================================================================
--- trunk/src/libxml/ait_impl.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/ait_impl.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -31,7 +31,7 @@
*/
/** @file
- * This file implements the xml::ait_impl, xml::attributes::iterator,
+ * This file implements the ait_impl, xml::attributes::iterator,
* xml::attributes::const_iterator and xml::attributes::attr classes.
**/
@@ -47,16 +47,19 @@
// libxml2 includes
#include <libxml/tree.h>
+using namespace xml;
+using namespace xml::impl;
+
/*
- * First we have the xml::ait_impl class.
+ * First we have the ait_impl class.
*/
//####################################################################
-xml::ait_impl::ait_impl (xmlNodePtr node, xmlAttrPtr prop) : xmlnode_(node), xmlattr_(prop), fake_(false) {
+ait_impl::ait_impl (xmlNodePtr node, xmlAttrPtr prop) : xmlnode_(node), xmlattr_(prop), fake_(false) {
attr_.set_data(xmlnode_, xmlattr_);
}
//####################################################################
-xml::ait_impl::ait_impl (const char *name, const char *value, bool) : xmlnode_(0), xmlattr_(0), fake_(true) {
+ait_impl::ait_impl (const char *name, const char *value, bool) : xmlnode_(0), xmlattr_(0), fake_(true) {
/*
* in this constructor and in the functions to follow, the last
* parameter, the bool, is only used to create a unique signature
@@ -64,12 +67,12 @@
attr_.set_data(name, value, true);
}
//####################################################################
-xml::ait_impl::ait_impl (const ait_impl &other) : xmlnode_(other.xmlnode_), xmlattr_(other.xmlattr_), fake_(other.fake_) {
+ait_impl::ait_impl (const ait_impl &other) : xmlnode_(other.xmlnode_), xmlattr_(other.xmlattr_), fake_(other.fake_) {
if (fake_) attr_.set_data(other.attr_.get_name(), other.attr_.get_value(), true);
else attr_.set_data(xmlnode_, xmlattr_);
}
//####################################################################
-xml::ait_impl& xml::ait_impl::operator= (const ait_impl &other) {
+ait_impl& ait_impl::operator= (const ait_impl &other) {
ait_impl tmp(other);
std::swap(xmlnode_, tmp.xmlnode_);
@@ -80,15 +83,15 @@
return *this;
}
//####################################################################
-xml::attributes::attr* xml::ait_impl::get (void) {
+xml::attributes::attr* ait_impl::get (void) {
return &attr_;
}
//####################################################################
-xmlAttrPtr xml::ait_impl::get_raw_attr (void) {
+xmlAttrPtr ait_impl::get_raw_attr (void) {
return xmlattr_;
}
//####################################################################
-xml::ait_impl& xml::ait_impl::operator++ (void) {
+ait_impl& ait_impl::operator++ (void) {
if (xmlattr_) xmlattr_ = xmlattr_->next;
else fake_ = false;
@@ -96,7 +99,7 @@
return *this;
}
//####################################################################
-xml::ait_impl xml::ait_impl::operator++ (int) {
+ait_impl ait_impl::operator++ (int) {
ait_impl tmp(xmlnode_, xmlattr_);
++(*this);
return tmp;
@@ -288,6 +291,8 @@
//####################################################################
namespace xml {
+
+namespace impl {
//####################################################################
xmlAttrPtr find_prop (xmlNodePtr xmlnode, const char *name) {
xmlAttrPtr prop = xmlnode->properties;
@@ -320,16 +325,9 @@
return 0;
}
+}
+
//####################################################################
- bool operator== (const ait_impl &lhs, const ait_impl &rhs) {
- if (lhs.fake_ || rhs.fake_) return false;
- return lhs.xmlattr_ == rhs.xmlattr_;
- }
- //####################################################################
- bool operator!= (const ait_impl &lhs, const ait_impl &rhs) {
- return !(lhs == rhs);
- }
- //####################################################################
bool operator== (const attributes::iterator &lhs, const attributes::iterator &rhs) {
return *(lhs.pimpl_) == *(rhs.pimpl_);
}
@@ -346,5 +344,16 @@
return !(lhs == rhs);
}
//####################################################################
+namespace impl {
+ bool operator== (const ait_impl &lhs, const ait_impl &rhs) {
+ if (lhs.fake_ || rhs.fake_) return false;
+ return lhs.xmlattr_ == rhs.xmlattr_;
+ }
+ //####################################################################
+ bool operator!= (const ait_impl &lhs, const ait_impl &rhs) {
+ return !(lhs == rhs);
+ }
}
+ //####################################################################
+}
//####################################################################
Modified: trunk/src/libxml/ait_impl.h
===================================================================
--- trunk/src/libxml/ait_impl.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/ait_impl.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -47,6 +47,8 @@
namespace xml {
+namespace impl {
+
/**
* the class that does all the work behind xml::attributes::iterator and
* xml::attributes::const_iterator.
@@ -78,5 +80,7 @@
xmlAttrPtr find_prop (xmlNodePtr xmlnode, const char *name);
xmlAttributePtr find_default_prop (xmlNodePtr xmlnode, const char *name);
+} // end impl namespace
+
} // end xml namespace
#endif
Modified: trunk/src/libxml/attributes.cxx
===================================================================
--- trunk/src/libxml/attributes.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/attributes.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -46,8 +46,11 @@
// libxml2 includes
#include <libxml/tree.h>
+using namespace xml;
+using namespace xml::impl;
+
//####################################################################
-struct xml::attributes::pimpl : public xml::pimpl_base<xml::attributes::pimpl> {
+struct xml::attributes::pimpl : public pimpl_base<xml::attributes::pimpl> {
//####################################################################
pimpl (void) : owner_(true) {
xmlnode_ = xmlNewNode(0, reinterpret_cast<const xmlChar*>("blank"));
Modified: trunk/src/libxml/document.cxx
===================================================================
--- trunk/src/libxml/document.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/document.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -56,12 +56,16 @@
// bring in private libxslt stuff (see bug #1927398)
#include "../libxslt/result.h"
+using namespace xml;
+using namespace xml::impl;
+
+
//####################################################################
namespace {
const char const_default_encoding[] = "ISO-8859-1";
}
//####################################################################
-struct xml::doc_impl {
+struct xml::impl::doc_impl {
//####################################################################
doc_impl (void) : doc_(0), xslt_result_(0) {
xmlDocPtr tmpdoc;
@@ -123,7 +127,7 @@
//####################################################################
xmlDocPtr doc_;
- xslt::result *xslt_result_;
+ xslt::impl::result *xslt_result_;
node root_;
std::string version_;
mutable std::string encoding_;
@@ -259,17 +263,17 @@
//####################################################################
void xml::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");
- xmlwrapp::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(child).get_node_data()));
+ xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(child).get_node_data()));
}
//####################################################################
xml::node::iterator xml::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");
- return node::iterator(xmlwrapp::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data())));
+ return node::iterator(xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data())));
}
//####################################################################
xml::node::iterator xml::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");
- return node::iterator(xmlwrapp::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), static_cast<xmlNodePtr>(position.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data())));
+ 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())));
}
//####################################################################
xml::node::iterator xml::document::replace (node::iterator old_node, const node &new_node) {
@@ -277,12 +281,12 @@
throw std::runtime_error("xml::document::replace can't replace element type nodes");
}
- return node::iterator(xmlwrapp::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(new_node).get_node_data())));
+ 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())));
}
//####################################################################
xml::node::iterator xml::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");
- return node::iterator(xmlwrapp::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node())));
+ return node::iterator(xml::impl::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node())));
}
//####################################################################
xml::node::iterator xml::document::erase (node::iterator first, node::iterator last) {
@@ -330,7 +334,7 @@
pimpl_->xslt_result_ = 0;
}
//####################################################################
-void xml::document::set_doc_data_from_xslt (void *data, xslt::result *xr) {
+void xml::document::set_doc_data_from_xslt (void *data, xslt::impl::result *xr) {
// this document came from a XSLT transformation
pimpl_->set_doc_data(static_cast<xmlDocPtr>(data), false);
pimpl_->xslt_result_ = xr;
Modified: trunk/src/libxml/dtd_impl.cxx
===================================================================
--- trunk/src/libxml/dtd_impl.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/dtd_impl.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -31,7 +31,7 @@
*/
/** @file
- * This file implements the xml::dtd_impl class.
+ * This file implements the dtd_impl class.
**/
// xmlwrapp includes
@@ -47,26 +47,29 @@
#include <libxml/valid.h>
#include <libxml/tree.h>
+using namespace xml;
+using namespace xml::impl;
+
//####################################################################
namespace {
extern "C" void dtd_error (void *ctxt, const char *message, ...);
extern "C" void dtd_warning (void *ctxt, const char*, ...);
} // end anonymous namespace
//####################################################################
-xml::dtd_impl::dtd_impl (const char *filename) : warnings_(0), dtd_(0) {
+dtd_impl::dtd_impl (const char *filename) : warnings_(0), dtd_(0) {
if ( (dtd_ = xmlParseDTD(0, reinterpret_cast<const xmlChar*>(filename))) == 0) {
error_ = "unable to parse DTD "; error_ += filename;
}
}
//####################################################################
-xml::dtd_impl::dtd_impl (void) : warnings_(0), dtd_(0) {
+dtd_impl::dtd_impl (void) : warnings_(0), dtd_(0) {
}
//####################################################################
-xml::dtd_impl::~dtd_impl (void) {
+dtd_impl::~dtd_impl (void) {
if (dtd_) xmlFreeDtd(dtd_);
}
//####################################################################
-void xml::dtd_impl::init_ctxt (void) {
+void dtd_impl::init_ctxt (void) {
std::memset(&vctxt_, 0, sizeof(vctxt_));
vctxt_.userData = this;
@@ -74,14 +77,14 @@
vctxt_.warning = dtd_warning;
}
//####################################################################
-bool xml::dtd_impl::validate (xmlDocPtr xmldoc) {
+bool dtd_impl::validate (xmlDocPtr xmldoc) {
init_ctxt();
if (dtd_) return xmlValidateDtd(&vctxt_, xmldoc, dtd_) != 0;
else return xmlValidateDocument(&vctxt_, xmldoc) != 0;
}
//####################################################################
-xmlDtdPtr xml::dtd_impl::release (void) {
+xmlDtdPtr dtd_impl::release (void) {
xmlDtdPtr xmldtd = dtd_;
dtd_ = 0;
return xmldtd;
@@ -90,16 +93,16 @@
namespace {
//####################################################################
extern "C" void dtd_error (void *ctxt, const char *message, ...) {
- xml::dtd_impl *dtd = static_cast<xml::dtd_impl*>(ctxt);
+ dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
va_list ap;
va_start(ap, message);
- xml::printf2string(dtd->error_, message, ap);
+ printf2string(dtd->error_, message, ap);
va_end(ap);
}
//####################################################################
extern "C" void dtd_warning (void *ctxt, const char*, ...) {
- xml::dtd_impl *dtd = static_cast<xml::dtd_impl*>(ctxt);
+ dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
++dtd->warnings_;
}
//####################################################################
Modified: trunk/src/libxml/dtd_impl.h
===================================================================
--- trunk/src/libxml/dtd_impl.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/dtd_impl.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -47,6 +47,8 @@
namespace xml {
+namespace impl {
+
class dtd_impl {
public:
/*
@@ -83,7 +85,9 @@
dtd_impl (const dtd_impl&);
dtd_impl& operator= (const dtd_impl&);
void init_ctxt (void);
-}; // end xml::dtd_impl class
+}; // end xml::impl::dtd_impl class
+} // end impl namespace
+
} // end xml namespace
#endif
Modified: trunk/src/libxml/event_parser.cxx
===================================================================
--- trunk/src/libxml/event_parser.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/event_parser.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -55,6 +55,9 @@
#include <iostream>
#include <fstream>
+using namespace xml;
+using namespace xml::impl;
+
//####################################################################
/*
* This is a hack to fix a problem with a change in the libxml2 API for
@@ -80,7 +83,7 @@
extern "C" void cb_ignore (void*, const xmlChar*, int);
} // end anonymous namespace
//####################################################################
-struct xml::epimpl {
+struct xml::impl::epimpl {
public:
epimpl (event_parser &parent);
~epimpl (void);
@@ -168,7 +171,7 @@
pimpl_->last_error_message_ = message;
}
//####################################################################
-xml::epimpl::epimpl (event_parser &parent)
+epimpl::epimpl (event_parser &parent)
: parser_status_(true), parent_(parent)
{
std::memset(&sax_handler_, 0, sizeof(sax_handler_));
@@ -191,11 +194,11 @@
}
}
//####################################################################
-xml::epimpl::~epimpl (void) {
+epimpl::~epimpl (void) {
xmlFreeParserCtxt(parser_context_);
}
//####################################################################
-void xml::epimpl::event_start_element (const xmlChar *tag, const xmlChar **props) {
+void epimpl::event_start_element (const xmlChar *tag, const xmlChar **props) {
if (!parser_status_) return;
try {
@@ -214,7 +217,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_end_element (const xmlChar *tag) {
+void epimpl::event_end_element (const xmlChar *tag) {
if (!parser_status_) return;
try {
@@ -226,7 +229,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_text (const xmlChar *text, int length) {
+void epimpl::event_text (const xmlChar *text, int length) {
if (!parser_status_) return;
try {
@@ -238,7 +241,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_pi (const xmlChar *target, const xmlChar *data) {
+void epimpl::event_pi (const xmlChar *target, const xmlChar *data) {
if (!parser_status_) return;
try {
@@ -251,7 +254,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_comment (const xmlChar *text) {
+void epimpl::event_comment (const xmlChar *text) {
if (!parser_status_) return;
try {
@@ -263,7 +266,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_cdata (const xmlChar *text, int length) {
+void epimpl::event_cdata (const xmlChar *text, int length) {
if (!parser_status_) return;
try {
@@ -275,7 +278,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_warning (const std::string &message) {
+void epimpl::event_warning (const std::string &message) {
if (!parser_status_) return;
try {
@@ -287,7 +290,7 @@
if (!parser_status_) xmlStopParser(parser_context_);
}
//####################################################################
-void xml::epimpl::event_error (const std::string &message) {
+void epimpl::event_error (const std::string &message) {
try { last_error_message_ = message; } catch ( ... ) { }
parser_status_ = false;
xmlStopParser(parser_context_);
@@ -299,32 +302,32 @@
{ return xmlGetPredefinedEntity(name); }
//####################################################################
extern "C" void cb_start_element (void *parser, const xmlChar *tag, const xmlChar **props)
- { static_cast<xml::epimpl*>(parser)->event_start_element(tag, props); }
+ { static_cast<epimpl*>(parser)->event_start_element(tag, props); }
//####################################################################
extern "C" void cb_end_element (void *parser, const xmlChar *tag)
- { static_cast<xml::epimpl*>(parser)->event_end_element(tag); }
+ { static_cast<epimpl*>(parser)->event_end_element(tag); }
//####################################################################
extern "C" void cb_text (void *parser, const xmlChar *text, int length)
- { static_cast<xml::epimpl*>(parser)->event_text(text, length); }
+ { static_cast<epimpl*>(parser)->event_text(text, length); }
//####################################################################
extern "C" void cb_pi (void *parser, const xmlChar *target, const xmlChar *data)
- { static_cast<xml::epimpl*>(parser)->event_pi(target, data); }
+ { static_cast<epimpl*>(parser)->event_pi(target, data); }
//####################################################################
extern "C" void cb_comment (void *parser, const xmlChar *text)
- { static_cast<xml::epimpl*>(parser)->event_comment(text); }
+ { static_cast<epimpl*>(parser)->event_comment(text); }
//####################################################################
extern "C" void cb_cdata (void *parser, const xmlChar *text, int length)
- { static_cast<xml::epimpl*>(parser)->event_cdata(text, length); }
+ { static_cast<epimpl*>(parser)->event_cdata(text, length); }
//####################################################################
extern "C" void cb_warning (void *parser, const char *message, ...) {
std::string complete_message;
va_list ap;
va_start(ap, message);
- xml::printf2string(complete_message, message, ap);
+ printf2string(complete_message, message, ap);
va_end(ap);
- static_cast<xml::epimpl*>(parser)->event_warning(complete_message);
+ static_cast<epimpl*>(parser)->event_warning(complete_message);
}
//####################################################################
extern "C" void cb_error (void *parser, const char *message, ...) {
@@ -332,10 +335,10 @@
va_list ap;
va_start(ap, message);
- xml::printf2string(complete_message, message, ap);
+ printf2string(complete_message, message, ap);
va_end(ap);
- static_cast<xml::epimpl*>(parser)->event_error(complete_message);
+ static_cast<epimpl*>(parser)->event_error(complete_message);
}
//####################################################################
extern "C" void cb_ignore (void*, const xmlChar*, int) {
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/node.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -58,8 +58,11 @@
#include <libxml/tree.h>
#include <libxml/parser.h>
+using namespace xml;
+using namespace xml::impl;
+
//####################################################################
-struct xml::node_impl : public xml::pimpl_base<xml::node_impl> {
+struct xml::impl::node_impl : public pimpl_base<xml::impl::node_impl> {
//####################################################################
node_impl (void) : xmlnode_(0), owner_(true), attrs_(0)
{ }
@@ -80,7 +83,7 @@
std::string tmp_string;
};
//####################################################################
-struct xml::node_cmp : public std::binary_function<xmlNodePtr, xmlNodePtr, bool> {
+struct xml::impl::node_cmp : public std::binary_function<xmlNodePtr, xmlNodePtr, bool> {
//####################################################################
node_cmp (cbfo_node_compare &cb) : cb_(cb) { }
//####################################################################
@@ -138,11 +141,11 @@
xmlAttrPtr attr_l, attr_r;
xmlAttributePtr dtd_l(0), dtd_r(0);
- attr_l = xml::find_prop(lhs, name_);
- if (attr_l == 0 && (dtd_l = xml::find_default_prop(lhs, name_)) == 0) return true;
+ attr_l = find_prop(lhs, name_);
+ if (attr_l == 0 && (dtd_l = find_default_prop(lhs, name_)) == 0) return true;
- attr_r = xml::find_prop(rhs, name_);
- if (attr_r == 0 && (dtd_r = xml::find_default_prop(rhs, name_)) == 0) return false;
+ attr_r = find_prop(rhs, name_);
+ if (attr_r == 0 && (dtd_r = find_default_prop(rhs, name_)) == 0) return false;
xmlChar *value_l, *value_r;
@@ -366,7 +369,7 @@
}
//####################################################################
void xml::node::push_back (const node &child) {
- xmlwrapp::node_insert(pimpl_->xmlnode_, 0, child.pimpl_->xmlnode_);
+ xml::impl::node_insert(pimpl_->xmlnode_, 0, child.pimpl_->xmlnode_);
}
//####################################################################
xml::node::size_type xml::node::size (void) const {
@@ -436,19 +439,19 @@
}
//####################################################################
xml::node::iterator xml::node::insert (const node &n) {
- return iterator(xmlwrapp::node_insert(pimpl_->xmlnode_, 0, n.pimpl_->xmlnode_));
+ return iterator(xml::impl::node_insert(pimpl_->xmlnode_, 0, n.pimpl_->xmlnode_));
}
//####################################################################
xml::node::iterator xml::node::insert (iterator position, const node &n) {
- return iterator(xmlwrapp::node_insert(pimpl_->xmlnode_, static_cast<xmlNodePtr>(position.get_raw_node()), n.pimpl_->xmlnode_));
+ return iterator(xml::impl::node_insert(pimpl_->xmlnode_, static_cast<xmlNodePtr>(position.get_raw_node()), n.pimpl_->xmlnode_));
}
//####################################################################
xml::node::iterator xml::node::replace (iterator old_node, const node &new_node) {
- return iterator(xmlwrapp::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), new_node.pimpl_->xmlnode_));
+ return iterator(xml::impl::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), new_node.pimpl_->xmlnode_));
}
//####################################################################
xml::node::iterator xml::node::erase (iterator to_erase) {
- return iterator(xmlwrapp::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node())));
+ return iterator(xml::impl::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node())));
}
//####################################################################
xml::node::iterator xml::node::erase (iterator first, iterator last) {
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/node_iterator.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -31,7 +31,7 @@
*/
/** @file
- * This file implements the xml::node_iterator class for libxml2.
+ * This file implements the xml::impl::node_iterator class for libxml2.
**/
// definition include
@@ -47,8 +47,11 @@
// libxml includes
#include <libxml/tree.h>
+using namespace xml;
+using namespace xml::impl;
+
// xml::node::iterator pimpl
-struct xml::nipimpl : public xml::pimpl_base<xml::nipimpl> {
+struct xml::impl::nipimpl : public pimpl_base<xml::impl::nipimpl> {
node_iterator it;
nipimpl (void) {};
@@ -57,27 +60,27 @@
};
/*
- * xml::node_iterator Real Iterator class
+ * xml::impl::node_iterator Real Iterator class
*/
//####################################################################
-xml::node* xml::node_iterator::get (void) const {
+xml::node* xml::impl::node_iterator::get (void) const {
fake_node_.set_node_data(node_);
return &fake_node_;
}
//####################################################################
-xml::node_iterator& xml::node_iterator::operator++ (void) {
+xml::impl::node_iterator& xml::impl::node_iterator::operator++ (void) {
node_ = node_->next;
return *this;
}
//####################################################################
-xml::node_iterator xml::node_iterator::operator++ (int) {
+xml::impl::node_iterator xml::impl::node_iterator::operator++ (int) {
node_iterator old(*this);
++(*this);
return old;
}
//####################################################################
-xmlNodePtr xml::node_iterator::get_raw_node (void) {
+xmlNodePtr xml::impl::node_iterator::get_raw_node (void) {
return node_;
}
//####################################################################
@@ -196,6 +199,8 @@
}
//####################################################################
namespace xml {
+
+namespace impl {
bool operator== (const node_iterator &lhs, const node_iterator &rhs) {
return lhs.node_ == rhs.node_;
}
@@ -203,6 +208,7 @@
bool operator!= (const node_iterator &lhs, const node_iterator &rhs) {
return !(lhs == rhs);
}
+}
bool operator== (const node::iterator &lhs, const node::iterator &rhs) {
return lhs.pimpl_->it == rhs.pimpl_->it;
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/node_iterator.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -31,7 +31,7 @@
*/
/** @file
- * This file defines the xml::node_iterator class for libxml2.
+ * This file defines the xml::impl::node_iterator class for libxml2.
**/
#ifndef _xmlwrapp_node_iterator_h_
@@ -45,6 +45,8 @@
namespace xml {
+namespace impl {
+
// base iterator class
class node_iterator {
public:
@@ -65,7 +67,9 @@
private:
mutable node fake_node_;
xmlNodePtr node_;
-}; // end xml::node_iterator class
+}; // end xml::impl::node_iterator class
+} // end impl namespace
+
} // end xml namespace
#endif
Modified: trunk/src/libxml/node_manip.cxx
===================================================================
--- trunk/src/libxml/node_manip.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/node_manip.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -45,7 +45,7 @@
#include <libxml/tree.h>
//####################################################################
-xmlNodePtr xmlwrapp::node_insert (xmlNodePtr parent, xmlNodePtr before, xmlNodePtr to_add) {
+xmlNodePtr xml::impl::node_insert (xmlNodePtr parent, xmlNodePtr before, xmlNodePtr to_add) {
xmlNodePtr new_xml_node = xmlCopyNode(to_add, 1);
if (!new_xml_node) throw std::bad_alloc();
@@ -64,7 +64,7 @@
return new_xml_node;
}
//####################################################################
-xmlNodePtr xmlwrapp::node_replace (xmlNodePtr old_node, xmlNodePtr new_node) {
+xmlNodePtr xml::impl::node_replace (xmlNodePtr old_node, xmlNodePtr new_node) {
xmlNodePtr copied_node = xmlCopyNode(new_node, 1);
if (!copied_node) throw std::bad_alloc();
@@ -81,7 +81,7 @@
return copied_node;
}
//####################################################################
-xmlNodePtr xmlwrapp::node_erase (xmlNodePtr to_erase) {
+xmlNodePtr xml::impl::node_erase (xmlNodePtr to_erase) {
xmlNodePtr after = to_erase->next;
xmlUnlinkNode(to_erase);
Modified: trunk/src/libxml/node_manip.h
===================================================================
--- trunk/src/libxml/node_manip.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/node_manip.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -41,8 +41,10 @@
// libxml includes
#include <libxml/tree.h>
-namespace xmlwrapp {
+namespace xml {
+namespace impl {
+
//####################################################################
/**
* Insert a node somewhere in the child list of a parent node.
@@ -80,4 +82,6 @@
//####################################################################
xmlNodePtr node_erase (xmlNodePtr to_erase);
}
+
+}
#endif
Modified: trunk/src/libxml/pimpl_base.h
===================================================================
--- trunk/src/libxml/pimpl_base.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/pimpl_base.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -41,6 +41,9 @@
namespace xml
{
+namespace impl
+{
+
// Base class for all pimpl classes. Uses custom pool allocator for better
// performance. Usage: derive your class FooImpl from pimpl_base<FooImpl>.
template<typename T>
@@ -72,6 +75,8 @@
#endif // HAVE_BOOST_POOL_SINGLETON_POOL_HPP
};
+} // namespace impl
+
} // namespace xml
#endif // _xmlwrapp_pimpl_base_h_
Modified: trunk/src/libxml/tree_parser.cxx
===================================================================
--- trunk/src/libxml/tree_parser.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/tree_parser.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -52,6 +52,9 @@
#include <string>
#include <memory>
+using namespace xml;
+using namespace xml::impl;
+
//####################################################################
/*
* This is a hack to fix a problem with a change in the libxml2 API for
@@ -70,7 +73,7 @@
extern "C" void cb_tree_ignore (void*, const xmlChar*, int);
}
//####################################################################
-struct xml::tree_impl {
+struct xml::impl::tree_impl {
tree_impl (void) : last_error_(const_default_error), warnings_(false), okay_(false) {
std::memset(&sax_, 0, sizeof(sax_));
initxmlDefaultSAXHandler(&sax_, 0);
@@ -166,12 +169,12 @@
try {
xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
- xml::tree_impl *p = static_cast<xml::tree_impl*>(ctxt->_private);
+ tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
if (!p) return; // handle bug in older versions of libxml
va_list ap;
va_start(ap, message);
- xml::printf2string(p->last_error_, message, ap);
+ printf2string(p->last_error_, message, ap);
va_end(ap);
xmlStopParser(ctxt);
@@ -182,7 +185,7 @@
try {
xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
- xml::tree_impl *p = static_cast<xml::tree_impl*>(ctxt->_private);
+ tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
if (!p) return; // handle bug in older versions of libxml
p->warnings_ = true;
Modified: trunk/src/libxml/utility.cxx
===================================================================
--- trunk/src/libxml/utility.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/utility.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -44,6 +44,8 @@
namespace xml {
+namespace impl {
+
//####################################################################
void printf2string (std::string &s, const char *message, va_list ap) {
char buffer[512];
@@ -60,4 +62,6 @@
}
//####################################################################
+} // end impl namespace
+
} // end xml namespace
Modified: trunk/src/libxml/utility.h
===================================================================
--- trunk/src/libxml/utility.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxml/utility.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -42,6 +42,8 @@
namespace xml {
+namespace impl {
+
/*
* exception safe wrapper around xmlChar*s that are returned from some
* of the libxml functions that the user must free.
@@ -62,5 +64,7 @@
void printf2string (std::string &s, const char *message, va_list ap);
+} // end impl namespace
+
} // end xml namespace
#endif
Modified: trunk/src/libxslt/result.h
===================================================================
--- trunk/src/libxslt/result.h 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxslt/result.h 2008-12-22 00:55:26 UTC (rev 122)
@@ -45,6 +45,8 @@
namespace xslt {
+namespace impl {
+
/**
* The xslt::result class is used as a callback by xml::document to allow
* special treatment of XML documents which were created by XSLT.
@@ -90,6 +92,8 @@
virtual ~result (void) { }
};
+} // end impl namespace
+
} // end xslt namespace
#endif
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2008-12-21 15:56:37 UTC (rev 121)
+++ trunk/src/libxslt/stylesheet.cxx 2008-12-22 00:55:26 UTC (rev 122)
@@ -60,7 +60,7 @@
// implementation of xslt::result using xslt::stylesheet: we pass this object
// to xml::document for the documents obtained via XSLT so that some operations
// (currently only saving) could be done differently for them
-class result_impl : public xslt::result {
+class result_impl : public xslt::impl::result {
public:
// We don't own the pointers given to us, their lifetime must be greater
// than the lifetime of this object.
@@ -73,7 +73,7 @@
if (xsltSaveResultToString(&xml_string, &xml_string_length, doc_, ss_) >= 0)
{
- xml::xmlchar_helper helper(xml_string);
+ xml::impl::xmlchar_helper helper(xml_string);
if (xml_string_length) s.assign(helper.get(), xml_string_length);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|