本文整理汇总了C++中ProjectItem::Key方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectItem::Key方法的具体用法?C++ ProjectItem::Key怎么用?C++ ProjectItem::Key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectItem
的用法示例。
在下文中一共展示了ProjectItem::Key方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecursiveAdd
void Project::RecursiveAdd(wxXmlNode *xmlNode, ProjectTreePtr &ptp, ProjectTreeNode *nodeParent)
{
// Build the key for this node
std::list<wxString> nameList;
wxXmlNode *parent = xmlNode->GetParent();
while ( parent ) {
nameList.push_front(parent->GetPropVal(wxT("Name"), wxEmptyString));
parent = parent->GetParent();
}
wxString key;
for (size_t i=0; i<nameList.size(); i++) {
key += nameList.front();
key += wxT(":");
nameList.pop_front();
}
key += xmlNode->GetPropVal(wxT("Name"), wxEmptyString);
// Create the tree node data
ProjectItem item;
if ( xmlNode->GetName() == wxT("Project") ) {
item = ProjectItem(key, xmlNode->GetPropVal(wxT("Name"), wxEmptyString), wxEmptyString, ProjectItem::TypeProject);
} else if ( xmlNode->GetName() == wxT("VirtualDirectory") ) {
item = ProjectItem(key, xmlNode->GetPropVal(wxT("Name"), wxEmptyString), wxEmptyString, ProjectItem::TypeVirtualDirectory);
} else if ( xmlNode->GetName() == wxT("File") ) {
wxFileName filename(xmlNode->GetPropVal(wxT("Name"), wxEmptyString));
//convert this file name to absolute path
DirSaver ds;
::wxSetWorkingDirectory(m_fileName.GetPath());
filename.MakeAbsolute();
item = ProjectItem(key, filename.GetFullName(), filename.GetFullPath(), ProjectItem::TypeFile);
} else {
// un-recognised or not viewable item in the tree,
// skip it and its children
return;
}
ProjectTreeNode *newNode = ptp->AddChild(item.Key(), item, nodeParent);
// This node has children, add them as well
wxXmlNode *children = xmlNode->GetChildren();
while ( children ) {
RecursiveAdd(children, ptp, newNode);
children = children->GetNext();
}
SetModified(true);
}