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


C++ StoragePtr::begin方法代码示例

本文整理汇总了C++中StoragePtr::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ StoragePtr::begin方法的具体用法?C++ StoragePtr::begin怎么用?C++ StoragePtr::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StoragePtr的用法示例。


在下文中一共展示了StoragePtr::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: file_notification

void
Database::writeNotification(bool single_line)
{
    StoragePtr homepage = m_Storages[IDX_HOMEPAGE];

    std::string filename = ConfigurationFindscholarships::instance()->pathDatabase() + currentDateTime();
    if (single_line)
    {
        filename = filename + ".single";
    }
    else
    {
        filename = filename + ".multiple";
    }

    std::ofstream file_notification(filename.c_str());
    if (file_notification.is_open())
    {
        Storage::const_iterator beg = homepage->begin();
        Storage::const_iterator end = homepage->end();
        end--;
        for (Storage::const_iterator it = end; it != beg; it--)
        {
            DatePtr deadline = it->first;
            const DataEntry& data = it->second;
            if (data.isNew())
            {
                if (single_line)
                {
                    file_notification << data.getTitle().getSingleLineNotification(deadline) << std::endl << std::endl;
                }
                else
                {
                    file_notification << data.getTitle().getMultipleLineNotification(deadline) << std::endl << std::endl;
                }
            }
        }

        DatePtr deadline = beg->first;
        const DataEntry& data = beg->second;
        if (data.isNew())
        {
            if (single_line)
            {
                file_notification << data.getTitle().getSingleLineNotification(deadline) << std::endl << std::endl;
            }
            else
            {
                file_notification << data.getTitle().getMultipleLineNotification(deadline) << std::endl << std::endl;
            }
        }
    }
    else
    {
        DBGERR(__FUNCTION__ << ": Cannot open file \"" << filename << "\" for writing!")
    }
}
开发者ID:daotranminh,项目名称:web-explorer,代码行数:57,代码来源:Database.cpp

示例2:

void
Database::showStorage(StoragePtr to_show)
{
    std::cout << "Size = " << to_show->size() << std::endl;
    for (Storage::const_iterator it = to_show->begin(); it != to_show->end(); ++it)
    {
        const DatePtr deadline = it->first;
        const DataEntry& data = it->second;

        std::cout << boost::gregorian::to_iso_extended_string(*deadline) << " " << data.getTitle().getTitleNoSpace() << std::endl;
    }
}
开发者ID:daotranminh,项目名称:web-explorer,代码行数:12,代码来源:Database.cpp

示例3: out

void
Database::writeToCategoryFile(const std::string& filename,
                              const std::string& title,
                              StoragePtr to_write)
{
    std::ofstream out(filename.c_str());

    if (out.is_open())
    {
        out << ConfigurationFindscholarships::instance()->categoryPart1() << std::endl;
        out << "<title>Findscholarships: " << title << "</title>" << std::endl;

        out << ConfigurationFindscholarships::instance()->categoryPart2() << std::endl;
        out << "<div><center><h2>" << title << "</h2></center></div>" << std::endl;
        out << ConfigurationFindscholarships::instance()->categoryPart3() << std::endl;

        std::string list_new = "";
        std::string list_old = "";

        for (Storage::const_iterator it = to_write->begin(); it != to_write->end(); ++it)
        {
            const DatePtr deadline = it->first;
            const DataEntry& data = it->second;
            const Title& title = data.getTitle();

            if (data.isNew())
            {
                list_new = "<p>" + list_new + title.getHtmlLink(deadline) + "<img src=\"images/new_icon.gif\"></p>\n\n";
            }
            else
            {
                list_old = "<p>" + list_old + title.getHtmlLink(deadline) + "</p>\n\n";
            }
        }

        out << list_new << list_old << std::endl;
        out << ConfigurationFindscholarships::instance()->categoryPart4() << std::endl;
        out.close();
    }
    else
    {
        DBGERR(__FUNCTION__ << ": Cannot write to category file \"" << filename << "\"!")
    }
}
开发者ID:daotranminh,项目名称:web-explorer,代码行数:44,代码来源:Database.cpp


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