diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-10 23:35:30 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-10 23:35:30 +0100 |
commit | 8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618 (patch) | |
tree | 3588c5990b6e5d6a0616442cb5bb4a4a76daff65 /src/gui | |
parent | fadc53015b35b6b51313fb1c1debea82e85b8110 (diff) | |
download | mana-8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618.tar.gz mana-8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618.tar.bz2 mana-8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618.tar.xz mana-8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618.zip |
Use string::empty() instead of comparing to ""
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 18 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 2 | ||||
-rw-r--r-- | src/gui/login.cpp | 10 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 2 | ||||
-rw-r--r-- | src/gui/register.cpp | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 48b1cda4..a06b9a6e 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -103,7 +103,7 @@ void BrowserBox::addRow(const std::string &row) newRow += "##<" + bLink.caption; tmp.erase(0, idx3 + 2); - if (tmp != "") + if (!tmp.empty()) { newRow += "##>"; } diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 1c0cea13..2845691a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -91,7 +91,7 @@ Window(""), mNetwork(network), mTmpVisible(false) // Read the party prefix std::string partyPrefix = config.getValue("PartyPrefix", "$"); - mPartyPrefix = (partyPrefix == "" ? '$' : partyPrefix.at(0)); + mPartyPrefix = (partyPrefix.empty() ? '$' : partyPrefix.at(0)); mReturnToggles = config.getValue("ReturnToggles", "0") == "1"; mRecorder = new Recorder(this); mParty = new Party(this, mNetwork); @@ -195,7 +195,7 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##S"; } - if (tmp.nick == "" && tmp.text.substr(0, 17) == "Visible GM status") + if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") { player_node->setGM(); } @@ -449,7 +449,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) msg = msg.substr(0, space); } - if (msg != "" && msg.at(0) == '/') + if (!msg.empty() && msg.at(0) == '/') { msg.erase(0, 1); } @@ -477,7 +477,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) mRecorder->changeRecordingStatus(msg); else if (command == "toggle") { - if (msg == "") + if (msg.empty()) { chatLog(mReturnToggles ? _("Return toggles chat.") : _("Message closes chat."), BY_SERVER); @@ -508,7 +508,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } else if (command == "party") { - if (msg == "") + if (msg.empty()) { chatLog(_("Unknown party command... Type \"/help\" party for more " "information."), BY_SERVER); @@ -519,7 +519,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) std::string rest = (space == std::string::npos ? "" : msg.substr(space + 1, msg.length())); - if (rest != "") + if (!rest.empty()) { msg = msg.substr(0, space); trim(msg); @@ -566,7 +566,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) { if ((*bi)->getType() == Being::PLAYER) { - if (response != "") + if (!response.empty()) { response += ", "; } @@ -758,7 +758,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) { if (command == "prefix") { - if (rest == "") + if (rest.empty()) { char temp[2] = "."; *temp = mPartyPrefix; @@ -789,7 +789,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) void ChatWindow::help(const std::string & msg1, const std::string & msg2) { chatLog(_("-- Help --"), BY_SERVER); - if (msg1 == "") + if (msg1.empty()) { chatLog(_("/announce: Global announcement (GM only)"), BY_SERVER); chatLog(_("/clear: Clears this window"), BY_SERVER); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 200679d1..4c117f0a 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -136,7 +136,7 @@ void ItemPopup::setItem(const ItemInfo &item) mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth, numRowsWeight * getFont()->getHeight())); - if (item.getEffect() == "") + if (item.getEffect().empty()) { setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() + (3 * getFont()->getHeight()))); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 47d5a99e..90ceab1a 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -189,7 +189,7 @@ bool LoginDialog::canSubmit() bool LoginDialog::isUShort(const std::string &str) { - if (str == "") + if (str.empty()) { return false; } @@ -228,7 +228,7 @@ unsigned short LoginDialog::getUShort(const std::string &str) void LoginDialog::DropDownList::saveEntry(const std::string &server, const std::string &port, int &saved) { - if (saved < MAX_SERVER_LIST_SIZE && server != "") + if (saved < MAX_SERVER_LIST_SIZE && !server.empty()) { config.setValue(mConfigPrefix + "Server" + toString(saved), server); config.setValue(mConfigPrefix + "Port" + toString(saved), port); @@ -247,7 +247,7 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, { std::string server = config.getValue(mConfigPrefix + "Server" + toString(i), ""); - if (server == "") // Just in case had original config entries + if (server.empty()) // Just in case had original config entries { server = config.getValue(mConfigPrefix + "ServerList" + toString(i), ""); @@ -255,13 +255,13 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, std::string port = config.getValue(mConfigPrefix + "Port" + toString(i), dfltPort.front()); - if (server != "") + if (!server.empty()) { mServers.push_back(server); mPorts.push_back(port); } } - if (mServers.size() == 0) + if (mServers.empty()) { mServers.assign(dflt.begin(), dflt.end()); mPorts.assign(dfltPort.begin(), dfltPort.end()); diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 022054cc..40ef974b 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -69,7 +69,7 @@ void Recorder::changeRecordingStatus(const std::string &msg) std::string msgCopy = msg; trim(msgCopy); - if (msgCopy == "") + if (msgCopy.empty()) { if (mStream.is_open()) { diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 7e0be5b1..e17f5902 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -249,7 +249,7 @@ bool RegisterDialog::canSubmit() const bool RegisterDialog::isUShort(const std::string &str) { - if (str == "") + if (str.empty()) { return false; } |