本文整理汇总了C++中Task::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::begin方法的具体用法?C++ Task::begin怎么用?C++ Task::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: taskDiff
bool taskDiff (const Task& before, const Task& after)
{
// Attributes are all there is, so figure the different attribute names
// between before and after.
std::vector <std::string> beforeAtts;
Task::const_iterator att;
for (att = before.begin (); att != before.end (); ++att)
beforeAtts.push_back (att->first);
std::vector <std::string> afterAtts;
for (att = after.begin (); att != after.end (); ++att)
afterAtts.push_back (att->first);
std::vector <std::string> beforeOnly;
std::vector <std::string> afterOnly;
listDiff (beforeAtts, afterAtts, beforeOnly, afterOnly);
if (beforeOnly.size () !=
afterOnly.size ())
return true;
std::vector <std::string>::iterator name;
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
if (*name != "uuid" &&
before.get (*name) != after.get (*name))
return true;
return false;
}
示例2: colorizeKeyword
static void colorizeKeyword (Task& task, const std::string& rule, const Color& base, Color& c)
{
// Observe the case sensitivity setting.
bool sensitive = context.config.getBoolean ("search.case.sensitive");
// The easiest thing to check is the description, because it is just one
// attribute.
if (find (task.get ("description"), rule.substr (14), sensitive) != std::string::npos)
c.blend (base);
// Failing the description check, look at all annotations, returning on the
// first match.
else
{
Task::iterator it;
for (it = task.begin (); it != task.end (); ++it)
{
if (it->first.substr (0, 11) == "annotation_" &&
find (it->second, rule.substr (14), sensitive) != std::string::npos)
{
c.blend (base);
return;
}
}
}
}
示例3: taskToMessage
semantic_map_msgs::Task MessageConversions::taskToMessage(const Task& task)
const {
semantic_map_msgs::Task message = actionToMessage<semantic_map_msgs::Task>(
task);
message.actions.reserve(task.getNumActions());
for (std::list<Action>::const_iterator it = task.begin();
it != task.end(); ++it)
message.actions.push_back(it->getIdentifier());
if (task.getQuantification() == Task::Union)
message.quantification = semantic_map_msgs::Task::QUANTIFICATION_UNION;
else
message.quantification = semantic_map_msgs::Task::
QUANTIFICATION_INTERSECTION;
message.unordered = task.isUnordered();
return message;
}
示例4: taskDifferences
std::string taskDifferences (const Task& before, const Task& after)
{
// Attributes are all there is, so figure the different attribute names
// between before and after.
std::vector <std::string> beforeAtts;
Task::const_iterator att;
for (att = before.begin (); att != before.end (); ++att)
beforeAtts.push_back (att->first);
std::vector <std::string> afterAtts;
for (att = after.begin (); att != after.end (); ++att)
afterAtts.push_back (att->first);
std::vector <std::string> beforeOnly;
std::vector <std::string> afterOnly;
listDiff (beforeAtts, afterAtts, beforeOnly, afterOnly);
// Now start generating a description of the differences.
std::stringstream out;
std::vector <std::string>::iterator name;
for (name = beforeOnly.begin (); name != beforeOnly.end (); ++name)
out << " - "
<< format (STRING_FEEDBACK_DELETED, ucFirst (*name))
<< "\n";
for (name = afterOnly.begin (); name != afterOnly.end (); ++name)
{
if (*name == "depends")
{
std::vector <int> deps_after;
after.getDependencies (deps_after);
std::string to;
join (to, ", ", deps_after);
out << " - "
<< format (STRING_FEEDBACK_DEP_SET, to)
<< "\n";
}
else
out << " - "
<< format (STRING_FEEDBACK_ATT_SET,
ucFirst (*name),
renderAttribute (*name, after.get (*name)))
<< "\n";
}
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
{
// Ignore UUID differences, and find values that changed, but are not also
// in the beforeOnly and afterOnly lists, which have been handled above..
if (*name != "uuid" &&
before.get (*name) != after.get (*name) &&
std::find (beforeOnly.begin (), beforeOnly.end (), *name) == beforeOnly.end () &&
std::find (afterOnly.begin (), afterOnly.end (), *name) == afterOnly.end ())
{
if (*name == "depends")
{
std::vector <int> deps_before;
before.getDependencies (deps_before);
std::string from;
join (from, ", ", deps_before);
std::vector <int> deps_after;
after.getDependencies (deps_after);
std::string to;
join (to, ", ", deps_after);
out << " - "
<< format (STRING_FEEDBACK_DEP_MOD, from, to)
<< "\n";
}
else
out << " - "
<< format (STRING_FEEDBACK_ATT_MOD,
ucFirst (*name),
renderAttribute (*name, before.get (*name)),
renderAttribute (*name, after.get (*name)))
<< "\n";
}
}
// Shouldn't just say nothing.
if (out.str ().length () == 0)
out << " - "
<< STRING_FEEDBACK_NOP
<< "\n";
return out.str ();
}
示例5: taskInfoDifferences
std::string taskInfoDifferences (
const Task& before,
const Task& after,
const std::string& dateformat,
long& last_timestamp,
const long current_timestamp)
{
// Attributes are all there is, so figure the different attribute names
// between before and after.
std::vector <std::string> beforeAtts;
Task::const_iterator att;
for (att = before.begin (); att != before.end (); ++att)
beforeAtts.push_back (att->first);
std::vector <std::string> afterAtts;
for (att = after.begin (); att != after.end (); ++att)
afterAtts.push_back (att->first);
std::vector <std::string> beforeOnly;
std::vector <std::string> afterOnly;
listDiff (beforeAtts, afterAtts, beforeOnly, afterOnly);
// Now start generating a description of the differences.
std::stringstream out;
std::vector <std::string>::iterator name;
for (name = beforeOnly.begin (); name != beforeOnly.end (); ++name)
{
if (*name == "depends")
{
std::vector <int> deps_before;
before.getDependencies (deps_before);
std::string from;
join (from, ", ", deps_before);
out << format (STRING_FEEDBACK_DEP_DEL, from)
<< "\n";
}
else if (name->substr (0, 11) == "annotation_")
{
out << format (STRING_FEEDBACK_ANN_DEL, before.get (*name))
<< "\n";
}
else if (*name == "start")
{
out << format (STRING_FEEDBACK_ATT_DEL_DUR, ucFirst (*name),
Duration (current_timestamp - last_timestamp).formatPrecise ())
<< "\n";
}
else
{
out << format (STRING_FEEDBACK_ATT_DEL, ucFirst (*name))
<< "\n";
}
}
for (name = afterOnly.begin (); name != afterOnly.end (); ++name)
{
if (*name == "depends")
{
std::vector <int> deps_after;
after.getDependencies (deps_after);
std::string to;
join (to, ", ", deps_after);
out << format (STRING_FEEDBACK_DEP_WAS_SET, to)
<< "\n";
}
else if (name->substr (0, 11) == "annotation_")
{
out << format (STRING_FEEDBACK_ANN_ADD, after.get (*name))
<< "\n";
}
else
{
if (*name == "start")
last_timestamp = current_timestamp;
out << format (STRING_FEEDBACK_ATT_WAS_SET,
ucFirst (*name),
renderAttribute (*name, after.get (*name), dateformat))
<< "\n";
}
}
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
if (*name != "uuid" &&
before.get (*name) != after.get (*name) &&
before.get (*name) != "" && after.get (*name) != "")
{
if (*name == "depends")
{
std::vector <int> deps_before;
before.getDependencies (deps_before);
std::string from;
join (from, ", ", deps_before);
std::vector <int> deps_after;
after.getDependencies (deps_after);
std::string to;
join (to, ", ", deps_after);
//.........这里部分代码省略.........