Changeset 106 for XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp
- Timestamp:
- 06/14/10 15:32:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp
r104 r106 3 3 4 4 #include "attribut.hpp" 5 6 using XMLIOSERVER::XML::THashAttributes; 5 7 6 8 namespace XMLIOSERVER … … 14 16 15 17 void RegisterAttribut(BaseAttribut* attribut){ attrList.addObject(attribut); } 16 StrHashMap<BaseAttribut>& getAttributList(void){ return (attrList); }18 const StrHashMap<BaseAttribut>& getAttributList(void) const { return (attrList); } 17 19 size_t getNbAttributes() const {return (attrList.getSize()); } 18 bool hasAttribut(const string _id) { return (attrList.hasMappedValue(_id)); }20 bool hasAttribut(const string& _id) { return (attrList.hasMappedValue(_id)); } 19 21 20 BaseAttribut* getAttribut(const string _id) throw (XMLIOUndefinedValueException) { return (attrList[_id]); } 22 BaseAttribut* getAttribut(const string& _id) throw (XMLIOUndefinedValueException) { return (attrList[_id]); } 23 24 friend ostream& operator<< (ostream& out, const AttributRegistrar& c) 25 { 26 for(unsigned int i = 0; i < c.attrList.getVectorSize(); i++) out << *c.attrList.getVector()[i]; 27 return (out); 28 } 29 30 31 void setAttributes(const THashAttributes& _attr) 32 { 33 for (THashAttributes::ConstIterator it = _attr.begin(); it != _attr.end(); it++) 34 if ((*it).first.compare(string("id"))!= 0 and (*it).first.compare(string("src"))!=0) 35 // (Au dessus) Non prise en compte de l'identifiant et de l'inclusion de fichiers externes lors de l'affectation des attributs. 36 this->setSAttribut((*it).first, (*it).second); 37 return; 38 } 39 40 void addAttributes(const AttributRegistrar& _parent) 41 { 42 const StrHashMap<BaseAttribut>& _pattr = _parent.getAttributList(); 43 const StrHashMap<BaseAttribut>& _lattr = getAttributList(); 44 //_pattr contient les attributs du parent, _lattr les attributs locaux. 45 46 for(unsigned int i = 0; i < _lattr.getVectorSize(); i++) 47 { 48 if(_lattr.getVector()[i]->_hasValue() or !_pattr.getVector()[i]->_hasValue()) continue; 49 _lattr.getVector()[i]->assignValue(_pattr.getVector()[i]); 50 } 51 } 21 52 22 53 void setSAttribut(const string& att_name, const std::string& value)
Note: See TracChangeset
for help on using the changeset viewer.