1 #ifndef TORCCOREUTILS_H 2 #define TORCCOREUTILS_H 13 void QtMessage (QtMsgType Type,
const QMessageLogContext &Context,
const QString &Message);
20 return QString(QMetaEnum::fromType<T>().valueToKey(Value)).toLower();
25 return QMetaEnum::fromType<T>().valueToKey(Value);
28 template <
typename T>
int StringToEnum(
const QString &Value,
bool CaseSensitive =
false)
30 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
32 return metaEnum.keyToValue(Value.toLatin1());
33 QByteArray value = Value.toLower().toLatin1();
34 for (
int count = metaEnum.keyCount() - 1 ; count >= 0; --count)
35 if (qstrcmp(value, QByteArray(metaEnum.key(count)).toLower()) == 0)
36 return metaEnum.value(count);
42 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
44 result.reserve(metaEnum.keyCount());
45 for (
int count = metaEnum.keyCount() - 1 ; count >= 0; --count)
46 result << QString(metaEnum.key(count)).toLower();
51 #endif // TORCCOREUTILS_H
bool HasZlib(void)
Return true if zlib support is available.
quint64 GetMicrosecondCount(void)
Get the current system clock time in microseconds.
QDateTime DateTimeFromString(const QString &String)
Parse a QDateTime from the given QString.
QString EnumToLowerString(T Value)
QByteArray GZipCompressFile(QFile &Source)
Compress the given file using GZip.
QByteArray GZipCompress(QByteArray &Source)
Compress the supplied data using GZip.
void QtMessage(QtMsgType Type, const QMessageLogContext &Context, const QString &Message)
A handler routine for Qt messages.
QString EnumToString(T Value)
int StringToEnum(const QString &Value, bool CaseSensitive=false)