added function getForSure
This commit is contained in:
parent
fbaf268435
commit
7c682a8a12
|
@ -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
|
* Add a configuration line
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -160,6 +180,9 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.2 2000/11/09 22:08:17 darkeye
|
||||||
|
added function getForSure
|
||||||
|
|
||||||
Revision 1.1 2000/11/08 17:29:50 darkeye
|
Revision 1.1 2000/11/08 17:29:50 darkeye
|
||||||
added configuration file reader
|
added configuration file reader
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,14 @@ class ConfigSection : public virtual Referable
|
||||||
get ( const char * key ) const throw ( Exception );
|
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
|
virtual bool
|
||||||
addLine ( const char * line ) throw ( Exception );
|
addLine ( const char * line ) throw ( Exception );
|
||||||
};
|
};
|
||||||
|
@ -137,6 +145,9 @@ class ConfigSection : public virtual Referable
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.2 2000/11/09 22:08:17 darkeye
|
||||||
|
added function getForSure
|
||||||
|
|
||||||
Revision 1.1 2000/11/08 17:29:50 darkeye
|
Revision 1.1 2000/11/08 17:29:50 darkeye
|
||||||
added configuration file reader
|
added configuration file reader
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue