diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 95da01e8a1..dcb671e922 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -62,7 +62,7 @@ static RlvBehaviourModifier_CompMax s_RlvBehaviourModifier_CompMax; * Definition: RlvBehaviourGenericProcessor("commandname", RLV_BHVR_COMMANDNAME) * Implement : nothing! (it automagically works) * For simple behaviours that only require recordkeeping and only run code when they toggle: - * Definition: RlvBehaviourToggleProcessor("commandname")) + * Definition: RlvBehaviourGenericToggleProcessor("commandname")) * Implement : void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) * For behaviours that require manual processing: * Definition: RlvBehaviourProcessor("commandname")) @@ -99,7 +99,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourInfo("detachallthis", RLV_BHVR_DETACHTHIS, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_SUBTREE)); addEntry(new RlvBehaviourInfo("detachthis_except", RLV_BHVR_DETACHTHISEXCEPT, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_NODE)); addEntry(new RlvBehaviourInfo("detachallthis_except", RLV_BHVR_DETACHTHISEXCEPT, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_SUBTREE)); - addEntry(new RlvBehaviourToggleProcessor("edit")); + addEntry(new RlvBehaviourGenericToggleProcessor("edit")); addEntry(new RlvBehaviourGenericProcessor("editobj", RLV_BHVR_EDITOBJ)); addEntry(new RlvBehaviourGenericProcessor("emote", RLV_BHVR_EMOTE)); addEntry(new RlvBehaviourGenericProcessor("fartouch", RLV_BHVR_FARTOUCH)); @@ -122,11 +122,11 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourProcessor("sendchannel", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourProcessor("sendchannel_except", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("sendchat", RLV_BHVR_SENDCHAT)); - addEntry(new RlvBehaviourToggleProcessor("sendim", RlvBehaviourInfo::BHVR_STRICT)); + addEntry(new RlvBehaviourGenericToggleProcessor("sendim", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("sendimto", RLV_BHVR_SENDIMTO, RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("sendgesture", RLV_BHVR_SENDGESTURE, RlvBehaviourInfo::BHVR_EXPERIMENTAL)); - addEntry(new RlvBehaviourToggleProcessor("setdebug")); - addEntry(new RlvBehaviourToggleProcessor("setenv")); + addEntry(new RlvBehaviourGenericToggleProcessor("setdebug")); + addEntry(new RlvBehaviourGenericToggleProcessor("setenv")); addEntry(new RlvBehaviourGenericProcessor("setgroup", RLV_BHVR_SETGROUP)); addEntry(new RlvBehaviourInfo("sharedunwear", RLV_BHVR_SHAREDUNWEAR, RLV_TYPE_ADDREM, RlvBehaviourInfo::BHVR_EXTENDED)); addEntry(new RlvBehaviourInfo("sharedwear", RLV_BHVR_SHAREDWEAR, RLV_TYPE_ADDREM, RlvBehaviourInfo::BHVR_EXTENDED)); @@ -134,7 +134,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourGenericProcessor("showhovertextall", RLV_BHVR_SHOWHOVERTEXTALL)); addEntry(new RlvBehaviourGenericProcessor("showhovertexthud", RLV_BHVR_SHOWHOVERTEXTHUD)); addEntry(new RlvBehaviourGenericProcessor("showhovertextworld", RLV_BHVR_SHOWHOVERTEXTWORLD)); - addEntry(new RlvBehaviourToggleProcessor("showinv")); + addEntry(new RlvBehaviourGenericToggleProcessor("showinv")); addEntry(new RlvBehaviourGenericProcessor("showloc", RLV_BHVR_SHOWLOC)); addEntry(new RlvBehaviourGenericProcessor("showminimap", RLV_BHVR_SHOWMINIMAP)); addEntry(new RlvBehaviourGenericProcessor("shownames", RLV_BHVR_SHOWNAMES)); @@ -621,14 +621,6 @@ bool RlvCommandOptionHelper::parseOption(const std::str return true; } -template -T RlvCommandOptionHelper::parseOption(const std::string& strOption) -{ - T value; - parseOption(strOption, value); - return value; -} - bool RlvCommandOptionHelper::parseStringList(const std::string& strOption, std::vector& optionList, const std::string& strSeparator) { if (!strOption.empty()) diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index 41daab1360..e172b1d492 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -149,13 +149,14 @@ template using RlvBehaviourGenericProcessor // RlvBehaviourProcessor and related classes - Handles add/rem comamnds aka "restrictions) // -template > +template , typename toggleHandlerImpl = RlvBehaviourToggleHandler> class RlvBehaviourToggleProcessor : public RlvBehaviourInfo { public: RlvBehaviourToggleProcessor(const std::string& strBhvr, U32 nBhvrFlags = 0) : RlvBehaviourInfo(strBhvr, eBhvr, RLV_TYPE_ADDREM, nBhvrFlags) {} - ERlvCmdRet processCommand(const RlvCommand& rlvCmd) const override { return RlvCommandHandlerBaseImpl::processCommand(rlvCmd, &RlvBehaviourGenericHandler::onCommand, &toggleHandlerImpl::onCommandToggle); } + ERlvCmdRet processCommand(const RlvCommand& rlvCmd) const override { return RlvCommandHandlerBaseImpl::processCommand(rlvCmd, &handlerImpl::onCommand, &toggleHandlerImpl::onCommandToggle); } }; +template > using RlvBehaviourGenericToggleProcessor = RlvBehaviourToggleProcessor, toggleHandlerImpl>; // ============================================================================ // RlvBehaviourModifier - stores behaviour modifiers in an - optionally - sorted list and returns the first element (or default value if there are no modifiers) @@ -413,7 +414,12 @@ class RlvCommandOptionHelper public: // NOTE: this function is destructive (reference value may still change on parsing failure) template static bool parseOption(const std::string& strOption, T& valueOption); - template static T parseOption(const std::string& strOption); + template static T parseOption(const std::string& strOption) + { + T value; + parseOption(strOption, value); + return value; + } static bool parseStringList(const std::string& strOption, std::vector& optionList, const std::string& strSeparator = std::string(RLV_OPTION_SEPARATOR)); };