added function getForSure

This commit is contained in:
darkeye 2000-11-09 22:08:17 +00:00
parent fbaf268435
commit 7c682a8a12
2 changed files with 34 additions and 0 deletions

View File

@ -107,6 +107,26 @@ ConfigSection :: get ( const char * key ) const throw ( Exception )
}
/*------------------------------------------------------------------------------
* Get a value for a key, in the key does not exist, throw an exception
*----------------------------------------------------------------------------*/
const char *
ConfigSection :: getForSure ( const char * key,
const char * message1 = 0,
const char * message2 = 0,
int code = 0 ) const
throw ( Exception )
{
const char * value;
if ( !(value = get( key)) ) {
throw Exception( __FILE__, __LINE__, key, message1, message2, code);
}
return value;
}
/*------------------------------------------------------------------------------
* Add a configuration line
*----------------------------------------------------------------------------*/
@ -160,6 +180,9 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
$Source$
$Log$
Revision 1.2 2000/11/09 22:08:17 darkeye
added function getForSure
Revision 1.1 2000/11/08 17:29:50 darkeye
added configuration file reader

View File

@ -117,6 +117,14 @@ class ConfigSection : public virtual Referable
get ( const char * key ) const throw ( Exception );
virtual const char *
getForSure ( const char * key,
const char * message1 = 0,
const char * message2 = 0,
int code = 0 ) const
throw ( Exception );
virtual bool
addLine ( const char * line ) throw ( Exception );
};
@ -137,6 +145,9 @@ class ConfigSection : public virtual Referable
$Source$
$Log$
Revision 1.2 2000/11/09 22:08:17 darkeye
added function getForSure
Revision 1.1 2000/11/08 17:29:50 darkeye
added configuration file reader