本文整理汇总了C++中PropertyList类的典型用法代码示例。如果您正苦于以下问题:C++ PropertyList类的具体用法?C++ PropertyList怎么用?C++ PropertyList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParentSheet
//////////////////////////////////////////////////////////////////////////
// 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;
}
示例2: HeterogeneousMedium
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
}
示例3: loadProperties
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);
}
示例4: populateList
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);
}
}
}
示例5: DeleteAllPropertiesFor
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;
}
示例6: WavefrontOBJ
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") {
示例7: TEST
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());
}
示例8: DeleteAllPropertiesFor
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;
}
示例9: Q_ASSERT
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);
}
}
}
}
示例10: Dielectric
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);
}
示例11: EnvMap
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;
}
}
示例12: GetPropertyList
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;
}
示例13: xmlFromWidgetBox
// 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;
}
示例14: supported
PropertyList OpenCvLuxPlugin::supported()
{
PropertyList props;
props.push_back(VehicleProperty::ExteriorBrightness);
return props;
}
示例15: if
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;
}