本文整理汇总了C++中FileObject::GetChildByName方法的典型用法代码示例。如果您正苦于以下问题:C++ FileObject::GetChildByName方法的具体用法?C++ FileObject::GetChildByName怎么用?C++ FileObject::GetChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileObject
的用法示例。
在下文中一共展示了FileObject::GetChildByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirectoryHierarchy
int FTPSession::GetDirectoryHierarchy(const char * inputDir) {
if (!m_running)
return -1;
char *pathEntry;
char* dir = SU::strdup(inputDir);
// We will store the parent directory paths to be
// examined in the below vector.
std::vector<char*> parentDirs;
int childCount;
char currentPath[MAX_PATH];
FileObject* currentFileObj = m_rootObject;
strcpy( currentPath, "/" );
// Split the entries based on '/' and append the
// previous directory name to get the full path.
pathEntry = strtok (dir,"/");
while(pathEntry != NULL) {
if (currentFileObj) {
childCount = currentFileObj->GetChildCount();
currentFileObj = currentFileObj->GetChildByName(pathEntry);
if (currentFileObj) {
HTREEITEM hti = (HTREEITEM)(currentFileObj->GetData());
if (hti) {
sprintf(currentPath,"%s%s/", currentPath, pathEntry);
pathEntry = strtok (NULL,"/");
continue;
}
}
// Cannot find the child. Check if it is because I have no
// information about the child, or that I cannot find the child.
if (!currentFileObj) {
// If I have child data, but I cannot find the child, then
// I will stop here and will not queue the operation.
if (childCount)
return 1;
}
}
if (!parentDirs.size()) {
parentDirs.push_back(SU::strdup(currentPath));
}
sprintf(currentPath,"%s%s/", currentPath, pathEntry);
parentDirs.push_back(SU::strdup(currentPath));
pathEntry = strtok (NULL,"/");
}
// If there is some parent directories to be examined,
// remove the last directory because this is same as
// the input directory.
if (parentDirs.size())
parentDirs.pop_back();
QueueGetDir * dirop = new QueueGetDir(m_hNotify, inputDir, parentDirs);
m_mainQueue->AddQueueOp(dirop);
return 0;
}