diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 953a339daee1d427aa95ddad9f986c1e04b05948..448eb5dc24506868c5013c6373e84bd561bf65e2 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -40,6 +40,10 @@ #include "rlvhandler.h" #include "rlvlocks.h" +#include <absl/strings/str_format.h> +#include <absl/strings/str_replace.h> +#include <absl/strings/str_split.h> + #include <boost/algorithm/string.hpp> #include <boost/regex.hpp> diff --git a/indra/newview/rlvenvironment.cpp b/indra/newview/rlvenvironment.cpp index 91e043da231ac574c241afe5f7a9cfe4bcb989da..cf1d0e58d98cbb6fef001077eebd0385b08d2a5e 100644 --- a/indra/newview/rlvenvironment.cpp +++ b/indra/newview/rlvenvironment.cpp @@ -18,7 +18,9 @@ #include "llinventoryfunctions.h" #include "llsettingsvo.h" -#include <boost/algorithm/string.hpp> + +#include "absl/strings/match.h" +#include "absl/strings/str_format.h" #include "rlvactions.h" #include "rlvenvironment.h" @@ -533,7 +535,7 @@ std::string RlvEnvironment::handleGetFn<LLVector2>(const std::function<LLVector2 { LLSettingsSky::ptr_t pSky = LLEnvironment::instance().getCurrentSky(); LLVector2 replyVec = fn(pSky); - return llformat("%f/%f", replyVec.mV[VX], replyVec.mV[VY]); + return absl::StrFormat("%f/%f", replyVec.mV[VX], replyVec.mV[VY]); } template<> @@ -541,7 +543,7 @@ std::string RlvEnvironment::handleGetFn<LLColor3>(const std::function<LLColor3(L { LLSettingsSky::ptr_t pSky = LLEnvironment::instance().getCurrentSky(); LLColor3 replyColor = fn(pSky); - return llformat("%f/%f/%f", replyColor.mV[VX], replyColor.mV[VY], replyColor.mV[VZ]); + return absl::StrFormat("%f/%f/%f", replyColor.mV[VX], replyColor.mV[VY], replyColor.mV[VZ]); } template<typename T> diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp index 9a44df67785f313ed40fba53f2d822839e086a01..311c60972705a517805579f7a4e90bf4ee2b1681 100644 --- a/indra/newview/rlvextensions.cpp +++ b/indra/newview/rlvextensions.cpp @@ -23,6 +23,8 @@ #include "rlvhandler.h" #include "rlvhelper.h" +#include "absl/strings/str_format.h" + // ============================================================================ std::map<std::string, S16> RlvExtGetSet::m_DbgAllowed; @@ -160,11 +162,11 @@ std::string RlvExtGetSet::onGetDebug(std::string strSetting) switch (pSetting->type()) { case TYPE_U32: - return llformat("%u", gSavedSettings.getU32(strSetting)); + return absl::StrFormat("%u", gSavedSettings.getU32(strSetting)); case TYPE_S32: - return llformat("%d", gSavedSettings.getS32(strSetting)); + return absl::StrFormat("%d", gSavedSettings.getS32(strSetting)); case TYPE_BOOLEAN: - return llformat("%d", gSavedSettings.getBOOL(strSetting)); + return absl::StrFormat("%d", gSavedSettings.getBOOL(strSetting)); default: RLV_ERRS << "Unexpected debug setting type" << LL_ENDL; break; @@ -193,7 +195,7 @@ std::string RlvExtGetSet::onGetPseudoDebug(const std::string& strSetting) else { if (isAgentAvatarValid()) - return llformat("%d", (gAgentAvatarp->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()] + return absl::StrFormat("%d", (gAgentAvatarp->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()] } } return std::string(); diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 256904cb4c24df7b2f46e8d67604cc4012226941..6d43c19d84a02f51468d072fe0d74c920e724518 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -70,6 +70,9 @@ // Boost includes #include <boost/algorithm/string.hpp> +// Abseil includes +#include <absl/strings/str_format.h> + // llappviewer.cpp extern BOOL gDoDisconnect; @@ -3459,7 +3462,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETCAM_AVDIST>::onCommand(const RlvCommand& { if (rlvCmd.hasOption()) return RLV_RET_FAILED_OPTION; - strReply = llformat("%.3lf", (gAgentCamera.getCameraPositionGlobal() - gAgent.getPositionGlobal()).magVec()); + strReply = absl::StrFormat("%.3lf", (gAgentCamera.getCameraPositionGlobal() - gAgent.getPositionGlobal()).magVec()); return RLV_RET_SUCCESS; } @@ -3471,7 +3474,7 @@ ERlvCmdRet RlvReplyCamMinMaxModifierHandler::onCommand(const RlvCommand& rlvCmd, return RLV_RET_FAILED_OPTION; ERlvBehaviour eBhvr = RlvBehaviourDictionary::instance().getBehaviourFromString("setcam_" + rlvCmd.getBehaviour().substr(7), RLV_TYPE_ADDREM); if (RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifierFromBehaviour(eBhvr)) - strReply = (pBhvrModifier->hasValue()) ? llformat("%.3f", pBhvrModifier->getValue<float>()) : LLStringUtil::null; + strReply = (pBhvrModifier->hasValue()) ? absl::StrFormat("%.3f", pBhvrModifier->getValue<float>()) : LLStringUtil::null; return RLV_RET_SUCCESS; } @@ -3509,7 +3512,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETCAM_FOV>::onCommand(const RlvCommand& rlv { if (rlvCmd.hasOption()) return RLV_RET_FAILED_OPTION; - strReply = llformat("%.3f", LLViewerCamera::getInstance()->getDefaultFOV()); + strReply = absl::StrFormat("%.3f", LLViewerCamera::getInstance()->getDefaultFOV()); return RLV_RET_SUCCESS; } @@ -3562,7 +3565,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETHEIGHTOFFSET>::onCommand(const RlvCommand else if (!isAgentAvatarValid()) return RLV_RET_FAILED_UNKNOWN; - strReply = llformat("%.2f", gAgentAvatarp->getHoverOffset()[VZ] * 100); + strReply = absl::StrFormat("%.2f", gAgentAvatarp->getHoverOffset()[VZ] * 100.f); return RLV_RET_SUCCESS; } @@ -3665,15 +3668,15 @@ ERlvCmdRet RlvHandler::onGetInvWorn(const RlvCommand& rlvCmd, std::string& strRe wi.cntChildWorn += wiFolder.cntWorn + wiFolder.cntChildWorn; wi.cntChildTotal += wiFolder.cntTotal + wiFolder.cntChildTotal; - strReply += llformat(",%s|%d%d", gInventory.getCategory(itFolder->first)->getName().c_str(), + absl::StrAppend(&strReply, absl::StrFormat(",%s|%d%d", gInventory.getCategory(itFolder->first)->getName(), (0 == wiFolder.cntTotal) ? 0 : (0 == wiFolder.cntWorn) ? 1 : (wiFolder.cntWorn != wiFolder.cntTotal) ? 2 : 3, (0 == wiFolder.cntChildTotal) ? 0 : (0 == wiFolder.cntChildWorn) ? 1 : (wiFolder.cntChildWorn != wiFolder.cntChildTotal) ? 2 : 3 - ); + )); } // Now just prepend the root and done - strReply = llformat("|%d%d", (0 == wi.cntTotal) ? 0 : (0 == wi.cntWorn) ? 1 : (wi.cntWorn != wi.cntTotal) ? 2 : 3, - (0 == wi.cntChildTotal) ? 0 : (0 == wi.cntChildWorn) ? 1 : (wi.cntChildWorn != wi.cntChildTotal) ? 2: 3) + strReply; + strReply = absl::StrCat(absl::StrFormat("|%d%d", (0 == wi.cntTotal) ? 0 : (0 == wi.cntWorn) ? 1 : (wi.cntWorn != wi.cntTotal) ? 2 : 3, + (0 == wi.cntChildTotal) ? 0 : (0 == wi.cntChildWorn) ? 1 : (wi.cntChildWorn != wi.cntChildTotal) ? 2: 3), strReply); return RLV_RET_SUCCESS; } diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 8316b0d114183c69521c9f247de54351b43940da..34d14ebba69bd560cc163da5e69b0f9a82edf130 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -27,6 +27,7 @@ #include "rlvinventory.h" #include "rlvmodifiers.h" +#include "absl/strings/str_format.h" #include <boost/algorithm/string.hpp> // ============================================================================ @@ -1002,7 +1003,7 @@ RlvCommandOptionAdjustHeight::RlvCommandOptionAdjustHeight(const RlvCommand& rlv if (1 == cmdTokens.size()) { m_fValid = (LLStringUtil::convertToF32(cmdTokens[0], m_nPelvisToFootOffset)); - m_nPelvisToFootOffset /= 100; + m_nPelvisToFootOffset /= 100.f; } else if ( (2 <= cmdTokens.size()) && (cmdTokens.size() <= 3) ) { @@ -1747,7 +1748,7 @@ void RlvBehaviourNotifyHandler::onCommand(const RlvCommand& rlvCmd, ERlvCmdRet e { case RLV_TYPE_ADD: case RLV_TYPE_REMOVE: - sendNotification(rlvCmd.asString(), "=" + rlvCmd.getParam()); + sendNotification(rlvCmd.asString(), absl::StrCat("=", rlvCmd.getParam())); break; case RLV_TYPE_CLEAR: sendNotification(rlvCmd.asString()); @@ -1769,7 +1770,7 @@ void RlvBehaviourNotifyHandler::sendNotification(const std::string& strText, con itNotify != pThis->m_Notifications.end(); ++itNotify) { if ( (itNotify->second.strFilter.empty()) || (boost::icontains(strText, itNotify->second.strFilter)) ) - RlvUtil::sendChatReply(itNotify->second.nChannel, "/" + strText + strSuffix); + RlvUtil::sendChatReply(itNotify->second.nChannel, absl::StrCat("/", strText, strSuffix)); } } } @@ -1777,31 +1778,31 @@ void RlvBehaviourNotifyHandler::sendNotification(const std::string& strText, con // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f void RlvBehaviourNotifyHandler::onWear(LLWearableType::EType eType, bool fAllowed) { - sendNotification(llformat("worn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str())); + sendNotification(absl::StrFormat("worn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType))); } // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f void RlvBehaviourNotifyHandler::onTakeOff(LLWearableType::EType eType, bool fAllowed) { - sendNotification(llformat("unworn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str())); + sendNotification(absl::StrFormat("unworn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType))); } // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f void RlvBehaviourNotifyHandler::onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed) { - sendNotification(llformat("attached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str())); + sendNotification(absl::StrFormat("attached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName())); } // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f void RlvBehaviourNotifyHandler::onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed) { - sendNotification(llformat("detached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str())); + sendNotification(absl::StrFormat("detached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName())); } // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f void RlvBehaviourNotifyHandler::onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed) { - sendNotification(llformat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str())); + sendNotification(absl::StrFormat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName())); } // ========================================================================= diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp index 4b94e34fdf55b2dd4d89d76bb9969583fa7fa642..4d62367e4a75aabbc70a77649fda380928bf55b8 100644 --- a/indra/newview/rlvlocks.cpp +++ b/indra/newview/rlvlocks.cpp @@ -27,6 +27,7 @@ #include "rlvhelper.h" #include "rlvinventory.h" +#include "absl/strings/str_format.h" // ============================================================================ // RlvAttachPtLookup member functions @@ -452,9 +453,9 @@ void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const const LLViewerInventoryItem* pItem = gInventory.getItem(idItem); std::string strItemId = idItem.asString(); - std::string strTemp = llformat("Wear %s '%s' (%s)", - (RLV_WEAR_ADD == eWearAction) ? "add" : "replace", (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str()); - RLV_INFOS << strTemp.c_str() << RLV_ENDL; + RLV_INFOS << absl::StreamFormat("Wear %s '%s' (%s)", + (RLV_WEAR_ADD == eWearAction) ? "add" : "replace", (pItem) ? pItem->getName() : "missing", strItemId) + << RLV_ENDL; if (!attachPts.empty()) { @@ -468,11 +469,10 @@ void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const for (uuid_vec_t::const_iterator itAttach = itAttachPt->second.begin(); itAttach != itAttachPt->second.end(); ++itAttach) { pItem = gInventory.getItem(*itAttach); - strItemId = (*itAttach).asString(); - - strTemp = llformat(" -> %s : %s (%s)", - pAttachPt->getName().c_str(), (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str()); - RLV_INFOS << strTemp.c_str() << RLV_ENDL; + + RLV_INFOS << absl::StreamFormat(" -> %s : %s (%s)", + pAttachPt->getName(), (pItem) ? pItem->getName() : "missing", (*itAttach).asString()) + << RLV_ENDL; } } else