Revert "[clang-tidy] Use .empty instead of comparing size"

This reverts commit a331cceded.
This commit is contained in:
Paul Beckingham 2020-12-05 16:18:15 -05:00
parent b2d46a1eba
commit 3e0a428185
18 changed files with 132 additions and 132 deletions

View file

@ -162,7 +162,7 @@ void A2::decompose ()
if (name == "rc") if (name == "rc")
{ {
if (!mod.empty()) if (mod != "")
tag ("CONFIG"); tag ("CONFIG");
else else
tag ("RC"); tag ("RC");
@ -258,7 +258,7 @@ bool CLI2::getDataLocation (int argc, const char** argv, Path& data)
if (value == nullptr) if (value == nullptr)
{ {
std::string location = Context::getContext ().config.get ("data.location"); std::string location = Context::getContext ().config.get ("data.location");
if (!location.empty()) if (location != "")
data = location; data = location;
return false; return false;
} }
@ -573,7 +573,7 @@ void CLI2::addContextFilter ()
// Detect if any context is set, and bail out if not // Detect if any context is set, and bail out if not
std::string contextName = Context::getContext ().config.get ("context"); std::string contextName = Context::getContext ().config.get ("context");
if (contextName.empty()) if (contextName == "")
{ {
Context::getContext ().debug ("No context."); Context::getContext ().debug ("No context.");
return; return;
@ -595,7 +595,7 @@ void CLI2::addContextFilter ()
Context::getContext ().debug ("Applying context: " + contextName); Context::getContext ().debug ("Applying context: " + contextName);
std::string contextFilter = Context::getContext ().config.get ("context." + contextName); std::string contextFilter = Context::getContext ().config.get ("context." + contextName);
if (contextFilter.empty()) if (contextFilter == "")
Context::getContext ().debug ("Context '" + contextName + "' not defined."); Context::getContext ().debug ("Context '" + contextName + "' not defined.");
else else
{ {
@ -635,14 +635,14 @@ void CLI2::prepareFilter ()
{ {
if (a.hasTag ("FILTER")) if (a.hasTag ("FILTER"))
{ {
if (!combined.empty()) if (combined != "")
combined += ' '; combined += ' ';
combined += a.attribute ("raw"); combined += a.attribute ("raw");
} }
} }
if (!combined.empty()) if (combined.size ())
Context::getContext ().footnote (std::string ("Filter: ") + combined); Context::getContext ().footnote (std::string ("Filter: ") + combined);
} }
} }
@ -704,7 +704,7 @@ bool CLI2::canonicalize (
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string CLI2::getBinary () const std::string CLI2::getBinary () const
{ {
if (!_args.empty()) if (_args.size ())
return _args[0].attribute ("raw"); return _args[0].attribute ("raw");
return ""; return "";
@ -743,14 +743,14 @@ const std::string CLI2::dump (const std::string& title) const
out << '\n'; out << '\n';
if (!_args.empty()) if (_args.size ())
{ {
out << " _args\n"; out << " _args\n";
for (const auto& a : _args) for (const auto& a : _args)
out << " " << a.dump () << '\n'; out << " " << a.dump () << '\n';
} }
if (!_id_ranges.empty()) if (_id_ranges.size ())
{ {
out << " _id_ranges\n "; out << " _id_ranges\n ";
for (const auto& range : _id_ranges) for (const auto& range : _id_ranges)
@ -764,7 +764,7 @@ const std::string CLI2::dump (const std::string& title) const
out << '\n'; out << '\n';
} }
if (!_uuid_list.empty()) if (_uuid_list.size ())
{ {
out << " _uuid_list\n "; out << " _uuid_list\n ";
for (const auto& uuid : _uuid_list) for (const auto& uuid : _uuid_list)
@ -1229,7 +1229,7 @@ void CLI2::desugarFilterAttributes ()
// An unquoted string, while equivalent to an empty string, doesn't cause // An unquoted string, while equivalent to an empty string, doesn't cause
// an operand shortage in eval. // an operand shortage in eval.
if (value.empty()) if (value == "")
value = "''"; value = "''";
// Some values are expressions, which need to be lexed. The best way to // Some values are expressions, which need to be lexed. The best way to
@ -1278,7 +1278,7 @@ void CLI2::desugarFilterAttributes ()
rhs.tag ("FILTER"); rhs.tag ("FILTER");
// Special case for '<name>:<value>'. // Special case for '<name>:<value>'.
if (mod.empty()) if (mod == "")
{ {
op.attribute ("raw", "="); op.attribute ("raw", "=");
rhs.attribute ("raw", value); rhs.attribute ("raw", value);
@ -1515,7 +1515,7 @@ void CLI2::findIDs ()
// listed as a MODIFICATION. // listed as a MODIFICATION.
std::string command = getCommand (); std::string command = getCommand ();
if (_id_ranges.empty() && if (! _id_ranges.size () &&
filterCount == 0 && filterCount == 0 &&
command != "add" && command != "add" &&
command != "log") command != "log")
@ -1606,7 +1606,7 @@ void CLI2::findUUIDs ()
} }
} }
if (_uuid_list.empty()) if (! _uuid_list.size ())
{ {
for (auto& a : _args) for (auto& a : _args)
{ {
@ -1655,8 +1655,8 @@ void CLI2::insertIDExpr ()
{ {
// Skip completely if no ID/UUID was found. This is because below, '(' and ')' // Skip completely if no ID/UUID was found. This is because below, '(' and ')'
// are inserted regardless of list size. // are inserted regardless of list size.
if (_id_ranges.empty() && if (! _id_ranges.size () &&
_uuid_list.empty()) ! _uuid_list.size ())
return; return;
// Find the *first* occurence of lexer type set/number/uuid, and replace it // Find the *first* occurence of lexer type set/number/uuid, and replace it
@ -1759,8 +1759,8 @@ void CLI2::insertIDExpr ()
} }
// Combine the ID and UUID sections with 'or'. // Combine the ID and UUID sections with 'or'.
if (!_id_ranges.empty() && if (_id_ranges.size () &&
!_uuid_list.empty()) _uuid_list.size ())
reconstructed.push_back (opOr); reconstructed.push_back (opOr);
// Add all UUID list items. // Add all UUID list items.
@ -2033,7 +2033,7 @@ void CLI2::defaultCommand ()
{ {
// Apply overrides, if any. // Apply overrides, if any.
std::string defaultCommand = Context::getContext ().config.get ("default.command"); std::string defaultCommand = Context::getContext ().config.get ("default.command");
if (!defaultCommand.empty()) if (defaultCommand != "")
{ {
// Modify _args, _original_args to be: // Modify _args, _original_args to be:
// <args0> [<def0> ...] <args1> [...] // <args0> [<def0> ...] <args1> [...]

View file

@ -779,7 +779,7 @@ int Context::dispatch (std::string &out)
{ {
// Autocomplete args against keywords. // Autocomplete args against keywords.
std::string command = cli2.getCommand (); std::string command = cli2.getCommand ();
if (!command.empty()) if (command != "")
{ {
updateXtermTitle (); updateXtermTitle ();
updateVerbosity (); updateVerbosity ();
@ -1026,7 +1026,7 @@ void Context::getLimits (int& rows, int& lines)
// This is an integer specified as a filter (limit:10). // This is an integer specified as a filter (limit:10).
auto limit = config.get ("limit"); auto limit = config.get ("limit");
if (!limit.empty()) if (limit != "")
{ {
if (limit == "page") if (limit == "page")
{ {
@ -1106,7 +1106,7 @@ void Context::staticInitialization ()
void Context::createDefaultConfig () void Context::createDefaultConfig ()
{ {
// Do we need to create a default rc? // Do we need to create a default rc?
if (!rc_file._data.empty() && ! rc_file.exists ()) if (rc_file._data != "" && ! rc_file.exists ())
{ {
if (config.getBoolean ("confirmation") && if (config.getBoolean ("confirmation") &&
! confirm ( format ("A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so Taskwarrior can proceed?", home_dir, rc_file._data))) ! confirm ( format ("A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so Taskwarrior can proceed?", home_dir, rc_file._data)))
@ -1240,7 +1240,7 @@ void Context::updateXtermTitle ()
void Context::updateVerbosity () void Context::updateVerbosity ()
{ {
auto command = cli2.getCommand (); auto command = cli2.getCommand ();
if (!command.empty() && if (command != "" &&
command[0] == '_') command[0] == '_')
{ {
verbosity = {"nothing"}; verbosity = {"nothing"};

View file

@ -63,7 +63,7 @@
bool getDOM (const std::string& name, Variant& value) bool getDOM (const std::string& name, Variant& value)
{ {
// Special case, blank refs cause problems. // Special case, blank refs cause problems.
if (name.empty()) if (name == "")
return false; return false;
auto len = name.length (); auto len = name.length ();
@ -111,7 +111,7 @@ bool getDOM (const std::string& name, Variant& value)
std::string commandLine; std::string commandLine;
for (auto& arg : Context::getContext ().cli2._original_args) for (auto& arg : Context::getContext ().cli2._original_args)
{ {
if (!commandLine.empty()) if (commandLine != "")
commandLine += ' '; commandLine += ' ';
commandLine += arg.attribute("raw"); commandLine += arg.attribute("raw");
@ -158,7 +158,7 @@ bool getDOM (const std::string& name, Variant& value)
std::string commandLine; std::string commandLine;
for (auto& arg : Context::getContext ().cli2._original_args) for (auto& arg : Context::getContext ().cli2._original_args)
{ {
if (!commandLine.empty()) if (commandLine != "")
commandLine += ' '; commandLine += ' ';
commandLine += arg.attribute("raw"); commandLine += arg.attribute("raw");
@ -242,17 +242,17 @@ bool getDOM (const std::string& name, Variant& value)
bool getDOM (const std::string& name, const Task& task, Variant& value) bool getDOM (const std::string& name, const Task& task, Variant& value)
{ {
// Special case, blank refs cause problems. // Special case, blank refs cause problems.
if (name.empty()) if (name == "")
return false; return false;
// Quickly deal with the most common cases. // Quickly deal with the most common cases.
if (!task.data.empty() && name == "id") if (task.data.size () && name == "id")
{ {
value = Variant (static_cast<int> (task.id)); value = Variant (static_cast<int> (task.id));
return true; return true;
} }
if (!task.data.empty() && name == "urgency") if (task.data.size () && name == "urgency")
{ {
value = Variant (task.urgency_c ()); value = Variant (task.urgency_c ());
return true; return true;
@ -295,13 +295,13 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
{ {
// Now that 'ref' is the contextual task, and any ID/UUID is chopped off the // Now that 'ref' is the contextual task, and any ID/UUID is chopped off the
// elements vector, DOM resolution is now simple. // elements vector, DOM resolution is now simple.
if (!ref.data.empty() && size == 1 && canonical == "id") if (ref.data.size () && size == 1 && canonical == "id")
{ {
value = Variant (static_cast<int> (ref.id)); value = Variant (static_cast<int> (ref.id));
return true; return true;
} }
if (!ref.data.empty() && size == 1 && canonical == "urgency") if (ref.data.size () && size == 1 && canonical == "urgency")
{ {
value = Variant (ref.urgency_c ()); value = Variant (ref.urgency_c ());
return true; return true;
@ -309,7 +309,7 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
Column* column = Context::getContext ().columns[canonical]; Column* column = Context::getContext ().columns[canonical];
if (!ref.data.empty() && size == 1 && column) if (ref.data.size () && size == 1 && column)
{ {
if (column->is_uda () && ! ref.has (canonical)) if (column->is_uda () && ! ref.has (canonical))
{ {
@ -344,13 +344,13 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
return true; return true;
} }
if (!ref.data.empty() && size == 2 && canonical == "tags") if (ref.data.size () && size == 2 && canonical == "tags")
{ {
value = Variant (ref.hasTag (elements[1]) ? elements[1] : ""); value = Variant (ref.hasTag (elements[1]) ? elements[1] : "");
return true; return true;
} }
if (!ref.data.empty() && size == 2 && column && column->type () == "date") if (ref.data.size () && size == 2 && column && column->type () == "date")
{ {
Datetime date (ref.get_date (canonical)); Datetime date (ref.get_date (canonical));
if (elements[1] == "year") { value = Variant (static_cast<int> (date.year ())); return true; } if (elements[1] == "year") { value = Variant (static_cast<int> (date.year ())); return true; }
@ -365,13 +365,13 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
} }
} }
if (!ref.data.empty() && size == 2 && elements[0] == "annotations" && elements[1] == "count") if (ref.data.size () && size == 2 && elements[0] == "annotations" && elements[1] == "count")
{ {
value = Variant (static_cast<int> (ref.getAnnotationCount ())); value = Variant (static_cast<int> (ref.getAnnotationCount ()));
return true; return true;
} }
if (!ref.data.empty() && size == 3 && elements[0] == "annotations") if (ref.data.size () && size == 3 && elements[0] == "annotations")
{ {
auto annos = ref.getAnnotations (); auto annos = ref.getAnnotations ();
@ -399,7 +399,7 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
} }
} }
if (!ref.data.empty() && size == 4 && elements[0] == "annotations" && elements[2] == "entry") if (ref.data.size () && size == 4 && elements[0] == "annotations" && elements[2] == "entry")
{ {
auto annos = ref.getAnnotations (); auto annos = ref.getAnnotations ();

View file

@ -218,7 +218,7 @@ void Eval::evaluatePostfixStack (
const std::vector <std::pair <std::string, Lexer::Type>>& tokens, const std::vector <std::pair <std::string, Lexer::Type>>& tokens,
Variant& result) const Variant& result) const
{ {
if (tokens.empty()) if (tokens.size () == 0)
throw std::string ("No expression to evaluate."); throw std::string ("No expression to evaluate.");
// This is stack used by the postfix evaluator. // This is stack used by the postfix evaluator.
@ -229,7 +229,7 @@ void Eval::evaluatePostfixStack (
if (token.second == Lexer::Type::op && if (token.second == Lexer::Type::op &&
token.first == "!") token.first == "!")
{ {
if (values.empty()) if (values.size () < 1)
throw std::string ("The expression could not be evaluated."); throw std::string ("The expression could not be evaluated.");
Variant right = values.back (); Variant right = values.back ();
@ -242,7 +242,7 @@ void Eval::evaluatePostfixStack (
else if (token.second == Lexer::Type::op && else if (token.second == Lexer::Type::op &&
token.first == "_neg_") token.first == "_neg_")
{ {
if (values.empty()) if (values.size () < 1)
throw std::string ("The expression could not be evaluated."); throw std::string ("The expression could not be evaluated.");
Variant right = values.back (); Variant right = values.back ();
@ -755,14 +755,14 @@ void Eval::infixToPostfix (
else if (token.second == Lexer::Type::op && else if (token.second == Lexer::Type::op &&
token.first == ")") token.first == ")")
{ {
while (!op_stack.empty() && while (op_stack.size () &&
op_stack.back ().first != "(") op_stack.back ().first != "(")
{ {
postfix.push_back (op_stack.back ()); postfix.push_back (op_stack.back ());
op_stack.pop_back (); op_stack.pop_back ();
} }
if (!op_stack.empty()) if (op_stack.size ())
op_stack.pop_back (); op_stack.pop_back ();
else else
throw std::string ("Mismatched parentheses in expression"); throw std::string ("Mismatched parentheses in expression");
@ -773,7 +773,7 @@ void Eval::infixToPostfix (
char type2; char type2;
unsigned int precedence2; unsigned int precedence2;
char associativity2; char associativity2;
while (!op_stack.empty() && while (op_stack.size () > 0 &&
identifyOperator (op_stack.back ().first, type2, precedence2, associativity2) && identifyOperator (op_stack.back ().first, type2, precedence2, associativity2) &&
((associativity == 'l' && precedence <= precedence2) || ((associativity == 'l' && precedence <= precedence2) ||
(associativity == 'r' && precedence < precedence2))) (associativity == 'r' && precedence < precedence2)))
@ -790,7 +790,7 @@ void Eval::infixToPostfix (
} }
} }
while (!op_stack.empty()) while (op_stack.size ())
{ {
if (op_stack.back ().first == "(" || if (op_stack.back ().first == "(" ||
op_stack.back ().first == ")") op_stack.back ().first == ")")

View file

@ -66,7 +66,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
if (a.hasTag ("FILTER")) if (a.hasTag ("FILTER"))
precompiled.push_back (std::pair <std::string, Lexer::Type> (a.getToken (), a._lextype)); precompiled.push_back (std::pair <std::string, Lexer::Type> (a.getToken (), a._lextype));
if (!precompiled.empty()) if (precompiled.size ())
{ {
Eval eval; Eval eval;
eval.addSource (domSource); eval.addSource (domSource);
@ -112,7 +112,7 @@ void Filter::subset (std::vector <Task>& output)
// Shortcut indicates that only pending.data needs to be loaded. // Shortcut indicates that only pending.data needs to be loaded.
bool shortcut = false; bool shortcut = false;
if (!precompiled.empty()) if (precompiled.size ())
{ {
Timer timer_pending; Timer timer_pending;
auto pending = Context::getContext ().tdb2.pending.get_tasks (); auto pending = Context::getContext ().tdb2.pending.get_tasks ();

View file

@ -135,7 +135,7 @@ void Hooks::onLaunch () const
Timer timer; Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-launch"); std::vector <std::string> matchingScripts = scripts ("on-launch");
if (!matchingScripts.empty()) if (matchingScripts.size ())
{ {
for (auto& script : matchingScripts) for (auto& script : matchingScripts)
{ {
@ -188,7 +188,7 @@ void Hooks::onExit () const
Timer timer; Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-exit"); std::vector <std::string> matchingScripts = scripts ("on-exit");
if (!matchingScripts.empty()) if (matchingScripts.size ())
{ {
// Get the set of changed tasks. // Get the set of changed tasks.
std::vector <Task> tasks; std::vector <Task> tasks;
@ -250,7 +250,7 @@ void Hooks::onAdd (Task& task) const
Timer timer; Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-add"); std::vector <std::string> matchingScripts = scripts ("on-add");
if (!matchingScripts.empty()) if (matchingScripts.size ())
{ {
// Convert task to a vector of strings. // Convert task to a vector of strings.
std::vector <std::string> input; std::vector <std::string> input;
@ -316,7 +316,7 @@ void Hooks::onModify (const Task& before, Task& after) const
Timer timer; Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-modify"); std::vector <std::string> matchingScripts = scripts ("on-modify");
if (!matchingScripts.empty()) if (matchingScripts.size ())
{ {
// Convert vector of tasks to a vector of strings. // Convert vector of tasks to a vector of strings.
std::vector <std::string> input; std::vector <std::string> input;
@ -601,7 +601,7 @@ int Hooks::callHookScript (
{ {
Context::getContext ().debug ("Hook: output"); Context::getContext ().debug ("Hook: output");
for (const auto& i : output) for (const auto& i : output)
if (!i.empty()) if (i != "")
Context::getContext ().debug (" " + i); Context::getContext ().debug (" " + i);
Context::getContext ().debug (format ("Hook: Completed with status {1}", status)); Context::getContext ().debug (format ("Hook: Completed with status {1}", status));

View file

@ -123,7 +123,7 @@ bool TF2::get (const std::string& uuid, Task& task)
if (! _loaded_tasks) if (! _loaded_tasks)
load_tasks (); load_tasks ();
if (!_tasks_map.empty() && uuid.size () == 36) if (_tasks_map.size () > 0 && uuid.size () == 36)
{ {
// Fast lookup, same result as below. Only used during "task import". // Fast lookup, same result as below. Only used during "task import".
auto i = _tasks_map.find (uuid); auto i = _tasks_map.find (uuid);
@ -263,8 +263,8 @@ void TF2::commit ()
if (_dirty) if (_dirty)
{ {
// Special case: added but no modified means just append to the file. // Special case: added but no modified means just append to the file.
if (_modified_tasks.empty() && _purged_tasks.empty() && if (!_modified_tasks.size () && !_purged_tasks.size () &&
(!_added_tasks.empty() || !_added_lines.empty())) (_added_tasks.size () || _added_lines.size ()))
{ {
if (_file.open ()) if (_file.open ())
{ {
@ -920,7 +920,7 @@ void TDB2::revert_pending (
Context::getContext ().debug ("TDB::revert - task found in pending.data"); Context::getContext ().debug ("TDB::revert - task found in pending.data");
// Either revert if there was a prior state, or remove the task. // Either revert if there was a prior state, or remove the task.
if (!prior.empty()) if (prior != "")
{ {
*task = prior; *task = prior;
std::cout << STRING_TDB2_REVERTED << '\n'; std::cout << STRING_TDB2_REVERTED << '\n';
@ -953,7 +953,7 @@ void TDB2::revert_completed (
Context::getContext ().debug ("TDB::revert_completed - task found in completed.data"); Context::getContext ().debug ("TDB::revert_completed - task found in completed.data");
// Either revert if there was a prior state, or remove the task. // Either revert if there was a prior state, or remove the task.
if (!prior.empty()) if (prior != "")
{ {
*task = prior; *task = prior;
if (task->find ("status:\"pending\"") != std::string::npos || if (task->find ("status:\"pending\"") != std::string::npos ||
@ -1003,7 +1003,7 @@ void TDB2::revert_backlog (
found = true; found = true;
// If this is a new task (no prior), then just remove it from the backlog. // If this is a new task (no prior), then just remove it from the backlog.
if (!current.empty() && prior.empty()) if (current != "" && prior == "")
{ {
// Yes, this is what is needed, when you want to erase using a reverse // Yes, this is what is needed, when you want to erase using a reverse
// iterator. // iterator.
@ -1055,7 +1055,7 @@ void TDB2::show_diff (
Task after (current); Task after (current);
if (!prior.empty()) if (prior != "")
{ {
Task before (prior); Task before (prior);
@ -1084,7 +1084,7 @@ void TDB2::show_diff (
std::string priorValue = before.get (att.first); std::string priorValue = before.get (att.first);
std::string currentValue = after.get (att.first); std::string currentValue = after.get (att.first);
if (!currentValue.empty()) if (currentValue != "")
{ {
row = view.addRow (); row = view.addRow ();
view.set (row, 0, att.first); view.set (row, 0, att.first);
@ -1135,7 +1135,7 @@ void TDB2::show_diff (
{ {
// Create reference tasks. // Create reference tasks.
Task before; Task before;
if (!prior.empty()) if (prior != "")
before.parse (prior); before.parse (prior);
Task after (current); Task after (current);
@ -1199,7 +1199,7 @@ void TDB2::show_diff (
} }
// Attribute deleted. // Attribute deleted.
else if (!before_att.empty() && after_att.empty()) else if (before_att != "" && after_att == "")
{ {
row = view.addRow (); row = view.addRow ();
view.set (row, 0, '-' + a + ':', color_red); view.set (row, 0, '-' + a + ':', color_red);
@ -1210,7 +1210,7 @@ void TDB2::show_diff (
} }
// Attribute added. // Attribute added.
else if (before_att.empty() && !after_att.empty()) else if (before_att == "" && after_att != "")
{ {
row = view.addRow (); row = view.addRow ();
view.set (row, 0, '-' + a + ':', color_red); view.set (row, 0, '-' + a + ':', color_red);
@ -1417,7 +1417,7 @@ const std::vector <Task> TDB2::children (Task& task)
std::string TDB2::uuid (int id) std::string TDB2::uuid (int id)
{ {
std::string result = pending.uuid (id); std::string result = pending.uuid (id);
if (result.empty()) if (result == "")
result = completed.uuid (id); result = completed.uuid (id);
return result; return result;

View file

@ -156,7 +156,7 @@ void TLSClient::init (
throw format ("Bad System Trust. {1}", gnutls_strerror (ret)); // All throw format ("Bad System Trust. {1}", gnutls_strerror (ret)); // All
#endif #endif
if (!_ca.empty()) if (_ca != "")
{ {
// The gnutls_certificate_set_x509_key_file call returns number of // The gnutls_certificate_set_x509_key_file call returns number of
// certificates parsed on success (including 0, when no certificate was // certificates parsed on success (including 0, when no certificate was
@ -170,8 +170,8 @@ void TLSClient::init (
} }
// TODO This may need 0x030111 protection. // TODO This may need 0x030111 protection.
if (!_cert.empty() && if (_cert != "" &&
!_key.empty() && _key != "" &&
(ret = gnutls_certificate_set_x509_key_file (_credentials, _cert.c_str (), _key.c_str (), GNUTLS_X509_FMT_PEM)) < 0) // 3.1.11 (ret = gnutls_certificate_set_x509_key_file (_credentials, _cert.c_str (), _key.c_str (), GNUTLS_X509_FMT_PEM)) < 0) // 3.1.11
throw format ("Bad client CERT/KEY file. {1}", gnutls_strerror (ret)); // All throw format ("Bad client CERT/KEY file. {1}", gnutls_strerror (ret)); // All
@ -189,7 +189,7 @@ void TLSClient::init (
throw format ("TLS client init error. {1}", gnutls_strerror (ret)); // All throw format ("TLS client init error. {1}", gnutls_strerror (ret)); // All
// Use default priorities unless overridden. // Use default priorities unless overridden.
if (_ciphers.empty()) if (_ciphers == "")
_ciphers = "NORMAL"; _ciphers = "NORMAL";
const char *err; const char *err;

View file

@ -653,7 +653,7 @@ void Task::parseJSON (const json::object* root_obj)
{ {
// If the attribute is a recognized column. // If the attribute is a recognized column.
std::string type = Task::attributes[i.first]; std::string type = Task::attributes[i.first];
if (!type.empty()) if (type != "")
{ {
// Any specified id is ignored. // Any specified id is ignored.
if (i.first == "id") if (i.first == "id")
@ -678,7 +678,7 @@ void Task::parseJSON (const json::object* root_obj)
auto text = i.second->dump (); auto text = i.second->dump ();
Lexer::dequote (text); Lexer::dequote (text);
Datetime d (text); Datetime d (text);
set (i.first, text.empty() ? "" : d.toEpochString ()); set (i.first, text == "" ? "" : d.toEpochString ());
} }
// Tags are an array of JSON strings. // Tags are an array of JSON strings.
@ -840,11 +840,11 @@ std::string Task::composeF4 () const
{ {
// Orphans have no type, treat as string. // Orphans have no type, treat as string.
std::string type = Task::attributes[it.first]; std::string type = Task::attributes[it.first];
if (type.empty()) if (type == "")
type = "string"; type = "string";
// If there is a value. // If there is a value.
if (!it.second.empty()) if (it.second != "")
{ {
ff4 += (first ? "" : " "); ff4 += (first ? "" : " ");
ff4 += it.first; ff4 += it.first;
@ -883,14 +883,14 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
continue; continue;
// If value is an empty string, do not ever output it // If value is an empty string, do not ever output it
if (i.second.empty()) if (i.second == "")
continue; continue;
if (attributes_written) if (attributes_written)
out << ','; out << ',';
std::string type = Task::attributes[i.first]; std::string type = Task::attributes[i.first];
if (type.empty()) if (type == "")
type = "string"; type = "string";
// Date fields are written as ISO 8601. // Date fields are written as ISO 8601.
@ -901,7 +901,7 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
<< (i.first == "modification" ? "modified" : i.first) << (i.first == "modification" ? "modified" : i.first)
<< "\":\"" << "\":\""
// Date was deleted, do not export parsed empty string // Date was deleted, do not export parsed empty string
<< (i.second.empty() ? "" : d.toISO ()) << (i.second == "" ? "" : d.toISO ())
<< '"'; << '"';
++attributes_written; ++attributes_written;
@ -1124,7 +1124,7 @@ void Task::addDependency (int depid)
{ {
// Check that id is resolvable. // Check that id is resolvable.
std::string uuid = Context::getContext ().tdb2.pending.uuid (depid); std::string uuid = Context::getContext ().tdb2.pending.uuid (depid);
if (uuid.empty()) if (uuid == "")
throw format ("Could not create a dependency on task {1} - not found.", depid); throw format ("Could not create a dependency on task {1} - not found.", depid);
std::string depends = get ("depends"); std::string depends = get ("depends");
@ -1146,7 +1146,7 @@ void Task::addDependency (const std::string& uuid)
// Store the dependency. // Store the dependency.
std::string depends = get ("depends"); std::string depends = get ("depends");
if (!depends.empty()) if (depends != "")
{ {
// Check for extant dependency. // Check for extant dependency.
if (depends.find (uuid) == std::string::npos) if (depends.find (uuid) == std::string::npos)
@ -1193,7 +1193,7 @@ void Task::removeDependency (int id)
{ {
std::string depends = get ("depends"); std::string depends = get ("depends");
std::string uuid = Context::getContext ().tdb2.pending.uuid (id); std::string uuid = Context::getContext ().tdb2.pending.uuid (id);
if (!uuid.empty() && depends.find (uuid) != std::string::npos) if (uuid != "" && depends.find (uuid) != std::string::npos)
removeDependency (uuid); removeDependency (uuid);
else else
throw format ("Could not delete a dependency on task {1} - not found.", id); throw format ("Could not delete a dependency on task {1} - not found.", id);
@ -1491,13 +1491,13 @@ void Task::substitute (
void Task::validate (bool applyDefault /* = true */) void Task::validate (bool applyDefault /* = true */)
{ {
Task::status status = Task::pending; Task::status status = Task::pending;
if (!get ("status").empty()) if (get ("status") != "")
status = getStatus (); status = getStatus ();
// 1) Provide missing attributes where possible // 1) Provide missing attributes where possible
// Provide a UUID if necessary. Validate if present. // Provide a UUID if necessary. Validate if present.
std::string uid = get ("uuid"); std::string uid = get ("uuid");
if (has ("uuid") && !uid.empty()) if (has ("uuid") && uid != "")
{ {
Lexer lex (uid); Lexer lex (uid);
std::string token; std::string token;
@ -1513,8 +1513,8 @@ void Task::validate (bool applyDefault /* = true */)
if (status == Task::pending && if (status == Task::pending &&
has ("due") && has ("due") &&
has ("recur") && has ("recur") &&
(! has ("parent") || get ("parent").empty()) && (! has ("parent") || get ("parent") == "") &&
(! has ("template") || get ("template").empty())) (! has ("template") || get ("template") == ""))
{ {
status = Task::recurring; status = Task::recurring;
} }
@ -1532,16 +1532,16 @@ void Task::validate (bool applyDefault /* = true */)
// Tasks with a wait: date get a special status. // Tasks with a wait: date get a special status.
else if (status == Task::pending && else if (status == Task::pending &&
has ("wait") && has ("wait") &&
!get ("wait").empty()) get ("wait") != "")
status = Task::waiting; status = Task::waiting;
// By default, tasks are pending. // By default, tasks are pending.
else if (! has ("status") || get ("status").empty()) else if (! has ("status") || get ("status") == "")
status = Task::pending; status = Task::pending;
// Default to 'periodic' type recurrence. // Default to 'periodic' type recurrence.
if (status == Task::recurring && if (status == Task::recurring &&
(! has ("rtype") || get ("rtype").empty())) (! has ("rtype") || get ("rtype") == ""))
{ {
set ("rtype", "periodic"); set ("rtype", "periodic");
} }
@ -1551,26 +1551,26 @@ void Task::validate (bool applyDefault /* = true */)
#ifdef PRODUCT_TASKWARRIOR #ifdef PRODUCT_TASKWARRIOR
// Provide an entry date unless user already specified one. // Provide an entry date unless user already specified one.
if (! has ("entry") || get ("entry").empty()) if (! has ("entry") || get ("entry") == "")
setAsNow ("entry"); setAsNow ("entry");
// Completed tasks need an end date, so inherit the entry date. // Completed tasks need an end date, so inherit the entry date.
if ((status == Task::completed || status == Task::deleted) && if ((status == Task::completed || status == Task::deleted) &&
(! has ("end") || get ("end").empty())) (! has ("end") || get ("end") == ""))
setAsNow ("end"); setAsNow ("end");
// Pending tasks cannot have an end date, remove if present // Pending tasks cannot have an end date, remove if present
if ((status == Task::pending) && (!get ("end").empty())) if ((status == Task::pending) && (get ("end") != ""))
remove ("end"); remove ("end");
// Provide an entry date unless user already specified one. // Provide an entry date unless user already specified one.
if (! has ("modified") || get ("modified").empty()) if (! has ("modified") || get ("modified") == "")
setAsNow ("modified"); setAsNow ("modified");
if (applyDefault && (! has ("parent") || get ("parent").empty())) if (applyDefault && (! has ("parent") || get ("parent") == ""))
{ {
// Override with default.project, if not specified. // Override with default.project, if not specified.
if (!Task::defaultProject.empty() && if (Task::defaultProject != "" &&
! has ("project")) ! has ("project"))
{ {
if (Context::getContext ().columns["project"]->validate (Task::defaultProject)) if (Context::getContext ().columns["project"]->validate (Task::defaultProject))
@ -1578,7 +1578,7 @@ void Task::validate (bool applyDefault /* = true */)
} }
// Override with default.due, if not specified. // Override with default.due, if not specified.
if (!Task::defaultDue.empty() && if (Task::defaultDue != "" &&
! has ("due")) ! has ("due"))
{ {
if (Context::getContext ().columns["due"]->validate (Task::defaultDue)) if (Context::getContext ().columns["due"]->validate (Task::defaultDue))
@ -1592,7 +1592,7 @@ void Task::validate (bool applyDefault /* = true */)
} }
// Override with default.scheduled, if not specified. // Override with default.scheduled, if not specified.
if (!Task::defaultScheduled.empty() && if (Task::defaultScheduled != "" &&
! has ("scheduled")) ! has ("scheduled"))
{ {
if (Context::getContext ().columns["scheduled"]->validate (Task::defaultScheduled)) if (Context::getContext ().columns["scheduled"]->validate (Task::defaultScheduled))
@ -1620,7 +1620,7 @@ void Task::validate (bool applyDefault /* = true */)
} }
} }
if (!udas.empty()) if (udas.size ())
{ {
// For each of those, setup the default value on the task now, // For each of those, setup the default value on the task now,
// of course only if we don't have one on the command line already // of course only if we don't have one on the command line already
@ -1629,7 +1629,7 @@ void Task::validate (bool applyDefault /* = true */)
std::string defVal= Context::getContext ().config.get ("uda." + uda + ".default"); std::string defVal= Context::getContext ().config.get ("uda." + uda + ".default");
// If the default is empty, or we already have a value, skip it // If the default is empty, or we already have a value, skip it
if (!defVal.empty() && get (uda).empty()) if (defVal != "" && get (uda) == "")
set (uda, defVal); set (uda, defVal);
} }
} }
@ -1652,18 +1652,18 @@ void Task::validate (bool applyDefault /* = true */)
// There is no fixing a missing description. // There is no fixing a missing description.
if (! has ("description")) if (! has ("description"))
throw std::string ("A task must have a description."); throw std::string ("A task must have a description.");
else if (get ("description").empty()) else if (get ("description") == "")
throw std::string ("Cannot add a task that is blank."); throw std::string ("Cannot add a task that is blank.");
// Cannot have a recur frequency with no due date - when would it recur? // Cannot have a recur frequency with no due date - when would it recur?
if (has ("recur") && (! has ("due") || get ("due").empty())) if (has ("recur") && (! has ("due") || get ("due") == ""))
throw std::string ("A recurring task must also have a 'due' date."); throw std::string ("A recurring task must also have a 'due' date.");
// Recur durations must be valid. // Recur durations must be valid.
if (has ("recur")) if (has ("recur"))
{ {
std::string value = get ("recur"); std::string value = get ("recur");
if (!value.empty()) if (value != "")
{ {
Duration p; Duration p;
std::string::size_type i = 0; std::string::size_type i = 0;
@ -2074,13 +2074,13 @@ void Task::modify (modType type, bool text_required /* = false */)
// 'value' requires eval. // 'value' requires eval.
std::string name = a.attribute ("canonical"); std::string name = a.attribute ("canonical");
std::string value = a.attribute ("value"); std::string value = a.attribute ("value");
if (value.empty() || if (value == "" ||
value == "''" || value == "''" ||
value == "\"\"") value == "\"\"")
{ {
// ::composeF4 will skip if the value is blank, but the presence of // ::composeF4 will skip if the value is blank, but the presence of
// the attribute will prevent ::validate from applying defaults. // the attribute will prevent ::validate from applying defaults.
if ((has (name) && !get (name).empty()) || if ((has (name) && get (name) != "") ||
(name == "due" && Context::getContext ().config.has ("default.due")) || (name == "due" && Context::getContext ().config.has ("default.due")) ||
(name == "scheduled" && Context::getContext ().config.has ("default.scheduled")) || (name == "scheduled" && Context::getContext ().config.has ("default.scheduled")) ||
(name == "project" && Context::getContext ().config.has ("default.project"))) (name == "project" && Context::getContext ().config.has ("default.project")))
@ -2155,7 +2155,7 @@ void Task::modify (modType type, bool text_required /* = false */)
// Unknown args are accumulated as though they were WORDs. // Unknown args are accumulated as though they were WORDs.
else else
{ {
if (!text.empty()) if (text != "")
text += ' '; text += ' ';
text += a.attribute ("raw"); text += a.attribute ("raw");
} }
@ -2164,7 +2164,7 @@ void Task::modify (modType type, bool text_required /* = false */)
// Task::modType determines what happens to the WORD arguments, if there are // Task::modType determines what happens to the WORD arguments, if there are
// any. // any.
if (!text.empty()) if (text != "")
{ {
Lexer::dequote (text); Lexer::dequote (text);

View file

@ -1900,7 +1900,7 @@ void Variant::cast (const enum type new_type)
break; break;
} }
if (!dateFormat.empty()) if (dateFormat != "")
{ {
_date = Datetime (_string, dateFormat).toEpoch (); _date = Datetime (_string, dateFormat).toEpoch ();
break; break;
@ -1961,7 +1961,7 @@ bool Variant::trivial () const
{ {
return (_type == type_integer && _integer == 0) || return (_type == type_integer && _integer == 0) ||
(_type == type_real && _real == 0.0) || (_type == type_real && _real == 0.0) ||
(_type == type_string && _string.empty()) || (_type == type_string && _string == "") ||
(_type == type_date && _date == 0) || (_type == type_date && _date == 0) ||
(_type == type_duration && _duration == 0); (_type == type_duration && _duration == 0);
} }

View file

@ -327,7 +327,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
// Listing breaks are simply blank lines inserted when a column value // Listing breaks are simply blank lines inserted when a column value
// changes. // changes.
if (s > 0 && if (s > 0 &&
!_breaks.empty()) _breaks.size () > 0)
{ {
for (auto& b : _breaks) for (auto& b : _breaks)
{ {

View file

@ -58,7 +58,7 @@ std::vector <Task> dependencyGetBlocking (const Task& task)
auto depends = task.get ("depends"); auto depends = task.get ("depends");
std::vector <Task> blocking; std::vector <Task> blocking;
if (!depends.empty()) if (depends != "")
for (auto& it : Context::getContext ().tdb2.pending.get_tasks ()) for (auto& it : Context::getContext ().tdb2.pending.get_tasks ())
if (it.getStatus () != Task::completed && if (it.getStatus () != Task::completed &&
it.getStatus () != Task::deleted && it.getStatus () != Task::deleted &&
@ -153,7 +153,7 @@ void dependencyChainOnComplete (Task& task)
auto blocking = dependencyGetBlocking (task); auto blocking = dependencyGetBlocking (task);
// If the task is anything but the tail end of a dependency chain. // If the task is anything but the tail end of a dependency chain.
if (!blocking.empty()) if (blocking.size ())
{ {
auto blocked = dependencyGetBlocked (task); auto blocked = dependencyGetBlocked (task);
@ -168,7 +168,7 @@ void dependencyChainOnComplete (Task& task)
} }
// If there are both blocking and blocked tasks, the chain is broken. // If there are both blocking and blocked tasks, the chain is broken.
if (!blocked.empty()) if (blocked.size ())
{ {
if (Context::getContext ().config.getBoolean ("dependency.reminder")) if (Context::getContext ().config.getBoolean ("dependency.reminder"))
{ {
@ -211,7 +211,7 @@ void dependencyChainOnStart (Task& task)
// If the task is anything but the tail end of a dependency chain, nag about // If the task is anything but the tail end of a dependency chain, nag about
// broken chain. // broken chain.
if (!blocking.empty()) if (blocking.size ())
{ {
std::cout << format (STRING_DEPEND_BLOCKED, task.identifier ()) std::cout << format (STRING_DEPEND_BLOCKED, task.identifier ())
<< '\n'; << '\n';

View file

@ -208,8 +208,8 @@ std::string taskInfoDifferences (
if (name != "uuid" && if (name != "uuid" &&
name != "modified" && name != "modified" &&
before.get (name) != after.get (name) && before.get (name) != after.get (name) &&
!before.get (name).empty() && before.get (name) != "" &&
!after.get (name).empty()) after.get (name) != "")
{ {
if (name == "depends") if (name == "depends")
{ {
@ -245,10 +245,10 @@ std::string renderAttribute (const std::string& name, const std::string& value,
Column* col = Context::getContext ().columns[name]; Column* col = Context::getContext ().columns[name];
if (col && if (col &&
col->type () == "date" && col->type () == "date" &&
!value.empty()) value != "")
{ {
Datetime d ((time_t)strtol (value.c_str (), nullptr, 10)); Datetime d ((time_t)strtol (value.c_str (), nullptr, 10));
if (format.empty()) if (format == "")
return d.toString (Context::getContext ().config.get ("dateformat")); return d.toString (Context::getContext ().config.get ("dateformat"));
return d.toString (format); return d.toString (format);
@ -379,7 +379,7 @@ void feedback_unblocked (const Task& task)
for (auto& i : blocked) for (auto& i : blocked)
{ {
auto blocking = dependencyGetBlocking (i); auto blocking = dependencyGetBlocking (i);
if (blocking.empty()) if (blocking.size () == 0)
{ {
if (i.id) if (i.id)
std::cout << format ("Unblocked {1} '{2}'.", std::cout << format ("Unblocked {1} '{2}'.",
@ -402,7 +402,7 @@ void feedback_unblocked (const Task& task)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void feedback_backlog () void feedback_backlog ()
{ {
if (!Context::getContext ().config.get ("taskd.server").empty() && if (Context::getContext ().config.get ("taskd.server") != "" &&
Context::getContext ().verbose ("sync")) Context::getContext ().verbose ("sync"))
{ {
int count = 0; int count = 0;
@ -423,7 +423,7 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
std::stringstream msg; std::stringstream msg;
std::string project = task.get ("project"); std::string project = task.get ("project");
if (!project.empty()) if (project != "")
{ {
if (scope) if (scope)
msg << format ("The project '{1}' has changed.", project) msg << format ("The project '{1}' has changed.", project)

View file

@ -116,7 +116,7 @@ std::string legacyCheckForDeprecatedVariables ()
} }
std::stringstream out; std::stringstream out;
if (!deprecated.empty()) if (deprecated.size ())
{ {
out << "Your .taskrc file contains variables that are deprecated:\n"; out << "Your .taskrc file contains variables that are deprecated:\n";
@ -149,7 +149,7 @@ std::string legacyCheckForDeprecatedColumns ()
std::stringstream out; std::stringstream out;
out << "\n"; out << "\n";
if (!deprecated.empty()) if (deprecated.size ())
{ {
out << "Your .taskrc file contains reports with deprecated columns. Please check for entry_time, start_time or end_time in:\n"; out << "Your .taskrc file contains reports with deprecated columns. Please check for entry_time, start_time or end_time in:\n";

View file

@ -41,7 +41,7 @@ bool nag (Task& task)
return false; return false;
auto msg = Context::getContext ().config.get ("nag"); auto msg = Context::getContext ().config.get ("nag");
if (!msg.empty()) if (msg != "")
{ {
// Scan all pending, non-recurring tasks. // Scan all pending, non-recurring tasks.
auto pending = Context::getContext ().tdb2.pending.get_tasks (); auto pending = Context::getContext ().tdb2.pending.get_tasks ();

View file

@ -155,7 +155,7 @@ bool generateDueDates (Task& parent, std::vector <Datetime>& allDue)
bool specificEnd = false; bool specificEnd = false;
Datetime until; Datetime until;
if (!parent.get ("until").empty()) if (parent.get ("until") != "")
{ {
until = Datetime (parent.get ("until")); until = Datetime (parent.get ("until"));
specificEnd = true; specificEnd = true;
@ -371,7 +371,7 @@ void updateRecurrenceMask (Task& task)
auto uuid = task.get ("parent"); auto uuid = task.get ("parent");
Task parent; Task parent;
if (!uuid.empty() && if (uuid != "" &&
Context::getContext ().tdb2.get (uuid, parent)) Context::getContext ().tdb2.get (uuid, parent))
{ {
unsigned int index = strtol (task.get ("imask").c_str (), nullptr, 10); unsigned int index = strtol (task.get ("imask").c_str (), nullptr, 10);

View file

@ -279,7 +279,7 @@ static std::vector <Datetime> generateAllDueDates (const Task& templateTask)
bool end_in_sight = false; bool end_in_sight = false;
Datetime until; Datetime until;
if (!templateTask.get ("until").empty()) if (templateTask.get ("until") != "")
{ {
until = Datetime (templateTask.get ("until")); until = Datetime (templateTask.get ("until"));
end_in_sight = true; end_in_sight = true;
@ -296,7 +296,7 @@ static std::vector <Datetime> generateAllDueDates (const Task& templateTask)
Datetime nextDue = generateNextDueDate (due, recur, lastN); Datetime nextDue = generateNextDueDate (due, recur, lastN);
// TODO Safety. // TODO Safety.
if (!dueDates.empty() && dueDates.back () == nextDue) if (dueDates.size () && dueDates.back () == nextDue)
break; break;
// If nextDue > until, it means there are no more tasks to generate, so // If nextDue > until, it means there are no more tasks to generate, so

View file

@ -55,7 +55,7 @@ void sort_tasks (
global_keys = split (keys, ','); global_keys = split (keys, ',');
// Only sort if necessary. // Only sort if necessary.
if (!order.empty()) if (order.size ())
std::stable_sort (order.begin (), order.end (), sort_compare); std::stable_sort (order.begin (), order.end (), sort_compare);
Context::getContext ().time_sort_us += timer.total_us (); Context::getContext ().time_sort_us += timer.total_us ();
@ -68,7 +68,7 @@ void sort_projects (
for (auto& project : allProjects) for (auto& project : allProjects)
{ {
const std::vector <std::string> parents = extractParents (project.first); const std::vector <std::string> parents = extractParents (project.first);
if (!parents.empty()) if (parents.size ())
{ {
// if parents exist: store iterator position of last parent // if parents exist: store iterator position of last parent
std::list <std::pair <std::string, int>>::iterator parent_pos; std::list <std::pair <std::string, int>>::iterator parent_pos;
@ -184,10 +184,10 @@ static bool sort_compare (int left, int right)
auto left_string = (*global_data)[left].get_ref (field); auto left_string = (*global_data)[left].get_ref (field);
auto right_string = (*global_data)[right].get_ref (field); auto right_string = (*global_data)[right].get_ref (field);
if (!left_string.empty() && right_string.empty()) if (left_string != "" && right_string == "")
return true; return true;
if (left_string.empty() && !right_string.empty()) if (left_string == "" && right_string != "")
return false; return false;
if (left_string == right_string) if (left_string == right_string)
@ -207,10 +207,10 @@ static bool sort_compare (int left, int right)
if (left_string == right_string) if (left_string == right_string)
continue; continue;
if (left_string.empty() && !right_string.empty()) if (left_string == "" && right_string != "")
return ascending; return ascending;
if (!left_string.empty() && right_string.empty()) if (left_string != "" && right_string == "")
return !ascending; return !ascending;
// Sort on the first dependency. // Sort on the first dependency.
@ -274,9 +274,9 @@ static bool sort_compare (int left, int right)
else else
{ {
// Empty values are unconditionally last, if no custom order was specified. // Empty values are unconditionally last, if no custom order was specified.
if (left_string.empty()) if (left_string == "")
return false; return false;
else if (right_string.empty()) else if (right_string == "")
return true; return true;
return ascending ? (left_string < right_string) return ascending ? (left_string < right_string)
@ -289,10 +289,10 @@ static bool sort_compare (int left, int right)
auto left_string = (*global_data)[left].get_ref (field); auto left_string = (*global_data)[left].get_ref (field);
auto right_string = (*global_data)[right].get_ref (field); auto right_string = (*global_data)[right].get_ref (field);
if (!left_string.empty() && right_string.empty()) if (left_string != "" && right_string == "")
return true; return true;
if (left_string.empty() && !right_string.empty()) if (left_string == "" && right_string != "")
return false; return false;
if (left_string == right_string) if (left_string == right_string)