|
From: <vac...@us...> - 2008-12-21 01:39:21
|
Revision: 118
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=118&view=rev
Author: vaclavslavik
Date: 2008-12-21 01:36:38 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
made node_iterator creation a bit faster: don't initialize fake_node_ to blank node and avoid xmlNewNode() call and accompanying memory allocation
Modified Paths:
--------------
trunk/include/xmlwrapp/attributes.h
trunk/include/xmlwrapp/node.h
trunk/src/libxml/node.cxx
trunk/src/libxml/node_iterator.h
Modified: trunk/include/xmlwrapp/attributes.h
===================================================================
--- trunk/include/xmlwrapp/attributes.h 2008-12-16 19:05:11 UTC (rev 117)
+++ trunk/include/xmlwrapp/attributes.h 2008-12-21 01:36:38 UTC (rev 118)
@@ -372,7 +372,10 @@
private:
struct pimpl; pimpl *pimpl_;
+
+ // private ctor to create uninitialized instance
explicit attributes (int);
+
void set_data (void *node);
void* get_data (void);
friend struct node_impl;
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2008-12-16 19:05:11 UTC (rev 117)
+++ trunk/include/xmlwrapp/node.h 2008-12-21 01:36:38 UTC (rev 118)
@@ -800,8 +800,13 @@
**/
//####################################################################
friend std::ostream& operator<< (std::ostream &stream, const node &n);
+
private:
node_impl *pimpl_;
+
+ // private ctor to create uninitialized instance
+ explicit node (int);
+
void set_node_data (void *data);
void* get_node_data (void);
void* release_node_data (void);
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2008-12-16 19:05:11 UTC (rev 117)
+++ trunk/src/libxml/node.cxx 2008-12-21 01:36:38 UTC (rev 118)
@@ -175,6 +175,10 @@
xmlNodePtr find_node(const char *name, xmlNodePtr first);
}
//####################################################################
+xml::node::node (int) {
+ pimpl_ = new node_impl;
+}
+//####################################################################
xml::node::node (void) {
std::auto_ptr<node_impl> ap(pimpl_ = new node_impl);
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2008-12-16 19:05:11 UTC (rev 117)
+++ trunk/src/libxml/node_iterator.h 2008-12-21 01:36:38 UTC (rev 118)
@@ -48,10 +48,10 @@
// base iterator class
class node_iterator {
public:
- node_iterator (void) : node_(0) {}
- node_iterator (node &parent) : node_(reinterpret_cast<xmlNodePtr>(parent.get_node_data())) {}
- node_iterator (xmlNodePtr xmlnode) : node_(xmlnode) {}
- node_iterator (const node_iterator &other) : node_(other.node_) {}
+ node_iterator (void) : fake_node_(0), node_(0) {}
+ node_iterator (node &parent) : fake_node_(0), node_(reinterpret_cast<xmlNodePtr>(parent.get_node_data())) {}
+ node_iterator (xmlNodePtr xmlnode) : fake_node_(0), node_(xmlnode) {}
+ node_iterator (const node_iterator &other) : fake_node_(0), node_(other.node_) {}
node_iterator& operator= (const node_iterator &other) { node_ = other.node_; return *this;}
node* get (void) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|