Browse Source

Remove isNotEmpty

task/remove_strings
Jessica James 3 years ago
parent
commit
8bd27485a9
  1. 2
      src/common/File.cpp
  2. 12
      src/common/IRC_Client.cpp
  3. 7
      src/include/Jupiter/Readable_String.h
  4. 8
      src/include/Jupiter/String_Imp.h

2
src/common/File.cpp

@ -150,7 +150,7 @@ bool Jupiter::File::load(FILE *file) {
chr = fgetc(file); chr = fgetc(file);
if (chr == EOF) { if (chr == EOF) {
if (buffer.isNotEmpty()) { if (!buffer.empty()) {
m_data->lines.emplace_back(buffer); m_data->lines.emplace_back(buffer);
return true; return true;
} }

12
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) { int Jupiter::IRC::Client::process_line(std::string_view in_line) {
Jupiter::ReferenceString line{in_line}; // TODO: remove this Jupiter::ReferenceString line{in_line}; // TODO: remove this
if (line.isNotEmpty()) if (!line.empty())
{ {
Jupiter::IRC::Client::writeToLogs(line); Jupiter::IRC::Client::writeToLogs(line);
if (m_output != nullptr) { 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); auto first_split = jessilib::split_once_view(line, " "sv);
Jupiter::ReferenceString w1 = first_split.first; Jupiter::ReferenceString w1 = first_split.first;
if (w1.isNotEmpty()) if (!w1.empty())
{ {
int numeric = asInt(first_split.second); int numeric = asInt(first_split.second);
if (w1[0] == ':') { //Messages if (w1[0] == ':') { //Messages
@ -802,7 +802,7 @@ int Jupiter::IRC::Client::process_line(std::string_view in_line) {
} }
else { else {
auto sender = getSender(line); auto sender = getSender(line);
if (sender.isNotEmpty()) { if (!sender.empty()) {
this->OnServerNotice(channel_name, sender, message); this->OnServerNotice(channel_name, sender, message);
for (auto& plugin: Jupiter::plugins) { for (auto& plugin: Jupiter::plugins) {
plugin->OnServerNotice(this, channel_name, sender, message); 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)) { else if (jessilib::equalsi(command_token, "PART"sv)) {
auto nick = getSender(line); auto nick = getSender(line);
if (nick.isNotEmpty()) { if (!nick.empty()) {
std::string_view channel_name = getLineToken(2); std::string_view channel_name = getLineToken(2);
if (!channel_name.empty()) { if (!channel_name.empty()) {
Channel* channel = getChannel(channel_name); 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); std::string_view channel_name = getLineToken(2);
if (!channel_name.empty()) { if (!channel_name.empty()) {
Jupiter::ReferenceString kicker = getSender(line); Jupiter::ReferenceString kicker = getSender(line);
if (kicker.isNotEmpty()) { if (!kicker.empty()) {
std::string_view kicked_nickname = getLineToken(3); std::string_view kicked_nickname = getLineToken(3);
if (!kicked_nickname.empty()) { if (!kicked_nickname.empty()) {
Channel* channel = getChannel(channel_name); 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 (!channel_name.empty()) {
if (m_chan_types.find(channel_name[0]) != std::string::npos) { if (m_chan_types.find(channel_name[0]) != std::string::npos) {
auto nick = getSender(line); auto nick = getSender(line);
if (nick.isNotEmpty()) { if (!nick.empty()) {
std::string_view mode_line = line.substr(std::min(line.find(' ', 2), line.size())); std::string_view mode_line = line.substr(std::min(line.find(' ', 2), line.size()));
if (!mode_line.empty()) { if (!mode_line.empty()) {
mode_line.remove_prefix(1); mode_line.remove_prefix(1);

7
src/include/Jupiter/Readable_String.h

@ -67,13 +67,6 @@ namespace Jupiter
*/ */
bool empty() const { return size() == 0; }; // KEEP 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. * @brief Returns the index of the first element in the string with the specified value.
* *

8
src/include/Jupiter/String_Imp.h

@ -112,7 +112,7 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Rea
const T *itr; const T *itr;
const T *end; const T *end;
if (lhs.isNotEmpty()) if (!lhs.empty())
{ {
itr = lhs.data(); itr = lhs.data();
end = itr + lhs.size(); end = itr + lhs.size();
@ -146,7 +146,7 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Rea
const T *itr; const T *itr;
const T *end; const T *end;
if (lhs.isNotEmpty()) if (!lhs.empty())
{ {
itr = lhs.data(); itr = lhs.data();
end = itr + lhs.size(); end = itr + lhs.size();
@ -435,7 +435,7 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Reada
const T *itr; const T *itr;
const T *end; const T *end;
if (lhs.isNotEmpty()) if (!lhs.empty())
{ {
itr = lhs.data(); itr = lhs.data();
end = itr + lhs.size(); end = itr + lhs.size();
@ -469,7 +469,7 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Reada
const T *itr; const T *itr;
const T *end; const T *end;
if (lhs.isNotEmpty()) if (!lhs.empty())
{ {
itr = lhs.data(); itr = lhs.data();
end = itr + lhs.size(); end = itr + lhs.size();

Loading…
Cancel
Save