added multiple-string constructors

This commit is contained in:
darkeye 2000-11-09 22:05:44 +00:00
parent fef3c01532
commit 00b2c26cc8
2 changed files with 104 additions and 0 deletions

View File

@ -68,6 +68,89 @@ static const char fileid[] = "$Id$";
/* ============================================================= module code */ /* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor
*----------------------------------------------------------------------------*/
Exception :: Exception ( const char * file,
unsigned int line,
const char * description1,
const char * description2,
int code = 0 ) throw ()
{
size_t len = 0;
if ( description1 ) {
len += strlen( description1);
}
if ( description2 ) {
len += strlen( description2);
}
if ( len ) {
char str[len+1];
str[0] = '\0';
if ( description1 ) {
strcat( str, description1);
}
if ( description2 ) {
strcat( str, description2);
}
init( file, line, str, code);
} else {
init( file, line, 0, code);
}
}
/*------------------------------------------------------------------------------
* Constructor
*----------------------------------------------------------------------------*/
Exception :: Exception ( const char * file,
unsigned int line,
const char * description1,
const char * description2,
const char * description3,
int code = 0 ) throw ()
{
size_t len = 0;
if ( description1 ) {
len += strlen( description1);
}
if ( description2 ) {
len += strlen( description2);
}
if ( description3 ) {
len += strlen( description3);
}
if ( len ) {
char str[len+1];
str[0] = '\0';
if ( description1 ) {
strcat( str, description1);
}
if ( description2 ) {
strcat( str, description2);
}
if ( description3 ) {
strcat( str, description3);
}
init( file, line, str, code);
} else {
init( file, line, 0, code);
}
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Initialize the class * Initialize the class
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -129,6 +212,9 @@ Exception :: strip ( void ) throw ()
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2000/11/09 22:05:44 darkeye
added multiple-string constructors
Revision 1.2 2000/11/05 14:08:27 darkeye Revision 1.2 2000/11/05 14:08:27 darkeye
changed builting to an automake / autoconf environment changed builting to an automake / autoconf environment

View File

@ -117,6 +117,21 @@ class Exception
} }
Exception ( const char * file,
unsigned int line,
const char * description1,
const char * description2,
int code = 0 ) throw ();
Exception ( const char * file,
unsigned int line,
const char * description1,
const char * description2,
const char * description3,
int code = 0 ) throw ();
inline inline
~Exception ( void ) throw () ~Exception ( void ) throw ()
{ {
@ -191,6 +206,9 @@ operator<< ( ostream & os,
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2000/11/09 22:05:44 darkeye
added multiple-string constructors
Revision 1.2 2000/11/05 14:08:27 darkeye Revision 1.2 2000/11/05 14:08:27 darkeye
changed builting to an automake / autoconf environment changed builting to an automake / autoconf environment