QString AMOldScanParametersDictionary::parseKeywordStringAndOperate(const QString &inputString){ operatingNow_ = true; QString parsedString = parseKeywordString(inputString); operateImplementation(parsedString); operatingNow_ = false; emit parsed(parsedString); return parsedString; }
QString AMOldScanParametersDictionary::parseKeywordString(const QString &inputString) { lastInputString_ = inputString; keywordParser_->setInitialText(inputString); keywordParser_->replaceAllUsingDictionary(keywordDictionary_); QString parsedString = keywordParser_->getReplacedText(); if(!operatingNow_) emit parsed(parsedString); return parsedString; }
bool reversible_program_options::is_write_realization_filename_set() const { if ( !parsed() || !d->has_out_realization ) { return false; } return is_set( "realname" ); }
void TraceLoader::parseTrace() { QList<ApiTraceFrame*> frames; int frameCount = 0; int lastPercentReport = 0; ApiTraceFrame *currentFrame = new ApiTraceFrame(); currentFrame->number = frameCount; FrameContents frameCalls; while (frameCalls.load(this, currentFrame, m_helpHash, m_parser)) { if (frameCalls.topLevelCount() == frameCalls.allCallsCount()) { currentFrame->setCalls(frameCalls.allCalls(), frameCalls.allCalls(), frameCalls.binaryDataSize()); } else { currentFrame->setCalls(frameCalls.topLevelCalls(), frameCalls.allCalls(), frameCalls.binaryDataSize()); } frames.append(currentFrame); if (frames.count() >= FRAMES_TO_CACHE) { emit framesLoaded(frames); frames.clear(); } if (m_parser.percentRead() - lastPercentReport >= 5) { emit parsed(m_parser.percentRead()); lastPercentReport = m_parser.percentRead(); } ++frameCount; currentFrame = new ApiTraceFrame(); currentFrame->number = frameCount; frameCalls.reset(); } //last frames won't have markers // it's just a bunch of Delete calls for every object // after the last SwapBuffers if (!frameCalls.isEmpty()) { if (frameCalls.topLevelCount() == frameCalls.allCallsCount()) { currentFrame->setCalls(frameCalls.allCalls(), frameCalls.allCalls(), frameCalls.binaryDataSize()); } else { currentFrame->setCalls(frameCalls.topLevelCalls(), frameCalls.allCalls(), frameCalls.binaryDataSize()); } frames.append(currentFrame); } if (frames.count()) { emit framesLoaded(frames); } }
GoogleCalendar::GoogleCalendar(QObject *parent, QString url) : QObject(parent) { QUrl parsed(url); access_manager = new QNetworkAccessManager(this); connect(access_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(dataDownloadComplete(QNetworkReply*))); connect(access_manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(dataDownloadSSLError(QNetworkReply*,QList<QSslError>))); webpath = parsed; qDebug() << QString("Added calendar for %1").arg(url); refreshCalendar(); }
bool ReplaceFileSystemURL(const char* base, const URLSegments& baseParsed, const Replacements<char>& replacements, URLQueryCharsetConverter* charsetConverter, URLBuffer<char>& output, URLSegments* outputParsed) { URLComponentSource<char> source(base); URLSegments parsed(baseParsed); SetupOverrideComponents(base, replacements, &source, &parsed); return doCanonicalizeFileSystemURL<char, unsigned char>(base, source, parsed, charsetConverter, output, *outputParsed); }
/* copied from virtualCluster.cpp but with one important difference: if a not-strict flag is set then warn the user but don't clear the lotserial field */ void LotserialLineEdit::sParse() { if (! _parsed) { QString stripped = text().stripWhiteSpace().upper(); if (stripped.length() == 0) setId(-1); else { XSqlQuery numQ; numQ.prepare(_query + _numClause + _extraClause + QString(";")); numQ.bindValue(":number", stripped); numQ.exec(); if (numQ.first()) { _valid = true; setId(numQ.value("id").toInt()); _name = (numQ.value("name").toString()); if (_hasDescription) _description = numQ.value("description").toString(); } else if (numQ.lastError().type() != QSqlError::None) { QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), numQ.lastError().databaseText()); return; } else if (_strict) VirtualClusterLineEdit::clear(); else if (isVisible() && QMessageBox::question(this, tr("Lot/Serial # Not Found"), tr("This Lot/Serial # was not found" + QString(_itemid > 0 ? " for this item" : "") + ". Are you sure it is correct?"), QMessageBox::Yes, QMessageBox::No | QMessageBox::Default) == QMessageBox::No) { VirtualClusterLineEdit::clear(); return; } else { VirtualClusterLineEdit::clear(); setText(stripped); } } } _parsed = TRUE; emit parsed(); }
po::variables_map create_cmd_params(int argc, char *argv[], po::options_description const &desc) { po::variables_map vm; po::parsed_options parsed ( po::command_line_parser(argc, argv) .options(desc) //.allow_unregistered( ) .run( )); po::store(parsed, vm); po::notify(vm); return vm; }
void VirtualCluster::addNumberWidget(VirtualClusterLineEdit* pNumberWidget) { _number = pNumberWidget; if (! _number) return; _grid->addWidget(_number, 0, 1); setFocusProxy(pNumberWidget); connect(_number, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_number, SIGNAL(parsed()), this, SLOT(sRefresh())); connect(_number, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); }
static int read_commandline(options& opt, std::vector<std::string>& args) { boost::program_options::options_description o_general("Options"); o_general.add_options() ("help,h", "display this message") ("api,a", boost::program_options::value(&opt.api_host), "api host (default: api.supermarx.nl)") ("config,C", boost::program_options::value(&opt.config), "path to the configfile (default: ./config.yaml)"); boost::program_options::variables_map vm; boost::program_options::options_description options("Allowed options"); options.add(o_general); boost::program_options::parsed_options parsed(boost::program_options::command_line_parser(args).options(options).allow_unregistered().run()); boost::program_options::store(parsed, vm); args = boost::program_options::collect_unrecognized(parsed.options, boost::program_options::include_positional); try { boost::program_options::notify(vm); } catch(const boost::program_options::required_option &e) { std::cerr << "You forgot this: " << e.what() << std::endl; return EXIT_FAILURE; } if(vm.count("help")) { std::cout << "SuperMarx commandline interface Paul. [https://github.com/SuperMarx/paul]" << std::endl << "Usage [1]: ./paul [options] <empty>" << std::endl << " Drops Paul into an interactive shell." << std::endl << "Usage [2]: ./paul [options] action" << std::endl << std::endl << "Actions:" << std::endl << " login logs an user in" << std::endl << " quit drops from the interactive cell (if applicable)" << std::endl << std::endl << o_general; return EXIT_FAILURE; } if(!vm.count("api")) opt.api_host = "https://api.supermarx.nl"; if(!vm.count("config")) opt.config = "./config.yaml"; return EXIT_SUCCESS; }
/// @brief Handle an alias element void operator()(elements::AliasElement const &elt) { // This is an alias. ParsedAlias parsed(elt.getSource()); if (!parsed.isValid()) { OSVR_DEV_VERBOSE("Couldn't parse alias: " << elt.getSource()); return; } /// @todo update the element with the normalized source? if (!parsed.isSimple()) { // Not simple: store the full string as a transform. m_source.nestTransform(parsed.getAliasValue()); } m_recurse(parsed.getLeaf()); }
void CrmClusterLineEdit::silentSetId(const int pId) { if (DEBUG) qDebug("VCLE %s::silentSetId(%d)", qPrintable(objectName()), pId); if (pId == -1) { XLineEdit::clear(); _model = new QSqlQueryModel(this); } else { XSqlQuery idQ; idQ.prepare(_query + _idClause + QString(";")); idQ.bindValue(":id", pId); idQ.exec(); if (idQ.first()) { if (_completer) static_cast<QSqlQueryModel* >(_completer->model())->setQuery(QSqlQuery()); _id = pId; _valid = true; _model->setQuery(idQ); setText(idQ.value("number").toString()); if (_hasName) _name = (idQ.value("name").toString()); if (_hasDescription) _description = idQ.value("description").toString(); if (_hasActive) setStrikeOut(!idQ.value("active").toBool()); if (_hasOwner) _owner = idQ.value("owner").toString(); if (_hasAssignto) _assignto = idQ.value("assignto").toString(); } else if (idQ.lastError().type() != QSqlError::NoError) QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), idQ.lastError().databaseText()); } _parsed = true; sHandleNullStr(); emit parsed(); }
void ItemCluster::addNumberWidget(ItemLineEdit* pNumberWidget) { _number = pNumberWidget; if (! _number) return; _grid->addWidget(_number, 0, 1); setFocusProxy(pNumberWidget); connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_info, SIGNAL(clicked()), this, SLOT(sInfo())); connect(_number, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_number, SIGNAL(parsed()), this, SLOT(sRefresh())); connect(_number, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); }
void VirtualClusterLineEdit::sParse() { if (DEBUG) qDebug("VCLE %s::sParse() entered with _parsed %d and text() %s", qPrintable(objectName()), _parsed, qPrintable(text())); if (! _parsed) { QString stripped = text().trimmed().toUpper(); if (stripped.length() == 0) { _parsed = true; setId(-1); } else { XSqlQuery numQ; numQ.prepare(_query + _numClause + (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) + ((_hasActive && ! _showInactive) ? _activeClause : "" ) + QString("ORDER BY %1 LIMIT 1;").arg(_numColName)); numQ.bindValue(":number", "^" + stripped); numQ.exec(); if (numQ.first()) { _valid = true; setId(numQ.value("id").toInt()); if (_hasName) _name = (numQ.value("name").toString()); if (_hasDescription) _description = numQ.value("description").toString(); } else { setId(-1); if (numQ.lastError().type() != QSqlError::NoError) QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), numQ.lastError().databaseText()); } } emit valid(_valid); emit parsed(); } _parsed = true; sHandleNullStr(); }
void yg::GetOptions (int argc, char **argv, std::string &input, std::string &output, std::vector <std::string> &tools) { po::options_description description ("Options"); description.add_options () ("input,i", po::value <std::string> (&input)->required (), "File to read template from") ("output,o", po::value <std::string> (&output)->required (), "File to write result to") ("extra,e", po::value <std::vector <std::string>> (&tools)->multitoken (), "Extra options"); po::positional_options_description positionalDescription; positionalDescription.add ("extra", -1); po::variables_map vm; po::command_line_parser parser (argc, argv); po::parsed_options parsed (parser.options (description) .positional (positionalDescription) .allow_unregistered () .run ()); po::store (parsed, vm); try { po::notify (vm); } catch (std::exception const &e) { std::stringstream ss; ss << e.what () << std::endl; ss << "Options Available: " << description << std::endl; throw std::logic_error (ss.str ()); } }
void LocString::readString(uint32 languageID, Common::SeekableReadStream &stream) { uint32 length = stream.readUint32LE(); std::pair<StringMap::iterator, bool> s = _strings.insert(std::make_pair(languageID, "")); if (length == 0) return; s.first->second = "[???]"; Common::ScopedPtr<Common::MemoryReadStream> data(stream.readStream(length)); Common::ScopedPtr<Common::MemoryReadStream> parsed(LangMan.preParseColorCodes(*data)); Common::Encoding encoding = LangMan.getEncodingLocString(LangMan.getLanguageGendered(languageID)); if (encoding != Common::kEncodingInvalid) s.first->second = Common::readString(*parsed, encoding); }
void VirtualClusterLineEdit::sParse() { if (DEBUG) qDebug("VCLE %s::sParse() entered with _parsed %d and text() %s", qPrintable(objectName()), _parsed, qPrintable(text())); if (! _parsed) { QString stripped = text().stripWhiteSpace().upper(); if (stripped.length() == 0) { _parsed = TRUE; setId(-1); } else { XSqlQuery numQ; numQ.prepare(_query + _numClause + (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) + QString(";")); numQ.bindValue(":number", stripped); numQ.exec(); if (numQ.first()) { _valid = true; setId(numQ.value("id").toInt()); if (_hasName) _name = (numQ.value("name").toString()); if (_hasDescription) _description = numQ.value("description").toString(); } else { clear(); if (numQ.lastError().type() != QSqlError::None) QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), numQ.lastError().databaseText()); } } } _parsed = TRUE; emit valid(_valid); emit parsed(); }
// TODO: can we get _recip_id and _recip_type using the inherited sParse()? void QuoteLineEdit::sParse() { if (! _parsed) { QString stripped = text().trimmed().toUpper(); if (stripped.length() == 0) { _parsed = true; setId(-1); } else { XSqlQuery numQ; numQ.prepare(_query + _numClause + (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) + QString(";")); numQ.bindValue(":number", "^" + stripped); numQ.exec(); if (numQ.first()) { _valid = true; setId(numQ.value("id").toInt()); if (_hasName) _name = numQ.value("name").toString(); if (_hasDescription) _description = numQ.value("description").toString(); _recip_id = numQ.value("recip_id").toInt(); _recip_type = numQ.value("recip_type").toString(); } else { setId(-1); if (numQ.lastError().type() != QSqlError::NoError) QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), numQ.lastError().databaseText()); } } emit valid(_valid); emit parsed(); } _parsed = true; sHandleNullStr(); }
QJSValue RequestPrototype::query(const QJSValue &query) { if (query.isObject()) { JSValueIterator it(query); while (it.next()) { m_query.addQueryItem( it.name(), it.value().toString()); } } else if (query.isString()) { QUrlQuery parsed(query.toString()); QList<QPair<QString, QString> > items = parsed.queryItems(QUrl::FullyDecoded); QPair<QString, QString> pair; foreach(pair, items) { m_query.addQueryItem(pair.first, pair.second); }
ImageCluster::ImageCluster(QWidget* pParent, const char* pName) : VirtualCluster(pParent, pName) { addNumberWidget(new ImageClusterLineEdit(this, pName)); _image = new QLabel("picture here"); _image->setPixmap(QPixmap()); _image->setAlignment(Qt::AlignLeft | Qt::AlignTop); QScrollArea * scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(true); scrollArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); scrollArea->setWidget(_image); _grid->addWidget(scrollArea, 1, 0, -1, -1); _description->hide(); _name->hide(); connect(_number, SIGNAL(parsed()), this, SLOT(sRefresh())); }
std::vector<ssize_t> Axis::parse (size_t ndim, const std::string& specifier) { std::vector<ssize_t> parsed (ndim); size_t str = 0; size_t lim = 0; size_t end = specifier.size(); size_t current = 0; try { while (str <= end) { bool pos = true; if (specifier[str] == '+') { pos = true; str++; } else if (specifier[str] == '-') { pos = false; str++; } else if (!isdigit (specifier[str])) throw 0; lim = str; while (isdigit (specifier[lim])) lim++; if (specifier[lim] != ',' && specifier[lim] != '\0') throw 0; parsed[current] = to<ssize_t> (specifier.substr (str, lim-str)) + 1; if (!pos) parsed[current] = -parsed[current]; str = lim+1; current++; } } catch (int) { throw Exception ("malformed axes specification \"" + specifier + "\""); } if (current != ndim) throw Exception ("incorrect number of axes in axes specification \"" + specifier + "\""); check (parsed, ndim); return parsed; }
bool Device::open(boost::asio::io_service &io_service, std::shared_ptr<ICallback> callback) { auto handle = CreateFile(m_path.c_str(), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if(handle == INVALID_HANDLE_VALUE) { return false; } m_handle=std::shared_ptr<void>(handle, &::CloseHandle); // get hid caps { HIDP_PREPARSED_DATA* preparsedData=0; if (!HidD_GetPreparsedData(handle, &preparsedData)){ return false; } std::shared_ptr<HIDP_PREPARSED_DATA> parsed( preparsedData, HidD_FreePreparsedData); HIDP_CAPS caps; if (HidP_GetCaps(preparsedData, &caps) != HIDP_STATUS_SUCCESS) { return false; } std::cout << "Usage: " << caps.Usage << std::endl; std::cout << "UsagePage: " << caps.UsagePage << std::endl; std::cout << "InputReportByteLength: " << caps.InputReportByteLength << std::endl; std::cout << "OutputReportByteLength: " << caps.OutputReportByteLength << std::endl; std::cout << "FeatureReportByteLength: " << caps.FeatureReportByteLength << std::endl; } // setup stream m_stream=std::make_shared<boost::asio::windows::stream_handle>(io_service, handle); m_callback=callback; beginRead(); m_callback->onConnect(this); return true; }
static void try_main(int argc,char* argv[]) { strelka_options opt; for (int i(0); i<argc; ++i) { if (i) opt.cmdline += ' '; opt.cmdline += argv[i]; } initialize_blt_signals(pinfo.name(),opt.cmdline.c_str()); std::vector<std::string> legacy_starling_args; po::variables_map vm; try { po::options_description visible(get_strelka_option_parser(opt)); po::options_description visible2(get_starling_shared_option_parser(opt)); visible.add(visible2); po::parsed_options parsed(po::command_line_parser(argc,argv).options(visible).allow_unregistered().run()); po::store(parsed,vm); po::notify(vm); // allow remaining options to be parsed using starling command-line parser: legacy_starling_args = po::collect_unrecognized(parsed.options,po::include_positional); } catch (const boost::program_options::error& e) { pinfo.usage(e.what()); } if ((argc==1) or vm.count("help")) { pinfo.usage(); } // temp workaround for blt/starling options which are not (yet) // under program_options control: // arg_data ad(legacy_starling_args,pinfo,opt.cmdline); legacy_starling_arg_parse(ad,opt); finalize_strelka_options(pinfo,vm,opt); strelka_run(opt); }
void ContactCluster::addNumberWidget(ContactClusterLineEdit* pNumberWidget) { _number = pNumberWidget; if (! _number) return; _number->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _number->setMinimumWidth(200); QHBoxLayout* hbox = new QHBoxLayout; QSpacerItem* item = new QSpacerItem(100, 20, QSizePolicy::Fixed, QSizePolicy::Fixed); hbox->addWidget(_number); hbox->addItem(item); _grid->addLayout(hbox, 0, 1, 1, 3); setFocusProxy(pNumberWidget); connect(_number, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_number, SIGNAL(parsed()), this, SLOT(sRefresh())); connect(_number, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); }
int p12ParseTop( CSSM_DATA &rawBlob, CSSM_CSP_HANDLE cspHand, CFStringRef pwd, bool verbose) { SecNssCoder coder; OidParser parser; P12Parsed parsed(coder); P12ParseInfo pinfo(coder, cspHand, parser, pwd, NULL, // no separate pwd parsed); printf("PKCS12 PFX:\n"); int rtn = p12Parse(rawBlob, pinfo, 3); /* find anything? */ if(verbose) { P12KnownBlobs &certs = pinfo.mParsed.mCerts; if(certs.mNumBlobs) { printf("\n\n"); for(unsigned dex=0; dex<certs.mNumBlobs; dex++) { printf("Cert %u:\n", dex); printCert(certs.mBlobs[dex].Data, certs.mBlobs[dex].Length, CSSM_FALSE); printf("\n"); } } P12KnownBlobs &crls = pinfo.mParsed.mCrls; if(crls.mNumBlobs) { printf("\n\n"); for(unsigned dex=0; dex<crls.mNumBlobs; dex++) { printf("CRL %u:\n", dex); printCrl(crls.mBlobs[dex].Data, crls.mBlobs[dex].Length, CSSM_FALSE); } } } return rtn; }
void VirtualClusterLineEdit::setId(const int pId) { if (DEBUG) qDebug("VCLE %s::setId(%d)", qPrintable(objectName()), pId); if (pId == -1 || pId == 0) { clear(); emit parsed(); } else { bool changed = (pId != _id); silentSetId(pId); if (changed) { emit newId(pId); emit valid(_valid); } } }
void Parser::parseTail() { if(!parsed()) { parse(); } if(!_tailParsed) { try { Object::ParsingContext context(object()); doParseTail(); _tailParsed = true; } catch (const ParsingException& exception) { handleParsingException(exception); } catch (const Object::ParsingContext::LockException&) { } } }
void UsernameLineEdit::setId(const int pId) { QString sql("SELECT usr_username AS number, " " usr_propername AS name " " FROM usr" " WHERE ((usr_id=:id)"); if(UsersActive == _type) sql += " AND (usr_active)"; else if(UsersInactive == _type) sql += " AND (NOT usr_active)"; sql += " );"; XSqlQuery query; query.prepare(sql); query.bindValue(":id", pId); query.exec(); setStrikeOut(!query.size()); if(query.first()) { _id = pId; _valid = true; _username = query.value("number").toString(); setText(_username); _name = query.value("name").toString(); } else { _id = -1; _valid = false; _name = QString(); _description = QString(); } emit newId(_id); emit valid(_valid); emit parsed(); _parsed = true; }
void VirtualClusterLineEdit::silentSetId(const int pId) { if (DEBUG) qDebug("VCLE %s::silentSetId(%d)", qPrintable(objectName()), pId); if (pId == -1) XLineEdit::clear(); else { XSqlQuery idQ; idQ.prepare(_query + _idClause + (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) + QString(";")); idQ.bindValue(":id", pId); idQ.exec(); if (idQ.first()) { _id = pId; _valid = true; setText(idQ.value("number").toString()); if (_hasName) _name = (idQ.value("name").toString()); if (_hasDescription) _description = idQ.value("description").toString(); if (_mapper->model() && _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text()) _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text()); } else if (idQ.lastError().type() != QSqlError::None) QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.") .arg(__FILE__) .arg(__LINE__), idQ.lastError().databaseText()); } _parsed = TRUE; emit parsed(); }
extern "C" JNIEXPORT bool JNICALL Java_com_felspar_android_Setting_fromJSON( JNIEnv *env, jobject self, jstring jdomain, jstring j_string ) { try { fostlib::string cppstring(fostlib::jni_cast<fostlib::string>(env, j_string)), domain(fostlib::jni_cast<fostlib::string>(env, jdomain)); fostlib::json parsed(fostlib::json::parse(cppstring)); g_settings.push_back( std::unique_ptr<fostlib::settings>( new fostlib::settings(domain, parsed))); g_sinks.reset(new fostlib::log::global_sink_configuration(c_logging.value())); fostlib::log::info(c_module) ("domain", domain) ("settings", parsed); return true; } catch ( fostlib::exceptions::exception &e ) { fostlib::log::info(c_module) ("exception", e.what()) ("data", e.data()); return false; } }