当前位置: 首页>>代码示例>>C++>>正文


C++ FilePtr::setFileData方法代码示例

本文整理汇总了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;
}
开发者ID:diegowald,项目名称:bhisa,代码行数:59,代码来源:ftpmanager.cpp

示例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;
}
开发者ID:diegowald,项目名称:bhisa,代码行数:63,代码来源:ftpmanager.cpp


注:本文中的FilePtr::setFileData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。