TreeFrogFramework  1.18
Namespaces | Macros | Functions
tglobal.h File Reference
#include <QtGlobal>
#include <QMetaType>
#include <TfNamespace>
#include <TDebug>
#include <TWebApplication>
#include "tfexception.h"
#include <cstdint>
Include dependency graph for tglobal.h:

Go to the source code of this file.

Namespaces

 Tf
 

Macros

#define TF_VERSION_STR   "1.19.0"
 
#define TF_VERSION_NUMBER   0x011900
 
#define TF_SRC_REVISION   1549
 
#define T_DECLARE_CONTROLLER(TYPE, NAME)
 
#define T_REGISTER_CONTROLLER(TYPE)   T_REGISTER_METATYPE(TYPE)
 
#define T_REGISTER_VIEW(TYPE)   T_REGISTER_METATYPE(TYPE)
 
#define T_REGISTER_METATYPE(TYPE)
 
#define T_DEFINE_CONTROLLER(TYPE)   T_DEFINE_VIEW(TYPE)
 
#define T_DEFINE_VIEW(TYPE)
 
#define T_REGISTER_STREAM_OPERATORS(TYPE)
 
#define T_DEFINE_PROPERTY(TYPE, PROPERTY)
 
#define T_CORE_EXPORT
 
#define T_MODEL_EXPORT
 
#define T_VIEW_EXPORT
 
#define T_CONTROLLER_EXPORT
 
#define T_HELPER_EXPORT
 
#define T_ATTRIBUTE_FORMAT(A, B)
 
#define T_EXPORT(VAR)   do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); exportVariant(QLatin1String(#VAR), (___##VAR##_), true); } while(0)
 
#define texport(VAR)   T_EXPORT(VAR)
 
#define T_EXPORT_UNLESS(VAR)   do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); exportVariant(QLatin1String(#VAR), (___##VAR##_), false); } while(0)
 
#define texportUnless(VAR)   T_EXPORT_UNLESS(VAR)
 
#define T_FETCH(TYPE, VAR)   TYPE VAR = variant(QLatin1String(#VAR)).value<TYPE>()
 
#define tfetch(TYPE, VAR)   T_FETCH(TYPE,VAR)
 
#define T_FETCH_V(TYPE, VAR, DEFAULT)   TYPE VAR = (hasVariant(QLatin1String(#VAR))) ? (variant(QLatin1String(#VAR)).value<TYPE>()) : (DEFAULT)
 
#define tfetchv(TYPE, VAR, DEFAULT)   T_FETCH_V(TYPE,VAR,DEFAULT)
 
#define T_EHEX(VAR)   eh(variant(QLatin1String(#VAR)))
 
#define tehex(VAR)   T_EHEX(VAR)
 
#define T_EHEX_V(VAR, DEFAULT)   do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) eh(DEFAULT); else eh(___##VAR##_); } while(0)
 
#define tehexv(VAR, DEFAULT)   T_EHEX_V(VAR,DEFAULT)
 
#define T_EHEX2(VAR, DEFAULT)   do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) eh(DEFAULT); else eh(___##VAR##_); } while(0)
 
#define tehex2(VAR, DEFAULT)   T_EHEX2(VAR,DEFAULT)
 
#define T_ECHOEX(VAR)   echo(variant(QLatin1String(#VAR)))
 
#define techoex(VAR)   T_ECHOEX(VAR)
 
#define T_ECHOEX_V(VAR, DEFAULT)   do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) echo(DEFAULT); else echo(___##VAR##_); } while(0)
 
#define techoexv(VAR, DEFAULT)   T_ECHOEX_V(VAR,DEFAULT)
 
#define T_ECHOEX2(VAR, DEFAULT)   do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) echo(DEFAULT); else echo(___##VAR##_); } while(0)
 
#define techoex2(VAR, DEFAULT)   T_ECHOEX2(VAR,DEFAULT)
 
#define T_FLASH(VAR)   do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); setFlash(QLatin1String(#VAR), (___##VAR##_)); } while(0)
 
#define tflash(VAR)   T_FLASH(VAR)
 
#define T_VARIANT(VAR)   (variant(QLatin1String(#VAR)).toString())
 
#define T_DISABLE_COPY(Class)
 
#define T_DISABLE_MOVE(Class)
 
#define tFatal   TDebug(Tf::FatalLevel).fatal
 
#define tError   TDebug(Tf::ErrorLevel).error
 
#define tWarn   TDebug(Tf::WarnLevel).warn
 
#define tInfo   TDebug(Tf::InfoLevel).info
 
#define tDebug   TDebug(Tf::DebugLevel).debug
 
#define tTrace   TDebug(Tf::TraceLevel).trace
 
#define TF_SET_CODEC_FOR_TR(codec)
 

Functions

T_CORE_EXPORT TWebApplicationTf::app ()
 
T_CORE_EXPORT TAppSettings * Tf::appSettings ()
 
T_CORE_EXPORT const QVariantMap & Tf::conf (const QString &configName)
 
T_CORE_EXPORT void Tf::msleep (unsigned long msecs)
 
T_CORE_EXPORT void Tf::srandXor128 (quint32 seed)
 
T_CORE_EXPORT quint32 Tf::randXor128 ()
 
T_CORE_EXPORT uint32_t Tf::rand32_r ()
 
T_CORE_EXPORT uint64_t Tf::rand64_r ()
 
T_CORE_EXPORT uint64_t Tf::random (uint64_t min, uint64_t max)
 
T_CORE_EXPORT uint64_t Tf::random (uint64_t max)
 
T_CORE_EXPORT TActionContext * Tf::currentContext ()
 
T_CORE_EXPORT TDatabaseContextTf::currentDatabaseContext ()
 
T_CORE_EXPORT QSqlDatabase & Tf::currentSqlDatabase (int id)
 
T_CORE_EXPORT QMap< QByteArray, const QMetaObject * > * Tf::metaObjects ()
 

Macro Definition Documentation

#define T_ATTRIBUTE_FORMAT (   A,
 
)
#define T_CONTROLLER_EXPORT
#define T_CORE_EXPORT
#define T_DECLARE_CONTROLLER (   TYPE,
  NAME 
)
Value:
typedef TYPE NAME; \
Q_DECLARE_METATYPE(NAME)
#define T_DEFINE_CONTROLLER (   TYPE)    T_DEFINE_VIEW(TYPE)
#define T_DEFINE_PROPERTY (   TYPE,
  PROPERTY 
)
Value:
inline void set##PROPERTY(const TYPE &v__) { PROPERTY = v__; } \
inline TYPE get##PROPERTY() const { return PROPERTY; }
#define T_DEFINE_VIEW (   TYPE)
Value:
class Static##TYPE##Definition \
{ \
public: \
Static##TYPE##Definition() \
{ \
Tf::metaObjects()->insert(QByteArray(#TYPE).toLower(), &TYPE::staticMetaObject); \
} \
}; \
static Static##TYPE##Definition _static##TYPE##Definition;
T_CORE_EXPORT QMap< QByteArray, const QMetaObject * > * metaObjects()
Definition: tglobal.cpp:235
#define T_DISABLE_COPY (   Class)
Value:
Class(const Class &) = delete; \
Class &operator=(const Class &) = delete;
#define T_DISABLE_MOVE (   Class)
Value:
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define T_ECHOEX (   VAR)    echo(variant(QLatin1String(#VAR)))
#define T_ECHOEX2 (   VAR,
  DEFAULT 
)    do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) echo(DEFAULT); else echo(___##VAR##_); } while(0)
#define T_ECHOEX_V (   VAR,
  DEFAULT 
)    do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) echo(DEFAULT); else echo(___##VAR##_); } while(0)
#define T_EHEX (   VAR)    eh(variant(QLatin1String(#VAR)))
#define T_EHEX2 (   VAR,
  DEFAULT 
)    do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) eh(DEFAULT); else eh(___##VAR##_); } while(0)
#define T_EHEX_V (   VAR,
  DEFAULT 
)    do { QString ___##VAR##_ = variant(QLatin1String(#VAR)).toString(); if (___##VAR##_.isEmpty()) eh(DEFAULT); else eh(___##VAR##_); } while(0)
#define T_EXPORT (   VAR)    do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); exportVariant(QLatin1String(#VAR), (___##VAR##_), true); } while(0)
#define T_EXPORT_UNLESS (   VAR)    do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); exportVariant(QLatin1String(#VAR), (___##VAR##_), false); } while(0)
#define T_FETCH (   TYPE,
  VAR 
)    TYPE VAR = variant(QLatin1String(#VAR)).value<TYPE>()
#define T_FETCH_V (   TYPE,
  VAR,
  DEFAULT 
)    TYPE VAR = (hasVariant(QLatin1String(#VAR))) ? (variant(QLatin1String(#VAR)).value<TYPE>()) : (DEFAULT)
#define T_FLASH (   VAR)    do { QVariant ___##VAR##_; ___##VAR##_.setValue(VAR); setFlash(QLatin1String(#VAR), (___##VAR##_)); } while(0)
#define T_HELPER_EXPORT
#define T_MODEL_EXPORT
#define T_REGISTER_CONTROLLER (   TYPE)    T_REGISTER_METATYPE(TYPE)
#define T_REGISTER_METATYPE (   TYPE)
Value:
class Static##TYPE##Instance \
{ \
public: \
Static##TYPE##Instance() \
{ \
qRegisterMetaType<TYPE>(); \
} \
}; \
static Static##TYPE##Instance _static##TYPE##Instance;
#define T_REGISTER_STREAM_OPERATORS (   TYPE)
Value:
class Static##TYPE##Instance \
{ \
public: \
Static##TYPE##Instance() \
{ \
qRegisterMetaTypeStreamOperators<TYPE>(#TYPE); \
} \
}; \
static Static##TYPE##Instance _static##TYPE##Instance;
#define T_REGISTER_VIEW (   TYPE)    T_REGISTER_METATYPE(TYPE)
#define T_VARIANT (   VAR)    (variant(QLatin1String(#VAR)).toString())
#define T_VIEW_EXPORT
#define tDebug   TDebug(Tf::DebugLevel).debug
#define techoex (   VAR)    T_ECHOEX(VAR)
#define techoex2 (   VAR,
  DEFAULT 
)    T_ECHOEX2(VAR,DEFAULT)
#define techoexv (   VAR,
  DEFAULT 
)    T_ECHOEX_V(VAR,DEFAULT)
#define tehex (   VAR)    T_EHEX(VAR)
#define tehex2 (   VAR,
  DEFAULT 
)    T_EHEX2(VAR,DEFAULT)
#define tehexv (   VAR,
  DEFAULT 
)    T_EHEX_V(VAR,DEFAULT)
#define tError   TDebug(Tf::ErrorLevel).error
#define texport (   VAR)    T_EXPORT(VAR)
#define texportUnless (   VAR)    T_EXPORT_UNLESS(VAR)
#define TF_SET_CODEC_FOR_TR (   codec)
#define TF_SRC_REVISION   1549
#define TF_VERSION_NUMBER   0x011900
#define TF_VERSION_STR   "1.19.0"
#define tFatal   TDebug(Tf::FatalLevel).fatal
#define tfetch (   TYPE,
  VAR 
)    T_FETCH(TYPE,VAR)
#define tfetchv (   TYPE,
  VAR,
  DEFAULT 
)    T_FETCH_V(TYPE,VAR,DEFAULT)
#define tflash (   VAR)    T_FLASH(VAR)
#define tInfo   TDebug(Tf::InfoLevel).info
#define tTrace   TDebug(Tf::TraceLevel).trace
#define tWarn   TDebug(Tf::WarnLevel).warn