QtWebApp.zip

  • E2_635255
    了解作者
  • 140.9KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-17 10:00
    上传日期
qt 实现MVC Api控制器开发 web api接口-连载【5】-企业级系统开发实战连载系列 -技术栈(vue、element-ui、qt、c++、sqlite)
QtWebApp.zip
  • QtWebApp
  • httpserver
  • httpserver.pri
    1KB
  • httprequesthandler.h
    1.4KB
  • httpglobal.h
    523B
  • httpsessionstore.cpp
    4.2KB
  • httpglobal.cpp
    87B
  • httpconnectionhandlerpool.h
    2.9KB
  • httpsession.h
    3.1KB
  • httpsessionstore.h
    3.7KB
  • httpsession.cpp
    4.1KB
  • httpconnectionhandler.h
    3.3KB
  • httplistener.cpp
    2.8KB
  • httplistener.h
    3.3KB
  • httpconnectionhandler.cpp
    9.1KB
  • httprequesthandler.cpp
    689B
  • httpcookie.h
    3.8KB
  • httprequest.h
    6.8KB
  • httpconnectionhandlerpool.cpp
    4.8KB
  • staticfilecontroller.cpp
    6.8KB
  • httpresponse.h
    4.5KB
  • httprequest.cpp
    16.8KB
  • staticfilecontroller.h
    3.1KB
  • httpresponse.cpp
    4.5KB
  • httpcookie.cpp
    5.1KB
  • qtservice
  • qtunixserversocket.cpp
    3.3KB
  • qtservice_win.cpp
    31.2KB
  • qtservice.h
    5.2KB
  • QtServiceBase
    23B
  • qtunixserversocket.h
    2.3KB
  • qtservice.cpp
    35.1KB
  • qtservice_unix.cpp
    13.2KB
  • qtunixsocket.cpp
    2.9KB
  • qtunixsocket.h
    2.2KB
  • QtServiceController
    23B
  • qtservice_p.h
    2.9KB
  • qtservice.pri
    367B
  • templateengine
  • templatecache.h
    2.7KB
  • templateglobal.h
    445B
  • templateloader.cpp
    3.3KB
  • template.cpp
    8.6KB
  • templatecache.cpp
    1.2KB
  • template.h
    4.5KB
  • templateengine.pri
    288B
  • templateloader.h
    2.4KB
  • logging
  • logmessage.cpp
    2.3KB
  • logging.pri
    249B
  • filelogger.h
    4.4KB
  • logger.h
    7.1KB
  • logglobal.h
    430B
  • filelogger.cpp
    4.7KB
  • dualfilelogger.h
    3KB
  • dualfilelogger.cpp
    830B
  • logger.cpp
    5.2KB
  • logmessage.h
    2.8KB
  • QtWebAppd_resource.rc
    694B
  • QtWebApp.sln
    2.8KB
  • QtWebApp_resource.aps
    79KB
  • QtWebApp.vcxproj.filters
    6.9KB
  • QtWebAppd_resource.aps
    79KB
  • QtWebApp_resource.rc
    692B
  • QtWebApp.pro
    823B
  • .qmake.stash
    1.4KB
  • QtWebApp.vcxproj
    16.5KB
  • QtWebApp.vcxproj.user
    222B
  • Doxyfile
    359B
  • mainpage.dox
    1.7KB
内容介绍
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qtservice.h" #include "qtservice_p.h" #include <QCoreApplication> #include <stdio.h> #include <QTimer> #include <QVector> #include <QProcess> #if defined(QTSERVICE_DEBUG) #include <QDebug> #include <QFile> #include <QTime> #include <QMutex> #if defined(Q_OS_WIN32) #include <qt_windows.h> #else #include <unistd.h> #include <stdlib.h> #endif static QFile* f = 0; static void qtServiceCloseDebugLog() { if (!f) return; QString ps(QTime::currentTime().toString("HH:mm:ss.zzz ") + QLatin1String("--- DEBUG LOG CLOSED ---\n\n")); f->write(ps.toLatin1()); f->flush(); f->close(); delete f; f = 0; } void qtServiceLogDebug(QtMsgType type, const char* msg) { static QMutex mutex; QMutexLocker locker(&mutex); QString s(QTime::currentTime().toString("HH:mm:ss.zzz ")); s += QString("[%1] ").arg( #if defined(Q_OS_WIN32) GetCurrentProcessId()); #else getpid()); #endif if (!f) { #if defined(Q_OS_WIN32) f = new QFile("c:/service-debuglog.txt"); #else f = new QFile("/tmp/service-debuglog.txt"); #endif if (!f->open(QIODevice::WriteOnly | QIODevice::Append)) { delete f; f = 0; return; } QString ps(QLatin1String("\n") + s + QLatin1String("--- DEBUG LOG OPENED ---\n")); f->write(ps.toLatin1()); } switch (type) { case QtWarningMsg: s += QLatin1String("WARNING: "); break; case QtCriticalMsg: s += QLatin1String("CRITICAL: "); break; case QtFatalMsg: s+= QLatin1String("FATAL: "); break; case QtDebugMsg: s += QLatin1String("DEBUG: "); break; default: // Nothing break; } s += msg; s += QLatin1String("\n"); f->write(s.toLatin1()); f->flush(); if (type == QtFatalMsg) { qtServiceCloseDebugLog(); exit(1); } } #endif /*! \class QtServiceController \brief The QtServiceController class allows you to control services from separate applications. QtServiceController provides a collection of functions that lets you install and run a service controlling its execution, as well as query its status. In order to run a service, the service must be installed in the system's service database using the install() function. The system will start the service depending on the specified StartupType; it can either be started during system startup, or when a process starts it manually. Once a service is installed, the service can be run and controlled manually using the start(), stop(), pause(), resume() or sendCommand() functions. You can at any time query for the service's status using the isInstalled() and isRunning() functions, or you can query its properties using the serviceDescription(), serviceFilePath(), serviceName() and startupType() functions. For example: \code MyService service; \\ which inherits QtService QString serviceFilePath; QtServiceController controller(service.serviceName()); if (controller.install(serviceFilePath)) controller.start() if (controller.isRunning()) QMessageBox::information(this, tr("Service Status"), tr("The %1 service is started").arg(controller.serviceName())); ... controller.stop(); controller.uninstall(); } \endcode An instance of the service controller can only control one single service. To control several services within one application, you must create en equal number of service controllers. The QtServiceController destructor neither stops nor uninstalls the associated service. To stop a service the stop() function must be called explicitly. To uninstall a service, you can use the uninstall() function. \sa QtServiceBase, QtService */ /*! \enum QtServiceController::StartupType This enum describes when a service should be started. \value AutoStartup The service is started during system startup. \value ManualStartup The service must be started manually by a process. \warning The \a StartupType enum is ignored under UNIX-like systems. A service, or daemon, can only be started manually on such systems with current implementation. \sa startupType() */ /*! Creates a controller object for the service with the given \a name. */ QtServiceController::QtServiceController(const QString &name) : d_ptr(new QtServiceControllerPrivate()) { Q_D(QtServiceController); d->q_ptr = this; d->serviceName = name; } /*! Destroys the service controller. This neither stops nor uninstalls the controlled service. To stop a service the stop() function must be called explicitly. To uninstall a service, you can use the uninstall() function. \sa stop(), QtServiceController::uninstall() */ QtServiceController::~QtServiceController() { delete d_ptr; } /*! \fn bool QtServiceController::isInstalled() const Returns true if the service is installed; otherwise returns false. On Windows it uses the system's service control manager. On Unix it checks configuration written to QSettings::SystemScope using "QtSoftware" as organization name. \sa install() */ /*! \fn bool QtServiceController::isRunning() const Returns true if the service is running; otherwise returns false. A service must be installed before it can be run using a controller. \sa start(), isInstalled() */ /*! Returns the name of the controlled service. \sa QtServiceController(), serviceDescription() */ QString QtServiceController::serviceName() const { Q_D(const QtServiceController); return d->serviceName; } /*! \fn QString QtServiceController::serviceDescription() const Returns the description of the controlled service. \sa install(), serviceName()
评论
    相关推荐