xml_reference.h

Go to the documentation of this file.
00001 #ifndef __XML_REFERENCE_H
00002 #define __XML_REFERENCE_H
00003 
00004 #include "mimasconfig.h"
00005 
00006 #ifdef HAVE_XALAN
00007 
00008 #include <cassert>
00009 #include <string>
00010 #include <XalanDOM/XalanNode.hpp>
00011 #include <util/XMLException.hpp>
00012 #include "mimasexception.h"
00013 #include "object.h"
00014 
00015 #ifdef XERCES_HAS_CPP_NAMESPACE
00016 using namespace XERCES_CPP_NAMESPACE;
00017 #endif
00018 #ifdef XALAN_HAS_CPP_NAMESPACE
00019 using namespace XALAN_CPP_NAMESPACE;
00020 #endif
00021 
00022 namespace mimas {
00023 
00024 class xml_document;
00025 class xml_node_reference_list;
00026 
00035 template< class T >
00036 class xml_reference: public object
00037 {
00038  public:
00040   xml_reference( T *_node, xml_document *_document );
00042   xml_reference( const xml_reference< T > &r );
00044   xml_reference< T > &operator=( const xml_reference< T > &r );
00047   T &operator*(void) const { assert( node != NULL ); return *node; }
00050   T *operator->(void) const { assert( node != NULL ); return node; }
00053   T *get(void) const { return node; }
00056   operator bool(void) const { return node != NULL; }
00059   bool operator! () const { return node == NULL; }
00062   std::string getNodeText(void) const throw (mimasexception,XMLException);
00077   xml_reference< XalanNode > selectNode( const char *xPath ) const
00078     throw (mimasexception,XMLException);
00083   xml_node_reference_list selectNodes( const char *xPath ) const
00084     throw (mimasexception,XMLException);
00093   bool existNode( const char *xPath ) const throw (XMLException);
00096   xml_document *getDocument(void) const { return document; }
00097  protected:
00099   T *node;
00101   xml_document *document;
00102 };
00103 
00109 template<class T, class U>
00110 xml_reference<T> dynamic_pointer_cast( xml_reference<U> const & r )
00111 {
00112   return xml_reference<T>( (T *)r.get(), r.getDocument() );
00113 }
00114 
00116 
00117 };
00118 
00119 #include "xml_reference.tcc"
00120 
00121 #endif
00122 
00123 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...