mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Revert "[clang-tidy] Remove redundant const"
This reverts commit 55d103c491
.
This commit is contained in:
parent
c43a513158
commit
702af00435
12 changed files with 36 additions and 36 deletions
10
src/CLI2.cpp
10
src/CLI2.cpp
|
@ -90,7 +90,7 @@ void A2::attribute (const std::string& name, const std::string& value)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Accessor for attributes.
|
// Accessor for attributes.
|
||||||
std::string A2::attribute (const std::string& name) const
|
const std::string A2::attribute (const std::string& name) const
|
||||||
{
|
{
|
||||||
// Prevent autovivification.
|
// Prevent autovivification.
|
||||||
auto i = _attributes.find (name);
|
auto i = _attributes.find (name);
|
||||||
|
@ -101,7 +101,7 @@ std::string A2::attribute (const std::string& name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string A2::getToken () const
|
const std::string A2::getToken () const
|
||||||
{
|
{
|
||||||
auto i = _attributes.find ("canonical");
|
auto i = _attributes.find ("canonical");
|
||||||
if (i == _attributes.end ())
|
if (i == _attributes.end ())
|
||||||
|
@ -175,7 +175,7 @@ void A2::decompose ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string A2::dump () const
|
const std::string A2::dump () const
|
||||||
{
|
{
|
||||||
auto output = Lexer::typeToString (_lextype);
|
auto output = Lexer::typeToString (_lextype);
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ void CLI2::prepareFilter ()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Return all the MISCELLANEOUS args.
|
// Return all the MISCELLANEOUS args.
|
||||||
std::vector <std::string> CLI2::getWords ()
|
const std::vector <std::string> CLI2::getWords ()
|
||||||
{
|
{
|
||||||
std::vector <std::string> words;
|
std::vector <std::string> words;
|
||||||
for (const auto& a : _args)
|
for (const auto& a : _args)
|
||||||
|
@ -710,7 +710,7 @@ std::string CLI2::getCommand (bool canonical) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string CLI2::dump (const std::string& title) const
|
const std::string CLI2::dump (const std::string& title) const
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
|
|
10
src/CLI2.h
10
src/CLI2.h
|
@ -43,9 +43,9 @@ public:
|
||||||
void tag (const std::string&);
|
void tag (const std::string&);
|
||||||
void unTag (const std::string&);
|
void unTag (const std::string&);
|
||||||
void attribute (const std::string&, const std::string&);
|
void attribute (const std::string&, const std::string&);
|
||||||
std::string attribute (const std::string&) const;
|
const std::string attribute (const std::string&) const;
|
||||||
std::string getToken () const;
|
const std::string getToken () const;
|
||||||
std::string dump () const;
|
const std::string dump () const;
|
||||||
void decompose ();
|
void decompose ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -75,11 +75,11 @@ public:
|
||||||
void addFilter (const std::string& arg);
|
void addFilter (const std::string& arg);
|
||||||
void addContextFilter ();
|
void addContextFilter ();
|
||||||
void prepareFilter ();
|
void prepareFilter ();
|
||||||
std::vector <std::string> getWords ();
|
const std::vector <std::string> getWords ();
|
||||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||||
std::string getBinary () const;
|
std::string getBinary () const;
|
||||||
std::string getCommand (bool canonical = true) const;
|
std::string getCommand (bool canonical = true) const;
|
||||||
std::string dump (const std::string& title = "CLI2 Parser") const;
|
const std::string dump (const std::string& title = "CLI2 Parser") const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleArg0 ();
|
void handleArg0 ();
|
||||||
|
|
|
@ -1006,7 +1006,7 @@ bool Context::verbose (const std::string& token)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <std::string> Context::getColumns () const
|
const std::vector <std::string> Context::getColumns () const
|
||||||
{
|
{
|
||||||
std::vector <std::string> output;
|
std::vector <std::string> output;
|
||||||
for (auto& col : columns)
|
for (auto& col : columns)
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
int getWidth (); // determine terminal width
|
int getWidth (); // determine terminal width
|
||||||
int getHeight (); // determine terminal height
|
int getHeight (); // determine terminal height
|
||||||
|
|
||||||
std::vector <std::string> getColumns () const;
|
const std::vector <std::string> getColumns () const;
|
||||||
void getLimits (int&, int&);
|
void getLimits (int&, int&);
|
||||||
|
|
||||||
bool color (); // TTY or <other>?
|
bool color (); // TTY or <other>?
|
||||||
|
|
|
@ -114,7 +114,7 @@ std::vector <std::string> Lexer::split (const std::string& text)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// No L10N - these are for internal purposes.
|
// No L10N - these are for internal purposes.
|
||||||
std::string Lexer::typeName (const Lexer::Type& type)
|
const std::string Lexer::typeName (const Lexer::Type& type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
static std::string typeToString (Lexer::Type);
|
static std::string typeToString (Lexer::Type);
|
||||||
|
|
||||||
// Static helpers.
|
// Static helpers.
|
||||||
static std::string typeName (const Lexer::Type&);
|
static const std::string typeName (const Lexer::Type&);
|
||||||
static bool isIdentifierStart (int);
|
static bool isIdentifierStart (int);
|
||||||
static bool isIdentifierNext (int);
|
static bool isIdentifierNext (int);
|
||||||
static bool isSingleCharOperator (int);
|
static bool isSingleCharOperator (int);
|
||||||
|
|
|
@ -555,7 +555,7 @@ void TF2::dependency_scan ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string TF2::dump ()
|
const std::string TF2::dump ()
|
||||||
{
|
{
|
||||||
Color red ("rgb500 on rgb100");
|
Color red ("rgb500 on rgb100");
|
||||||
Color yellow ("rgb550 on rgb220");
|
Color yellow ("rgb550 on rgb220");
|
||||||
|
@ -1307,7 +1307,7 @@ int TDB2::latest_id ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <Task> TDB2::all_tasks ()
|
const std::vector <Task> TDB2::all_tasks ()
|
||||||
{
|
{
|
||||||
std::vector <Task> all (pending._tasks.size () +
|
std::vector <Task> all (pending._tasks.size () +
|
||||||
pending._added_tasks.size () +
|
pending._added_tasks.size () +
|
||||||
|
@ -1350,7 +1350,7 @@ bool TDB2::has (const std::string& uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <Task> TDB2::siblings (Task& task)
|
const std::vector <Task> TDB2::siblings (Task& task)
|
||||||
{
|
{
|
||||||
std::vector <Task> results;
|
std::vector <Task> results;
|
||||||
if (task.has ("parent"))
|
if (task.has ("parent"))
|
||||||
|
@ -1385,7 +1385,7 @@ std::vector <Task> TDB2::siblings (Task& task)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <Task> TDB2::children (Task& task)
|
const std::vector <Task> TDB2::children (Task& task)
|
||||||
{
|
{
|
||||||
std::vector <Task> results;
|
std::vector <Task> results;
|
||||||
std::string parent = task.get ("uuid");
|
std::string parent = task.get ("uuid");
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
void has_ids ();
|
void has_ids ();
|
||||||
void auto_dep_scan ();
|
void auto_dep_scan ();
|
||||||
void clear ();
|
void clear ();
|
||||||
std::string dump ();
|
const std::string dump ();
|
||||||
|
|
||||||
void dependency_scan ();
|
void dependency_scan ();
|
||||||
|
|
||||||
|
@ -121,12 +121,12 @@ public:
|
||||||
int latest_id ();
|
int latest_id ();
|
||||||
|
|
||||||
// Generalized task accessors.
|
// Generalized task accessors.
|
||||||
std::vector <Task> all_tasks ();
|
const std::vector <Task> all_tasks ();
|
||||||
bool get (int, Task&);
|
bool get (int, Task&);
|
||||||
bool get (const std::string&, Task&);
|
bool get (const std::string&, Task&);
|
||||||
bool has (const std::string&);
|
bool has (const std::string&);
|
||||||
std::vector <Task> siblings (Task&);
|
const std::vector <Task> siblings (Task&);
|
||||||
std::vector <Task> children (Task&);
|
const std::vector <Task> children (Task&);
|
||||||
|
|
||||||
// ID <--> UUID mapping.
|
// ID <--> UUID mapping.
|
||||||
std::string uuid (int);
|
std::string uuid (int);
|
||||||
|
|
|
@ -167,7 +167,7 @@ std::string Task::statusToText (Task::status s)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Returns a proper handle to the task. Tasks should not be referenced by UUIDs
|
// Returns a proper handle to the task. Tasks should not be referenced by UUIDs
|
||||||
// as long as they have non-zero ID.
|
// as long as they have non-zero ID.
|
||||||
std::string Task::identifier (bool shortened /* = false */) const
|
const std::string Task::identifier (bool shortened /* = false */) const
|
||||||
{
|
{
|
||||||
if (id != 0)
|
if (id != 0)
|
||||||
return format (id);
|
return format (id);
|
||||||
|
@ -207,7 +207,7 @@ std::vector <std::string> Task::all ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string Task::get (const std::string& name) const
|
const std::string Task::get (const std::string& name) const
|
||||||
{
|
{
|
||||||
auto i = data.find (name);
|
auto i = data.find (name);
|
||||||
if (i != data.end ())
|
if (i != data.end ())
|
||||||
|
@ -1695,7 +1695,7 @@ void Task::validate_before (const std::string& left, const std::string& right)
|
||||||
// Encode values prior to serialization.
|
// Encode values prior to serialization.
|
||||||
// [ -> &open;
|
// [ -> &open;
|
||||||
// ] -> &close;
|
// ] -> &close;
|
||||||
std::string Task::encode (const std::string& value) const
|
const std::string Task::encode (const std::string& value) const
|
||||||
{
|
{
|
||||||
auto modified = str_replace (value, "[", "&open;");
|
auto modified = str_replace (value, "[", "&open;");
|
||||||
return str_replace (modified, "]", "&close;");
|
return str_replace (modified, "]", "&close;");
|
||||||
|
@ -1705,7 +1705,7 @@ std::string Task::encode (const std::string& value) const
|
||||||
// Decode values after parse.
|
// Decode values after parse.
|
||||||
// [ <- &open;
|
// [ <- &open;
|
||||||
// ] <- &close;
|
// ] <- &close;
|
||||||
std::string Task::decode (const std::string& value) const
|
const std::string Task::decode (const std::string& value) const
|
||||||
{
|
{
|
||||||
if (value.find ('&') == std::string::npos)
|
if (value.find ('&') == std::string::npos)
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -89,8 +89,8 @@ public:
|
||||||
void setAsNow (const std::string&);
|
void setAsNow (const std::string&);
|
||||||
bool has (const std::string&) const;
|
bool has (const std::string&) const;
|
||||||
std::vector <std::string> all ();
|
std::vector <std::string> all ();
|
||||||
std::string identifier (bool shortened = false) const;
|
const std::string identifier (bool shortened = false) const;
|
||||||
std::string get (const std::string&) const;
|
const std::string get (const std::string&) const;
|
||||||
const std::string& get_ref (const std::string&) const;
|
const std::string& get_ref (const std::string&) const;
|
||||||
int get_int (const std::string&) const;
|
int get_int (const std::string&) const;
|
||||||
unsigned long get_ulong (const std::string&) const;
|
unsigned long get_ulong (const std::string&) const;
|
||||||
|
@ -168,8 +168,8 @@ private:
|
||||||
void parseJSON (const json::object*);
|
void parseJSON (const json::object*);
|
||||||
void parseLegacy (const std::string&);
|
void parseLegacy (const std::string&);
|
||||||
void validate_before (const std::string&, const std::string&);
|
void validate_before (const std::string&, const std::string&);
|
||||||
std::string encode (const std::string&) const;
|
const std::string encode (const std::string&) const;
|
||||||
std::string decode (const std::string&) const;
|
const std::string decode (const std::string&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float urgency_project () const;
|
float urgency_project () const;
|
||||||
|
|
|
@ -159,7 +159,7 @@ void uuid_unparse_lower (uuid_t uu, char *out)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string uuid ()
|
const std::string uuid ()
|
||||||
{
|
{
|
||||||
uuid_t id;
|
uuid_t id;
|
||||||
uuid_generate (id);
|
uuid_generate (id);
|
||||||
|
@ -198,7 +198,7 @@ std::string uuid ()
|
||||||
// - delimiter is the character used to split up projects into subprojects.
|
// - delimiter is the character used to split up projects into subprojects.
|
||||||
// - defaults to the period, '.'
|
// - defaults to the period, '.'
|
||||||
//
|
//
|
||||||
std::string indentProject (
|
const std::string indentProject (
|
||||||
const std::string& project,
|
const std::string& project,
|
||||||
const std::string& whitespace /* = " " */,
|
const std::string& whitespace /* = " " */,
|
||||||
char delimiter /* = '.' */)
|
char delimiter /* = '.' */)
|
||||||
|
@ -226,7 +226,7 @@ std::string indentProject (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <std::string> extractParents (
|
const std::vector <std::string> extractParents (
|
||||||
const std::string& project,
|
const std::string& project,
|
||||||
const char& delimiter /* = '.' */)
|
const char& delimiter /* = '.' */)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,14 +45,14 @@ int confirm4 (const std::string&);
|
||||||
#ifndef HAVE_UUID_UNPARSE_LOWER
|
#ifndef HAVE_UUID_UNPARSE_LOWER
|
||||||
void uuid_unparse_lower (uuid_t uu, char *out);
|
void uuid_unparse_lower (uuid_t uu, char *out);
|
||||||
#endif
|
#endif
|
||||||
std::string uuid ();
|
const std::string uuid ();
|
||||||
|
|
||||||
std::string indentProject (
|
const std::string indentProject (
|
||||||
const std::string&,
|
const std::string&,
|
||||||
const std::string& whitespace = " ",
|
const std::string& whitespace = " ",
|
||||||
char delimiter = '.');
|
char delimiter = '.');
|
||||||
|
|
||||||
std::vector <std::string> extractParents (
|
const std::vector <std::string> extractParents (
|
||||||
const std::string&,
|
const std::string&,
|
||||||
const char& delimiter = '.');
|
const char& delimiter = '.');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue