#include "llviewerprecompiledheaders.h" #include "llagent.h" #include "llviewerobject.h" #include "llviewerstats.h" #include "llviewerwindow.h" #include "llvoavatar.h" #include "llwlparammanager.h" #include "rlvhelper.h" #include "rlvevent.h" #include "rlvhandler.h" // ============================================================================ // Static variable initialization // RlvMultiStringSearch RlvCommand::m_BhvrLookup; // ============================================================================ // Checked: RlvCommand::RlvCommand(const std::string& strCommand) : m_eBehaviour(RLV_BHVR_UNKNOWN), m_eParamType(RLV_TYPE_UNKNOWN) { if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam))) { if ( ("n" == m_strParam) || ("add" == m_strParam) ) m_eParamType = RLV_TYPE_ADD; else if ( ("y" == m_strParam) || ("rem" == m_strParam) ) m_eParamType = RLV_TYPE_REMOVE; else if ("force" == m_strParam) m_eParamType = RLV_TYPE_FORCE; else { m_eParamType = RLV_TYPE_REPLY; // Assume it's a reply command until we encounter a non-digit if ( (m_strParam.empty()) || (-1 != m_strParam.find_first_not_of("0123456789")) ) { m_eParamType = RLV_TYPE_UNKNOWN; m_fValid = ("clear" == m_strBehaviour); } } } if (!m_fValid) { m_strBehaviour = m_strOption = m_strParam = ""; return; } U16 nBehaviour; if (m_BhvrLookup.getExactMatchParam(m_strBehaviour, nBehaviour)) { m_eBehaviour = (ERlvBehaviour)nBehaviour; } } RlvCommand::RlvCommand(const RlvCommand& rlvCmd) : m_fValid(rlvCmd.m_fValid), m_strBehaviour(rlvCmd.m_strBehaviour), m_eBehaviour(rlvCmd.m_eBehaviour), m_strOption(rlvCmd.m_strOption), m_strParam(rlvCmd.m_strParam), m_eParamType(rlvCmd.m_eParamType) { } // ============================================================================ /* * ------------------------------ * Command | RLV | RLVa * ------------------------------ * : | F | F (missing behaviour) * :option | F | F (missing behaviour) * := | T | F (missing behaviour) * :option= | T | F (missing behaviour) * :option=param | T | F (missing behaviour) * = | T | F (missing behaviour) * =param | T | F (missing behaviour) * cmd | F | F (missing param) [T if == "clear"] * cmd: | F | F (missing param) * cmd:option | F | F (missing param) * cmd:= | T | F (missing param) [1] * cmd:option= | T | F (missing param) [1] * cmd= | T | F (missing param) [1] * cmd:option=param | T | T * cmd=param | T | T * cmd:=param | T | T * * [1] 'clear:=', 'clear:option=' and 'clear=' are "valid" variations of 'clear' */ BOOL RlvCommand::parseCommand(/*[in]*/ const std::string& strCommand, /*[out]*/ std::string& strBehaviour, /*[out]*/ std::string& strOption, /*[out]*/ std::string& strParam) { // Format: [: