TreeFrogFramework 2.10
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
Tf Namespace Reference

Enumerations

enum  QuotedStrSplitBehavior { SplitWhereverSep = 0 , SplitSkipQuotedString }
 
enum  CaseSensitivity { CaseInsensitive = Qt::CaseInsensitive , CaseSensitive = Qt::CaseSensitive }
 
enum  HttpMethod {
  Invalid = 0 , Get , Head , Post ,
  Options , Put , Delete , Trace ,
  Connect , Patch
}
 
enum  HttpStatusCode {
  Continue = 100 , SwitchingProtocols = 101 , OK = 200 , Created = 201 ,
  Accepted = 202 , NonAuthoritativeInformation = 203 , NoContent = 204 , ResetContent = 205 ,
  PartialContent = 206 , MultipleChoices = 300 , MovedPermanently = 301 , Found = 302 ,
  SeeOther = 303 , NotModified = 304 , UseProxy = 305 , TemporaryRedirect = 307 ,
  BadRequest = 400 , Unauthorized = 401 , PaymentRequired = 402 , Forbidden = 403 ,
  NotFound = 404 , MethodNotAllowed = 405 , NotAcceptable = 406 , ProxyAuthenticationRequired = 407 ,
  RequestTimeout = 408 , Conflict = 409 , Gone = 410 , LengthRequired = 411 ,
  PreconditionFailed = 412 , RequestEntityTooLarge = 413 , RequestURITooLong = 414 , UnsupportedMediaType = 415 ,
  RequestedRangeNotSatisfiable = 416 , ExpectationFailed = 417 , InternalServerError = 500 , NotImplemented = 501 ,
  BadGateway = 502 , ServiceUnavailable = 503 , GatewayTimeout = 504 , HTTPVersionNotSupported = 505
}
 
enum  AjaxOption {
  Asynchronous = 0 , ContentType , Encoding , Method ,
  Parameters , PostBody , RequestHeaders , EvalJS ,
  EvalJSON , SanitizeJSON
}
 
enum  AjaxEvent {
  Create = 100 , Uninitialized , Loading , Loaded ,
  Interactive , Success , Failure , Complete
}
 
enum  ValidationRule {
  Required = 0 , MaxLength , MinLength , IntMax ,
  IntMin , DoubleMax , DoubleMin , EmailAddress ,
  Url , Date , Time , DateTime ,
  Pattern , Custom , RuleCount
}
 
enum  EscapeFlag { Compatible = 0 , Quotes , NoQuotes }
 
enum  SortOrder { AscendingOrder = Qt::AscendingOrder , DescendingOrder = Qt::DescendingOrder }
 
enum  AppAttribute {
  ListenPort = 0 , InternalEncoding = 1 , HttpOutputEncoding = 2 , Locale = 3 ,
  MultiProcessingModule = 4 , UploadTemporaryDirectory = 5 , SqlDatabaseSettingsFiles = 6 , MongoDbSettingsFile = 7 ,
  RedisSettingsFile = 8 , MemcachedSettingsFile = 9 , SqlQueriesStoredDirectory = 10 , DirectViewRenderMode = 11 ,
  ApplicationAbortOnFatal = 13 , LimitRequestBody , EnableCsrfProtectionModule , EnableHttpMethodOverride ,
  SessionName , SessionStoreType , SessionAutoIdRegeneration , SessionCookiePath ,
  SessionGcProbability , SessionGcMaxLifeTime , SessionSecret , SessionCsrfProtectionKey ,
  MPMThreadMaxAppServers , MPMThreadMaxThreadsPerAppServer , MPMEpollMaxAppServers , SystemLogFilePath ,
  SystemLogLayout , SystemLogDateTimeFormat , AccessLogFilePath , AccessLogLayout ,
  AccessLogDateTimeFormat , ActionMailerDeliveryMethod , ActionMailerCharacterSet , ActionMailerDelayedDelivery ,
  ActionMailerSmtpHostName , ActionMailerSmtpPort , ActionMailerSmtpAuthentication , ActionMailerSmtpUserName ,
  ActionMailerSmtpPassword , ActionMailerSmtpEnablePopBeforeSmtp , ActionMailerSmtpPopServerHostName , ActionMailerSmtpPopServerPort ,
  ActionMailerSmtpPopServerEnableApop , ActionMailerSendmailCommandLocation , HttpKeepAliveTimeout , LDPreload ,
  JavaScriptPath , ListenAddress , SessionCookieMaxAge , SessionCookieDomain ,
  CacheSettingsFile , CacheBackend , CacheGcProbability , CacheEnableCompression ,
  SessionCookieSameSite , EnableForwardedForHeader , TrustedProxyServers , ActionMailerSmtpRequireTLS ,
  SqlQueryLogFilePath , SqlQueryLogLayout , SqlQueryLogDateTimeFormat
}
 
enum  CloseCode {
  NormalClosure = 1000 , GoingAway = 1001 , ProtocolError = 1002 , UnsupportedData = 1003 ,
  Reserved = 1004 , NoStatusRcvd = 1005 , AbnormalClosure = 1006 , InvalidFramePayloadData = 1007 ,
  PolicyViolation = 1008 , MessageTooBig = 1009 , MandatoryExtension = 1010 , InternalError = 1011 ,
  ServiceRestart = 1012 , TryAgainLater = 1013 , TLSHandshake = 1015
}
 
enum  LogPriority {
  FatalLevel = 0 , ErrorLevel , WarnLevel , InfoLevel ,
  DebugLevel , TraceLevel
}
 
enum class  KvsEngine : int {
  CacheKvs = 0 , MongoDB , Redis , Memcached ,
  SharedMemory , Num
}
 
enum class  SocketState : int { Unconnected = 0 , Connecting , Connected }
 
enum  SystemOpCode {
  InvalidOpCode = 0x00 , WebSocketSendText = 0x01 , WebSocketSendBinary = 0x02 , WebSocketPublishText = 0x03 ,
  WebSocketPublishBinary = 0x04 , MaxOpCode = 0x04
}
 

Functions

T_CORE_EXPORT void setupAppLoggers (TLogger *logger=nullptr)
 
T_CORE_EXPORT void releaseAppLoggers ()
 
T_CORE_EXPORT void logging (int priority, const QByteArray &msg)
 
T_CORE_EXPORT TWebApplicationapp () noexcept
 
T_CORE_EXPORT TAppSettings * appSettings () noexcept
 
T_CORE_EXPORT const QVariantMap & conf (const QString &configName) noexcept
 
T_CORE_EXPORT void msleep (int64_t msecs) noexcept
 
T_CORE_EXPORT int64_t getMSecsSinceEpoch ()
 
T_CORE_EXPORT uint32_t rand32_r () noexcept
 
T_CORE_EXPORT uint64_t rand64_r () noexcept
 
T_CORE_EXPORT uint64_t random (uint64_t min, uint64_t max) noexcept
 
T_CORE_EXPORT uint64_t random (uint64_t max) noexcept
 
T_CORE_EXPORT TCachecache () noexcept
 
T_CORE_EXPORT TAbstractControllercurrentController ()
 
const TAbstractControllerconstCurrentController ()
 
T_CORE_EXPORT TDatabaseContextcurrentDatabaseContext ()
 
T_CORE_EXPORT QSqlDatabase & currentSqlDatabase (int id) noexcept
 
T_CORE_EXPORT QMap< QByteArray, std::function< QObject *()> > * objectFactories () noexcept
 
T_CORE_EXPORT QByteArray lz4Compress (const char *data, int nbytes, int compressionLevel=1) noexcept
 
T_CORE_EXPORT QByteArray lz4Compress (const QByteArray &data, int compressionLevel=1) noexcept
 
T_CORE_EXPORT QByteArray lz4Uncompress (const char *data, int nbytes) noexcept
 
T_CORE_EXPORT QByteArray lz4Uncompress (const QByteArray &data) noexcept
 
bool strcmp (const QByteArray &str1, const QByteArray &str2)
 
template<typename... Args>
void fatal (const std::format_string< Args... > &fmt, Args &&... args)
 
template<typename... Args>
void error (const std::format_string< Args... > &fmt, Args &&... args)
 
template<typename... Args>
void warn (const std::format_string< Args... > &fmt, Args &&... args)
 
template<typename... Args>
void info (const std::format_string< Args... > &fmt, Args &&... args)
 
template<typename... Args>
void debug (const std::format_string< Args... > &fmt, Args &&... args)
 
template<typename... Args>
void trace (const std::format_string< Args... > &fmt, Args &&... args)
 
T_CORE_EXPORT void setAppLogLayout (const QByteArray &layout)
 
T_CORE_EXPORT void setAppLogDateTimeFormat (const QByteArray &format)
 
T_CORE_EXPORT void setupSystemLogger (TSystemLogger *logger=nullptr)
 
T_CORE_EXPORT void releaseSystemLogger ()
 
T_CORE_EXPORT void tSystemMessage (int priority, const QByteArray &message)
 
T_CORE_EXPORT void setupAccessLogger ()
 
T_CORE_EXPORT void releaseAccessLogger ()
 
T_CORE_EXPORT bool isAccessLoggerAvailable ()
 
T_CORE_EXPORT void setupQueryLogger ()
 
T_CORE_EXPORT void releaseQueryLogger ()
 
T_CORE_EXPORT void writeAccessLog (const TAccessLog &log)
 
T_CORE_EXPORT void writeQueryLog (const QString &query, bool success, const QSqlError &error, int duration)
 
T_CORE_EXPORT void traceQuery (int duration, const QByteArray &msg)
 
template<typename... Args>
void traceQueryLog (int duration, const std::format_string< Args... > &fmt, Args &&... args)
 
T_CORE_EXPORT QMap< QString, QVariant > settingsToMap (QSettings &settings, const QString &env=QString())
 

Variables

constexpr auto KeepEmptyParts = Qt::KeepEmptyParts
 
constexpr auto SkipEmptyParts = Qt::SkipEmptyParts
 
constexpr auto ReadOnly = QIODeviceBase::ReadOnly
 
constexpr auto WriteOnly = QIODeviceBase::WriteOnly
 
constexpr auto CR = "\x0d"
 
constexpr auto LF = "\x0a"
 
constexpr auto CRLF = "\x0d\x0a"
 
constexpr auto CRLFCRLF = "\x0d\x0a\x0d\x0a"
 

Detailed Description

The Tf namespace contains miscellaneous identifiers used throughout the library of TreeFrog Framework.

Enumeration Type Documentation

◆ AjaxEvent

Enumerator
Create 
Uninitialized 
Loading 
Loaded 
Interactive 
Success 
Failure 
Complete 

◆ AjaxOption

Enumerator
Asynchronous 
ContentType 
Encoding 
Method 
Parameters 
PostBody 
RequestHeaders 
EvalJS 
EvalJSON 
SanitizeJSON 

◆ AppAttribute

Enumerator
ListenPort 
InternalEncoding 
HttpOutputEncoding 
Locale 
MultiProcessingModule 
UploadTemporaryDirectory 
SqlDatabaseSettingsFiles 
MongoDbSettingsFile 
RedisSettingsFile 
MemcachedSettingsFile 
SqlQueriesStoredDirectory 
DirectViewRenderMode 
ApplicationAbortOnFatal 
LimitRequestBody 
EnableCsrfProtectionModule 
EnableHttpMethodOverride 
SessionName 
SessionStoreType 
SessionAutoIdRegeneration 
SessionCookiePath 
SessionGcProbability 
SessionGcMaxLifeTime 
SessionSecret 
SessionCsrfProtectionKey 
MPMThreadMaxAppServers 
MPMThreadMaxThreadsPerAppServer 
MPMEpollMaxAppServers 
SystemLogFilePath 
SystemLogLayout 
SystemLogDateTimeFormat 
AccessLogFilePath 
AccessLogLayout 
AccessLogDateTimeFormat 
ActionMailerDeliveryMethod 
ActionMailerCharacterSet 
ActionMailerDelayedDelivery 
ActionMailerSmtpHostName 
ActionMailerSmtpPort 
ActionMailerSmtpAuthentication 
ActionMailerSmtpUserName 
ActionMailerSmtpPassword 
ActionMailerSmtpEnablePopBeforeSmtp 
ActionMailerSmtpPopServerHostName 
ActionMailerSmtpPopServerPort 
ActionMailerSmtpPopServerEnableApop 
ActionMailerSendmailCommandLocation 
HttpKeepAliveTimeout 
LDPreload 
JavaScriptPath 
ListenAddress 
SessionCookieMaxAge 
SessionCookieDomain 
CacheSettingsFile 
CacheBackend 
CacheGcProbability 
CacheEnableCompression 
SessionCookieSameSite 
EnableForwardedForHeader 
TrustedProxyServers 
ActionMailerSmtpRequireTLS 
SqlQueryLogFilePath 
SqlQueryLogLayout 
SqlQueryLogDateTimeFormat 

◆ CaseSensitivity

Enumerator
CaseInsensitive 
CaseSensitive 

◆ CloseCode

Enumerator
NormalClosure 
GoingAway 
ProtocolError 
UnsupportedData 
Reserved 
NoStatusRcvd 
AbnormalClosure 
InvalidFramePayloadData 
PolicyViolation 
MessageTooBig 
MandatoryExtension 
InternalError 
ServiceRestart 
TryAgainLater 
TLSHandshake 

◆ EscapeFlag

Enumerator
Compatible 
Quotes 
NoQuotes 

◆ HttpMethod

Enumerator
Invalid 
Get 
Head 
Post 
Options 
Put 
Delete 
Trace 
Connect 
Patch 

◆ HttpStatusCode

Enumerator
Continue 
SwitchingProtocols 
OK 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultipleChoices 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
RequestEntityTooLarge 
RequestURITooLong 
UnsupportedMediaType 
RequestedRangeNotSatisfiable 
ExpectationFailed 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HTTPVersionNotSupported 

◆ KvsEngine

enum class Tf::KvsEngine : int
strong
Enumerator
CacheKvs 
MongoDB 
Redis 
Memcached 
SharedMemory 
Num 

◆ LogPriority

Enumerator
FatalLevel 

Severe error events that will presumably lead the app to abort.

ErrorLevel 

Error events that might still allow the app to continue running.

WarnLevel 

Potentially harmful situations.

InfoLevel 

Informational messages that highlight the progress of the app.

DebugLevel 

Informational events that are most useful to debug the app.

TraceLevel 

Finer-grained informational events than the DEBUG.

◆ QuotedStrSplitBehavior

Enumerator
SplitWhereverSep 
SplitSkipQuotedString 

◆ SocketState

enum class Tf::SocketState : int
strong
Enumerator
Unconnected 
Connecting 
Connected 

◆ SortOrder

Enumerator
AscendingOrder 
DescendingOrder 

◆ SystemOpCode

Enumerator
InvalidOpCode 
WebSocketSendText 
WebSocketSendBinary 
WebSocketPublishText 
WebSocketPublishBinary 
MaxOpCode 

◆ ValidationRule

Enumerator
Required 
MaxLength 
MinLength 
IntMax 
IntMin 
DoubleMax 
DoubleMin 
EmailAddress 
Url 
Date 
Time 
DateTime 
Pattern 
Custom 
RuleCount 

Function Documentation

◆ app()

TWebApplication * Tf::app ( )
noexcept

Returns a global pointer referring to the unique application object.

◆ appSettings()

TAppSettings * Tf::appSettings ( )
noexcept

Returns a global pointer referring to the unique application settings object.

◆ cache()

TCache * Tf::cache ( )
noexcept

◆ conf()

const QVariantMap & Tf::conf ( const QString &  configName)
noexcept

Returns the map associated with config file configName in 'conf' directory.

◆ constCurrentController()

const TAbstractController * Tf::constCurrentController ( )
inline

◆ currentController()

TAbstractController * Tf::currentController ( )

◆ currentDatabaseContext()

TDatabaseContext * Tf::currentDatabaseContext ( )

◆ currentSqlDatabase()

QSqlDatabase & Tf::currentSqlDatabase ( int  id)
noexcept

◆ debug()

template<typename... Args>
void Tf::debug ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the debug message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ error()

template<typename... Args>
void Tf::error ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the error message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ fatal()

template<typename... Args>
void Tf::fatal ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the fatal message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ getMSecsSinceEpoch()

int64_t Tf::getMSecsSinceEpoch ( )

◆ info()

template<typename... Args>
void Tf::info ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the infomation message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ isAccessLoggerAvailable()

bool Tf::isAccessLoggerAvailable ( )

◆ logging()

void Tf::logging ( int  priority,
const QByteArray &  msg 
)

◆ lz4Compress() [1/2]

QByteArray Tf::lz4Compress ( const char *  data,
int  nbytes,
int  compressionLevel = 1 
)
noexcept

◆ lz4Compress() [2/2]

QByteArray Tf::lz4Compress ( const QByteArray &  data,
int  compressionLevel = 1 
)
noexcept

◆ lz4Uncompress() [1/2]

QByteArray Tf::lz4Uncompress ( const char *  data,
int  nbytes 
)
noexcept

◆ lz4Uncompress() [2/2]

QByteArray Tf::lz4Uncompress ( const QByteArray &  data)
noexcept

◆ msleep()

void Tf::msleep ( int64_t  msecs)
noexcept

Causes the current thread to sleep for msecs milliseconds.

◆ objectFactories()

QMap< QByteArray, std::function< QObject *()> > * Tf::objectFactories ( )
noexcept

◆ rand32_r()

uint32_t Tf::rand32_r ( )
noexcept

◆ rand64_r()

uint64_t Tf::rand64_r ( )
noexcept

◆ random() [1/2]

uint64_t Tf::random ( uint64_t  max)
noexcept

Random number generator in the range from 0 to max.

◆ random() [2/2]

uint64_t Tf::random ( uint64_t  min,
uint64_t  max 
)
noexcept

Random number generator in the range from min to max.

◆ releaseAccessLogger()

void Tf::releaseAccessLogger ( )

◆ releaseAppLoggers()

void Tf::releaseAppLoggers ( )

Releases all the loggers.

This function is for internal use only.

◆ releaseQueryLogger()

void Tf::releaseQueryLogger ( )

◆ releaseSystemLogger()

void Tf::releaseSystemLogger ( )

◆ setAppLogDateTimeFormat()

void Tf::setAppLogDateTimeFormat ( const QByteArray &  format)

◆ setAppLogLayout()

void Tf::setAppLogLayout ( const QByteArray &  layout)

◆ settingsToMap()

QMap< QString, QVariant > Tf::settingsToMap ( QSettings &  settings,
const QString &  env = QString() 
)

◆ setupAccessLogger()

void Tf::setupAccessLogger ( )

◆ setupAppLoggers()

void Tf::setupAppLoggers ( TLogger logger = nullptr)

Sets up all the loggers set in the logger.ini.

This function is for internal use only.

◆ setupQueryLogger()

void Tf::setupQueryLogger ( )

◆ setupSystemLogger()

void Tf::setupSystemLogger ( TSystemLogger *  logger = nullptr)

◆ strcmp()

bool Tf::strcmp ( const QByteArray &  str1,
const QByteArray &  str2 
)
inline

◆ trace()

template<typename... Args>
void Tf::trace ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the trace message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ traceQuery()

void Tf::traceQuery ( int  duration,
const QByteArray &  msg 
)

◆ traceQueryLog()

template<typename... Args>
void Tf::traceQueryLog ( int  duration,
const std::format_string< Args... > &  fmt,
Args &&...  args 
)

◆ tSystemMessage()

void Tf::tSystemMessage ( int  priority,
const QByteArray &  message 
)

◆ warn()

template<typename... Args>
void Tf::warn ( const std::format_string< Args... > &  fmt,
Args &&...  args 
)

Outputs the warning message to the log file, formatting args according to the format string fmt.

See also
https://en.cppreference.com/w/cpp/utility/format/format

◆ writeAccessLog()

void Tf::writeAccessLog ( const TAccessLog &  log)

◆ writeQueryLog()

void Tf::writeQueryLog ( const QString &  query,
bool  success,
const QSqlError &  error,
int  duration 
)

Variable Documentation

◆ CR

constexpr auto Tf::CR = "\x0d"
constexpr

◆ CRLF

constexpr auto Tf::CRLF = "\x0d\x0a"
constexpr

◆ CRLFCRLF

constexpr auto Tf::CRLFCRLF = "\x0d\x0a\x0d\x0a"
constexpr

◆ KeepEmptyParts

constexpr auto Tf::KeepEmptyParts = Qt::KeepEmptyParts
constexpr

◆ LF

constexpr auto Tf::LF = "\x0a"
constexpr

◆ ReadOnly

constexpr auto Tf::ReadOnly = QIODeviceBase::ReadOnly
constexpr

◆ SkipEmptyParts

constexpr auto Tf::SkipEmptyParts = Qt::SkipEmptyParts
constexpr

◆ WriteOnly

constexpr auto Tf::WriteOnly = QIODeviceBase::WriteOnly
constexpr