From 8bd27485a9bca535a598447aa550d862ba3a8b42 Mon Sep 17 00:00:00 2001 From: Jessica James Date: Mon, 29 Nov 2021 23:30:55 -0600 Subject: [PATCH] Remove isNotEmpty --- src/common/File.cpp | 2 +- src/common/IRC_Client.cpp | 12 ++++++------ src/include/Jupiter/Readable_String.h | 7 ------- src/include/Jupiter/String_Imp.h | 8 ++++---- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/common/File.cpp b/src/common/File.cpp index c5b5922..2f1dd84 100644 --- a/src/common/File.cpp +++ b/src/common/File.cpp @@ -150,7 +150,7 @@ bool Jupiter::File::load(FILE *file) { chr = fgetc(file); if (chr == EOF) { - if (buffer.isNotEmpty()) { + if (!buffer.empty()) { m_data->lines.emplace_back(buffer); return true; } diff --git a/src/common/IRC_Client.cpp b/src/common/IRC_Client.cpp index 483717c..a2594ee 100644 --- a/src/common/IRC_Client.cpp +++ b/src/common/IRC_Client.cpp @@ -379,7 +379,7 @@ size_t Jupiter::IRC::Client::messageChannels(const Jupiter::ReadableString &mess int Jupiter::IRC::Client::process_line(std::string_view in_line) { Jupiter::ReferenceString line{in_line}; // TODO: remove this - if (line.isNotEmpty()) + if (!line.empty()) { Jupiter::IRC::Client::writeToLogs(line); if (m_output != nullptr) { @@ -390,7 +390,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) { auto first_split = jessilib::split_once_view(line, " "sv); Jupiter::ReferenceString w1 = first_split.first; - if (w1.isNotEmpty()) + if (!w1.empty()) { int numeric = asInt(first_split.second); if (w1[0] == ':') { //Messages @@ -802,7 +802,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) { } else { auto sender = getSender(line); - if (sender.isNotEmpty()) { + if (!sender.empty()) { this->OnServerNotice(channel_name, sender, message); for (auto& plugin: Jupiter::plugins) { plugin->OnServerNotice(this, channel_name, sender, message); @@ -864,7 +864,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) { } else if (jessilib::equalsi(command_token, "PART"sv)) { auto nick = getSender(line); - if (nick.isNotEmpty()) { + if (!nick.empty()) { std::string_view channel_name = getLineToken(2); if (!channel_name.empty()) { Channel* channel = getChannel(channel_name); @@ -898,7 +898,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) { std::string_view channel_name = getLineToken(2); if (!channel_name.empty()) { Jupiter::ReferenceString kicker = getSender(line); - if (kicker.isNotEmpty()) { + if (!kicker.empty()) { std::string_view kicked_nickname = getLineToken(3); if (!kicked_nickname.empty()) { Channel* channel = getChannel(channel_name); @@ -966,7 +966,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) { if (!channel_name.empty()) { if (m_chan_types.find(channel_name[0]) != std::string::npos) { auto nick = getSender(line); - if (nick.isNotEmpty()) { + if (!nick.empty()) { std::string_view mode_line = line.substr(std::min(line.find(' ', 2), line.size())); if (!mode_line.empty()) { mode_line.remove_prefix(1); diff --git a/src/include/Jupiter/Readable_String.h b/src/include/Jupiter/Readable_String.h index a42e89e..f0aa2b1 100644 --- a/src/include/Jupiter/Readable_String.h +++ b/src/include/Jupiter/Readable_String.h @@ -67,13 +67,6 @@ namespace Jupiter */ bool empty() const { return size() == 0; }; // KEEP - /** - * @brief Checks if the String is not empty. - * - * @return True if the String is not empty, false otherwise. - */ - virtual bool isNotEmpty() const { return !empty(); }; // REMOVE - /** * @brief Returns the index of the first element in the string with the specified value. * diff --git a/src/include/Jupiter/String_Imp.h b/src/include/Jupiter/String_Imp.h index 334eb50..eb81a97 100644 --- a/src/include/Jupiter/String_Imp.h +++ b/src/include/Jupiter/String_Imp.h @@ -112,7 +112,7 @@ template Jupiter::String_Strict::String_Strict(const Jupiter::Rea const T *itr; const T *end; - if (lhs.isNotEmpty()) + if (!lhs.empty()) { itr = lhs.data(); end = itr + lhs.size(); @@ -146,7 +146,7 @@ template Jupiter::String_Strict::String_Strict(const Jupiter::Rea const T *itr; const T *end; - if (lhs.isNotEmpty()) + if (!lhs.empty()) { itr = lhs.data(); end = itr + lhs.size(); @@ -435,7 +435,7 @@ template Jupiter::String_Loose::String_Loose(const Jupiter::Reada const T *itr; const T *end; - if (lhs.isNotEmpty()) + if (!lhs.empty()) { itr = lhs.data(); end = itr + lhs.size(); @@ -469,7 +469,7 @@ template Jupiter::String_Loose::String_Loose(const Jupiter::Reada const T *itr; const T *end; - if (lhs.isNotEmpty()) + if (!lhs.empty()) { itr = lhs.data(); end = itr + lhs.size();