本文整理汇总了C++中serviceName函数的典型用法代码示例。如果您正苦于以下问题:C++ serviceName函数的具体用法?C++ serviceName怎么用?C++ serviceName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serviceName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: qWarning
/*!
* Attempts to register the service on the local network.
*
* If noAutoRename is set to true, registration will fail if another service of the same service type
* is already registered with the same service name. Otherwise, the service name will be updated with
* a number to make it unique.
*
* \sa registered
* \sa registrationError
*/
void QxtDiscoverableService::registerService(bool noAutoRename)
{
if(state() != Unknown) {
qWarning() << "QxtDiscoverableService: Cannot register service while not in Unknown state";
emit registrationError(0);
return;
}
QStringList subtypes = qxt_d().serviceSubTypes;
subtypes.prepend(fullServiceType());
DNSServiceErrorType err;
err = DNSServiceRegister(&(qxt_d().service),
noAutoRename ? kDNSServiceFlagsNoAutoRename : 0,
qxt_d().iface,
serviceName().isEmpty() ? 0 : serviceName().toUtf8().constData(),
subtypes.join(",_").toUtf8().constData(),
domain().isEmpty() ? 0 : domain().toUtf8().constData(),
host().isEmpty() ? 0 : host().toUtf8().constData(),
qxt_d().port,
1, // must include null terminator
"",
QxtDiscoverableServicePrivate::registerServiceCallback,
&qxt_d());
if(err != kDNSServiceErr_NoError) {
qxt_d().state = Unknown;
emit registrationError(err);
} else {
qxt_d().state = Registering;
qxt_d().notifier = new QSocketNotifier(DNSServiceRefSockFD(qxt_d().service), QSocketNotifier::Read, this);
QObject::connect(qxt_d().notifier, SIGNAL(activated(int)), &qxt_d(), SLOT(socketData()));
}
}
开发者ID:npsm,项目名称:libqxt,代码行数:43,代码来源:qxtdiscoverableservice.cpp
示例2: isRunning
bool QtServiceController::isRunning() const
{
QtUnixSocket sock;
if (sock.connectTo(socketPath(serviceName())))
return true;
return false;
}
开发者ID:OldFrank,项目名称:openvpn-client,代码行数:7,代码来源:qtservice_unix.cpp
示例3: checkDaemonExistence
bool checkDaemonExistence(const char* daemonName)
{
SingleLogger* logger = SingleLogger::InitLogger();
std::string serviceName(daemonName);
bool isRunning = false;
std::string pidFileName("/var/run/" + serviceName + ".pid");
std::ifstream pidFile(pidFileName.c_str(), std::ifstream::binary);
if(pidFile.is_open())
{
long pid = 0;
std::string pidLine;
if (pidFile.is_open())
{
getline(pidFile, pidLine);
pid = std::stoi(pidLine);
kill(pid, 0);
isRunning = !(errno == ESRCH);
}
}
if (!isRunning)
{
std::ofstream pidFile(pidFileName.c_str(), std::ofstream::binary);
if (pidFile.is_open()) {
pidFile << getpid();
pidFile.close();
}
else
logger->logMessage(SingleLogger::WARNING, "pid file is not created");
}
else
logger->logMessage(SingleLogger::ERROR, "daemon already running");
return isRunning;
}
开发者ID:camerafifo,项目名称:testfifo,代码行数:35,代码来源:main.cpp
示例4: switch
void QtServiceBase::logMessage(const QString &message, QtServiceBase::MessageType type,
int, uint, const QByteArray &)
{
if (!d_ptr->sysd)
return;
int st;
switch(type) {
case QtServiceBase::Error:
st = LOG_ERR;
break;
case QtServiceBase::Warning:
st = LOG_WARNING;
break;
default:
st = LOG_INFO;
}
if (!d_ptr->sysd->ident) {
QString tmp = encodeName(serviceName(), TRUE);
int len = tmp.toLocal8Bit().size();
d_ptr->sysd->ident = new char[len+1];
d_ptr->sysd->ident[len] = '\0';
::memcpy(d_ptr->sysd->ident, tmp.toLocal8Bit().constData(), len);
}
openlog(d_ptr->sysd->ident, LOG_PID, LOG_DAEMON);
foreach(QString line, message.split('\n'))
syslog(st, "%s", line.toLocal8Bit().constData());
closelog();
}
开发者ID:w0land,项目名称:qtnotifydaemon,代码行数:28,代码来源:qtservice_unix.cpp
示例5: executeService
bool ShellCommandService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasCommand* command = getCommandParameters(model, "shellCommand");
if(command && !command->text().isEmpty()){
if (command->parameter("detached") == "true"){
detachedShellCommand(command->text(), response);
}
else if (command->parameter("threaded") == "true") {
shellTask(command->text(), response);
}
else if (command->parameter("status") == "true") {
TasCommand* command = getCommandParameters(model, "shellCommand");
if(command && !command->text().isEmpty()){
qint64 pid = command->text().toInt();
if (command->parameter("kill") == "true") {
killTask(pid, response);
} else {
shellStatus(pid, response);
}
}
}
else{
shellCommand(command->text(), response);
}
}
else{
response.setErrorMessage(NO_COMMAND_TO_EXECUTE);
}
return true;
}
else{
return false;
}
}
开发者ID:jppiiroinen,项目名称:cutedriver-agent_qt,代码行数:35,代码来源:shellcommandservice.cpp
示例6: executeService
bool RegisterService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasCommand* command = getCommandParameters(model, COMMAND_REGISTER);
if(command){
ClientDetails client;
bool ok;
//this should not really ever fail (app pid used to generate in client side)
quint64 clientPid = command->parameter(PLUGIN_ID).toULongLong(&ok);
client.processId = clientPid;
client.processName = command->parameter(PLUGIN_NAME);
#ifdef Q_OS_SYMBIAN
client.applicationUid = command->parameter(APP_UID);
#endif
client.pluginType = command->parameter(PLUGIN_TYPE);
client.socket = response.requester();
registerPlugin(client);
}
else{
command = getCommandParameters(model, COMMAND_UNREGISTER);
if(command){
unRegisterPlugin(*command);
}
}
return true;
}
else{
return false;
}
}
开发者ID:d0b3rm4n,项目名称:agent_qt,代码行数:30,代码来源:registerservice.cpp
示例7: QDEBUG_WRITE
// ----------------------------------------------------------------------------
// MsgErrorWatcher::~MsgErrorWatcher
// @see MsgErrorWatcher.h
// ----------------------------------------------------------------------------
void MsgErrorWatcher::ShowNote(TMsgErrorNoteIds errornoteid)
{
QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Enter")
QDEBUG_WRITE_FORMAT("errornoteid : ", errornoteid)
HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning);
QAction* actionView = NULL;
QAction* actionQuit = NULL;
const QAction* result = NULL;
//create dialog parameters
QString text("");
switch (errornoteid) {
case EDiskLowNote1:
text = LOC_MSG_ERRH_DISK_LOW_1;
break;
case EMemoryLowNote:
text = LOC_MSG_ERRH_MEMORY_LOW;
break;
case ERoamingNote:
text = LOC_MMS_OFF;
break;
case EInvalidAccessPointNote:
text = LOC_MSG_ERRH_ACCESS_POINTS_INV;
messageBox.setTimeout(HbPopup::NoTimeout);
messageBox.setText(text);
actionView = new QAction(LOC_OK, this);
messageBox.setAction(actionView, HbDeviceMessageBox::AcceptButtonRole);
actionQuit = new QAction(LOC_CANCEL, this);
messageBox.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole);
messageBox.setDismissPolicy(HbPopup::NoDismiss);
// launch Messagebox
result = messageBox.exec();
// if accepted launch view else quit
if (messageBox.isAcceptAction(result)) {
QList<QVariant> args;
QString serviceName("messagesettings");
QString operation("launchSettings(int)");
XQAiwRequest* request;
XQApplicationManager appManager;
request = appManager.create(serviceName, "com.nokia.symbian.IMessageSettings",
operation, false); // non embedded
if (request == NULL) {
return;
}
args << QVariant(MsgSettingsView::MMSView);
request->setArguments(args);
request->send();
delete request;
}
return;
default:
break;
}
HbDeviceNotificationDialog::notification("", text);
QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Exit")
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:63,代码来源:msgerrorwatcher.cpp
示例8: settings
bool QtServiceController::uninstall()
{
QSettings settings(QSettings::SystemScope, "QtSoftware");
settings.beginGroup("services");
settings.remove(serviceName());
settings.endGroup();
settings.sync();
QSettings::Status ret = settings.status();
if (ret == QSettings::AccessError) {
fprintf(stderr, "Cannot uninstall \"%s\". Cannot write to: %s. Check permissions.\n",
serviceName().toLatin1().constData(),
settings.fileName().toLatin1().constData());
}
return (ret == QSettings::NoError);
}
开发者ID:OldFrank,项目名称:openvpn-client,代码行数:18,代码来源:qtservice_unix.cpp
示例9: executeService
bool ObjectService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
performObjectService(model, response);
return true;
}
else{
return false;
}
}
开发者ID:jppiiroinen,项目名称:cutedriver-agent_qt,代码行数:10,代码来源:objectservice.cpp
示例10: executeService
/*!
Passes service directed to plugins on to the correct plugin.
*/
bool InfoService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
mLogger->performLogService(model, response);
return true;
}
else{
return false;
}
}
开发者ID:alirezaarmn,项目名称:cutedriver-agent_qt,代码行数:13,代码来源:infoservice.cpp
示例11: strcpy
void Master::executeInterruptionList()
{
int i = 0;
for(Linterrupt::interator n = interruptions.begin(); n != interruptions.end(); ++n)
{
//pegando o nome do servico
string serviceTemp = n->getService();
char *service = new char [serviceTemp.length()+1];
strcpy (service, serviceTemp.c_str());
char *name = strtok(service, "/");
string serviceName(name, strlen(name)+1);
if(inNodeList(serviceName))
{
for(Lnode::interator n = nodes.begin(); n != nodes.end(); ++n)
{
if(n->getName().compare(serviceTemp))
{
n->runService(serviceTemp);
}
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
continue;
}
if(inSuperNodeList(serviceName))
{
for(Lsnode::interator n = sNodes.begin(); n != sNodes.end(); ++n)
{
if(n->getName().compare(serviceTemp))
n->runService(serviceTemp);
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
continue;
}
int temp = inConnectionList(serviceName);
if(temp >= 0)
{
for(Lconection::interator n = connections.begin(); n != connections.end(); ++n)
{
if(temp == i)
n->sendMessage(serviceTemp);
i++;
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
}
}
}
开发者ID:matrpedreira,项目名称:ProjES,代码行数:53,代码来源:master.cpp
示例12: Service
Service(int argc, char **argv)
: QtService<QCoreApplication>(argc, argv, "Elephant Service")
{
setServiceDescription("No description yet.");
qApp->setApplicationName(serviceName());
qApp->setOrganizationName("GKHY");
qApp->setOrganizationDomain("www.gkhy.com.cn");
setServiceFlags(QtService::Default);
setStartupType(QtServiceController::AutoStartup);
}
开发者ID:Quenii,项目名称:ADCEVM-minor,代码行数:13,代码来源:ElephantService.cpp
示例13: kdWarning
QString KInetSocketAddress::pretty() const
{
if(d->sockfamily != AF_INET
#ifdef AF_INET6
&& d->sockfamily != AF_INET6
#endif
)
{
kdWarning() << "KInetSocketAddress::pretty() called on uninitialized class\n";
return i18n("<empty>");
}
return i18n("1: hostname, 2: port number", "%1 port %2").arg(nodeName()).arg(serviceName());
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:14,代码来源:ksockaddr.cpp
示例14: nativeLlcpSocket_doConnectBy
/*******************************************************************************
**
** Function: nativeLlcpSocket_doConnectBy
**
** Description: Establish a connection to the peer.
** e: JVM environment.
** o: Java object.
** sn: Service name.
**
** Returns: True if ok.
**
*******************************************************************************/
static jboolean nativeLlcpSocket_doConnectBy (JNIEnv* e, jobject o, jstring sn)
{
ALOGD ("%s: enter", __FUNCTION__);
PeerToPeer::tJNI_HANDLE jniHandle = (PeerToPeer::tJNI_HANDLE) nfc_jni_get_nfc_socket_handle(e, o);
ScopedUtfChars serviceName(e, sn);
if (serviceName.c_str() == NULL)
{
return JNI_FALSE;
}
bool stat = PeerToPeer::getInstance().connectConnOriented(jniHandle, serviceName.c_str());
ALOGD ("%s: exit", __FUNCTION__);
return stat ? JNI_TRUE : JNI_FALSE;
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:28,代码来源:NativeLlcpSocket.cpp
示例15: executeService
bool ScreenshotService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasLogger::logger()->debug("ScreenshotService::executeService in");
QGuiApplication *app = qobject_cast<QGuiApplication*>(qApp);
if(app){
getScreenshot(model, response);
}
else{
TasLogger::logger()->debug("ScreenshotService::executeService application has no ui!");
response.setErrorMessage(NO_UI_ERROR);
}
return true;
}
else{
return false;
}
}
开发者ID:alirezaarmn,项目名称:cutedriver-agent_qt,代码行数:18,代码来源:screenshotservice.cpp
示例16: tmppixmap
void OutQueueStatisticsWidget::updateStatistics(OutQueueStatistics& stats)
{
static const int cellx = 6 ;
static const int celly = 10+4 ;
QPixmap tmppixmap(maxWidth, maxHeight);
tmppixmap.fill(Qt::transparent);
setFixedHeight(maxHeight);
QPainter painter(&tmppixmap);
painter.initFrom(this);
maxHeight = 500 ;
// std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl;
// draw...
int ox=5,oy=5 ;
painter.setPen(QColor::fromRgb(70,70,70)) ;
//painter.drawLine(0,oy,maxWidth,oy) ;
//oy += celly ;
QString by_priority_string,by_service_string ;
for(int i=1;i<stats.per_priority_item_count.size();++i)
by_priority_string += QString::number(stats.per_priority_item_count[i]) + " (" + QString::number(i) + ") " ;
for(std::map<uint16_t,uint32_t>::const_iterator it(stats.per_service_item_count.begin());it!=stats.per_service_item_count.end();++it)
by_service_string += QString::number(it->second) + " (" + serviceName(it->first) + ") " ;
painter.drawText(ox,oy+celly,tr("Outqueue statistics")+":") ; oy += celly*2 ;
painter.drawText(ox+2*cellx,oy+celly,tr("By priority: ") + by_priority_string); oy += celly ;
painter.drawText(ox+2*cellx,oy+celly,tr("By service : ") + by_service_string); oy += celly ;
oy += celly ;
// update the pixmap
//
pixmap = tmppixmap;
maxHeight = oy ;
}
开发者ID:WAR10CKfreeworld,项目名称:RetroShare,代码行数:41,代码来源:OutQueueStatistics.cpp
示例17: fullServiceName
/*!
* Returns the endpoint's full service name.
*
* The full service name is a human-readbale form. For example, the full name for
* the `cloudsearch` service is `Amazon CloudSearch`. Likewise, the full name for
* the `rds` service is `Amazon Relational Database Service`.
*
* \sa serviceName
*/
QString AwsEndpoint::fullServiceName() const
{
return fullServiceName(serviceName());
}
开发者ID:pcolby,项目名称:libqtaws,代码行数:13,代码来源:awsendpoint.cpp
示例18: sendCmd
bool QtServiceController::sendCommand(int code)
{
return sendCmd(serviceName(), QString(QLatin1String("num:") + QString::number(code)));
}
开发者ID:OldFrank,项目名称:openvpn-client,代码行数:4,代码来源:qtservice_unix.cpp
示例19: supportedRegions
/*!
* Returns a list of regions the endpoint supports for \e {at least one} of the
* the given \a {transport}s.
*
* Alternatvely, AwsEndpoint::regionName may be used to get this endpoint's
* \e primary region.
*/
QStringList AwsEndpoint::supportedRegions(const Transports transport) const
{
return supportedRegions(serviceName(), transport);
}
开发者ID:pcolby,项目名称:libqtaws,代码行数:11,代码来源:awsendpoint.cpp
示例20: processArgs
int processArgs(int argc, char **argv)
{
if (argc > 2) {
QString arg1(argv[1]);
if (arg1 == QLatin1String("-i") ||
arg1 == QLatin1String("-install")) {
if (argc > 2) {
QString account;
QString password;
QString path(argv[2]);
if (argc > 3) {
account = argv[3];
}
if (argc > 4) {
password = argv[4];
}
printf("The service %s installed.\n",
(QtServiceController::install(path, account, password) ? "was" : "was not"));
return 0;
}
} else {
QString serviceName(argv[1]);
QtServiceController controller(serviceName);
QString option(argv[2]);
if (option == QLatin1String("-u") ||
option == QLatin1String("-uninstall")) {
printf("The service \"%s\" %s uninstalled.\n",
controller.serviceName().toLatin1().constData(),
(controller.uninstall() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-s") ||
option == QLatin1String("-start")) {
QStringList args;
for (int i = 3; i < argc; ++i) {
args.append(QString::fromLocal8Bit(argv[i]));
}
printf("The service \"%s\" %s started.\n",
controller.serviceName().toLatin1().constData(),
(controller.start(args) ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-t") ||
option == QLatin1String("-terminate")) {
printf("The service \"%s\" %s stopped.\n",
controller.serviceName().toLatin1().constData(),
(controller.stop() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-p") ||
option == QLatin1String("-pause")) {
printf("The service \"%s\" %s paused.\n",
controller.serviceName().toLatin1().constData(),
(controller.pause() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-r") ||
option == QLatin1String("-resume")) {
printf("The service \"%s\" %s resumed.\n",
controller.serviceName().toLatin1().constData(),
(controller.resume() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-c") ||
option == QLatin1String("-command")) {
if (argc > 3) {
QString codestr(argv[3]);
int code = codestr.toInt();
printf("The command %s sent to the service \"%s\".\n",
(controller.sendCommand(code) ? "was" : "was not"),
controller.serviceName().toLatin1().constData());
return 0;
}
} else if (option == QLatin1String("-v") ||
option == QLatin1String("-version")) {
bool installed = controller.isInstalled();
printf("The service\n"
"\t\"%s\"\n\n", controller.serviceName().toLatin1().constData());
printf("is %s", (installed ? "installed" : "not installed"));
printf(" and %s\n\n", (controller.isRunning() ? "running" : "not running"));
if (installed) {
printf("path: %s\n", controller.serviceFilePath().toLatin1().data());
printf("description: %s\n", controller.serviceDescription().toLatin1().data());
printf("startup: %s\n", controller.startupType() == QtServiceController::AutoStartup ? "Auto" : "Manual");
}
return 0;
}
}
}
printf("controller [-i PATH | SERVICE_NAME [-v | -u | -s | -t | -p | -r | -c CODE] | -h] [-w]\n\n"
"\t-i(nstall) PATH\t: Install the service\n"
"\t-v(ersion)\t: Print status of the service\n"
"\t-u(ninstall)\t: Uninstall the service\n"
"\t-s(tart)\t: Start the service\n"
"\t-t(erminate)\t: Stop the service\n"
"\t-p(ause)\t: Pause the service\n"
"\t-r(esume)\t: Resume the service\n"
"\t-c(ommand) CODE\t: Send a command to the service\n"
"\t-h(elp)\t\t: Print this help info\n"
"\t-w(ait)\t\t: Wait for keypress when done\n");
return 0;
}
开发者ID:ihehui,项目名称:HHSharedLibs,代码行数:97,代码来源:main.cpp
注:本文中的serviceName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论