source: XMLIO_V2/dev/dev_rv/attribut_registrar.hpp @ 88

Last change on this file since 88 was 88, checked in by hozdoba, 14 years ago

Version expérimentale, commit pour sauvegarde.

File size: 1.6 KB
Line 
1#ifndef __ATTRIBUT_REGISTRAR__
2#define __ATTRIBUT_REGISTRAR__
3
4#include "attribut.hpp"
5
6namespace XMLIOSERVER
7{
8   class AttributRegistrar
9   {
10      public :
11       
12         AttributRegistrar():attrList()
13         {/* Ne rien faire de plus */}
14     
15         void RegisterAttribut(BaseAttribut* attribut){ attrList.addPtrObject(attribut); }         
16         StrHashMap<BaseAttribut*>& getAttributList(void) { return (attrList); }         
17         size_t getNbAttributes() const {return (attrList.getSize()); }
18         bool hasAttribut(const string _id) { return (attrList.hasMappedValue(_id)); }
19         
20         BaseAttribut* getAttribut(const string _id) throw (XMLIOUndefinedValueException) { return (attrList[_id]); }
21       
22         void setSAttribut(const string& att_name, const std::string& value)
23         {
24            //std::cout << "Attribut :" <<  att_name<< ", " << value<< std::endl;
25
26            if (hasAttribut(att_name))
27            { getAttribut(att_name)->setFromString(value) ; }
28            else
29            {
30               ostringstream oss;
31               oss << "CAttributRegistrar::setAttribut<ValueType>, could not find <<"<<att_name<<">> attribut in registred list" <<">>";
32               throw XMLIOUndefinedValueException(oss.str());
33            }
34         
35         }
36             
37         ostream & PrintAttribut(ostream& o) {o << "A réimplémenter"; return o ;}
38         
39        ~AttributRegistrar(void)
40        {/* Ne rien faire de plus */}
41       
42      private :
43         StrHashMap<BaseAttribut*> attrList;
44       
45   }; // class AttributRegistrar 
46}; // namespace XMLIOSERVER
47
48
49#endif //__ATTRIBUT_REGISTRAR__
Note: See TracBrowser for help on using the repository browser.