00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "XBase.h"
00020 #include "CStringUtil.h"
00021 #include <cerrno>
00022 #include <cstdarg>
00023
00024
00025
00026
00027
00028 XBase::XBase() :
00029 m_what()
00030 {
00031
00032 }
00033
00034 XBase::XBase(const CString& msg) :
00035 m_what(msg)
00036 {
00037
00038 }
00039
00040 XBase::~XBase()
00041 {
00042
00043 }
00044
00045 const char*
00046 XBase::what() const
00047 {
00048 if (m_what.empty()) {
00049 m_what = getWhat();
00050 }
00051 return m_what.c_str();
00052 }
00053
00054 CString
00055 XBase::format(const char* , const char* fmt, ...) const throw()
00056 {
00057
00058
00059
00060
00061 CString result;
00062 va_list args;
00063 va_start(args, fmt);
00064 try {
00065 result = CStringUtil::vformat(fmt, args);
00066 }
00067 catch (...) {
00068
00069 }
00070 va_end(args);
00071
00072 return result;
00073 }