本文整理汇总了C++中Entries::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Entries::size方法的具体用法?C++ Entries::size怎么用?C++ Entries::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entries
的用法示例。
在下文中一共展示了Entries::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _write
bool PLS::_write(const Entries &list)
{
Writer *writer = ioCtrl.rawPtr< Writer >();
writer->write(QString("[playlist]\r\nNumberOfEntries=" + QString::number(list.size()) + "\r\n").toUtf8());
for (int i = 0; i < list.size(); i++)
{
const Playlist::Entry &entry = list[i];
QString idx = QString::number(i+1);
QString url = entry.url;
const bool isFile = url.startsWith("file://");
if (isFile)
url.remove(0, 7);
#ifdef Q_OS_WIN
if (isFile)
url.replace("/", "\\");
#endif
if (!url.isEmpty())
writer->write(QString("File" + idx + "=" + url + "\r\n").toUtf8());
if (!entry.name.isEmpty())
writer->write(QString("Title" + idx + "=" + QString(entry.name).replace('\n', '\001') + "\r\n").toUtf8());
if (entry.length >= 0)
writer->write(QString("Length" + idx + "=" + QString::number(entry.length) + "\r\n").toUtf8());
if (entry.selected)
writer->write(QString("QMPlay_sel" + idx + "=" + QString::number(entry.selected) + "\r\n").toUtf8());
if (entry.queue)
writer->write(QString("QMPlay_queue" + idx + "=" + QString::number(entry.queue) + "\r\n").toUtf8());
if (entry.GID)
writer->write(QString("QMPlay_GID" + idx + "=" + QString::number(entry.GID) + "\r\n").toUtf8());
if (entry.parent)
writer->write(QString("QMPlay_parent" + idx + "=" + QString::number(entry.parent) + "\r\n").toUtf8());
}
return true;
}
示例2: update
void CalendarCell::update(const dbo::ptr<UserAccount>& user, const WDate& date)
{
date_ = date;
user_ = user;
clear();
dbo::Session& session = PlannerApplication::plannerApplication()->session;
dbo::Transaction transaction(session);
WString day;
day += boost::lexical_cast<std::string>(date.day());
if (date.day() == 1)
day += " " + WDate::longMonthName(date.month());
WText* header = new WText(day);
header->setStyleClass("cell-header");
addWidget(header);
typedef dbo::collection< dbo::ptr<Entry> > Entries;
Entries entries = user->entriesInRange(date, date.addDays(1));
const unsigned maxEntries = 4;
unsigned counter = 0;
for (Entries::const_iterator i = entries.begin();
i != entries.end(); ++i, ++counter) {
if (counter == maxEntries) {
WText* extra =
new WText(tr("calendar.cell.extra")
.arg((int)(entries.size() - maxEntries)));
extra->setStyleClass("cell-extra");
addWidget(extra);
extra->clicked().preventPropagation();
extra->clicked().connect(this, &CalendarCell::showAllEntriesDialog);
break;
}
WString format = EntryDialog::timeFormat;
addWidget(new WText((*i)->start.toString(format) +
"-" +
(*i)->stop.toString(format) +
": " + (*i)->summary));
}
transaction.commit();
}
示例3: launch_pipeline
inline children launch_pipeline(const Entries &entries)
{
BOOST_ASSERT(entries.size() >= 2);
children cs;
detail::file_handle fhinvalid;
boost::scoped_array<detail::pipe> pipes(new detail::pipe[entries.size() - 1]);
#if defined(BOOST_POSIX_API)
{
typename Entries::size_type i = 0;
const typename Entries::value_type::context_type &ctx = entries[i].context;
detail::info_map infoin, infoout;
if (ctx.stdin_behavior.get_type() != stream_behavior::close)
{
detail::stream_info si = detail::stream_info(ctx.stdin_behavior, false);
infoin.insert(detail::info_map::value_type(STDIN_FILENO, si));
}
BOOST_ASSERT(ctx.stdout_behavior.get_type() == stream_behavior::close);
detail::stream_info si2(close_stream(), true);
si2.type_ = detail::stream_info::use_handle;
si2.handle_ = pipes[i].wend().release();
infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si2));
if (ctx.stderr_behavior.get_type() != stream_behavior::close)
{
detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true);
infoout.insert(detail::info_map::value_type(STDERR_FILENO, si));
}
detail::posix_setup s;
s.work_directory = ctx.work_directory;
pid_t pid = detail::posix_start(entries[i].executable, entries[i].arguments, ctx.environment, infoin, infoout, s);
detail::file_handle fhstdin;
if (ctx.stdin_behavior.get_type() == stream_behavior::capture)
{
fhstdin = detail::posix_info_locate_pipe(infoin, STDIN_FILENO, false);
BOOST_ASSERT(fhstdin.valid());
}
cs.push_back(child(pid, fhstdin, fhinvalid, fhinvalid));
}
for (typename Entries::size_type i = 1; i < entries.size() - 1; ++i)
{
const typename Entries::value_type::context_type &ctx = entries[i].context;
detail::info_map infoin, infoout;
BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close);
detail::stream_info si1(close_stream(), false);
si1.type_ = detail::stream_info::use_handle;
si1.handle_ = pipes[i - 1].rend().release();
infoin.insert(detail::info_map::value_type(STDIN_FILENO, si1));
BOOST_ASSERT(ctx.stdout_behavior.get_type() == stream_behavior::close);
detail::stream_info si2(close_stream(), true);
si2.type_ = detail::stream_info::use_handle;
si2.handle_ = pipes[i].wend().release();
infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si2));
if (ctx.stderr_behavior.get_type() != stream_behavior::close)
{
detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true);
infoout.insert(detail::info_map::value_type(STDERR_FILENO, si));
}
detail::posix_setup s;
s.work_directory = ctx.work_directory;
pid_t pid = detail::posix_start(entries[i].executable, entries[i].arguments, ctx.environment, infoin, infoout, s);
cs.push_back(child(pid, fhinvalid, fhinvalid, fhinvalid));
}
{
typename Entries::size_type i = entries.size() - 1;
const typename Entries::value_type::context_type &ctx = entries[i].context;
detail::info_map infoin, infoout;
BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close);
detail::stream_info si1(close_stream(), false);
si1.type_ = detail::stream_info::use_handle;
si1.handle_ = pipes[i - 1].rend().release();
infoin.insert(detail::info_map::value_type(STDIN_FILENO, si1));
if (ctx.stdout_behavior.get_type() != stream_behavior::close)
{
detail::stream_info si = detail::stream_info(ctx.stdout_behavior, true);
infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si));
}
if (ctx.stderr_behavior.get_type() != stream_behavior::close)
//.........这里部分代码省略.........
示例4: _read
Playlist::Entries PLS::_read()
{
Reader *reader = ioCtrl.rawPtr< Reader >();
Entries list;
QString playlistPath = filePath(reader->getUrl());
if (playlistPath.startsWith("file://"))
playlistPath.remove(0, 7);
else
playlistPath.clear();
const QList< QByteArray > playlistLines = readLines();
for (int i = 0; i < playlistLines.count(); ++i)
{
const QByteArray &line = playlistLines[i];
if (line.isEmpty())
continue;
int idx = line.indexOf('=');
if (idx < 0)
continue;
int number_idx = -1;
for (int i = 0; i < line.length(); ++i)
{
if (line[i] == '=')
break;
if (line[i] >= '0' && line[i] <= '9')
{
number_idx = i;
break;
}
}
if (number_idx == -1)
continue;
QByteArray key = line.left(number_idx);
QByteArray value = line.mid(idx+1);
int entry_idx = line.mid(number_idx, idx - number_idx).toInt() - 1;
prepareList(&list, entry_idx);
if (entry_idx < 0 || entry_idx > list.size() - 1)
continue;
if (key == "File")
list[entry_idx].url = Url(value, playlistPath);
else if (key == "Title")
list[entry_idx].name = value.replace('\001', '\n');
else if (key == "Length")
list[entry_idx].length = value.toInt();
else if (key == "QMPlay_sel")
list[entry_idx].selected = value.toInt();
else if (key == "QMPlay_queue")
list[entry_idx].queue = value.toInt();
else if (key == "QMPlay_GID")
list[entry_idx].GID = value.toInt();
else if (key == "QMPlay_parent")
list[entry_idx].parent = value.toInt();
}
return list;
}