本文整理汇总了C++中DataElement::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ DataElement::getParent方法的具体用法?C++ DataElement::getParent怎么用?C++ DataElement::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataElement
的用法示例。
在下文中一共展示了DataElement::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
void ModelServicesImp::clear()
{
// Destroy only the top-level elements since they will destroy all child elements
while (mElements.empty() == false)
{
for (multimap<Key, DataElement*>::iterator iter = mElements.begin(); iter != mElements.end(); ++iter)
{
DataElement* pElement = iter->second;
if ((pElement != NULL) && (pElement->getParent() == NULL))
{
destroyElement(pElement);
break;
}
}
}
mElements.clear();
}
示例2:
vector<string> ModelServicesImp::getElementNames(const DataElement* pParent, const string& type) const
{
vector<string> elementNames;
multimap<Key, DataElement*>::const_iterator iter;
for (iter = mElements.begin(); iter != mElements.end(); ++iter)
{
DataElement* pElement = iter->second;
if (pElement != NULL)
{
DataElement* pCurrentParent = pElement->getParent();
if (pCurrentParent == pParent)
{
if ((type.empty() == true) || (pElement->isKindOf(type) == true))
{
elementNames.push_back(pElement->getName());
}
}
}
}
return elementNames;
}
示例3: getSubstitutedText
string TextObjectImp::getSubstitutedText()
{
string txt = getText();
DataElement* pParent = getElement();
pParent = (pParent == NULL) ? NULL : pParent->getParent();
DataDescriptor* pParentDesc = (pParent == NULL) ? NULL : pParent->getDataDescriptor();
DynamicObject* pParentMetadata = (pParentDesc == NULL) ? NULL : pParentDesc->getMetadata();
for (int i = 0; i < 50; ++i)
{
//each pass does replacement of $M(a) currently in the string.
//do 50 passes to perform sub-expansion at most fifty times, ie. prevent infinite loop
//for non-terminating recursive expansion
string::size_type pos = txt.find("$");
while (pos != string::npos)
{
if (pos + 1 >= txt.size())
{
break;
}
string type = txt.substr(pos+1, 1);
if (type != "$") //ie. not $$, the escape sequence so continue
{
bool replaced = false;
if (pos+4 < txt.size()) //ie. $M(a)
{
if (txt[pos+2] == '(')
{
string::size_type closeParen = txt.find(')', pos+2);
if (closeParen == string::npos)
{
closeParen = txt.size();
}
string variableName = txt.substr(pos+3, closeParen-(pos+2)-1);
string replacementString;
if (type == "M" || type == "S")
{
DataElement* pElmnt = pParent;
DynamicObject* pMetadata = pParentMetadata;
if (variableName.substr(0, 2) == "//")
{
string::size_type endNamePos = variableName.find("//", 2);
if (endNamePos != string::npos)
{
string elementName = variableName.substr(2, endNamePos - 2);
variableName = variableName.substr(endNamePos + 2);
if (!variableName.empty())
{
if (elementName[0] == '[' && elementName[elementName.size() - 1] == ']')
{
elementName = elementName.substr(1, elementName.size() - 2);
std::list<GraphicObject*> objects;
getLayer()->getObjects(VIEW_OBJECT, objects);
for (std::list<GraphicObject*>::iterator object = objects.begin();
object != objects.end(); ++object)
{
GraphicObject* pObj = *object;
if (pObj->getName() == elementName)
{
SpatialDataView* pSdv = dynamic_cast<SpatialDataView*>(pObj->getObjectView());
if (pSdv != NULL)
{
pElmnt = pSdv->getLayerList()->getPrimaryRasterElement();
DataDescriptor* pDesc =
(pElmnt == NULL) ? NULL : pElmnt->getDataDescriptor();
pMetadata = (pDesc == NULL) ? NULL : pDesc->getMetadata();
}
break;
}
}
}
else
{
pElmnt = Service<ModelServices>()->getElement(elementName,
TypeConverter::toString<RasterElement>(), NULL);
DataDescriptor* pDesc = (pElmnt == NULL) ? NULL : pElmnt->getDataDescriptor();
pMetadata = (pDesc == NULL) ? NULL : pDesc->getMetadata();
}
}
else
{
pElmnt = NULL;
pMetadata = NULL;
}
}
}
bool success = false;
if (type == "M" && pMetadata != NULL)
{
DataVariant var = pMetadata->getAttributeByPath(variableName);
if (var.isValid())
{
DataVariant::Status status;
replacementString = var.toDisplayString(&status);
success = (status == DataVariant::SUCCESS);
if (mMetadataObjects.find(pMetadata) == mMetadataObjects.end())
{
mMetadataObjects.insert(make_pair(pMetadata, new AttachmentPtr<DynamicObject>(
pMetadata, SIGNAL_NAME(Subject, Modified),
Slot(this, &TextObjectImp::invalidateTexture))));
//.........这里部分代码省略.........