Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

StringTools.hpp

Go to the documentation of this file.
00001 /* ImLib3D
00002  * Copyright (c) 2001, ULP-IPB Strasbourg.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00019 
00020 #ifndef _StringTools_hpp
00021 #define _StringTools_hpp
00022 
00023 #include<map>
00024 #include<list>
00025 
00026 
00027 
00028 // typedef for map[string]=string
00029 typedef map< string, string, less<string > >  StrMap;
00030 typedef StrMap::value_type StrMapVT;
00031 typedef map< string, int, less<string > >  StrIntMap;
00032 typedef StrIntMap::value_type StrIntMapVT;
00033 
00034 // ********** StrStr ***********
00036 
00038 class StrStr : public StrMap
00039 {
00040 public:
00041     void Set(string s,string val)
00042     {
00043         StrMap::iterator it=(*this).find(s);
00044         if(it==(*this).end()){this->insert(value_type(s,val));}
00045         else{(*it).second=val;}     
00046     }
00047     const string operator [] (const string &str) const
00048     {
00049         StrMap::const_iterator it=(*this).find(str);
00050         if(it==(*this).end()){return string();}
00051         return (*it).second;
00052     }
00053 };
00054 
00055 #endif // _StringTools_hpp

Generated on Fri Jun 17 13:36:07 2005 for ImLib3D by  doxygen 1.4.2