00001 #ifndef _CTBattrList_HXX 00002 #define _CTBattrList_HXX 1 00003 00008 /*----------------------------------------------------------------------------*/ 00009 /* C Tool Box: Designed and implemented by: */ 00010 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00011 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00012 /* Email: W.F.J.Mueller@gsi.de */ 00013 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00014 /*------------------------------------------+---------------------------------*/ 00015 00016 #include "CTBvector.hxx" 00017 #include "CTBpair.hxx" 00018 #include "CTBstring.hxx" 00019 #include "CTBxmlIStream.hxx" 00020 #include "CTBxmlOStream.hxx" 00021 00022 class CTBattrList { 00023 public: 00024 CTBattrList(); 00025 ~CTBattrList(); 00026 00027 void Set(const char* c_key, const char* c_value); 00028 void Set(const char* c_key, const CTBstring& value); 00029 00030 CTBint Size() const; 00031 void Clear(); 00032 00033 void ToStream(ostream& os) const; 00034 00035 void ToXStream(CTBxmlOStream& xos, 00036 const char* c_name = "CTBattrList") const; 00037 void FromXStream(CTBxmlIStream& xis, 00038 const char* c_name = "CTBattrList"); 00039 00040 const CTBstring& operator[](CTBint i_ind) const; 00041 const CTBstring& operator[](const char* c_key) const; 00042 const CTBstring& operator[](const CTBstring& key) const; 00043 00044 bool operator!() const; 00045 operator void* () const; 00046 00047 private: 00048 00049 CTBint Find(const char* c_key) const; 00050 CTBint Find(const CTBstring& key) const; 00051 00052 CTBint FindOrCreate(const char* c_key) ; 00053 CTBint FindOrCreate(const CTBstring& key); 00054 00055 private: 00056 00057 CTBvector<CTBpair<CTBstring, CTBstring> > m_attrlist; 00058 }; 00059 00060 ostream& operator<<(ostream& os, const CTBattrList& obj); 00061 00062 CTBxmlOStream& operator<<(CTBxmlOStream& xos, const CTBattrList& obj); 00063 CTBxmlIStream& operator>>(CTBxmlIStream& xis, CTBattrList& obj); 00064 00065 #include "CTBattrList.icc" 00066 00067 #endif