////////////////////////////////////////////////////////////////////////// // Page 2 ////////////////////////////////////////////////////////////////////////// LRESULT CDiskPropertyPage2::OnInitDialog(HWND /*hWndFocus*/, LPARAM /*lParam*/) { WTL::CString strCaption; strCaption.LoadString(IDS_DISKPROPERTYPAGE_CAPTION); GetParentSheet()->SetWindowText(strCaption); CDiskObjectPtr disk = GetParentSheet()->GetDiskObject(); m_listProperty.SubclassWindow( GetDlgItem(IDC_LIST_PROPERTY) ); DWORD dwStyle = LVS_EX_FULLROWSELECT; //| LVS_EX_GRIDLINES //| LVS_EX_INFOTIP m_listProperty.SetExtendedListViewStyle( dwStyle, dwStyle ); WTL::CString strCol[2]; strCol[0].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_NAME ); strCol[1].LoadString( IDS_DISKPROPERTYPAGE_LIST_COL_VALUE ); m_listProperty.InsertColumn( 0, strCol[0], LVCFMT_LEFT, 130, -1 ); m_listProperty.InsertColumn( 1, strCol[1], LVCFMT_LEFT, 200, -1 ); const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( disk ); PropertyList propList = phandler->GetPropertyList( disk ); PropertyList::iterator itr; for ( itr = propList.begin(); itr != propList.end(); ++itr ) { m_listProperty.InsertItem( itr->strName, itr->strValue, itr->strToolTip ); } return 0; }
HeterogeneousMedium(const PropertyList &propList) { // Denotes the scattering albedo m_albedo = propList.getColor("albedo"); // An (optional) transformation that converts between medium and world coordinates m_worldToMedium = propList.getTransform("toWorld", Transform()).inverse(); // Optional multiplicative factor that will be applied to all density values in the file m_densityMultiplier = propList.getFloat("densityMultiplier", 1.0f); m_filename = propList.getString("filename"); QByteArray filename = m_filename.toLocal8Bit(); QFile file(m_filename); if (!file.exists()) throw NoriException(QString("The file \"%1\" does not exist!").arg(m_filename)); /* Parse the file header */ file.open(QIODevice::ReadOnly); QDataStream stream(&file); stream.setByteOrder(QDataStream::LittleEndian); qint8 header[3], version; qint32 type; stream >> header[0] >> header[1] >> header[2] >> version >> type; if (memcmp(header, "VOL", 3) != 0 || version != 3) throw NoriException("This is not a valid volume data file!"); stream >> m_resolution.x() >> m_resolution.y() >> m_resolution.z(); file.close(); cout << "Mapping \"" << filename.data() << "\" (" << m_resolution.x() << "x" << m_resolution.y() << "x" << m_resolution.z() << ") into memory .." << endl; m_fileSize = (size_t) file.size(); #if defined(PLATFORM_LINUX) || defined(PLATFORM_MACOS) int fd = open(filename.data(), O_RDONLY); if (fd == -1) throw NoriException(QString("Could not open \"%1\"!").arg(m_filename)); m_data = (float *) mmap(NULL, m_fileSize, PROT_READ, MAP_SHARED, fd, 0); if (m_data == NULL) throw NoriException("mmap(): failed."); if (close(fd) != 0) throw NoriException("close(): unable to close file descriptor!"); #elif defined(PLATFORM_WINDOWS) m_file = CreateFileA(filename.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (m_file == INVALID_HANDLE_VALUE) throw NoriException(QString("Could not open \"%1\"!").arg(m_filename)); m_fileMapping = CreateFileMapping(m_file, NULL, PAGE_READONLY, 0, 0, NULL); if (m_fileMapping == NULL) throw NoriException("CreateFileMapping(): failed."); m_data = (float *) MapViewOfFile(m_fileMapping, FILE_MAP_READ, 0, 0, 0); if (m_data == NULL) throw NoriException("MapViewOfFile(): failed."); #endif m_data += 12; // Shift past the header }
void WaitZarInstance::loadProperties() { //Add our properties to a proplist PropertyList proplist; proplist.push_back (_waitzar_encoding_prop); proplist.push_back (_waitzar_encoding_unicode_prop); proplist.push_back (_waitzar_encoding_zawgyi_prop); proplist.push_back (_waitzar_encoding_wininnwa_prop); //Now, register these properties register_properties(proplist); //Set tooltips _waitzar_encoding_prop.set_tip (_("The encoding of the text WaitZar outputs. Change this only if you know what you're doing.")); _waitzar_encoding_unicode_prop.set_tip (_("The encoding as defined in Unicode 5.1 and later. The default & recommended option.")); update_property (_waitzar_encoding_unicode_prop); _waitzar_encoding_zawgyi_prop.set_tip (_("The encoding used by the Zawgyi-One font, a popular font on the web which conflicts with Unicode.")); update_property (_waitzar_encoding_zawgyi_prop); _waitzar_encoding_wininnwa_prop.set_tip (_("The encoding used by the Win Innwa font family (inc. Win Kalaw), a popular legacy font which conflicts with ASCII.")); update_property (_waitzar_encoding_wininnwa_prop); //Finally, double-check the label... although this really shouldn't change. String newLbl = ""; int encoding = model->getOutputEncoding(); if (encoding == ENCODING_UNICODE) newLbl = "UNI"; else if (encoding == ENCODING_ZAWGYI) newLbl = "ZG"; else if (encoding == ENCODING_WININNWA) newLbl = "WI"; else newLbl = "??"; _waitzar_encoding_prop.set_label (newLbl); update_property (_waitzar_encoding_prop); }
void ModelerUserInterface::populateList(GroupProperty* group, Fl_Tree_Item* parent) { // Create a tree node for this group. Fl_Tree_Item* item; if (parent == NULL) { // HACK: We have to add and remove a fake list item so that the tree // control will create a root node to put it under. m_controlsTree->remove(m_controlsTree->add("You shouldn't see this.")); item = m_controlsTree->root(); item->label(group->getName()); } else { item = m_controlsTree->add(parent, group->getName()); } item->user_data(group); // Examine the group's property list for group properties. PropertyList* controls = group->getProperties(); for (PropertyList::iterator iter = controls->begin(); iter != controls->end(); iter++) { // See if it's a GroupProperty by attempting to cast it GroupProperty* childGroup = dynamic_cast<GroupProperty*>(*iter); // If it is, add it to the list. if (childGroup) { ModelerUserInterface::populateList(childGroup, item); } } }
nsresult nsPropertyTable::TransferOrDeleteAllPropertiesFor(nsPropertyOwner aObject, nsPropertyTable *aOtherTable) { nsresult rv = NS_OK; for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) { if (prop->mTransfer) { PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*> (PL_DHashTableOperate(&prop->mObjectValueMap, aObject, PL_DHASH_LOOKUP)); if (PL_DHASH_ENTRY_IS_BUSY(entry)) { rv = aOtherTable->SetProperty(aObject, prop->mName, entry->value, prop->mDtorFunc, prop->mDtorData, prop->mTransfer); if (NS_FAILED(rv)) { DeleteAllPropertiesFor(aObject); aOtherTable->DeleteAllPropertiesFor(aObject); break; } PL_DHashTableRawRemove(&prop->mObjectValueMap, entry); } } else { prop->DeletePropertyFor(aObject); } } return rv; }
WavefrontOBJ(const PropertyList &propList) { typedef boost::unordered_map<OBJVertex, uint32_t, OBJVertexHash> VertexMap; /* Process the OBJ-file line by line */ QString filename = propList.getString("filename"); QFile input(filename); if (!input.open(QIODevice::ReadOnly | QIODevice::Text)) throw NoriException(QString("Cannot open \"%1\"").arg(filename)); Transform trafo = propList.getTransform("toWorld", Transform()); cout << "Loading \"" << qPrintable(filename) << "\" .." << endl; m_name = filename; QTextStream stream(&input); QTextStream line; QString temp, prefix; std::vector<Point3f> positions; std::vector<Point2f> texcoords; std::vector<Normal3f> normals; std::vector<uint32_t> indices; std::vector<OBJVertex> vertices; VertexMap vertexMap; while (!(temp = stream.readLine()).isNull()) { line.setString(&temp); line >> prefix; if (prefix == "v") { Point3f p; line >> p.x() >> p.y() >> p.z(); p = trafo * p; positions.push_back(p); } else if (prefix == "vt") {
TEST(tabledesc, test) { TableDescBuilder tableBuilder; tableBuilder.setTableId(0x11); tableBuilder.setConfig(kFakeFlags); TableModPropertyEviction eviction; eviction.setFlags(0x31323334); TableModPropertyVacancy vacancy; vacancy.setVacancyDown(0x41); vacancy.setVacancyUp(0x51); vacancy.setVacancy(0x61); PropertyList properties; properties.add(eviction); properties.add(vacancy); tableBuilder.setProperties(properties); MemoryChannel channel{OFP_VERSION_5}; tableBuilder.write(&channel); channel.flush(); EXPECT_HEX("001811002122232400020008313233340003000841516100", channel.data(), channel.size()); }
nsresult nsPropertyTable::TransferOrDeleteAllPropertiesFor(nsPropertyOwner aObject, nsPropertyTable *aOtherTable) { nsresult rv = NS_OK; for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) { if (prop->mTransfer) { auto entry = static_cast<PropertyListMapEntry*> (prop->mObjectValueMap.Search(aObject)); if (entry) { rv = aOtherTable->SetProperty(aObject, prop->mName, entry->value, prop->mDtorFunc, prop->mDtorData, prop->mTransfer); if (NS_FAILED(rv)) { DeleteAllPropertiesFor(aObject); aOtherTable->DeleteAllPropertiesFor(aObject); break; } prop->mObjectValueMap.RemoveEntry(entry); } } else { prop->DeletePropertyFor(aObject); } } return rv; }
void KWidgetStreamer::propertyFromStream( QDataStream& stream, QObject* to ) { // Only handle widgets. Alternatives to widgets are layouts, validators, timers, etc. if ( ! to->inherits("QWidget") ) return; // Stream in all the children (if any) const QObjectList* children = to->children(); unsigned int count; stream >> count; if ( children ) { Q_ASSERT( count == children->count() ); for ( QObjectListIt it = QObjectListIt(*children); *it; ++it ) fromStream( stream, *it ); } else { Q_ASSERT( count == 0 ); } // Now stream in properties for ( PropertyMapIt mapIt = _map.begin(); mapIt != _map.end(); mapIt++ ) { QString tp = mapIt.key(); PropertyList list = mapIt.data(); if ( to->inherits( tp.latin1() ) ) { for ( PropertyListIt it = list.begin(); it != list.end(); ++it ) { QVariant value; stream >> value; to->setProperty((*it).latin1(), value); } } } }
Dielectric(const PropertyList &propList) { /* Interior IOR (default: BK7 borosilicate optical glass) */ m_intIOR = propList.getFloat("intIOR", 1.5046f); /* Exterior IOR (default: air) */ m_extIOR = propList.getFloat("extIOR", 1.000277f); }
EnvMap(const PropertyList &props) : Emitter(props.getTransform("toWorld", Transform())) { //set the arguments std::string filePath = props.getString("lightProbPath", ""); filesystem::path path = getFileResolver()->resolve(filePath); //try to set it try { if (path.extension() == "exr") { m_lightprobe = new Bitmap(path.str()); m_wrapper = new HSWrapper(*m_lightprobe); m_latlngMap = new LatLongMap(); m_BBox.min = Point2i(0, 0); m_BBox.max = Point2i(m_lightprobe->cols(), m_lightprobe->rows()); m_width = m_lightprobe->cols(); m_height = m_lightprobe->rows(); } else { cerr << "Fatal error: unknown file \"" << filePath << "\", expected an extension of type .exr" << endl; } } catch (const std::exception &e) { cerr << "Fatal error: " << e.what() << endl; } }
PropertyList CUnitDiskUIHandler::GetPropertyList(CDiskObjectPtr obj) const { PropertyList propList; PropertyListItem propItem; WTL::CString strBuffer; CUnitDiskObjectPtr unitDisk = boost::dynamic_pointer_cast<CUnitDiskObject>(obj); CUnitDiskInfoHandlerPtr handler = unitDisk->GetInfoHandler(); CHDDDiskInfoHandler *pHDDHandler = dynamic_cast<CHDDDiskInfoHandler*>(handler.get()); if ( pHDDHandler != NULL ) { // TODO : String resources propItem.strName.LoadString( IDS_UIHANDLER_PROPERTY_MODEL ); propItem.strValue = pHDDHandler->GetModelName(); propItem.strToolTip.LoadString( IDS_UIHANDLER_PROPERTY_MODEL_TOOLTIP ); propList.push_back( propItem ); propItem.strName.LoadString( IDS_UIHANDLER_PROPERTY_SERIALNO ); propItem.strValue = pHDDHandler->GetSerialNo(); propItem.strToolTip.LoadString( IDS_UIHANDLER_PROPERTY_SERIALNO_TOOLTIP ); propList.push_back( propItem ); } return propList; }
Layer::PropertyList TimeInstantLayer::getProperties() const { PropertyList list = SingleColourLayer::getProperties(); list.push_back("Plot Type"); return list; }
void Action::listProperties(PropertyList& list, bool self, bool child) { Bindable::listProperties(list); list.push_back("ActionName"); list.push_back("ParentActionSchemaName"); }
// Get XML for a new form from the widget box. Change objectName/geometry // properties to be suitable for new forms static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName) { typedef QList<DomProperty*> PropertyList; QDesignerWidgetBoxInterface::Widget widget; const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget); if (!found) return QString(); QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false)); if (domUI.isNull()) return QString(); domUI->setAttributeVersion(QLatin1String("4.0")); DomWidget *domWidget = domUI->elementWidget(); if (!domWidget) return QString(); // Properties: Remove the "objectName" property in favour of the name attribute and check geometry. domWidget->setAttributeName(objectName); const QString geometryProperty = QLatin1String("geometry"); const QString objectNameProperty = QLatin1String("objectName"); PropertyList properties = domWidget->elementProperty(); for (PropertyList::iterator it = properties.begin(); it != properties.end(); ) { DomProperty *property = *it; if (property->attributeName() == objectNameProperty) { // remove "objectName" it = properties.erase(it); delete property; } else { if (property->attributeName() == geometryProperty) { // Make sure form is at least 400, 300 if (DomRect *geom = property->elementRect()) { if (geom->elementWidth() < NewFormWidth) geom->setElementWidth(NewFormWidth); if (geom->elementHeight() < NewFormHeight) geom->setElementHeight(NewFormHeight); } } ++it; } } // Add a window title property DomString *windowTitleString = new DomString; windowTitleString->setText(objectName); DomProperty *windowTitleProperty = new DomProperty; windowTitleProperty->setAttributeName(QLatin1String("windowTitle")); windowTitleProperty->setElementString(windowTitleString); properties.push_back(windowTitleProperty); // ------ domWidget->setElementProperty(properties); // Embed in in DomUI and get string. Omit the version number. domUI->setElementClass(objectName); QString rc; { // Serialize domUI QXmlStreamWriter writer(&rc); writer.setAutoFormatting(true); writer.setAutoFormattingIndent(1); writer.writeStartDocument(); domUI->write(writer); writer.writeEndDocument(); } return rc; }
PropertyList OpenCvLuxPlugin::supported() { PropertyList props; props.push_back(VehicleProperty::ExteriorBrightness); return props; }
PyObject * PyIMEngine::py_register_properties (PyIMEngineObject *self, PyObject *args) { PyObject *props = NULL; PropertyList proplist; int i; if (!PyArg_ParseTuple (args, "O:register_properties", &props)) return NULL; if (PyList_Check (props)) { for (i = 0; i < PyList_Size (props); i++) { PyObject *prop = PyList_GetItem (props, i); proplist.push_back (PyProperty_AsProperty (prop)); } } else if (PyTuple_Check (props)) { for (i = 0; i < PyTuple_Size (props); i++) { PyObject *prop = PyTuple_GetItem (props, i); proplist.push_back (PyProperty_AsProperty (prop)); } } else { PyErr_SetString (PyExc_TypeError, "the argument must be a list or a tuple that contains propertys"); return NULL; } self->engine.register_properties (proplist); Py_INCREF (Py_None); return Py_None; }
void KWidgetStreamer::propertyToStream( const QObject* from, QDataStream& stream ) { // Only handle widgets. Alternatives to widgets are layouts, validators, timers, etc. if ( ! from->inherits("QWidget") ) return; // Serializing all the children (if any). const QObjectList* children = from->children(); if ( children ) { stream << children->count(); for ( QObjectListIt it = QObjectListIt(*children); *it; ++it ) { toStream( *it, stream ); } } else { stream << (unsigned int) 0; } // Now stream out properties for ( PropertyMapIt mapIt = _map.begin(); mapIt != _map.end(); mapIt++ ) { QString tp = mapIt.key(); PropertyList list = mapIt.data(); if ( from->inherits( tp.latin1() ) ) { for ( PropertyListIt it = list.begin(); it != list.end(); ++it ) { QVariant prop = from->property( (*it).latin1() ); if ( ! prop.isValid() ) qWarning("Invalid property: %s:%s", tp.latin1(), (*it).latin1() ); stream << prop ; } } } }
void nsPropertyTable::DeleteAllPropertiesFor(nsPropertyOwner aObject) { for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) { prop->DeletePropertyFor(aObject); } }
nsresult nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject, nsIAtom *aPropertyName, void *aPropertyValue, NSPropertyDtorFunc aPropDtorFunc, void *aPropDtorData, bool aTransfer, void **aOldValue) { NS_PRECONDITION(aPropertyName && aObject, "unexpected null param"); PropertyList* propertyList = GetPropertyListFor(aPropertyName); if (propertyList) { // Make sure the dtor function and data and the transfer flag match if (aPropDtorFunc != propertyList->mDtorFunc || aPropDtorData != propertyList->mDtorData || aTransfer != propertyList->mTransfer) { NS_WARNING("Destructor/data mismatch while setting property"); return NS_ERROR_INVALID_ARG; } } else { propertyList = new PropertyList(aPropertyName, aPropDtorFunc, aPropDtorData, aTransfer); if (!propertyList || !propertyList->mObjectValueMap.ops) { delete propertyList; return NS_ERROR_OUT_OF_MEMORY; } propertyList->mNext = mPropertyList; mPropertyList = propertyList; } // The current property value (if there is one) is replaced and the current // value is destroyed nsresult result = NS_OK; PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*> (PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject, PL_DHASH_ADD)); if (!entry) return NS_ERROR_OUT_OF_MEMORY; // A nullptr entry->key is the sign that the entry has just been allocated // for us. If it's non-nullptr then we have an existing entry. if (entry->key) { if (aOldValue) *aOldValue = entry->value; else if (propertyList->mDtorFunc) propertyList->mDtorFunc(const_cast<void*>(entry->key), aPropertyName, entry->value, propertyList->mDtorData); result = NS_PROPTABLE_PROP_OVERWRITTEN; } else if (aOldValue) { *aOldValue = nullptr; } entry->key = aObject; entry->value = aPropertyValue; return result; }
Depth(const PropertyList &propList) { /* Depth near and far plane distance */ m_near = propList.getFloat("near", 1e-4); m_far = propList.getFloat("far", 1e2); /* Min intensity */ m_Ka = propList.getFloat("ambiant", 0.1); m_gamma = propList.getFloat("gamma", 5.0); }
void PointLight::GetPropertyList( PropertyList& o_properties ) const { Property* name = new Property( COMP_PROP_NAME, GetName() ); o_properties.AddProperty(name); Property* position = new Property( COMP_PROP_POSITION, m_transform.GetPosition() ); o_properties.AddProperty(position); }
QString Mapping::selectAllQuery() const { Q_CHECK_PTR(table()); PropertyList pl = properties(); QStringList cn; for (PropertyList::const_iterator it = pl.begin(); it != pl.end(); it++) { cn << (*it)->tableColumn()->name(); } return QString("SELECT %1 FROM %2").arg(cn.join(", ")).arg(table()->qualifiedName()); }
NORI_NAMESPACE_BEGIN areaLight::areaLight (const PropertyList &props) : Emitter() { //set the arguments m_radiance = props.getColor("radiance", Color3f(10.0f, 10.0f, 10.0f)); m_shootInNormalDirc = props.getBoolean("shootInNormal", false); }
void Entity::setProperties(const PropertyList& properties, bool replace) { if (replace) { m_propertyStore.clear(); setProperty(SpawnFlagsKey, "0"); } PropertyList::const_iterator it, end; for (it = properties.begin(), end = properties.end(); it != end; ++it) setProperty(it->key(), it->value()); }
Phong(const PropertyList &propList) { m_Kd = propList.getColor("kd", Color3f(0.5f)); m_Ks = propList.getColor("ks", Color3f(0.5f)); m_exp = propList.getFloat("n", 20.0f); // computation of the sampling weights float wd = m_Kd.getLuminance(); float ws = m_Ks.getLuminance(); m_specSamplingWeight = ws / (ws + wd); m_diffSamplingWeight = 1.0f - m_specSamplingWeight; }
RoughDielectric(const PropertyList &propList) { /* Interior IOR (default: BK7 borosilicate optical glass) */ m_intIOR = propList.getFloat("intIOR", 1.5046f); /* Exterior IOR (default: air) */ m_extIOR = propList.getFloat("extIOR", 1.000277f); /* RMS surface roughness */ m_alpha = propList.getFloat("alpha", 0.1f); }
PropertyFilter::PropertyFilter(const PropertyList& aPropertyTypes) : propertyCount(aPropertyTypes.size()), defMethod(StringMatch::PARTIAL), currentFilterProperty(aPropertyTypes.size()), inverse(false), usingTypedMethod(false), numComparisonMode(LAST), propertyTypes(aPropertyTypes), id(lastFilterToken++) { }
size_t nsPropertyTable::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; for (PropertyList *prop = mPropertyList; prop; prop = prop->mNext) { n += prop->SizeOfIncludingThis(aMallocSizeOf); } return n; }
void nsPropertyTable::DeleteAllProperties() { while (mPropertyList) { PropertyList* tmp = mPropertyList; mPropertyList = mPropertyList->mNext; tmp->Destroy(); delete tmp; } }