void HTMLPropertiesCollection::EnsureFresh() { if (mDoc && !mIsDirty) { return; } mIsDirty = false; mProperties.Clear(); mNames->Clear(); // We don't clear NamedItemEntries because the PropertyNodeLists must be live. mNamedItemEntries.EnumerateRead(MarkDirty, NULL); if (!mRoot->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) { return; } CrawlProperties(); TreeOrderComparator comparator; mProperties.Sort(comparator); // Create the names DOMStringList uint32_t count = mProperties.Length(); for (uint32_t i = 0; i < count; ++i) { const nsAttrValue* attr = mProperties.ElementAt(i)->GetParsedAttr(nsGkAtoms::itemprop); for (uint32_t i = 0; i < attr->GetAtomCount(); i++) { nsDependentAtomString propName(attr->AtomAt(i)); // ContainsInternal must not call EnsureFresh bool contains = mNames->ContainsInternal(propName); if (!contains) { mNames->Add(propName); } } } }
bool INDI_D::updateSwitchGUI(ISwitchVectorProperty *svp) { INDI_P *guiProp = NULL; QString propName(svp->name); if (strcmp(svp->device, dv->getDeviceName())) return false; foreach(INDI_G *pg, groupsList) { if ( (guiProp = pg->getProperty(propName)) != NULL) break; } if (guiProp == NULL) return false; guiProp->updateStateLED(); if (guiProp->getGUIType() == PG_MENU) guiProp->updateMenuGUI(); else { foreach(INDI_E *lp, guiProp->getElements()) lp->syncSwitch(); } return true; }
bool INDI_D::updateLightGUI (ILightVectorProperty *lvp) { INDI_P *guiProp = NULL; QString propName(lvp->name); if (strcmp(lvp->device, dv->getDeviceName())) return false; foreach(INDI_G *pg, groupsList) { if ( (guiProp = pg->getProperty(propName)) != NULL) break; } if (guiProp == NULL) return false; guiProp->updateStateLED(); foreach(INDI_E *lp, guiProp->getElements()) lp->syncLight(); return true; }
JNIEXPORT void JNICALL Java_org_apache_subversion_javahl_SVNRepos_setRevProp (JNIEnv *env, jobject jthis, jobject jpath, jobject jrevision, jstring jpropName, jstring jpropValue, jboolean jusePreRevPropChangeHook, jboolean jusePostRevPropChangeHook) { JNIEntry(SVNRepos, setRevProp); SVNRepos *cl = SVNRepos::getCppObject(jthis); if (cl == NULL) { JNIUtil::throwError(_("bad C++ this")); return; } File path(jpath); if (JNIUtil::isExceptionThrown()) return; Revision revision(jrevision); if (JNIUtil::isExceptionThrown()) return; JNIStringHolder propName(jpropName); if (JNIUtil::isExceptionThrown()) return; JNIStringHolder propValue(jpropValue); if (JNIUtil::isExceptionThrown()) return; cl->setRevProp(path, revision, propName, propValue, jusePreRevPropChangeHook ? true : false, jusePostRevPropChangeHook ? true : false); }
void MainWindow::keyReleaseEvent(QKeyEvent* event) { if ( !event->isAutoRepeat() ) { QString key(kmap.map( event->key())); if ( !key.isEmpty() ) { QString propName( QString( PROP_APP_UI_KEY_MAPPING ).arg(key)); int action = ui->view->getOptions()->getIntDef(propName.toAscii().constData(), 0); if ( action != 0 && action < aList.size() ) { aList.at(action)->trigger(); } else switch ( event->key() ) { case Qt::Key_Menu: on_actionShowMenu_triggered(); break; case Qt::Key_PageUp: on_actionPreviousPage_triggered(); break; case Qt::Key_PageDown: on_actionNextPage_triggered(); break; default: break; } } } }
U_CFUNC void U_CALLCONV derivedPropsLineFn(void *context, char *fields[][2], int32_t /* fieldCount */, UErrorCode *pErrorCode) { UnicodeTest *me=(UnicodeTest *)context; uint32_t start, end; int32_t i; u_parseCodePointRange(fields[0][0], &start, &end, pErrorCode); if(U_FAILURE(*pErrorCode)) { me->errln("UnicodeTest: syntax error in DerivedCoreProperties.txt or DerivedNormalizationProps.txt field 0 at %s\n", fields[0][0]); return; } /* parse derived binary property name, ignore unknown names */ i=getTokenIndex(derivedPropsNames, LENGTHOF(derivedPropsNames), fields[1][0]); if(i<0) { UnicodeString propName(fields[1][0], (int32_t)(fields[1][1]-fields[1][0])); propName.trim(); if(me->unknownPropertyNames->find(propName)==NULL) { UErrorCode errorCode=U_ZERO_ERROR; me->unknownPropertyNames->puti(propName, 1, errorCode); me->errln("UnicodeTest warning: unknown property name '%s' in DerivedCoreProperties.txt or DerivedNormalizationProps.txt\n", fields[1][0]); } return; } me->derivedProps[i].add(start, end); }
void GroupRep::toOntologyRepItemList() { for (GroupRep::NumericGroupRep::const_iterator it = numericGroupRep_.begin(); it != numericGroupRep_.end(); ++it) { izenelib::util::UString propName(it->first, izenelib::util::UString::UTF_8); stringGroupRep_.push_back(faceted::OntologyRepItem(0, propName, 0, 0)); faceted::OntologyRepItem& topItem = stringGroupRep_.back(); unsigned int count = 0; izenelib::util::UString ustr; for (list<pair<double, unsigned int> >::const_iterator lit = it->second.begin(); lit != it->second.end(); ++lit) { formatNumericToUStr(lit->first, ustr); stringGroupRep_.push_back(faceted::OntologyRepItem(1, ustr, 0, lit->second)); count += lit->second; } topItem.doc_count = count; } numericGroupRep_.clear(); NumericRangeGroupCounter::toOntologyRepItemList(*this); numericRangeGroupRep_.clear(); }
void EquipmentButton::recChanged(QMetaProperty prop, QVariant val) { QString propName(prop.name()); if( propName == "equipment" ) setEquipment( qobject_cast<Equipment*>(BeerXMLElement::extractPtr(val)) ); }
static int getPluginWeight(const QString& pluginID, int majVersion) { QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) ); QString propName( pluginID + QString::number(majVersion) + QString::fromUtf8("_tab_weight") ); int curValue = settings.value( propName, QVariant(0) ).toInt(); return curValue; }
void NodeV3Loader::onHandlePropTypeByte(cocos2d::Node* node, cocos2d::Node* parent, const char* propertyName, unsigned char byte, cocosbuilder::CCBReader* reader) { std::string propName(propertyName); if (propName == property::opacity) { return node->setOpacity(byte); } Super::onHandlePropTypeByte(node, parent, propertyName, byte, reader); }
void NodeV3Loader::onHandlePropTypeColor3(cocos2d::Node* node, cocos2d::Node* parent, const char* propertyName, cocos2d::Color3B color3B, cocosbuilder::CCBReader* reader) { std::string propName(propertyName); if (propName == property::color) { return node->setColor(color3B); } Super::onHandlePropTypeColor3(node, parent, propertyName, color3B, reader); }
const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node, v8::HeapGraphEdge::Type type, const char* name) { for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { const v8::HeapGraphEdge* prop = node->GetChild(i); if (prop->GetType() == type) { v8::String::Utf8Value propName(prop->GetName()); if (!strcmp(name, *propName)) return prop->GetToNode(); } } return nullptr; }
static void incrementPluginWeight(const QString& pluginID, const QString& presetName, int majVersion) { QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) ); QString propName( pluginID + QString::number(majVersion) + presetName + QString::fromUtf8("_tab_weight") ); int curValue = settings.value( propName, QVariant(0) ).toInt(); ++curValue; settings.setValue( propName, QVariant(curValue) ); }
void ButtonLoader::onHandlePropTypeFloat(cocos2d::Node* node, cocos2d::Node* parent, const char* propertyName, float floatValue, cocosbuilder::CCBReader* reader) { auto button = dynamic_cast<Button*>(node); std::string propName(propertyName); if (propName == property::pressed_sprite_frame_brightness) { return button->pressedStateBrightness(floatValue); } Super::onHandlePropTypeFloat(node, parent, propertyName, floatValue, reader); }
void NodeV3Loader::onHandlePropTypeInteger(cocos2d::Node* node, cocos2d::Node* parent, const char* propertyName, int integer, cocosbuilder::CCBReader* reader) { std::string propName(propertyName); if (propName == property::local_z_order) { if (localZOrderOverridden_) { node->setLocalZOrder(integer); } return; } Super::onHandlePropTypeInteger(node, parent, propertyName, integer, reader); }
/* Call back for V8 named properties. This is the entry point for setting * properties from js. We handle the properties we know and let V8 handle * all other properties. */ Handle<Value> TiObject::_propSetter(Local<String> prop, Local<Value> value, const AccessorInfo& info) { HandleScope handleScope; Handle<Object> result; TiObject* obj = getTiObjectFromJsObject(info.Holder()); if (obj == NULL) { // We are not tracking this object so let V8 handle it. info.Holder()->ForceSet(prop, value); return value; } String::Utf8Value propName(prop); const char* propString = (const char*)(*propName); return obj->setPropHelper(propString, value, &TiObject::setValue); }
/* Call back for V8 named properties. This is the entry point for accessing * properties from js. We handle the properties we know and let V8 handle * all other properties. */ Handle<Value> TiObject::_propGetter(Local<String> prop, const AccessorInfo& info) { HandleScope handleScope; Handle<Object> result; TiObject* obj = getTiObjectFromJsObject(info.Holder()); if (obj == NULL) { // Returns "empty". This will cause V8 to go back to default lookup. return result; } Handle<ObjectTemplate> global = getObjectTemplateFromJsObject(info.Holder()); String::Utf8Value propName(prop); const char* propString = (const char*)(*propName); TiObject* propObject = obj->onLookupMember(propString); if (propObject == NULL) { // TODO: Fix the following block of commented out code. Currently it breaks // Titanium runtime. /* if(obj->canAddMembers()) { // If we're allowed to add members, return an "empty" result // so V8 will handle it. V8 will set the value internally so // we can ignore non-Titanium objects. return result; } */ return Handle<Value>(); } Handle<Value> ret = propObject->getValue(); if (!ret.IsEmpty()) { return handleScope.Close(ret); } if ((propObject->hasMembers()) || (propObject->isFunction())) { result = global->NewInstance(); propObject->setValue(result); setTiObjectToJsObject(result, propObject); } else { propObject->release(); return handleScope.Close(propObject->getValue()); } propObject->release(); return handleScope.Close(result); }
// プロパティの設定 Handle<Value> TJSObject::setter(Local<String> property, Local<Value> value, const AccessorInfo& info) { tTJSVariant self; if (getVariant(self, info.This())) { String::Value propName(property); tTJSVariant param = toVariant(value); tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().PropSet(TJS_MEMBERENSURE, *propName, NULL, ¶m, NULL))) { return Undefined(); } else { return ERROR_KRKR(error); } } return ERROR_BADINSTANCE(); }
void MashListModel::mashChanged(QMetaProperty prop, QVariant val) { Mash* mSend = qobject_cast<Mash*>(sender()); // NOTE: how to get around the issue that the sender might live in // a different thread and therefore always cause sSend == 0? if( mSend == 0 ) return; QString propName(prop.name()); if( propName == "name" ) { int ndx = mashes.indexOf(mSend); if( ndx >= 0 ) emit dataChanged( createIndex(ndx,0), createIndex(ndx,0) ); } }
void NodeV3Loader::onHandlePropTypeCheck(cocos2d::Node* node, cocos2d::Node* parent, const char* propertyName, bool check, cocosbuilder::CCBReader* reader) { std::string propName(propertyName); if (propName == property::local_z_order_overridden) { localZOrderOverridden_ = check; return; } if (propName == property::cascade_color_enabled) { return node->setCascadeColorEnabled(check); } if (propName == property::cascade_opacity_enabled) { return node->setCascadeOpacityEnabled(check); } Super::onHandlePropTypeCheck(node, parent, propertyName, check, reader); }
// プロパティの設定 void TJSObject::setter(Local<String> property, Local<Value> value, const PropertyCallbackInfo<Value>& info) { Isolate *isolate = info.GetIsolate(); HandleScope handle_scope(isolate); tTJSVariant self; if (getVariant(isolate, self, info.This())) { String::Value propName(property); tTJSVariant param = toVariant(isolate, value); tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().PropSet(TJS_MEMBERENSURE, *propName, NULL, ¶m, NULL))) { } else { info.GetReturnValue().Set(ERROR_KRKR(isolate, error)); } return; } info.GetReturnValue().Set(ERROR_BADINSTANCE(isolate)); }
// プロパティの取得 Handle<Value> TJSObject::getter(Local<String> property, const AccessorInfo& info) { String::Value propName(property); if (wcscmp(*propName, TJSINSTANCENAME) == 0) { return Handle<Value>(); } tTJSVariant self; if (getVariant(self, info.This())) { tjs_error error; tTJSVariant result; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().PropGet(0, *propName, NULL, &result, NULL))) { return toJSValue(result); } else { return ERROR_KRKR(error); } } return ERROR_BADINSTANCE(); }
nsresult sbWatchFolderService::EnumerateItemsByPaths(sbStringSet & aPathSet) { nsresult rv; nsCOMPtr<sbIMutablePropertyArray> properties = do_CreateInstance(SB_MUTABLEPROPERTYARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsString propName(NS_LITERAL_STRING(SB_PROPERTY_CONTENTURL)); sbStringSetIter begin = aPathSet.begin(); sbStringSetIter end = aPathSet.end(); sbStringSetIter next; for (next = begin; next != end; ++next) { // Convert the current path to a URI, then get the spec. nsCOMPtr<nsIURI> fileURI; rv = GetFilePathURI(*next, getter_AddRefs(fileURI)); if (NS_FAILED(rv)) { NS_WARNING("Could not get the file path URI!"); continue; } nsCString pathSpec; rv = fileURI->GetSpec(pathSpec); if (NS_FAILED(rv)) { NS_WARNING("Could not get the URI spec!"); continue; } rv = properties->AppendProperty(propName, NS_ConvertUTF8toUTF16(pathSpec)); if (NS_FAILED(rv)) { NS_WARNING("Could not append a property!"); } } PRUint16 enumType = sbIMediaList::ENUMERATIONTYPE_SNAPSHOT; rv = mMainLibrary->EnumerateItemsByProperties(properties, this, enumType); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; }
bool AgentInitializer::parsePropertySpec( TiXmlElement * node ) { if ( node->ValueStr() == "Property" ) { const char * cName = node->Attribute( "name" ); if ( cName == 0x0 ) { logger << Logger::ERR_MSG << "AgentSet Property tag specified on line " << node->Row() << " without a \"name\" attribute."; return false; } ::std::string propName( cName ); return processProperty( propName, node ) != FAILURE; } else if ( VERBOSE ) { logger << Logger::WARN_MSG << "Unexpected tag when looking for a property of an AgentSet parameter set: " << node->ValueStr() << "\n"; TiXmlAttribute * attr; for ( attr = node->FirstAttribute(); attr; attr = attr->Next() ) { if ( setFromXMLAttribute( attr->Name(), attr->ValueStr() ) == FAILURE ) { return false; } } } // Unexpected tags are ignored return true; }
bool INDI_D::updateBLOBGUI (IBLOB *bp) { INDI_P *guiProp = NULL; QString propName(bp->bvp->name); if (strcmp(bp->bvp->device, dv->getDeviceName())) return false; foreach(INDI_G *pg, groupsList) { if ( (guiProp = pg->getProperty(propName)) != NULL) break; } if (guiProp == NULL) return false; guiProp->updateStateLED(); return true; }
// プロパティの取得 void TJSObject::getter(Local<String> property, const PropertyCallbackInfo<Value>& info) { Isolate *isolate = info.GetIsolate(); HandleScope handle_scope(isolate); String::Value propName(property); if (wcscmp(*propName, TJSINSTANCENAME) == 0) { return; } tTJSVariant self; if (getVariant(isolate, self, info.This())) { tjs_error error; tTJSVariant result; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().PropGet(0, *propName, NULL, &result, NULL))) { info.GetReturnValue().Set(toJSValue(isolate, result)); } else { info.GetReturnValue().Set(ERROR_KRKR(isolate, error)); } return; } info.GetReturnValue().Set(ERROR_BADINSTANCE(isolate)); }
bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize) { PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(kwds, &pos, &key, &value)) { if (!blackListSize || !std::binary_search(blackList, blackList + blackListSize, std::string(Shiboken::String::toCString(key)))) { QByteArray propName(Shiboken::String::toCString(key)); if (metaObj->indexOfProperty(propName) != -1) { propName[0] = std::toupper(propName[0]); propName.prepend("set"); Shiboken::AutoDecRef propSetter(PyObject_GetAttrString(qObj, propName.constData())); if (!propSetter.isNull()) { Shiboken::AutoDecRef args(PyTuple_Pack(1, value)); Shiboken::AutoDecRef retval(PyObject_CallObject(propSetter, args)); } else { PyObject* attr = PyObject_GenericGetAttr(qObj, key); if (PySide::Property::checkType(attr)) PySide::Property::setValue(reinterpret_cast<PySideProperty*>(attr), qObj, value); } } else { propName.append("()"); if (metaObj->indexOfSignal(propName) != -1) { propName.prepend('2'); PySide::Signal::connect(qObj, propName, value); } else { PyErr_Format(PyExc_AttributeError, "'%s' is not a Qt property or a signal", propName.constData()); return false; }; } } } return true; }
/** * Builds a list of commands for the right click on Editor Chunk Item operation. * * @return Returns the list of commands. */ std::vector<std::string> PropertiesHelper::command() { propMap_.clear(); std::vector<std::string> links; int index = 0; for (int i=0; i < propCount(); i++) { DataDescription* pDD = pType()->property( i ); if (!pDD->editable()) continue; if ( isUserDataObjectLink(i) ) { PyObjectPtr ob( propGetPy( i ), PyObjectPtr::STEAL_REFERENCE ); std::string uniqueId = PyString_AsString( PyTuple_GetItem( ob.getObject(), 0 ) ); if ( !uniqueId.empty() ) { links.push_back( "#"+propName(i) ); links.push_back( "#"+uniqueId ); links.push_back( "Delete Link" ); propMap_[index++] = PropertyIndex( i ); links.push_back( "##" ); links.push_back( "##" ); } } else if ( isUserDataObjectLinkArray(i) ) { PyObjectPtr ob( propGetPy( i ), PyObjectPtr::STEAL_REFERENCE ); SequenceDataType* dataType = static_cast<SequenceDataType*>( pDD->dataType() ); ArrayPropertiesHelper propArray; propArray.init( pItem(), &(dataType->getElemType()), ob.getObject()); int numProps = propArray.propCount(); if ( numProps > 0 ) { links.push_back( "#"+propName(i) ); links.push_back( "Delete All" ); propMap_[index++] = PropertyIndex( i ); links.push_back( "" ); // Iterate through the array of links for(int j = 0; j < numProps; j++) { PyObjectPtr link( propArray.propGetPy( j ), PyObjectPtr::STEAL_REFERENCE ); std::string uniqueId = PyString_AsString( PyTuple_GetItem( link.getObject(), 0 ) ); if ( !uniqueId.empty() ) { links.push_back( "#"+uniqueId ); links.push_back( "Delete Link" ); PropertyIndex pi( i ); pi.append( j ); propMap_[index++] = pi; links.push_back( "##" ); } } links.push_back( "##" ); } } } return links; }
void EquipmentButton::equipChanged(QMetaProperty prop, QVariant val) { QString propName(prop.name()); if( propName == "name" ) setText( val.toString() ); }
void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject, int revision, Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags) { Q_UNUSED(revision); qPersistentDispose(constructor); // Now invalid bool dynamicMetaObject = isDynamicMetaObject(metaObject); allowedRevisionCache.append(0); int methodCount = metaObject->methodCount(); // 3 to block the destroyed signal and the deleteLater() slot int methodOffset = qMax(3, metaObject->methodOffset()); methodIndexCache.resize(methodCount - methodIndexCacheStart); for (int ii = methodOffset; ii < methodCount; ++ii) { QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; // Extract method name const char *signature = m.signature(); const char *cptr = signature; while (*cptr != '(') { Q_ASSERT(*cptr != 0); ++cptr; } QString str = dynamicMetaObject?QString::fromUtf8(signature, cptr - signature): QString::fromLatin1(signature, cptr - signature); QHashedString methodName(str); Data *data = &methodIndexCache[ii - methodIndexCacheStart]; data->lazyLoad(m); if (data->isSignal()) data->flags |= signalFlags; else data->flags |= methodFlags; if (!dynamicMetaObject) data->flags |= Data::IsDirect; data->metaObjectOffset = allowedRevisionCache.count() - 1; if (Data **old = stringCache.value(methodName)) { // We only overload methods in the same class, exactly like C++ if ((*old)->flags & Data::IsFunction && (*old)->coreIndex >= methodOffset) data->relatedIndex = (*old)->coreIndex; data->overrideIndexIsProperty = !bool((*old)->flags & Data::IsFunction); data->overrideIndex = (*old)->coreIndex; } stringCache.insert(methodName, data); } int propCount = metaObject->propertyCount(); int propOffset = metaObject->propertyOffset(); propertyIndexCache.resize(propCount - propertyIndexCacheStart); for (int ii = propOffset; ii < propCount; ++ii) { QMetaProperty p = metaObject->property(ii); if (!p.isScriptable()) continue; QString str = dynamicMetaObject?QString::fromUtf8(p.name()): QString::fromLatin1(p.name()); QHashedString propName(str); Data *data = &propertyIndexCache[ii - propertyIndexCacheStart]; data->lazyLoad(p, engine); data->flags |= propertyFlags; if (!dynamicMetaObject) data->flags |= Data::IsDirect; data->metaObjectOffset = allowedRevisionCache.count() - 1; if (Data **old = stringCache.value(propName)) { data->overrideIndexIsProperty = !bool((*old)->flags & Data::IsFunction); data->overrideIndex = (*old)->coreIndex; } stringCache.insert(propName, data); } }