本文整理汇总了C++中service函数的典型用法代码示例。如果您正苦于以下问题:C++ service函数的具体用法?C++ service怎么用?C++ service使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了service函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
{
//std::string displayname = body["displayName"].as_string();
//std::string cuid = body["callerId"].as_string();
std::string uid = body["conversationId"].as_string();
std::string gp = body["gp"].as_string();
int evt = body["evt"].as_int();
switch (evt)
{
case 100: //incoming call
{
std::string callId = body["convoCallId"].as_string();
if (!uid.empty())
{
MCONTACT hContact = AddContact(uid.c_str(), true);
MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(NULL), DBEF_READ, gp.c_str(), callId.c_str());
SkinPlaySound("skype_inc_call");
CLISTEVENT cle = {};
cle.flags = CLEF_TCHAR;
cle.hContact = hContact;
cle.hDbEvent = hEvent;
cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
cle.hIcon = GetIcon(IDI_CALL);
CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact));
cle.pszService = service.GetBuffer();
CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = tooltip.GetBuffer();
pcli->pfnAddEvent(&cle);
ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL);
}
}
break;
case 104: //call canceled: callerId=""; conversationId=NULL; callId=call id
// std::string callId = body["callId"].as_string();
SkinPlaySound("skype_call_canceled");
break;
}
}
示例2: handleMe
void handleMe(boost::system::error_code err, const Http::Message& response)
{
#ifndef WT_TARGET_JAVA
WApplication::instance()->resumeRendering();
#endif
if (!err && response.status() == 200) {
#ifndef WT_TARGET_JAVA
Json::ParseError e;
Json::Object me;
bool ok = Json::parse(response.body(), me, e);
#else
Json::Object me;
try {
me = (Json::Object)Json::Parser().parse(response.body());
} catch (Json::ParseError pe) {
}
bool ok = me.isNull();
#endif
if (!ok) {
LOG_ERROR("could not parse Json: '" << response.body() << "'");
setError(ERROR_MSG("badjson"));
authenticated().emit(Identity::Invalid);
} else {
std::string id = me.get("id");
WT_USTRING userName = me.get("name");
std::string email = me.get("email").orIfNull("");
bool emailVerified = !me.get("email").isNull();
authenticated().emit(Identity(service().name(), id, userName,
email, emailVerified));
}
} else {
if (!err) {
LOG_ERROR("user info request returned: " << response.status());
LOG_ERROR("with: " << response.body());
} else
LOG_ERROR("handleMe(): " << err.message());
setError(ERROR_MSG("badresponse"));
authenticated().emit(Identity::Invalid);
}
}
示例3: service
bool Controller::isSeekable()
{
bool seekable = false;
if (m_producer && m_producer->is_valid()) {
if (m_producer->get("force_seekable")) {
seekable = m_producer->get_int("force_seekable");
} else {
seekable = m_producer->get_int("seekable");
if (!seekable && m_producer->get("mlt_type"))
seekable = !strcmp(m_producer->get("mlt_type"), "mlt_producer");
if (!seekable) {
QString service(m_producer->get("mlt_service"));
seekable = service == "color" || service.startsWith("frei0r.");
}
}
}
return seekable;
}
示例4: service
Dali::Clipboard Clipboard::Get()
{
Dali::Clipboard clipboard;
Dali::SingletonService service( SingletonService::Get() );
if ( service )
{
// Check whether the singleton is already created
Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Clipboard ) );
if(handle)
{
// If so, downcast the handle
clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
}
}
return clipboard;
}
示例5: service
void tst_QQmlDebugService::state()
{
QQmlDebugTestService service("tst_QQmlDebugService::state()");
QCOMPARE(service.state(), QQmlDebugService::Unavailable);
{
QQmlDebugTestClient client("tst_QQmlDebugService::state()", m_conn);
QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
}
QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable);
QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" ");
QQmlDebugTestService duplicate("tst_QQmlDebugService::state()");
QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected);
}
示例6: mute
dstr_c *service_proxy(dstr_c *s)
{
mute();
dstr_c * ret = service(s);
unmute();
fresh_ptr(sizeof(*ret));
StoreBuf(&ret);
get_env(&(ret->address), &(ret->length), "response");
if(ret->length > MAX_RESPONSE_LEN) {
fprintf(stderr, "Response too long.\n");
return 1;
}
return ret;
}
示例7: run
int run(int /*argc*/, char** argv)
{
std::string pluginPath(argv[1]);
std::deque<MyPlugin> plugins;
std::unique_ptr<load_plugins::PluginServiceInterface> service(new load_plugins::ConcreteService());
MyPluginFactory factory(pluginPath, *service);
factory.load();
auto availablePlugins = factory.availablePlugins();
printPluginNames(availablePlugins);
createPlugins(factory, availablePlugins, plugins);
callPlugins(plugins);
service->report();
return 0;
}
示例8: opendir
int ServiceManager::list(const char *type)
{
DIR *rootDir = opendir(root_);
logUser("Info::ServiceManager list '%s'", type);
if (rootDir != NULL)
{
dirent *dirEntry = NULL;
while ((dirEntry = readdir(rootDir)) != NULL)
{
char *name = dirEntry->d_name;
if (name != NULL && name[0] != '.' && strncmp(name, "D-", 2) == 0)
{
char *path = new char[strlen(root_) + strlen("/") + strlen(name) + 1];
if (path != NULL)
{
strcpy(path, root_);
strcat(path, "/");
strcat(path, name);
Service service(path,"");
service.load();
if (type == NULL || (type != NULL && strcmp(type, service.getType())==0)
|| strlen(service.getType())==0)// && service.isRunning())
{
logUser("%d %s %s is %s", service.getPid(), service.getType(),
name, (service.isRunning() ? "running" : "not running"));
}
delete [] path;
}
}
}
}
else
{
logUser("Error: Cannot open root directory '%s'.",root_);
return -1;
}
return 0;
}
示例9: main
int main( int argc, char **argv )
{
QApplication app( argc, argv);
KAboutData aboutData( QStringLiteral("kioexec"), i18n("KIOExec"), KIO_VERSION_STRING,
i18n(description), KAboutLicense::GPL,
i18n("(c) 1998-2000,2003 The KFM/Konqueror Developers"));
aboutData.addAuthor(i18n("David Faure"),QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Stephan Kulow"),QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Bernhard Rosenkraenzer"),QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Waldo Bastian"),QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Oswald Buddenhagen"),QString(), QStringLiteral("[email protected]"));
KAboutData::setApplicationData(aboutData);
KDBusService service(KDBusService::Multiple);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("tempfiles") , i18n("Treat URLs as local files and delete them afterwards")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("suggestedfilename <file name>") , i18n("Suggested file name for the downloaded file")));
parser.addPositionalArgument(QStringLiteral("command"), i18n("Command to execute"));
parser.addPositionalArgument(QStringLiteral("urls"), i18n("URL(s) or local file(s) used for 'command'"));
app.setQuitOnLastWindowClosed(false);
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
if (parser.positionalArguments().count() < 1) {
parser.showHelp(-1);
return -1;
}
const bool tempfiles = parser.isSet(QStringLiteral("tempfiles"));
const QString suggestedfilename = parser.value(QStringLiteral("suggestedfilename"));
KIOExec exec(parser.positionalArguments(), tempfiles, suggestedfilename);
// Don't go into the event loop if we already want to exit (#172197)
if (exec.exited())
return 0;
return app.exec();
}
示例10: main
int main(int N, char *P[])
{
int ln, sock, nsock, pid;
/* on gere le signal SIGCHLD */
signal(SIGCHLD, interrupt);
/* creation du socket */
if((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) {
perror("socket");
exit(1);
}
/* ATTACHEMENT AU PORT */
if(bind(sock,(struct sockaddr*)&Sin, sizeof(Sin)) < 0) {
perror("bind");
exit(2);
}
ln = sizeof(Sin);
if (getsockname(sock,(struct sockaddr*)&Sin,(socklen_t*)&ln) < 0) {
perror("getsockname");
exit(3);
}
printf("Le serveur est attache au port %u\n",ntohs(Sin.sin_port));
/* definition du nb d'appels simultanes */
if (listen(sock,5) < 0) {
perror("listen");
exit(4);
}
/* boucle d'attente */
for (;;) {
if((nsock=accept(sock,(struct sockaddr*)&Sin,(socklen_t*)&ln))<0) {
perror("accept");
exit(5);
}
/* creation d'un nouveau processus dedie au client */
if ((pid = fork()) == -1) {
perror("fork");
exit(6);
}
if (pid == 0) { /* processus fils */
service(nsock);
}
close(nsock); /* il ne l'utilise pas */
}
}
示例11: renet_connection_disconnect
VALUE renet_connection_disconnect(VALUE self, VALUE timeout)
{
Connection* connection;
Data_Get_Struct(self, Connection, connection);
VALUE lock = rb_iv_get(self, "@lock");
rb_mutex_lock(lock);
VALUE rv = Qfalse;
if (connection->online == 0)
{
rv = Qtrue;
}
else
{
connection->online = 0;
enet_peer_disconnect(connection->peer, 0);
while (service(self, connection, NUM2UINT(timeout)) > 0)
{
switch (connection->event->type)
{
case ENET_EVENT_TYPE_NONE:
break;
case ENET_EVENT_TYPE_CONNECT:
break;
case ENET_EVENT_TYPE_RECEIVE:
enet_packet_destroy (connection->event->packet);
break;
case ENET_EVENT_TYPE_DISCONNECT:
rv = Qtrue;
break;
}
if (rv == Qtrue)
{
break;
}
}
if (rv != Qtrue) { enet_peer_disconnect_now(connection->peer, 0); }
}
rb_mutex_unlock(lock);
return rv;
}
示例12: main
int main(int argc, char** argv)
{
OSS::OSS_init();
ServiceOptions::daemonize(argc, argv);
ServiceOptions service(argc, argv, "sipXsbc", "1.0.0", "(c) eZuce, Inc. All rights reserved.");
service.addDaemonOptions();
//
// Initialize the logger
//
service.addOptionString('L', "log-file", ": Specify the application log file.", ServiceOptions::CommandLineOption);
service.addOptionInt('l', "log-level",
": Specify the application log priority level."
"Valid level is between 0-7. "
"0 (EMERG) 1 (ALERT) 2 (CRIT) 3 (ERR) 4 (WARNING) 5 (NOTICE) 6 (INFO) 7 (DEBUG)"
, ServiceOptions::CommandLineOption);
service.addOptionFlag("log-no-compress", ": Specify if logs will be compressed after rotation.");
service.addOptionInt("log-purge-count", ": Specify the number of archive to maintain.");
service.parseOptions();
initLogger(service);
OSS::SIP::B2BUA::SBController sbc;
//
// Initialize the datastore
//
initDataStore(sbc);
//
// Initialize java scripts
//
initHandler(sbc, service);
//
// Initialize the transports
//
initListeners(sbc, service);
sbc.run();
OSS::app_wait_for_termination_request();
OSS::OSS_deinit();
}
示例13: dbg
int
main
(
int argc,
char *argv[]
)
{
dbg( "argc=%d, argv=%p\n", argc, argv );
usage( argc, argv );
chk_doc_root( argv[1] );
install_signal_handlers();
service( stdin, stdout, argv[1] );
return 0;
}
示例14: service
StatusCode TubeLayerPhiEtaCaloTool::initialize() {
StatusCode sc = GaudiTool::initialize();
if (sc.isFailure()) return sc;
m_geoSvc = service("GeoSvc");
if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
<< "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
return StatusCode::FAILURE;
}
if (m_readoutName != "") {
// Check if readouts exist
info() << "Readout: " << m_readoutName << endmsg;
if (m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) {
error() << "Readout <<" << m_readoutName << ">> does not exist." << endmsg;
return StatusCode::FAILURE;
}
}
return sc;
}
示例15: file
bool EmmaClientWidget::acceptDialogDone(int result)
{
if(result == QDialog::Accepted) {
QString fn = ui->edFileName->text().trimmed();
if(!fn.isEmpty()) {
QFile file(fn);
if(!file.open(QIODevice::WriteOnly | QIODevice::Append)) {
qf::qmlwidgets::dialogs::MessageBox::showError(this, tr("File '%1' cannot be open for writing.").arg(fn));
return false;
}
}
EmmaClient *svc = service();
if(svc) {
svc->setFileName(fn);
svc->loadSettings();
}
}
return true;
}