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

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     bool hasElement(const string_type& nm);
00066     bool hasElement(const string_type& nm,const string_type& ns);
00068     attribute_type& getAttribute(const string_type& nm,const string_type& ns);
00070    attribute_type& getAttribute(const string_type& nm);
00072     element_type& getElement(const string_type& name,int index);
00074     element_type& getElement(const string_type& name,const string_type& ns,int index);
00075     
00081     nodelist_type getElementsByTagName(const string_type& tagname,const string_type& ns = string_type() );
00082 
00084     void declareNamespace(const string_type& name,const string_type& url) {
00085       name_to_url_.insert( std::make_pair(name,url) );
00086     }
00088     virtual string_type queryURI(const string_type& name) const;
00090     virtual string_type queryPrefix(const string_type& url) const;
00092     virtual bool isMapped( const string_type& uri ) const;
00093 
00094     friend class DOM_Parser<charT,char_traits,xml_traits>;
00095   };
00096 }
00097 
00098 #ifndef MiX_NODECONTAINER_CPP_
00099 #include "NodeContainer.cpp"
00100 #endif
00101 
00102 #endif

MiXに対してThu Sep 4 05:11:11 2003に生成されました。 doxygen1.2.18