#include "llviewerprecompiledheaders.h"
#include "llagent.h"
#include "llfloaterwindlight.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
//
RlvCommand::RlvBhvrTable RlvCommand::m_BhvrMap;
// ============================================================================
// RlvCommmand
//
// Checked: 2009-09-10 (RLVa-1.0.3a) | Modified: RLVa-1.0.3a
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)))
{
S32 nTemp = 0;
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 if (LLStringUtil::convertToS32(m_strParam, nTemp)) // Assume it's a reply command if we can convert to an S32
m_eParamType = RLV_TYPE_REPLY;
else if (m_strBehaviour == "clear") // clear is the odd one out so just make it its own type
m_eParamType = RLV_TYPE_CLEAR;
else
{
m_eParamType = RLV_TYPE_UNKNOWN;
m_fValid = false;
}
}
if (!m_fValid)
{
m_strBehaviour = m_strOption = m_strParam = "";
return;
}
RlvBhvrTable::const_iterator itBhvr = m_BhvrMap.find(m_strBehaviour);
if (itBhvr != m_BhvrMap.end())
m_eBehaviour = itBhvr->second;
}
bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam)
{
// (See behaviour notes for the command parsing truth table)
// Format: [: