本文整理汇总了C++中Property::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Property::GetName方法的具体用法?C++ Property::GetName怎么用?C++ Property::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::GetName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadNode
//----------------------------------------------------------------
bool PropertyList::ReadNode(wxXmlNode* node)
/**
* \brief Read out a 'properties' xml element node or a 'property'
* xml element node where type attribute is 'properties'.
* See class description for structure of such an xml node.
* \param node The 'properties' xml element node or 'property' node
* with spezific a spezific type.
* \return True on success; false otherwise.
**/
{
// Fehler abfangen
if (unlikely(node == NULL)) {
wxLogError(_T("[penv::PropertyList::ReadNode] Properties node is NULL."));
return (false);
}
if (unlikely(node->GetType() != wxXML_ELEMENT_NODE)) {
wxLogError(_T("[penv::PropertyList::ReadNode] Given properties node '%s' is not an element."), node->GetName().c_str());
return (false);
}
if (node->GetName() != _T("properties") && (node->GetName() == _T("property") &&
node->GetPropVal(_T("type"), wxEmptyString) != _T("properties")))
{
wxLogError(_T("[penv::PropertyList::ReadNode] Node must have the name 'properties' or 'property' with type set to 'properties'."));
return (false);
}
// Alle Elemente in dem Node einlesen
wxXmlNode* child = node->GetChildren();
while (child != NULL)
{
// Nicht Element Knoten überspringen
if (child->GetType() != wxXML_ELEMENT_NODE || child->GetName() != _T("property")) {
child = child->GetNext();
continue;
}
// Property erstellen und auslesen
Property* prop = new Property();
if (unlikely(!prop->ReadNode(child))) {
// Wenn ein Fehler aufgetreten ist, dann eine Warning ausgeben
// und nicht hinzufügen
wxLogWarning(_T("[penv::PropertyList::ReadNode] Could not read property \"%s\"."), child->GetName().c_str());
} else {
// Überprüfen, ob das Property mit dem Namen schon in der
// Liste existiert
if (m_hashmap->find(prop->GetName()) != m_hashmap->end()) {
wxLogWarning(_T("[penv::PropertyList::ReadNode] Property with the name \"%s\" already exists."), prop->GetName().c_str());
} else {
(*m_hashmap)[prop->GetName()] = prop;
}
}
child = child->GetNext();
}
return (true);
}
示例2: SetProperty
//----------------------------------------------------------------
void PropertyList::SetProperty(const wxString& propname, const Property& prop)
/**
* \brief Sets the property with the given name. If the property does
* not exists the property will be created. If the property already exists
* the property will be overridden.
* \param propname The property name.
* \param prop The property.
**/
{
Property* setprop = GetProperty(propname, true);
if (setprop->GetType() != prop.GetType())
{
setprop->SetType(prop.GetType());
setprop->SetName(prop.GetName());
}
switch (setprop->GetType())
{
case penvPT_Boolean:
setprop->SetBoolean(prop.GetBoolean());
break;
case penvPT_Integer:
setprop->SetInteger(prop.GetInteger());
break;
case penvPT_Double:
setprop->SetDouble(prop.GetDouble());
break;
case penvPT_String:
setprop->SetString(prop.GetString());
break;
case penvPT_Properties:
setprop->SetPropertyList(prop.GetPropertyList());
break;
case penvPT_ArrayBoolean:
NOT_IMPLEMENTED_YET();
break;
case penvPT_ArrayInteger:
NOT_IMPLEMENTED_YET();
break;
case penvPT_ArrayDouble:
NOT_IMPLEMENTED_YET();
break;
case penvPT_ArrayString:
NOT_IMPLEMENTED_YET();
break;
default:
wxString msg = wxString::Format(_T("Unknown type for property %s."), setprop->GetName().c_str());
break;
}
}
示例3: data
QVariant QPropertyModel::data(const QModelIndex& index, int role) const
{
if( !index.isValid() )
return QVariant();
if( role != Qt::DisplayRole && role != Qt::ToolTipRole && role != Qt::StatusTipRole )
return QVariant();
Property* prop = GetProperty(index);
if( role == Qt::ToolTipRole || role == Qt::StatusTipRole )
return QVariant(prop->GetDescription());
if( index.column() == PROPERTY_COLUMN )
{
if( IsComponent(index) )
return QVariant(prop->GetComponentName(index.row()));
else
return QVariant(prop->GetName());
}
else
{
String str;
if( IsComponent(index) )
prop->GetComponentValueString(mEdited, GetComponentIndex(index), str);
else
prop->GetValueString(mEdited, str);
return QVariant(str.c_str());
}
}
示例4: ParsePropertyElement
// }}}
// {{{ void Property::ParsePropertyElement(wxXmlNode *node)
void Property::ParsePropertyElement(wxXmlNode *node) {
address = node->GetPropVal(wxT("address"), wxEmptyString);
className = node->GetPropVal(wxT("classname"), wxEmptyString);
constant = (node->GetPropVal(wxT("constant"), wxT("0")) == wxT("1"));
fullName = node->GetPropVal(wxT("fullname"), wxEmptyString);
hasChildren = (node->GetPropVal(wxT("children"), wxT("0")) == wxT("1"));
key = node->GetPropVal(wxT("key"), wxEmptyString);
name = node->GetPropVal(wxT("name"), wxEmptyString);
size = StringToULong(node->GetPropVal(wxT("size"), wxT("0")));
try {
type = conn->TypemapGet().GetType(node->GetPropVal(wxT("type"), wxT("undefined")));
}
catch (Error e) {
type = Type();
}
data = node->GetNodeContent();
for (wxXmlNode *child = node->GetChildren(); child != NULL; child = child->GetNext()) {
if (child->GetType() == wxXML_ELEMENT_NODE && child->GetName() == wxT("property")) {
Property *prop = new Property(conn, context, depth, this);
prop->ParsePropertyElement(child);
children[prop->GetName()] = prop;
}
}
}
示例5: LoadMesh
Mesh* ModelLoader::LoadMesh(BinaryReader &br)
{
Mesh *mesh = new Mesh();
mesh ->id = br.Read<int>();
mesh->name = br.Read<std::string>();
if (m_fileVersion > 0)
{
for (int i = 0; i < 16; i++)
mesh->m_worldInverseMatrix.a[i] = br.Read<float>();
mesh->m_worldMatrix = mesh->m_worldInverseMatrix.GetInversed();
}
int meshPartsCount = br.Read<int>();
for (int i = 0; i < meshPartsCount; i++)
{
MeshPart *meshPart = LoadMeshPart(br);
meshPart->mesh = mesh;
mesh ->AddMeshPart(meshPart);
}
int propsCount = br.Read<int>();
for (int i = 0; i < propsCount; i++)
{
Property *prop = LoadProperty(br);
mesh->m_properties[prop->GetName()] = prop;
}
return mesh;
}
示例6: WriteNode
//----------------------------------------------------------------
wxXmlNode* PropertyList::WriteNode()
/**
* \brief Writes a 'properties' xml element node.
* See class description for structure of such an xml node.
* \return The 'properties' xml element node; or NULL on error.
**/
{
wxXmlNode* node = PenvHelper::CreateXmlNode(_T("properties"));
PropertiesHashMap::iterator itr;
for (itr = m_hashmap->begin(); itr != m_hashmap->end(); itr++)
{
Property* prop = itr->second;
wxXmlNode* child = prop->WriteNode();
if (child == NULL)
{
wxLogError(_T("[penv::PropertyList::WriteNode] Failed to write property '%s', skipping."), prop->GetName().c_str());
continue;
}
PenvHelper::AddXmlChildNode(node, child);
}
return (node);
}