本文整理汇总了C++中service函数的典型用法代码示例。如果您正苦于以下问题:C++ service函数的具体用法?C++ service怎么用?C++ service使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了service函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:45,代码来源:skype_trouter.cpp
示例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);
}
}
开发者ID:caseymcc,项目名称:wt,代码行数:45,代码来源:FacebookService.C
示例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;
}
开发者ID:GNUmedia,项目名称:shotcut,代码行数:18,代码来源:mltcontroller.cpp
示例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;
}
开发者ID:mettalla,项目名称:dali,代码行数:18,代码来源:clipboard-impl-wl.cpp
示例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);
}
开发者ID:ghjinlei,项目名称:qt5,代码行数:18,代码来源:tst_qqmldebugservice.cpp
示例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;
}
开发者ID:tari3x,项目名称:csec-modex,代码行数:18,代码来源:proxies.c
示例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;
}
开发者ID:paxos1977,项目名称:PluginFactory,代码行数:18,代码来源:main.cpp
示例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;
}
开发者ID:kleopatra999,项目名称:finx,代码行数:44,代码来源:ServiceManager.cpp
示例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();
}
开发者ID:emmanuel099,项目名称:kio,代码行数:43,代码来源:main.cpp
示例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 */
}
}
开发者ID:RobinChap,项目名称:ProjTransCIO,代码行数:43,代码来源:servcom.c
示例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;
}
开发者ID:jvranish,项目名称:rENet,代码行数:43,代码来源:renet_connection.c
示例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();
}
开发者ID:ezuce,项目名称:sipXsbc,代码行数:43,代码来源:main.cpp
示例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;
}
开发者ID:tomohikoseven,项目名称:http,代码行数:19,代码来源:main.c
示例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;
}
开发者ID:HEP-FCC,项目名称:FCCSW,代码行数:19,代码来源:TubeLayerPhiEtaCaloTool.cpp
示例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;
}
开发者ID:xkenia,项目名称:quickbox,代码行数:19,代码来源:emmaclientwidget.cpp
示例16: TEST_F
TEST_F(StreamingRpcTest, auto_close_if_host_socket_closed) {
HandlerControl hc;
OrderedInputHandler handler(&hc);
hc.block = true;
brpc::StreamOptions opt;
opt.handler = &handler;
const int N = 10000;
opt.max_buf_size = sizeof(uint32_t) * N;
brpc::Server server;
MyServiceWithStream service(opt);
ASSERT_EQ(0, server.AddService(&service, brpc::SERVER_DOESNT_OWN_SERVICE));
ASSERT_EQ(0, server.Start(9007, NULL));
brpc::Channel channel;
ASSERT_EQ(0, channel.Init("127.0.0.1:9007", NULL));
brpc::Controller cntl;
brpc::StreamId request_stream;
brpc::StreamOptions request_stream_options;
request_stream_options.max_buf_size = sizeof(uint32_t) * N;
ASSERT_EQ(0, StreamCreate(&request_stream, cntl, &request_stream_options));
brpc::ScopedStream stream_guard(request_stream);
test::EchoService_Stub stub(&channel);
stub.Echo(&cntl, &request, &response, NULL);
ASSERT_FALSE(cntl.Failed()) << cntl.ErrorText() << " request_stream=" << request_stream;
{
brpc::SocketUniquePtr ptr;
ASSERT_EQ(0, brpc::Socket::Address(request_stream, &ptr));
brpc::Stream* s = (brpc::Stream*)ptr->conn();
ASSERT_TRUE(s->_host_socket != NULL);
s->_host_socket->SetFailed();
}
usleep(100);
butil::IOBuf out;
out.append("test");
ASSERT_EQ(EINVAL, brpc::StreamWrite(request_stream, out));
while (!handler.stopped()) {
usleep(100);
}
ASSERT_FALSE(handler.failed());
ASSERT_EQ(0, handler.idle_times());
ASSERT_EQ(0, handler._expected_next_value);
}
开发者ID:sharpglasses,项目名称:brpc,代码行数:43,代码来源:brpc_streaming_rpc_unittest.cpp
示例17: tn
/// Retrieve conversion service by name
SmartIF<IConversionSvc>& PersistencySvc::service(const std::string& nam) {
Gaudi::Utils::TypeNameString tn(nam);
IConversionSvc* svc = 0;
for ( Services::iterator it = m_cnvServices.begin(); it != m_cnvServices.end(); it++ ) {
if ( (*it).second.service()->name() == tn.name() ) {
return (*it).second.conversionSvc();
}
}
StatusCode status = Service::service(nam, svc, true);
if ( status.isSuccess() ) {
if ( addCnvService(svc).isSuccess() ) {
svc->release(); // Do not double-reference count
return service(nam); // now it is in the list
}
}
info() << "Cannot access Conversion service:" << nam << endmsg;
static SmartIF<IConversionSvc> no_svc;
return no_svc;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:20,代码来源:PersistencySvc.cpp
示例18: service
bool GlslManager::init_chain( mlt_service aservice )
{
bool error = true;
Mlt::Service service( aservice );
EffectChain* chain = (EffectChain*) service.get_data( "movit chain" );
if ( !chain ) {
mlt_profile profile = mlt_service_profile( aservice );
Input* input = new MltInput( profile->width, profile->height );
chain = new EffectChain( profile->display_aspect_num, profile->display_aspect_den );
chain->add_input( input );
service.set( "movit chain", chain, 0, (mlt_destructor) deleteChain );
service.set( "movit input", input, 0 );
service.set( "_movit finalized", 0 );
service.listen( "service-changed", aservice, (mlt_listener) GlslManager::onServiceChanged );
service.listen( "property-changed", aservice, (mlt_listener) GlslManager::onPropertyChanged );
error = false;
}
return error;
}
开发者ID:jksiezni,项目名称:mlt,代码行数:19,代码来源:filter_glsl_manager.cpp
示例19: grpc_init
void HybridSimulationManager::Start()
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
grpc_init();
///0.0.0.0 means to listen on all devices
string jupedsim_service_address("0.0.0.0:"+std::to_string(_config->GetServicePort()));
JPSserver service(this, _latches, _config);
_service = &service;
ServerBuilder builder;
builder.AddListeningPort(jupedsim_service_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
_server = builder.BuildAndStart();
Log->Write("INFO:\tJPS server at port: "+std::to_string(_config->GetServicePort())+" is up and running.");
_server->Wait();
}
开发者ID:JuPedSim,项目名称:jpscore,代码行数:19,代码来源:HybridSimulationManager.cpp
示例20: main
int main(int argc, char *argv[])
{
KLocalizedString::setApplicationDomain("kde5-nm-connection-editor");
QApplication app(argc, argv);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-system-network")));
KAboutData about(QStringLiteral("kde5-nm-connection-editor"), i18n("Connection editor"),
PLASMA_NM_VERSION_STRING, i18n("Manage your network connections"),
KAboutLicense::GPL, i18n("(C) 2013-2015 Jan Grulich and Lukáš Tinkl"),
i18n("This application allows you to create, edit and delete network connections.\n\nUsing NM version: %1", NetworkManager::version()));
about.addAuthor(i18n("Jan Grulich"), i18n("Developer"), QStringLiteral("[email protected]"));
about.addAuthor(i18n("Lukáš Tinkl"), i18n("Developer"), QStringLiteral("[email protected]"));
about.addCredit(i18n("Lamarque Souza"), i18n("libnm-qt author"), QStringLiteral("[email protected]"));
about.addCredit(i18n("Daniel Nicoletti"), i18n("various bugfixes"), QStringLiteral("[email protected]"));
about.addCredit(i18n("Will Stephenson"), i18n("VPN plugins"), QStringLiteral("[email protected]"));
about.addCredit(i18n("Ilia Kats"), i18n("VPN plugins"), QStringLiteral("[email protected]"));
about.setProductName(QByteArrayLiteral("plasma-nm/editor"));
KAboutData::setApplicationData(about);
KDBusService service(KDBusService::Unique);
QCommandLineParser parser;
QCommandLineOption importVpnOption(QStringLiteral("import-vpn"), i18n("Import VPN Connection"), QStringLiteral("path"));
parser.addOption(importVpnOption);
parser.addHelpOption();
parser.addVersionOption();
about.setupCommandLine(&parser);
parser.process(app);
about.processCommandLine(&parser);
ConnectionEditor * editor = new ConnectionEditor();
if (parser.isSet(importVpnOption)) {
editor->importVpnAtPath(parser.value(importVpnOption));
}
editor->show();
QObject::connect(&service, &KDBusService::activateRequested, editor, &ConnectionEditor::activateAndRaise);
return app.exec();
}
开发者ID:KDE,项目名称:plasma-nm,代码行数:43,代码来源:main.cpp
注:本文中的service函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论