本文整理汇总了C++中StoragePtr::end方法的典型用法代码示例。如果您正苦于以下问题:C++ StoragePtr::end方法的具体用法?C++ StoragePtr::end怎么用?C++ StoragePtr::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoragePtr
的用法示例。
在下文中一共展示了StoragePtr::end方法的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!")
}
}
示例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;
}
}
示例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 << "\"!")
}
}