int Kernel::do_switches() { try { // add -h, -v, etc addBasicSwitchSet(); // add the options for the derived application addSwitches(); // parse the command line parseSwitches(); } catch (std::exception const& e) { const std::string s("Caught exception handling switches: "); printError(s + e.what()); return 1; } catch (...) { printError("Caught unknown exception handling switches"); return 1; } return 0; }
void SwitcherConfig::processMergedConfig(const QJsonDocument &document) { LOG_DEBUG << "#"; if (document.isObject()) { parseSwitches(document.object()); emit switchesUpdated(); } else { LOG_WARNING << "Remote document is not an object"; } }
virtual void parse(QDomElement & resources) { QDomNodeList nodes = resources.elementsByTagName("computer"); parseNodes(nodes); QDomNodeList stores = resources.elementsByTagName("storage"); parseStores(stores); QDomNodeList switches = resources.elementsByTagName("router"); parseSwitches(switches); QDomNodeList links = resources.elementsByTagName("link"); parseLinks(links); }
bool SwitcherConfig::processLocalConfig(const QJsonDocument &document) { LOG_VERBOSE_OR_DEBUG << document; bool anyError = false; do { if (!document.isObject()) { LOG_WARNING << "Json document is not an object"; anyError = true; break; } QJsonObject rootObject = document.object(); parseSwitches(rootObject); emit switchesUpdated(); } while (false); return anyError; }