本文整理汇总了C++中Arguments::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Arguments::contains方法的具体用法?C++ Arguments::contains怎么用?C++ Arguments::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arguments
的用法示例。
在下文中一共展示了Arguments::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
/*
* Description:
*
*This program tries to find the TIM gateway from Quby makeing use of Upnp.
*After this it will fetch the information from all sensors and publish it
*on the dbus
*
*UPNP code: https://garage.maemo.org/frs/download.php/8365/libbrisa_0.1.1.tar.gz
*/
QCoreApplication app(argc, argv);
Arguments arg;
usage(arg);
if (arg.contains("h")) {
arg.help();
exit(0);
}
initLogger(QsLogging::InfoLevel);
if (arg.contains("d"))
logger.setLoggingLevel((QsLogging::Level)arg.value("d").toInt());
if (arg.contains("dbus"))
VBusItems::setDBusAddress(arg.value("dbus"));
else
VBusItems::setConnectionType(QDBusConnection::SystemBus);
QDBusConnection dbus = VBusItems::getConnection("settings");
if (!dbus.isConnected()) {
QLOG_ERROR() << "DBus connection failed.";
exit(EXIT_FAILURE);
}
// Wait for local settings to become available on the DBus
QLOG_INFO() << "Wait for local settings on DBus... ";
BusItemCons settings("com.victronenergy.settings", "/Settings", dbus);
QVariant reply = settings.getValue();
while (reply.isValid() == false) {
reply = settings.getValue();
usleep(500000);
QLOG_INFO() << "Wait...";
}
QLOG_INFO() << "Local settings found!";
Qwacs qwacs(&app, arg.value("g"));
return app.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Arguments arg;
usage(arg);
if (arg.contains("h")) {
arg.help();
exit(0);
}
QsLogging::Level logLevel = QsLogging::InfoLevel;
if (arg.contains("d"))
logLevel = static_cast<QsLogging::Level>(arg.value("d").toInt());
initLogger(logLevel);
QDBusConnection dbus = QDBusConnection::systemBus();
if (arg.contains("dbus")) {
QString dbusAddress = arg.value("dbus");
if (dbusAddress != "system") {
if (dbusAddress == "session")
dbus = QDBusConnection::sessionBus();
else
dbus = QDBusConnection::connectToBus(dbusAddress, "modbus_tcp");
}
}
if (!dbus.isConnected()) {
QLOG_ERROR() << "DBus connection failed.";
exit(EXIT_FAILURE);
}
App dbusModbusApp(dbus);
return app.exec();
}