From 3b654a09865bb216e42637988d896ef5159cd9fe Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 13 Mar 2019 20:27:52 -0400 Subject: [PATCH] Be more like C++, please. --- indra/newview/hippopanelgrids.cpp | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/indra/newview/hippopanelgrids.cpp b/indra/newview/hippopanelgrids.cpp index 45479a697..53446f17c 100644 --- a/indra/newview/hippopanelgrids.cpp +++ b/indra/newview/hippopanelgrids.cpp @@ -173,7 +173,7 @@ void HippoPanelGridsImpl::refresh() LLComboBox *grids = getChild("grid_selector"); S32 selectIndex = -1, i = 0; grids->removeall(); - if (defaultGrid != "") { + if (!defaultGrid.empty()) { grids->add(defaultGrid); selectIndex = i++; } @@ -193,10 +193,10 @@ void HippoPanelGridsImpl::refresh() if (selectIndex >= 0) { grids->setCurrentByIndex(selectIndex); } else { - grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label + grids->setLabel(LLStringUtil::null); // LLComboBox::removeall() does not clear the label } - childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); + childSetTextArg("default_grid", "[DEFAULT]", !defaultGrid.empty() ? defaultGrid : " "); childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable ); childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0)); @@ -250,7 +250,7 @@ void HippoPanelGridsImpl::loadCurGrid() childSetValue("render_compat", gridInfo->isRenderCompat()); enableEditing(!gridInfo->getLocked()); } else { - std::string empty = ""; + const std::string& empty = LLStringUtil::null; LLComboBox *platform = getChild("platform"); if (platform) platform->setCurrentByIndex(HippoGridInfo::PLATFORM_OTHER); childSetText("gridname", empty); @@ -291,9 +291,9 @@ bool HippoPanelGridsImpl::saveCurGrid() refresh(); std::string gridname = childGetValue("gridname"); - if (gridname == "") gridname = ""; + if (gridname == "") gridname.clear(); std::string loginuri = childGetValue("loginuri"); - if (loginuri == "") loginuri = ""; + if (loginuri == "") loginuri.clear(); if (gridname.empty() && !loginuri.empty()) this->retrieveGridInfo(); @@ -302,8 +302,8 @@ bool HippoPanelGridsImpl::saveCurGrid() // check nickname std::string gridname = childGetValue("gridname"); - childSetValue("gridname", (gridname != "")? gridname: ""); - if (gridname == "") { + childSetValue("gridname", !gridname.empty() ? gridname : ""); + if (gridname.empty()) { LLNotificationsUtil::add("GridsNoNick"); return false; } @@ -315,7 +315,7 @@ bool HippoPanelGridsImpl::saveCurGrid() } // check login URI - if (loginuri == "") { + if (loginuri.empty()) { LLSD args; args["NAME"] = gridname; LLNotificationsUtil::add("GridsNoLoginUri", args); @@ -388,7 +388,7 @@ void HippoPanelGridsImpl::reset() void HippoPanelGridsImpl::retrieveGridInfo() { std::string loginuri = childGetValue("loginuri"); - if ((loginuri == "") || (loginuri == "")) { + if ((loginuri.empty()) || (loginuri == "")) { LLNotificationsUtil::add("GridInfoNoLoginUri"); return; } @@ -398,7 +398,7 @@ void HippoPanelGridsImpl::retrieveGridInfo() if (mState == NORMAL) { grid = gHippoGridManager->getGrid(mCurGrid); } else if ((mState == ADD_NEW) || (mState == ADD_COPY)) { - grid = new HippoGridInfo(""); + grid = new HippoGridInfo(LLStringUtil::null); cleanupGrid = true; } else { LL_ERRS() << "Illegal state " << mState << '.' << LL_ENDL; @@ -416,17 +416,17 @@ void HippoPanelGridsImpl::retrieveGridInfo() if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER) getChild("platform")->setCurrentByIndex(grid->getPlatform()); - if (grid->getGridName() != "") childSetText("gridname", grid->getGridName()); - if (grid->getLoginUri() != "") childSetText("loginuri", grid->getLoginUri()); - if (grid->getLoginPage() != "") childSetText("loginpage", grid->getLoginPage()); - if (grid->getHelperUri() != "") childSetText("helperuri", grid->getHelperUri()); - if (grid->getWebSite() != "") childSetText("website", grid->getWebSite()); - if (grid->getSupportUrl() != "") childSetText("support", grid->getSupportUrl()); - if (grid->getRegisterUrl() != "") childSetText("register", grid->getRegisterUrl()); - if (grid->getPartnerUrl() != "") childSetText("partner", grid->getPartnerUrl()); - if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl()); - if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl()); - if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage()); + if (!grid->getGridName().empty()) childSetText("gridname", grid->getGridName()); + if (!grid->getLoginUri().empty()) childSetText("loginuri", grid->getLoginUri()); + if (!grid->getLoginPage().empty()) childSetText("loginpage", grid->getLoginPage()); + if (!grid->getHelperUri().empty()) childSetText("helperuri", grid->getHelperUri()); + if (!grid->getWebSite().empty()) childSetText("website", grid->getWebSite()); + if (!grid->getSupportUrl().empty()) childSetText("support", grid->getSupportUrl()); + if (!grid->getRegisterUrl().empty()) childSetText("register", grid->getRegisterUrl()); + if (!grid->getPartnerUrl().empty()) childSetText("partner", grid->getPartnerUrl()); + if (!grid->getPasswordUrl().empty()) childSetText("password", grid->getPasswordUrl()); + if (!grid->getSearchUrl().empty()) childSetText("search", grid->getSearchUrl()); + if (!grid->getGridMessage().empty()) childSetText("gridmessage", grid->getGridMessage()); } catch(AIAlert::ErrorCode const& error) {