本文整理汇总了C++中FilePtr::setFileData方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::setFileData方法的具体用法?C++ FilePtr::setFileData怎么用?C++ FilePtr::setFileData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::setFileData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseDirectoryContentsWindows
NodeList FtpManager::parseDirectoryContentsWindows(std::ostringstream &content)
{
std::stringstream ss;
ss << content.str();
NodeList res = NodeList::create();
std::string line;
while (std::getline(ss, line))
{
QString permissions = "";
QString numberOfLinks = "";
QString user = "";
QString group = "";
QString size = "";
QString date = "";
QString time = "";
QString filename = "";
QString l = QString::fromStdString(line);
QStringList fields = l.split(' ', QString::SplitBehavior::SkipEmptyParts);
date = fields[0];
l = l.replace(l.indexOf(date), date.size(), "");
time = fields[1];
l = l.replace(l.indexOf(time), time.size(), "");
QString word = fields[2];
if (word == "<DIR>")
permissions = "d";
else
size = word;
l = l.replace(l.indexOf(word), word.size(), "");
filename = l.trimmed();
if (filename.toLower() != ".control.db")
{
qDebug() << permissions << ", " << numberOfLinks << ", " << user
<< ", " << group << ", " << size << ", " <<
", " << time << ", " << filename;
if (!permissions.startsWith('d'))
{
FilePtr f = FilePtr::create(filename);
f->setFileData(permissions, user, size.toUInt(),
date, time);
(*res)[filename] = f;
}
else
{
FolderPtr f = FolderPtr::create(filename);
(*res)[filename] = f;
}
}
}
return res;
}
示例2: parseDirectoryContentsLinux
NodeList FtpManager::parseDirectoryContentsLinux(std::ostringstream &content)
{
std::stringstream ss;
ss << content.str();
NodeList res = NodeList::create();
std::string line;
while (std::getline(ss, line))
{
QString permissions;
QString numberOfLinks;
QString user;
QString group;
QString size;
QString month;
QString day;
QString time;
QString filename;
QString l = QString::fromStdString(line);
QStringList fields = l.split(' ', QString::SplitBehavior::SkipEmptyParts);
permissions = fields[0];
l = l.replace(l.indexOf(permissions), permissions.size(), "");
numberOfLinks = fields[1];
l = l.replace(l.indexOf(numberOfLinks), numberOfLinks.size(), "");
user = fields[2];
l = l.replace(l.indexOf(user), user.size(), "");
group = fields[3];
l = l.replace(l.indexOf(group), group.size(), "");
size = fields[4];
l = l.replace(l.indexOf(size), size.size(), "");
month = fields[5];
l = l.replace(l.indexOf(month), month.size(), "");
day = fields[6];
l = l.replace(l.indexOf(day), day.size(), "");
time = fields[7];
l = l.replace(l.indexOf(time), time.size(), "");
filename = l.trimmed();
if (filename.toLower() != ".control.db")
{
qDebug() << permissions << ", " << numberOfLinks << ", " << user
<< ", " << group << ", " << size << ", " <<
month << ", " << day << ", " << time << ", " << filename;
if (!permissions.startsWith('d'))
{
FilePtr f = FilePtr::create(filename);
f->setFileData(permissions, user, size.toUInt(),
month + "-" + day, time);
(*res)[filename] = f;
}
else
{
(*res)[filename] = FolderPtr::create(filename);
}
}
}
return res;
}