本文整理汇总了C++中nodelist::iterator::get方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::get方法的具体用法?C++ iterator::get怎么用?C++ iterator::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodelist::iterator
的用法示例。
在下文中一共展示了iterator::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void Scene::print() {
string strFileName = getLogFile();
ofstream output(strFileName, ios::app);
output << "========================================================Begin Scene" << endl;
int nI;
output << "SCENE at iteration " << m_nIteration << endl;
output << "Scene objects by name: " << endl;
NodeList::iterator it;
for (it = _children.begin(); it != _children.end(); it++) {
output << "Parent: " << it->get()->getParent(0)->getName()
<< "; Class Name:" << it->get()->className() << "; Object Name: " <<it->get()->getName() << endl;
}
for (it = _children.begin(); it != _children.end(); it++) {
nI = it - _children.begin();
ref_ptr<VR::AbstractObject> pObject = dynamic_cast<VR::AbstractObject*>(this->getChild(nI));
if (!pObject.valid())
continue;
else
pObject->print(output);
}
output << "========================================================End Scene" << endl;
output.close();
m_nIteration++;
}
示例2:
Node * Scene::getChild(const string & astrChildName) {
if (astrChildName.empty()) {
return 0;
}
NodeList::iterator it = _children.begin();
for (it; it != _children.end(); it++) {
const string strChild = it->get()->getName();
if (strChild == astrChildName) {
Node * pChild = dynamic_cast<Node*>(it->get());
return pChild;
}
}
return 0;
}
示例3: preparedObjectData
void AbstractObject::preparedObjectData(std::vector<std::string> &avecItems, std::string & astrParent) {
ref_ptr<AbstractObject> pAbstractObject = dynamic_cast<AbstractObject*>(this);
vector<string> * pvecItems = &avecItems;
int nI=1;
string strClassName = pAbstractObject->className();
const string * pstrObjectName = &pAbstractObject->getName();
string strItem = (string(2*nI,' ') + strClassName + ";" + *pstrObjectName + ";" + pAbstractObject->prepareRowData(astrParent));
pvecItems->push_back(strItem);
nI += 1; //enlarge indent by 1 unit
NodeList::iterator it;
for (it = pAbstractObject->_children.begin(); it != pAbstractObject->_children.end(); it++) {
ref_ptr<AbstractObject> pChild = dynamic_cast<AbstractObject*>(it->get());
if(pChild == NULL) {
break;
}
strClassName = pChild->className();
pstrObjectName = &pChild->getName();
strItem = (strClassName + ";" + *pstrObjectName + ";" + pChild->prepareRowData(pAbstractObject->getName()));
pvecItems->push_back(string(2*nI,' ') + strItem);
}
}
示例4: writeObjectHierarchy
void AbstractObject::writeObjectHierarchy(vector<string> &avecstrHierarchy) {
//Object name
avecstrHierarchy.push_back(getName());
ref_ptr<AbstractObject> pAO = dynamic_cast<AbstractObject*>(this);
NodeList::iterator it = pAO->_children.begin();
for (it; it != pAO->_children.end(); it++) {
string strName = it->get()->getName();
if (strName.empty()) {
break;
} else {
strName = string(2,' ') + strName;
avecstrHierarchy.push_back(strName);
}
}
}