本文整理汇总了C++中T_TRACEFUNC函数的典型用法代码示例。如果您正苦于以下问题:C++ T_TRACEFUNC函数的具体用法?C++ T_TRACEFUNC怎么用?C++ T_TRACEFUNC使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T_TRACEFUNC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: T_TRACEFUNC
void TApplicationServer::incomingConnection(int socketDescriptor)
{
T_TRACEFUNC("socketDescriptor: %d", socketDescriptor);
switch ( Tf::app()->multiProcessingModule() ) {
case TWebApplication::Thread:
for (;;) {
if (actionContextCount() < maxServers) {
TActionThread *thread = new TActionThread(socketDescriptor);
connect(thread, SIGNAL(finished()), this, SLOT(deleteActionContext()));
insertPointer(thread);
thread->start();
break;
}
Tf::msleep(1);
qApp->processEvents(QEventLoop::ExcludeSocketNotifiers);
}
break;
case TWebApplication::Prefork: {
close(); // Closes the listening port
TActionForkProcess *process = new TActionForkProcess(socketDescriptor);
connect(process, SIGNAL(finished()), this, SLOT(deleteActionContext()));
insertPointer(process);
process->start();
break; }
default:
break;
}
}
示例2: T_TRACEFUNC
/*!
\~english
Returns the rendering data of the partial template given by \a templateName.
\~japanese
部分テンプレート \a templateName に変数 \a vars を設定した描画データを返す
*/
QString TActionController::getRenderingData(const QString &templateName, const QVariantHash &vars)
{
T_TRACEFUNC("templateName: %s", qPrintable(templateName));
// Creates view-object
QStringList names = templateName.split("/");
if (names.count() != 2) {
tError("Invalid patameter: %s", qPrintable(templateName));
return QString();
}
TDispatcher<TActionView> viewDispatcher(viewClassName(names[0], names[1]));
TActionView *view = viewDispatcher.object();
if (!view) {
return QString();
}
QVariantHash hash = allVariants();
for (QHashIterator<QString, QVariant> i(vars); i.hasNext(); ) {
i.next();
hash.insert(i.key(), i.value()); // item's value of same key is replaced
}
view->setController(this);
view->setVariantHash(hash);
return view->toString();
}
示例3: T_TRACEFUNC
void TSmtpMailer::sendAndDeleteLater()
{
T_TRACEFUNC("");
send();
mailMessage.clear();
deleteLater();
}
示例4: T_TRACEFUNC
TSendmailMailer::~TSendmailMailer()
{
T_TRACEFUNC("");
if (!mailMessage.isEmpty()) {
tSystemWarn("Mail not sent. Deleted it.");
}
}
示例5: T_TRACEFUNC
void TSmtpMailer::sendLater(const TMailMessage &message)
{
T_TRACEFUNC("");
mailMessage = message;
QTimer::singleShot(0, this, SLOT(sendAndDeleteLater()));
}
示例6: T_TRACEFUNC
/*!
Creates and returns a TSessionStore object that matches the given key,
or returns 0 if no matching session store is found.
*/
TSessionStore *TSessionStoreFactory::create(const QString &key)
{
T_TRACEFUNC("key: %s", qPrintable(key));
static const QString COOKIE_KEY = TSessionCookieStore().key().toLower();
static const QString SQLOBJECT_KEY = TSessionSqlObjectStore().key().toLower();
static const QString FILE_KEY = TSessionFileStore().key().toLower();
static const QString REDIS_KEY = TSessionRedisStore().key().toLower();
QMutexLocker locker(&mutex);
loadPlugins();
TSessionStore *ret = 0;
QString k = key.toLower();
if (k == COOKIE_KEY) {
ret = new TSessionCookieStore;
} else if (k == SQLOBJECT_KEY) {
ret = new TSessionSqlObjectStore;
} else if (k == FILE_KEY) {
ret = new TSessionFileStore;
} else if (k == REDIS_KEY) {
ret = new TSessionRedisStore;
} else {
TSessionStoreInterface *ssif = sessIfMap->value(k);
if (ssif) {
ret = ssif->create(key);
}
}
return ret;
}
示例7: T_TRACEFUNC
/*!
Returns a QUrl to \a action of \a controller with arguments \a args.
The current controller name is used, if the \a controller is a empty string.
The current action name is used, if the \a action is a empty string.
If \a query is not empty, sets the query string to an encoded version
of \a query.
*/
QUrl TActionHelper::url(const QString &controller, const QString &action,
const QStringList &args,
const QVariantMap &query) const
{
T_TRACEFUNC("%s : %s", qPrintable(controller), qPrintable(action));
Q_ASSERT(this->controller());
QString path;
QString ctrl = (controller.isEmpty()) ? this->controller()->name() : controller;
QString act = (action.isEmpty()) ? this->controller()->activeAction() : action;
path.append('/').append(ctrl).append('/').append(act);
for (QStringListIterator i(args); i.hasNext(); ) {
path.append('/').append(THttpUtility::toUrlEncoding(i.next()));
}
// appends query items
QString querystr;
for (QMapIterator<QString, QVariant> it(query); it.hasNext(); ) {
it.next();
if (!it.key().isEmpty()) {
querystr += it.key();
querystr += QLatin1Char('=');
querystr += it.value().toString();
querystr += QLatin1Char('&');
}
}
querystr.chop(1);
if (!querystr.isEmpty()) {
path += QLatin1Char('?');
path += querystr;
}
return QUrl(path);
}
示例8: T_TRACEFUNC
TKvsDatabase &TActionContext::getKvsDatabase(TKvsDatabase::Type type)
{
T_TRACEFUNC("type:%d", (int)type);
TKvsDatabase &db = kvsDatabases[(int)type];
if (!db.isValid()) {
db = TKvsDatabasePool2::instance()->database(type);
}
return db;
}
示例9: T_TRACEFUNC
qint64 TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *body, qint64 length)
{
T_TRACEFUNC("length:%s", qPrintable(QString::number(length)));
header.setContentLength(length);
header.setRawHeader("Server", "TreeFrog server");
header.setCurrentDate();
// Write data
return writeResponse(header, body);
}
示例10: T_TRACEFUNC
bool TApplicationServerBase::loadLibraries()
{
T_TRACEFUNC("");
// Loads libraries
if (libsLoaded.isEmpty()) {
// Sets work directory
QString libPath = Tf::app()->libPath();
if (QDir(libPath).exists()) {
// To resolve the symbols in the app libraries
QDir::setCurrent(libPath);
} else {
tSystemError("lib directory not found");
return false;
}
loadedTimestamp = latestLibraryTimestamp();
#if defined(Q_OS_WIN)
QStringList libs = { "controller", "view" };
#elif defined(Q_OS_LINUX)
QStringList libs = { "libcontroller.so", "libview.so" };
#elif defined(Q_OS_DARWIN)
QStringList libs = { "libcontroller.dylib", "libview.dylib" };
#else
QStringList libs = { "libcontroller.so", "libview.so" };
#endif
for (const auto &libname : libs) {
auto lib = new QLibrary(libname);
if (lib->load()) {
tSystemDebug("Library loaded: %s", qPrintable(lib->fileName()));
libsLoaded << lib;
} else {
tSystemWarn("%s", qPrintable(lib->errorString()));
}
}
QStringList controllers = TActionController::availableControllers();
tSystemDebug("Available controllers: %s", qPrintable(controllers.join(" ")));
}
QDir::setCurrent(Tf::app()->webRootPath());
TSystemBus::instantiate();
TPublisher::instantiate();
TUrlRoute::instantiate();
TSqlDatabasePool::instantiate();
TKvsDatabasePool::instantiate();
return true;
}
示例11: T_TRACEFUNC
qint64 TActionContext::writeResponse(THttpResponseHeader& header, QIODevice *body, qint64 length)
{
T_TRACEFUNC("length:%s", qPrintable(QString::number(length)));
qint64 res = -1;
if (httpSocket) {
header.setContentLength(length);
header.setRawHeader("Server", "TreeFrog server");
header.setRawHeader("Date", QLocale::c().toString(QDateTime::currentDateTime().toUTC(),
QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")).toLatin1());
header.setRawHeader("Connection", "close");
res = httpSocket->write(static_cast<THttpHeader*>(&header), body);
}
return res;
}
示例12: T_TRACEFUNC
QSqlDatabase &TActionContext::getDatabase(int id)
{
T_TRACEFUNC("id:%d", id);
if (id < 0 || id >= Tf::app()->databaseSettingsCount())
return sqlDatabases[Tf::app()->databaseSettingsCount()]; // invalid db
QSqlDatabase &db = sqlDatabases[id];
if (!db.isValid()) {
db = TSqlDatabasePool::instance()->pop(id);
beginTransaction(db);
}
return db;
}
示例13: QTcpSocket
THttpSocket::THttpSocket(QObject *parent)
: QTcpSocket(parent), lengthToRead(-1)
{
T_TRACEFUNC("");
do {
sid = point.fetch_add(1);
} while (!socketManager[sid].compareExchange(nullptr, this)); // store a socket
tSystemDebug("THttpSocket sid:%d", sid);
connect(this, SIGNAL(readyRead()), this, SLOT(readRequest()));
connect(this, SIGNAL(requestWrite(const QByteArray&)), this, SLOT(writeRawData(const QByteArray&)), Qt::QueuedConnection);
idleElapsed = std::time(nullptr);
}
示例14: T_TRACEFUNC
bool TSessionManager::store(TSession &session)
{
T_TRACEFUNC("");
if (session.id().isEmpty()) {
tSystemError("Internal Error [%s:%d]", __FILE__, __LINE__);
return false;
}
bool res = false;
TSessionStore *store = TSessionStoreFactory::create(storeType());
if (store) {
res = store->store(session);
delete store;
}
return res;
}
示例15: T_TRACEFUNC
THttpRequest THttpSocket::read()
{
T_TRACEFUNC("");
THttpRequest req;
if (canReadRequest()) {
int idx = readBuffer.indexOf("\r\n\r\n");
if (idx > 0) {
if (fileBuffer.isOpen()) {
fileBuffer.close();
req.setRequest(readBuffer.left(idx + 4), fileBuffer.fileName());
} else {
req.setRequest(readBuffer.left(idx + 4), readBuffer.mid(idx + 4));
}
readBuffer.clear();
req.setClientAddress(peerAddress());
}
}
return req;
}