14 #include <boost/lexical_cast.hpp> 
   18 namespace confparser {
 
   38       : std::invalid_argument( "Tried to retrieve non-existing parameter" ),
 
   47       : std::invalid_argument( 
"Tried to retrieve non-existing parameter " 
   90   typedef std::multimap< std::string, ConfBlock >::iterator 
childIter;
 
   91   typedef std::map< std::string, std::string >::iterator 
propIter;
 
  130     if ( it == 
children_.end() ) 
return NULL;
 
  131     return &(it->second);
 
  141   std::pair< childIter, childIter > 
findAll( std::string blockName ) {
 
  142     return children_.equal_range( blockName );
 
  151   template < 
typename T >
 
  152   T getParam( std::string key ) 
throw ( std::invalid_argument ) {
 
  153     std::map< std::string, std::string >::iterator it = 
props_.find( key );
 
  157       return boost::lexical_cast<
T>( it->second );
 
  158     } 
catch( boost::bad_lexical_cast& e ) {
 
  159       throw std::invalid_argument( 
"Bad value given for key '" + key + 
"': could not convert" );
 
  171   template < 
typename T >
 
  172   bool getParam( std::string key, 
T& value ) 
throw ( std::invalid_argument ) {
 
  174     if ( it == 
props_.end() ) 
return false;
 
  176       value = boost::lexical_cast<
T>( it->second );
 
  177     } 
catch( boost::bad_lexical_cast& e ) {
 
  178       throw std::invalid_argument( 
"Bad value given for key '" + key + 
"': could not convert" );
 
  213   bool addParam( std::string key, std::string value ) {
 
  214     std::pair<propIter,bool> p = 
props_.insert( std::make_pair( key, value ) );
 
  226   template < 
typename T >
 
  229     if ( it == 
props_.end() ) 
return false;
 
  230     it->second = boost::lexical_cast<std::string>( value );
 
  241     return props_.erase( key );
 
  270   std::map< std::string, std::string > 
props_;