void CaptureContext::LoadRenames(const QString &data) { QVariantMap root = JSONToVariant(data); if(root.contains(lit("CustomResourceNames"))) { QVariantMap resources = root[lit("CustomResourceNames")].toMap(); for(const QString &str : resources.keys()) { ResourceId id; if(str.startsWith(lit("resourceid::"))) { qulonglong num = str.mid(sizeof("resourceid::") - 1).toULongLong(); memcpy(&id, &num, sizeof(num)); } else { qCritical() << "Unrecognised resourceid encoding" << str; } if(id != ResourceId()) m_CustomNames[id] = resources[str].toString(); } } }
wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator() : wkt_multi_generator::base_type(wkt) { boost::spirit::karma::lit_type lit; boost::spirit::karma::eps_type eps; boost::spirit::karma::_val_type _val; boost::spirit::karma::_1_type _1; boost::spirit::karma::_a_type _a; geometry_types.add (mapnik::geometry_type::types::Point,"Point") (mapnik::geometry_type::types::LineString,"LineString") (mapnik::geometry_type::types::Polygon,"Polygon") ; wkt = eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)] << lit("GeometryCollection(") << geometry << lit(")") | eps(is_multi(_val)) << lit("Multi") << geometry_types[_1 = phoenix::at_c<0>(_a)] << "(" << multi_geometry << ")" | geometry ; geometry = -(single_geometry % lit(',')) ; single_geometry = geometry_types[_1 = _type(_val)] << path ; multi_geometry = -(path % lit(',')) ; }
escaped_string<OutputIterator>::escaped_string() : escaped_string::base_type(esc_str) { karma::lit_type lit; karma::_r1_type _r1; karma::hex_type hex; karma::right_align_type right_align; karma::print_type kprint; esc_char.add ('"', "\\\"") ('\\', "\\\\") ('\b', "\\b") ('\f', "\\f") ('\n', "\\n") ('\r', "\\r") ('\t', "\\t") ; esc_str = lit(_r1) << *(esc_char | kprint | "\\u" << right_align(4,lit('0'))[hex]) << lit(_r1) ; }
void CaptureDialog::SetInjectMode(bool inject) { m_Inject = inject; if(inject) { ui->injectGroup->setVisible(true); ui->exeGroup->setVisible(false); ui->topVerticalSpacer->spacerItem()->changeSize(0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum); ui->verticalLayout->invalidate(); ui->globalGroup->setVisible(false); fillProcessList(); ui->launch->setText(lit("Inject")); this->setWindowTitle(lit("Inject into Process")); } else { ui->injectGroup->setVisible(false); ui->exeGroup->setVisible(true); ui->topVerticalSpacer->spacerItem()->changeSize(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); ui->verticalLayout->invalidate(); ui->globalGroup->setVisible(m_Ctx.Config().AllowGlobalHook); ui->launch->setText(lit("Launch")); this->setWindowTitle(lit("Launch Application")); } }
void CaptureDialog::initWarning(RDLabel *warning) { if(!warning) return; if(warning->devicePixelRatio() >= 2) warning->setText(warning->text().replace(lit(".png"), lit("@2x.png"))); auto calcPaletteFromStyle = [warning](QEvent *) { QPalette pal = warning->palette(); QColor base = pal.color(QPalette::ToolTipBase); pal.setColor(QPalette::Foreground, pal.color(QPalette::ToolTipText)); pal.setColor(QPalette::Window, base); pal.setColor(QPalette::Base, base.darker(120)); warning->setPalette(pal); }; calcPaletteFromStyle(NULL); warning->setBackgroundRole(QPalette::Window); warning->setForegroundRole(QPalette::Foreground); QObject::connect(warning, &RDLabel::mouseMoved, [warning](QMouseEvent *) { warning->setBackgroundRole(QPalette::Base); }); QObject::connect(warning, &RDLabel::leave, [warning]() { warning->setBackgroundRole(QPalette::Window); }); QObject::connect(warning, &RDLabel::styleChanged, calcPaletteFromStyle); warning->setAutoFillBackground(true); warning->setMouseTracking(true); warning->setVisible(false); }
void PythonContext::setPyGlobal(const char *varName, PyObject *obj) { if(!initialised()) { emit exception( lit("SystemError"), tr("Python integration failed to initialise, see diagnostic log for more information."), -1, {}); return; } int ret = -1; PyGILState_STATE gil = PyGILState_Ensure(); if(obj) ret = PyDict_SetItemString(context_namespace, varName, obj); PyGILState_Release(gil); if(ret == 0) return; emit exception(lit("RuntimeError"), tr("Failed to set variable '%1'").arg(QString::fromUtf8(varName)), -1, {}); }
void PythonContext::setGlobal(const char *varName, const char *typeName, void *object) { if(!initialised()) { emit exception( lit("SystemError"), tr("Python integration failed to initialise, see diagnostic log for more information."), -1, {}); return; } PyGILState_STATE gil = PyGILState_Ensure(); // we don't need separate functions for each module, as they share type info PyObject *obj = PassObjectToPython(typeName, object); int ret = -1; if(obj) ret = PyDict_SetItemString(context_namespace, varName, obj); PyGILState_Release(gil); if(ret != 0) { emit exception(lit("RuntimeError"), tr("Failed to set variable '%1' of type '%2'") .arg(QString::fromUtf8(varName)) .arg(QString::fromUtf8(typeName)), -1, {}); return; } setPyGlobal(varName, obj); }
void generate_path(PathType const& path, path_output_attributes const& path_attributes) { util::svg_generator<OutputIterator,PathType> svg_path_grammer; karma::generate(output_iterator_, lit("<path ") << svg_path_grammer, path); path_attributes_grammar attributes_grammar; path_dash_array_grammar dash_array_grammar; karma::generate(output_iterator_, lit(" ") << dash_array_grammar, path_attributes.stroke_dasharray()); karma::generate(output_iterator_, lit(" ") << attributes_grammar << lit("/>\n"), path_attributes); }
BugReport::operator QVariant() const { QVariantMap map; map[lit("reportId")] = reportId; map[lit("submitDate")] = submitDate; map[lit("checkDate")] = checkDate; map[lit("unreadUpdates")] = unreadUpdates; return map; }
SPIRVDisassembler::operator QVariant() const { QVariantMap map; map[lit("tool")] = (uint32_t)tool; map[lit("name")] = name; map[lit("executable")] = executable; map[lit("args")] = args; return map; }
void generate_path(OutputIterator & output_iterator, PathType const& path, svg::path_output_attributes const& path_attributes) { using path_dash_array_grammar = svg::svg_path_dash_array_grammar<OutputIterator>; using path_attributes_grammar = svg::svg_path_attributes_grammar<OutputIterator>; static const path_attributes_grammar attributes_grammar; static const path_dash_array_grammar dash_array_grammar; static const svg::svg_path_generator<OutputIterator,PathType> svg_path_grammer; boost::spirit::karma::lit_type lit; boost::spirit::karma::generate(output_iterator, lit("<path ") << svg_path_grammer, path); boost::spirit::karma::generate(output_iterator, lit(" ") << dash_array_grammar, path_attributes.stroke_dasharray()); boost::spirit::karma::generate(output_iterator, lit(" ") << attributes_grammar << lit("/>\n"), path_attributes); }
void TipsDialog::showTip(int i) { if(i >= m_tips.size() || i < 0) return; Tip &tip = m_tips[i]; ++i; ui->tipTextLabel->setText(tip.tip); QString url = lit("https://renderdoc.org/tips/%1").arg(i); ui->tipUrlLabel->setText(lit("<a href='%1'>%1</a>").arg(url)); ui->tipsGroupBox->setTitle(tr("Tip #%1").arg(i)); ui->titleLabel->setText(tr("Tip #%1: %2").arg(i).arg(tip.title)); }
feature_generator_grammar<OutputIterator, FeatureType>::feature_generator_grammar() : feature_generator_grammar::base_type(feature) { boost::spirit::karma::lit_type lit; boost::spirit::karma::uint_type uint_; boost::spirit::karma::_val_type _val; boost::spirit::karma::_1_type _1; feature = lit("{\"type\":\"Feature\",\"id\":") << uint_[_1 = id_(_val)] << lit(",\"geometry\":") << geometry[_1 = geom_(_val)] << lit(",\"properties\":") << properties << lit('}') ; }
void CustomTemplates::save() { if ( mCurrentItem ) { CustomTemplateItem *vitem = mItemList[ mCurrentItem->text( 1 ) ]; if ( vitem ) { vitem->mContent = mEdit->text(); vitem->mShortcut = mKeyButton->shortcut(); } } QStringList list; QListViewItemIterator lit( mList ); while ( lit.current() ) { list.append( (*lit)->text( 1 ) ); ++lit; } QDictIterator<CustomTemplateItem> it( mItemList ); for ( ; it.current() ; ++it ) { // list.append( (*it)->mName ); CTemplates t( (*it)->mName ); QString &content = (*it)->mContent; if ( content.stripWhiteSpace().isEmpty() ) { content = "%BLANK"; } t.setContent( content ); t.setShortcut( (*it)->mShortcut.toString() ); t.setType( (*it)->mType ); t.writeConfig(); } GlobalSettings::self()->setCustomTemplates( list ); GlobalSettings::self()->writeConfig(); // update kmail menus related to custom templates if ( kmkernel->getKMMainWidget() ) kmkernel->getKMMainWidget()->updateCustomTemplateMenus(); }
void NifCheckBoxList::parseText( const QString& text ) { // set flag to accept next editTextChanged request // normally this gets called by setCurrentIndex which is undesirable. if (!text.isEmpty()) { // Build RegEx for efficient search. Then set model to match QString str; QStringList list = text.split(QRegExp("\\s*\\|\\s*"), QString::SkipEmptyParts); QStringListIterator lit(list); while ( lit.hasNext() ) { if (!str.isEmpty()) str += "|"; str += QRegExp::escape(lit.next()); } str.insert(0, '('); str.append(')'); QRegExp re(str); for (int i=0; i < count(); ++i) { QString txt = this->itemData(i, Qt::DisplayRole).toString(); this->setItemData(i, re.exactMatch(txt), Qt::UserRole); } this->setEditText( text ); } }
std::pair<unit_map::unit_iterator, bool> unit_map::move(const map_location &src, const map_location &dst) { self_check(); DBG_NG << "Unit map: Moving unit from " << src << " to " << dst << "\n"; //Find the unit at the src location t_lmap::iterator i = lmap_.find(src); if(i == lmap_.end()) { return std::make_pair(make_unit_iterator(the_end_), false);} t_ilist::iterator lit(i->second); if(src == dst){ return std::make_pair(make_unit_iterator(lit),true);} //Fail if there is no unit to move unit *p = lit->unit; if(p == NULL){ return std::make_pair(make_unit_iterator(lit), false);} p->set_location(dst); ///@todo upgrade to quick_erase when boost 1.42 supported by wesnoth lmap_.erase(i); std::pair<t_lmap::iterator,bool> res = lmap_.insert(std::make_pair(dst, lit)); //Fail and don't move if the destination is already occupied if(res.second == false) { p->set_location(src); lmap_.insert(std::make_pair(src, lit)); return std::make_pair(make_unit_iterator(lit), false); } self_check(); return std::make_pair(make_unit_iterator(lit), true); }
void TR_LocalLiveRangeReduction::printRefInfo(TR_TreeRefInfo *treeRefInfo) { if (trace()) { TR::Node *n; ListIterator<TR::Node> lit(treeRefInfo->getFirstRefNodesList()); traceMsg(comp(),"[%p]:F={",treeRefInfo->getTreeTop()->getNode()); for (n = lit.getFirst(); n != NULL; n = lit.getNext()) traceMsg(comp(),"%p ",n); traceMsg(comp(),"},M={"); lit.set(treeRefInfo->getMidRefNodesList()); for (n = lit.getFirst(); n != NULL; n = lit.getNext()) traceMsg(comp(),"%p ",n); traceMsg(comp(),"},L={"); lit.set(treeRefInfo->getLastRefNodesList()); for (n = lit.getFirst(); n != NULL; n = lit.getNext()) traceMsg(comp(),"%p ",n); traceMsg(comp(),"}\n"); if (treeRefInfo->getUseSym() && treeRefInfo->getDefSym()) { traceMsg(comp(),"[%p]:use = ",treeRefInfo->getTreeTop()->getNode()); treeRefInfo->getUseSym()->print(comp()); traceMsg(comp()," def = "); treeRefInfo->getDefSym()->print(comp()); traceMsg(comp(),"\n"); } } }
unit *unit_map::extract(const map_location &loc) { self_check(); t_lmap::iterator i = lmap_.find(loc); if (i == lmap_.end()) { return NULL; } t_ilist::iterator lit(i->second); unit *u = lit->unit; size_t uid( u->underlying_id() ); DBG_NG << "Extract unit " << uid << " - " << u->id() << " from location: (" << loc << ")\n"; if(lit->ref_count == 0){ assert(lit != the_end_); if(umap_.erase(uid) != 1){ error_recovery_externally_changed_uid(lit); } ilist_.erase( lit ); } else { //Soft extraction keeps the old lit item if any iterators reference it lit->unit = NULL; lit->deleted_uid = uid; assert( uid != 0); } lmap_.erase(i); self_check(); return u; }
static bool number(struct scanner *s, int64_t *out, int *out_tok) { bool is_float = false, is_hex = false; const char *start = s->s + s->pos; char *end; if (lit(s, "0x")) { while (is_xdigit(peek(s))) next(s); is_hex = true; } else { while (is_digit(peek(s))) next(s); is_float = chr(s, '.'); while (is_digit(peek(s))) next(s); } if (s->s + s->pos == start) return false; errno = 0; if (is_hex) *out = strtoul(start, &end, 16); else if (is_float) *out = strtod(start, &end); else *out = strtoul(start, &end, 10); if (errno != 0 || s->s + s->pos != end) *out_tok = ERROR_TOK; else *out_tok = (is_float ? FLOAT : INTEGER); return true; }
void ControllerAxisEventThrower::publish(ControllerAxisEventThrower *src, ControllerAxisEventArgs *args) { std::list<ControllerAxisEventListener*>::iterator lit(axisListeners.begin()), lend(axisListeners.end()); for(;lit!=lend;++lit) { (*lit)->handleEvent(src, args); } }
SpriteFile::~SpriteFile() { std::vector<SDL_Surface*>::iterator lit(surfaces.begin()), lend(surfaces.end()); for(;lit!=lend;++lit) { SDL_FreeSurface((*lit)); } }
csv_line_grammar<Iterator, Skipper>::csv_line_grammar() : csv_line_grammar::base_type(line) { qi::_r1_type _r1; qi::_r2_type _r2; qi::lit_type lit; qi::char_type char_; unesc_char.add ("\\a", '\a') ("\\b", '\b') ("\\f", '\f') ("\\n", '\n') ("\\r", '\r') ("\\t", '\t') ("\\v", '\v') ("\\\\",'\\') ("\\\'", '\'') ("\\\"", '\"') ("\"\"", '\"') // double quote ; line = -lit("\r") > -lit("\n") > column(_r1, _r2) % lit(_r1) ; column = quoted(_r2) | *(char_ - lit(_r1)) ; quoted = lit(_r1) > text(_r1) > lit(_r1) // support unmatched quotes or not (??) ; text = *(unesc_char | (char_ - lit(_r1))) ; BOOST_SPIRIT_DEBUG_NODES((line)(column)(quoted)); }
SynchronizerDirList::~SynchronizerDirList() { if (fileIterator) delete fileIterator; QHashIterator< QString, vfile *> lit(*this); while (lit.hasNext()) delete lit.next().value(); }
//zrusi vsechny svetla void CGEnMain::DeleteAllLights() { CPLightListIter lit(lights); while(!lit.End()){ lightcache->DeleteLight(lit); lit++; } DeleteListElems(lights); }
wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single) : wkt_generator::base_type(wkt) { boost::spirit::karma::uint_type uint_; boost::spirit::karma::_val_type _val; boost::spirit::karma::_1_type _1; boost::spirit::karma::lit_type lit; boost::spirit::karma::_a_type _a; boost::spirit::karma::_b_type _b; boost::spirit::karma::_c_type _c; boost::spirit::karma::_r1_type _r1; boost::spirit::karma::eps_type eps; boost::spirit::karma::string_type kstring; wkt = point | linestring | polygon ; point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)] << kstring[ phoenix::if_ (single) [_1 = "Point("] .else_[_1 = "("]] << point_coord [_1 = _first(_val)] << lit(')') ; linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)] << kstring[ phoenix::if_ (single) [_1 = "LineString("] .else_[_1 = "("]] << coords << lit(')') ; polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)] << kstring[ phoenix::if_ (single) [_1 = "Polygon("] .else_[_1 = "("]] << coords2 << lit("))") ; point_coord = &uint_ << coordinate << lit(' ') << coordinate ; polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1][_a = _x(_val)][ _b = _y(_val)] << kstring[ if_ (_r1 > 1) [_1 = "),("] .else_[_1 = "("]] | &uint_(mapnik::SEG_LINETO) << lit(',') << eps[_a = _x(_val)][_b = _y(_val)] ) << coordinate[_1 = _a] << lit(' ') << coordinate[_1 = _b] ; coords2 %= *polygon_coord(_a,_b,_c) ; coords = point_coord % lit(',') ; }
int SlaterDetBuilder::putDeterminant(xmlNodePtr cur, int firstIndex) { string basisName("invalid"); string detname("NONE"), refname("NONE"); OhmmsAttributeSet aAttrib; aAttrib.add(basisName,basisset_tag); aAttrib.add(detname,"id"); aAttrib.add(refname,"ref"); aAttrib.put(cur); xmlNodePtr c_ptr = NULL, o_ptr=NULL; Det_t* adet=0; //index of the last SlaterDeterminant int dIndex=DetSet.size(); if(refname == "NONE") { //create one and use detname if(detname =="NONE") { //no id is given, assign one char newname[8]; sprintf(newname,"det%d",dIndex); detname=newname; } } map<string,SPOSetBasePtr>::iterator lit(SPOSet.find(detname)); SPOSetBasePtr psi; if(lit == SPOSet.end()) { #if defined(ENABLE_SMARTPOINTER) psi.reset(myBasisSetFactory->createSPOSet(cur)); #else psi = myBasisSetFactory->createSPOSet(cur); #endif psi->put(cur); psi->checkObject(); SPOSet[detname]=psi; } else { psi = (*lit).second; } if(psi->getOrbitalSetSize()) { map<string,Det_t*>::iterator dit(DetSet.find(detname)); if(dit == DetSet.end()) { adet = new Det_t(psi,firstIndex); adet->set(firstIndex,psi->getOrbitalSetSize()); DetSet[detname]=adet; } else { adet = (*dit).second; } firstIndex += psi->getOrbitalSetSize(); } //only if a determinant is not 0 if(adet) SlaterDetSet.back()->add(adet); return firstIndex; }
void Buffer::clear(void) { std::list<Chunk*>::iterator lit(chunks.begin()), lend(chunks.end()); for(;lit!=lend;++lit) { delete (*lit); } chunks.clear(); }
void DrGroup::getOptions(QMap< QString, QString > &opts, bool incldef) { QDictIterator< DrBase > dit(m_options); for(; dit.current(); ++dit) dit.current()->getOptions(opts, incldef); QPtrListIterator< DrGroup > lit(m_subgroups); for(; lit.current(); ++lit) lit.current()->getOptions(opts, incldef); }
void DrGroup::setOptions(const QMap< QString, QString > &opts) { QDictIterator< DrBase > dit(m_options); for(; dit.current(); ++dit) dit.current()->setOptions(opts); QPtrListIterator< DrGroup > lit(m_subgroups); for(; lit.current(); ++lit) lit.current()->setOptions(opts); }
void DrGroup::clearConflict() { QDictIterator< DrBase > dit(m_options); for(; dit.current(); ++dit) dit.current()->setConflict(false); QPtrListIterator< DrGroup > lit(m_subgroups); for(; lit.current(); ++lit) lit.current()->clearConflict(); }