mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Code Cleanup
- Eliminated obsolete composeYAML and composeCSV methods. With export capabilities moving outside the core, these are no longer needed.
This commit is contained in:
parent
5276bfd473
commit
f14b414b9c
2 changed files with 0 additions and 93 deletions
91
src/Task.cpp
91
src/Task.cpp
|
@ -537,97 +537,6 @@ std::string Task::composeF4 () const
|
|||
return ff4;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeCSV () const
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
// Deliberately no 'id'.
|
||||
out << "'" << get ("uuid") << "',";
|
||||
out << "'" << get ("status") << "',";
|
||||
|
||||
// Tags
|
||||
std::vector <std::string> tags;
|
||||
getTags (tags);
|
||||
std::string allTags;
|
||||
join (allTags, " ", tags);
|
||||
out << "'" << allTags << "',";
|
||||
|
||||
out << get ("entry") << ",";
|
||||
out << get ("start") << ",";
|
||||
|
||||
if (has ("due"))
|
||||
out << get ("due") << ",";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
if (has ("recur"))
|
||||
out << get ("recur") << ",";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
out << get ("end") << ",";
|
||||
|
||||
if (has ("project"))
|
||||
out << "'" << get ("project") << "',";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
if (has ("priority"))
|
||||
out << "'" << get ("priority") << "',";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
if (has ("fg"))
|
||||
out << "'" << get ("fg") << "',";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
if (has ("bg"))
|
||||
out << "'" << get ("bg") << "',";
|
||||
else
|
||||
out << ",";
|
||||
|
||||
// Convert single quotes to double quotes, because single quotes are used to
|
||||
// delimit the values that need it.
|
||||
std::string clean = get ("description");
|
||||
std::replace (clean.begin (), clean.end (), '\'', '"');
|
||||
out << "'" << clean << "'\n";
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeYAML () const
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
// Task header.
|
||||
out << " task:\n";
|
||||
|
||||
// Get all the supported attribute names.
|
||||
std::vector <std::string> names = context.getColumns ();
|
||||
std::sort (names.begin (), names.end ());
|
||||
|
||||
// Only include non-trivial attributes.
|
||||
std::string value;
|
||||
std::vector <std::string>::iterator name;
|
||||
for (name = names.begin (); name != names.end (); ++name)
|
||||
if ((value = get (*name)) != "")
|
||||
out << " " << *name << ": " << value << "\n";
|
||||
|
||||
// Now the annotations, which are not listed in names.
|
||||
std::map <std::string, std::string> annotations;
|
||||
getAnnotations (annotations);
|
||||
std::map <std::string, std::string>::iterator a;
|
||||
for (a = annotations.begin (); a != annotations.end (); ++a)
|
||||
out << " annotation:\n"
|
||||
<< " entry: " << a->first.substr (11) << "\n"
|
||||
<< " description: " << a->second << "\n";
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Task::composeJSON (bool include_id /*= false*/) const
|
||||
{
|
||||
|
|
|
@ -45,8 +45,6 @@ public:
|
|||
|
||||
void parse (const std::string&);
|
||||
std::string composeF4 () const;
|
||||
std::string composeCSV () const;
|
||||
std::string composeYAML () const;
|
||||
std::string composeJSON (bool include_id = false) const;
|
||||
|
||||
// Status values.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue