本文整理汇总了C++中Task::addTags方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::addTags方法的具体用法?C++ Task::addTags怎么用?C++ Task::addTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::addTags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseTask
void CmdEdit::parseTask (Task& task, const std::string& after, const std::string& dateformat)
{
// project
std::string value = findValue (after, "\n Project:");
if (task.get ("project") != value)
{
if (value != "")
{
context.footnote (STRING_EDIT_PROJECT_MOD);
task.set ("project", value);
}
else
{
context.footnote (STRING_EDIT_PROJECT_DEL);
task.remove ("project");
}
}
// tags
value = findValue (after, "\n Tags:");
std::vector <std::string> tags;
split (tags, value, ' ');
task.remove ("tags");
task.addTags (tags);
// description.
value = findMultilineValue (after, "\n Description:", "\n Created:");
if (task.get ("description") != value)
{
if (value != "")
{
context.footnote (STRING_EDIT_DESC_MOD);
task.set ("description", value);
}
else
throw std::string (STRING_EDIT_DESC_REMOVE_ERR);
}
// entry
value = findValue (after, "\n Created:");
if (value != "")
{
std::string formatted = formatDate (task, "entry", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_ENTRY_MOD);
task.set ("entry", Date(value, dateformat).toEpochString ());
}
}
else
throw std::string (STRING_EDIT_ENTRY_REMOVE_ERR);
// start
value = findValue (after, "\n Started:");
if (value != "")
{
if (task.get ("start") != "")
{
std::string formatted = formatDate (task, "start", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_START_MOD);
task.set ("start", Date(value, dateformat).toEpochString ());
}
}
else
{
context.footnote (STRING_EDIT_START_MOD);
task.set ("start", Date(value, dateformat).toEpochString ());
}
}
else
{
if (task.get ("start") != "")
{
context.footnote (STRING_EDIT_START_DEL);
task.remove ("start");
}
}
// end
value = findValue (after, "\n Ended:");
if (value != "")
{
if (task.get ("end") != "")
{
std::string formatted = formatDate (task, "end", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_END_MOD);
task.set ("end", Date(value, dateformat).toEpochString ());
}
}
else if (task.getStatus () != Task::deleted)
throw std::string (STRING_EDIT_END_SET_ERR);
}
else
//.........这里部分代码省略.........
示例2: parseTask
void CmdEdit::parseTask (Task& task, const std::string& after, const std::string& dateformat)
{
// project
std::string value = findValue (after, "\n Project:");
if (task.get ("project") != value)
{
if (value != "")
{
context.footnote (STRING_EDIT_PROJECT_MOD);
task.set ("project", value);
}
else
{
context.footnote (STRING_EDIT_PROJECT_DEL);
task.remove ("project");
}
}
// tags
value = findValue (after, "\n Tags:");
std::vector <std::string> tags;
split (tags, value, ' ');
task.remove ("tags");
task.addTags (tags);
// description.
value = findMultilineValue (after, "\n Description:", "\n Created:");
if (task.get ("description") != value)
{
if (value != "")
{
context.footnote (STRING_EDIT_DESC_MOD);
task.set ("description", value);
}
else
throw std::string (STRING_EDIT_DESC_REMOVE_ERR);
}
// entry
value = findValue (after, "\n Created:");
if (value != "")
{
std::string formatted = formatDate (task, "entry", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_ENTRY_MOD);
task.set ("entry", ISO8601d (value, dateformat).toEpochString ());
}
}
else
throw std::string (STRING_EDIT_ENTRY_REMOVE_ERR);
// start
value = findValue (after, "\n Started:");
if (value != "")
{
if (task.get ("start") != "")
{
std::string formatted = formatDate (task, "start", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_START_MOD);
task.set ("start", ISO8601d (value, dateformat).toEpochString ());
}
}
else
{
context.footnote (STRING_EDIT_START_MOD);
task.set ("start", ISO8601d (value, dateformat).toEpochString ());
}
}
else
{
if (task.get ("start") != "")
{
context.footnote (STRING_EDIT_START_DEL);
task.remove ("start");
}
}
// end
value = findValue (after, "\n Ended:");
if (value != "")
{
if (task.get ("end") != "")
{
std::string formatted = formatDate (task, "end", dateformat);
if (formatted != value)
{
context.footnote (STRING_EDIT_END_MOD);
task.set ("end", ISO8601d (value, dateformat).toEpochString ());
}
}
else if (task.getStatus () != Task::deleted)
throw std::string (STRING_EDIT_END_SET_ERR);
}
else
//.........这里部分代码省略.........