ICU-820 make error/log functions more convenient with sprintf-style formatting
X-SVN-Rev: 3466
This commit is contained in:
parent
a93cba766c
commit
2b041cf380
@ -15,6 +15,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/ures.h"
|
||||
@ -766,6 +767,51 @@ void IntlTest::errln( const UnicodeString &message )
|
||||
if (!no_err_msg) LL_message( message, TRUE );
|
||||
}
|
||||
|
||||
/* convenience functions that include sprintf formatting */
|
||||
void IntlTest::log(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
log(UnicodeString(buffer, ""));
|
||||
}
|
||||
|
||||
void IntlTest::logln(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
logln(UnicodeString(buffer, ""));
|
||||
}
|
||||
|
||||
void IntlTest::err(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
err(UnicodeString(buffer, ""));
|
||||
}
|
||||
|
||||
void IntlTest::errln(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
errln(UnicodeString(buffer, ""));
|
||||
}
|
||||
|
||||
void IntlTest::printErrors()
|
||||
{
|
||||
IntlTest::LL_message(errorList, TRUE);
|
||||
|
@ -64,28 +64,22 @@ public:
|
||||
|
||||
virtual void log( const UnicodeString &message );
|
||||
|
||||
// convenience function; assume that the message contains only invariant charcters
|
||||
virtual void log( const char *message );
|
||||
|
||||
virtual void logln( const UnicodeString &message );
|
||||
|
||||
// convenience function; assume that the message contains only invariant charcters
|
||||
virtual void logln( const char *message );
|
||||
|
||||
virtual void logln( void );
|
||||
|
||||
virtual void err(void);
|
||||
|
||||
virtual void err( const UnicodeString &message );
|
||||
|
||||
// convenience function; assume that the message contains only invariant charcters
|
||||
virtual void err( const char *message );
|
||||
|
||||
virtual void errln( const UnicodeString &message );
|
||||
|
||||
// convenience function; assume that the message contains only invariant charcters
|
||||
virtual void errln( const char *message );
|
||||
|
||||
// convenience functions: sprintf() + errln() etc.
|
||||
void log(const char *fmt, ...);
|
||||
void logln(const char *fmt, ...);
|
||||
void err(const char *fmt, ...);
|
||||
void errln(const char *fmt, ...);
|
||||
|
||||
// Print ALL named errors encountered so far
|
||||
void printErrors();
|
||||
|
||||
@ -150,22 +144,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
inline void IntlTest::log( const char *message ) {
|
||||
log(UnicodeString(message, ""));
|
||||
}
|
||||
|
||||
inline void IntlTest::logln( const char *message ) {
|
||||
logln(UnicodeString(message, ""));
|
||||
}
|
||||
|
||||
inline void IntlTest::err( const char *message ) {
|
||||
err(UnicodeString(message, ""));
|
||||
}
|
||||
|
||||
inline void IntlTest::errln( const char *message ) {
|
||||
errln(UnicodeString(message, ""));
|
||||
}
|
||||
|
||||
void it_log( UnicodeString message );
|
||||
void it_logln( UnicodeString message );
|
||||
void it_logln( void );
|
||||
|
Loading…
Reference in New Issue
Block a user