Xml::NodePtrs Xml::find(XmlNodes &xmlNodes, const string &key, const string &val) { NodePtrs ret; XmlNodes::iterator itr = xmlNodes.begin(); for(; itr != xmlNodes.end(); ++itr) { XmlNode::Attr::iterator loc = itr->attr.find(key); if(loc != itr->attr.end()) if(loc->second.str == val) ret.push_back(&*itr); } return ret; }
// copied from local folder node void DesktopNode::scan(const string& dir, NodePtrs &result) { StringList current_dirs = PathManager::GetDirsInPath(dir.c_str()); StringList current_books = PathManager::GetFilesInPath(dir.c_str()); for (size_t i = 0; i < current_dirs.size(); i++) { string folder_path = PathManager::ConcatPath(dir.c_str(), current_dirs[i].c_str()); if (!PathManager::IsDocumentsPath(folder_path.c_str())) { continue; } NodePtr folder_node; if (PathManager::IsBookStorePath(folder_path)) // Do NOT filter { folder_node = createBookStoreNode(folder_path); } else if (PathManager::IsNewsPath(folder_path.c_str())) // Do Not filter { folder_node = createPushedMessageNode(folder_path); } else// if (LocalFolderNode::testStatus(folder_path, status_filter)) { folder_node.reset(new LocalFolderNode(this, folder_path)); } if (folder_node != 0) result.push_back(folder_node); } CDKFileManager* file_manager = CDKFileManager::GetFileManager(); for (size_t i = 0; i < current_books.size(); i++) { string book_path = PathManager::ConcatPath(dir.c_str(), current_books[i].c_str()); PCDKFile file = file_manager->GetFileByPath(book_path); if (file != 0) { NodePtr book_node(new FileNode(this, file)); result.push_back(book_node); } } }