void CHelpSystemCore::MergeTopicIndex( CChm &chmRef, chmIndexIter chmBegin, chmIndexIter chmEnd, CIndexTree *parent, CIndexTree::CHILDREN &indexNodes ) { for (; chmBegin != chmEnd; ++chmBegin) { const std::string *nodeName = &(*chmBegin)->name; CIndexTree::CHILDREN::iterator node = indexNodes.find(nodeName); if (node == indexNodes.end()) { node = indexNodes.insert(std::make_pair(nodeName, CIndexTree(parent, nodeName))).first; } for (std::list<chm::chm_index_topic>::const_iterator i = (*chmBegin)->topics.begin(); i != (*chmBegin)->topics.end(); ++i) { CDocument * doc = chmRef.GetDocument(&i->path); doc->SetIndexNode(&node->second); node->second.GetTopics().push_back(CIndexTopic(&i->title, doc)); } if (!(*chmBegin)->children.empty()) { MergeTopicIndex( chmRef, (*chmBegin)->children.begin(), (*chmBegin)->children.end(), &node->second, node->second.GetChildren() ); } } }