/* ImLib3D
 * Copyright (c) 2001, ULP-IPB Strasbourg.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
/*! \file StringTools.hpp */
//!StringTools.hpp
#ifndef _StringTools_hpp
#define _StringTools_hpp

#include<map>
#include<list>



// typedef for map[string]=string
typedef map< string, string, less<string > >  StrMap;
typedef StrMap::value_type StrMapVT;
typedef map< string, int, less<string > >  StrIntMap;
typedef StrIntMap::value_type StrIntMapVT;

// ********** StrStr ***********
//! String to string map, 
/*! operator [s] returns empty string if s is not found
 */
class StrStr : public StrMap
{
public:
	void Set(string s,string val)
	{
		StrMap::iterator it=(*this).find(s);
		if(it==(*this).end()){this->insert(value_type(s,val));}
		else{(*it).second=val;}		
	}
    const string operator [] (const string &str) const
    {
		StrMap::const_iterator it=(*this).find(str);
		if(it==(*this).end()){return string();}
		return (*it).second;
    }
};

#endif // _StringTools_hpp
