メインページ   名前空間一覧   クラス階層   構成   ファイル一覧   名前空間メンバ   構成メンバ   ファイルメンバ  

NodeContainer.h

解説を見る。
00001 // -*- mode: c++ -*-
00002 
00003 #ifndef MiX_NODECONTAINER_H_
00004 #define MiX_NODECONTAINER_H_
00005 
00006 #include "NodeList.h"
00007 #include "Node.h"
00008 #include <utility>
00009 
00010 namespace MiX{
00011 
00012   template <class charT,class char_traits,class xml_traits>
00013   class NodeContainer : virtual public Node<charT,char_traits,xml_traits>{
00014   public:
00015     MiX_Template_Typedef(charT,char_traits,xml_traits);
00016     typedef NodeContainer<charT,char_traits,xml_traits> this_type;
00017   protected:
00018     nodelist_type children_;
00019     void addChild(node_type* node);
00020 
00021     std::map<string_type,string_type> name_to_url_;
00022 
00023     void cloneChildren(this_type& dest) const{
00024       typename nodelist_type::const_iterator it = getChildren().begin();
00025       typename nodelist_type::const_iterator last = getChildren().end();
00026       for( ; it!=last ; ++it ){
00027         (*it)->clone(dest,dest.getChildren().end());
00028       }
00029     }
00030 
00031   protected:
00033     NodeContainer() : node_type(),children_() { };
00039     NodeContainer(const this_type& src){ };
00041     template <class Pred>
00042     typename nodelist_type::iterator search(Pred pred,int index){
00043       int i = 0;
00044       typename nodelist_type::iterator it,first,last=getChildren().end();
00045       for ( first=getChildren().begin(); it!=last ; first=++it,++i ){
00046         it = std::find_if(first,last,pred);
00047         if( i==index ) break;
00048       }
00049       return it;
00050     }
00051   public:
00053     virtual ~NodeContainer() throw();
00055     nodelist_type& getChildren(){ return children_; };
00057     const nodelist_type& getChildren() const { return children_; };
00058 
00060     bool hasAttribute(const string_type& nm);
00062     bool hasAttribute(const string_type& nm,const string_type& ns);
00064     attribute_type& getAttribute(const string_type& nm,const string_type& ns);
00066    attribute_type& getAttribute(const string_type& nm);
00068     element_type& getElement(const string_type& name,int index);
00070     element_type& getElement(const string_type& name,const string_type& ns,int index);
00071     
00077     nodelist_type getElementsByTagName(const string_type& tagname,const string_type& ns = string_type() );
00078 
00080     void addNSName(const string_type& name,const string_type& url) {
00081       name_to_url_.insert( std::make_pair(name,url) );
00082     }
00084     virtual string_type queryURL(const string_type& name) const;
00086     virtual string_type queryNSName(const string_type& url) const;
00087     
00088     friend class DOM_Parser<charT,char_traits,xml_traits>;
00089   };
00090 }
00091 
00092 #ifndef MiX_NODECONTAINER_CPP_
00093 #include "NodeContainer.cpp"
00094 #endif
00095 
00096 #endif

MiXに対してMon Nov 18 03:48:27 2002に生成されました。 doxygen1.2.14 作者 Dimitri van Heesch, © 1997-2002