Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-06-13 13:39:34


Stefan Seefeld wrote

>>I also like the
>> xml::dom::document document = xml::dom::parse_file(argv[1]);
>>style usage. Also:
>> xml::dom::element e = doc.documentElement();
>> xml::dom::node n = e;

>>This is just my preferred style/usage, and does not have to be adopted.

>you mean you vote for the 'nodes-are-references' style ?

I mean, for example:
   namespace boost { namespace xml { namespace dom
   {
      typedef DocumentImpl * document;
   }}}

>>This would, however, allow the implementation to be adapted to when memory
>>management needs to be used and to switch between different management
>>policies for the various implementations.

>Can you elaborate ?

Sure. In the libxml2 versions, nodes are explicitly deleted, and thus do not
need to be managed, e.g:
   typedef node_impl * node;

If an object requires explicit management, via shared_ptr for example:
   typedef boost::shared_ptr< node_impl > node;

Or, if it is say using a wrapper around an MSXML interface:
   class node: public CComPtr< IXMLDOMNode >{ ... };

The user can thus write:
   boost::xml::dom::node mynode = doc.selectNode( "/h:*[1]" );

without worrying about the underlying representation of
boost::xml::dom::node.

Regards,
Reece

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk