本文整理汇总了C++中Task::addDependency方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::addDependency方法的具体用法?C++ Task::addDependency怎么用?C++ Task::addDependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::addDependency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseTask
//.........这里部分代码省略.........
// is complex as finding the correspondence between each original line
// and edited line may be impossible (bug #705). It would be simpler if
// each annotation was put on a line with a distinguishable id (then
// for each line: if the annotation is the same, then it is copied; if
// the annotation is modified, then its original date may be kept; and
// if there is no corresponding id, then a new unique date is created).
Date when (value.substr (0, gap), dateformat);
// This guarantees that if more than one annotation has the same date,
// that the seconds will be different, thus unique, thus not squashed.
// Bug #249
when += (const int) annotations.size ();
std::stringstream name;
name << "annotation_" << when.toEpoch ();
std::string text = trim (value.substr (gap + 4), "\t ");
annotations.insert (std::make_pair (name.str (), text));
}
}
}
task.setAnnotations (annotations);
// Dependencies
value = findValue (after, "\n Dependencies:");
std::vector <std::string> dependencies;
split (dependencies, value, ",");
task.remove ("depends");
std::vector <std::string>::iterator dep;
for (dep = dependencies.begin (); dep != dependencies.end (); ++dep)
{
if (dep->length () >= 7)
task.addDependency (*dep);
else
task.addDependency ((int) strtol (dep->c_str (), NULL, 10));
}
// UDAs
std::map <std::string, Column*>::iterator col;
for (col = context.columns.begin (); col != context.columns.end (); ++col)
{
std::string type = context.config.get ("uda." + col->first + ".type");
if (type != "")
{
std::string value = findValue (after, "\n UDA " + col->first + ":");
if ((task.get (col->first) != value) && (type != "date" ||
(task.get (col->first) != Date (value, dateformat).toEpochString ())) &&
(type != "duration" ||
(task.get (col->first) != (std::string) Duration (value) )))
{
if (value != "")
{
context.footnote (format (STRING_EDIT_UDA_MOD, col->first));
if (type == "string")
{
task.set (col->first, value);
}
else if (type == "numeric")
{
Nibbler n (value);
double d;
if (n.getNumber (d) &&
n.depleted ())
task.set (col->first, value);
示例2: parseTask
//.........这里部分代码省略.........
ISO8601d when (value.substr (0, gap), dateformat);
// If the map already contains a annotation for a given timestamp
// we need to increment until we find an unused key
int timestamp = (int) when.toEpoch ();
std::stringstream name;
do
{
name.str (""); // Clear
name << "annotation_" << timestamp;
timestamp++;
}
while (annotations.find (name.str ()) != annotations.end ());
std::string text = trim (value.substr (gap + 4), "\t ");
annotations.insert (std::make_pair (name.str (), json::decode (text)));
}
}
}
task.setAnnotations (annotations);
// Dependencies
value = findValue (after, "\n Dependencies:");
std::vector <std::string> dependencies;
split (dependencies, value, ",");
task.remove ("depends");
for (auto& dep : dependencies)
{
if (dep.length () >= 7)
task.addDependency (dep);
else
task.addDependency ((int) strtol (dep.c_str (), NULL, 10));
}
// UDAs
for (auto& col : context.columns)
{
std::string type = context.config.get ("uda." + col.first + ".type");
if (type != "")
{
std::string value = findValue (after, "\n UDA " + col.first + ":");
if ((task.get (col.first) != value) && (type != "date" ||
(task.get (col.first) != ISO8601d (value, dateformat).toEpochString ())) &&
(type != "duration" ||
(task.get (col.first) != (std::string) ISO8601p (value))))
{
if (value != "")
{
context.footnote (format (STRING_EDIT_UDA_MOD, col.first));
if (type == "string")
{
task.set (col.first, value);
}
else if (type == "numeric")
{
Nibbler n (value);
double d;
if (n.getNumber (d) &&
n.depleted ())
task.set (col.first, value);
else