tcglobal.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "tcglobal.h"
00018
00019
00020 namespace tc {
00021
00022
00023
00024 DebugMessage
00025 debug(const QString &fmt)
00026 {
00027 return DebugMessage(QtDebugMsg, fmt);
00028 }
00029
00030
00031
00032 DebugMessage
00033 warn(const QString &fmt)
00034 {
00035 return DebugMessage(QtWarningMsg, fmt);
00036 }
00037
00038
00039
00040 DebugMessage
00041 error(const QString &fmt)
00042 {
00043 return DebugMessage(QtCriticalMsg, fmt);
00044 }
00045
00046
00047
00048 DebugMessage
00049 fatal(const QString &fmt)
00050 {
00051 return DebugMessage(QtFatalMsg, fmt);
00052 }
00053
00054
00055 ConnectionStatusReason
00056 connectionStatusReasonFromString(const QString &str)
00057 {
00058 if (str.isEmpty())
00059 return UnrecognizedReason;
00060 if (!str.compare("MISC", Qt::CaseInsensitive))
00061 return MiscellaneousReason;
00062 if (!str.compare("IDENTITY", Qt::CaseInsensitive))
00063 return IdentityMismatch;
00064 if (!str.compare("RESOURCELIMIT", Qt::CaseInsensitive))
00065 return ResourceLimitReached;
00066 if (!str.compare("DONE", Qt::CaseInsensitive))
00067 return ConnectionDone;
00068 if (!str.compare("CONNECTREFUSED"))
00069 return ConnectionRefused;
00070 if (!str.compare("CONNECTRESET", Qt::CaseInsensitive))
00071 return ConnectionRefused;
00072 if (!str.compare("TIMEOUT", Qt::CaseInsensitive))
00073 return ConnectionTimeout;
00074 if (!str.compare("NOROUTE", Qt::CaseInsensitive))
00075 return NoRouteToHost;
00076 if (!str.compare("IOERROR", Qt::CaseInsensitive))
00077 return ConnectionIoError;
00078 return UnrecognizedReason;
00079 }
00080
00081
00082 Severity
00083 severityFromString(const QString &str)
00084 {
00085 if (!str.compare("DEBUG", Qt::CaseInsensitive))
00086 return DebugSeverity;
00087 if (!str.compare("INFO", Qt::CaseInsensitive))
00088 return InfoSeverity;
00089 if (!str.compare("NOTICE", Qt::CaseInsensitive))
00090 return NoticeSeverity;
00091 if (!str.compare("WARN", Qt::CaseInsensitive))
00092 return WarnSeverity;
00093 if (!str.compare("ERR", Qt::CaseInsensitive))
00094 return ErrorSeverity;
00095 return UnrecognizedSeverity;
00096 }
00097
00098 }
00099