[FIXED] RlvHandler::hasBehaviourExcept() returns FALSE on modifier commands
-> Example: issue @tplocal:50=n -> gRlvHandler.hasBehaviour(RLV_BHVR_TPLOCAL) will return true but gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, LLUUID::null) will return FALSE => since it's a modifier command it will be reference counted but that fact is lost on manual matching (tplocal=n != tplocal:<option>=n) so we keep track of reference counting in the command --HG-- branch : RLVameow-7.2.2
parent
d36c0de9e6
commit
60f93645aa
|
|
@ -1251,6 +1251,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
|
|||
if (rlvCmd.isStrict())
|
||||
addException(rlvCmd.getObjectID(), RLV_BHVR_PERMISSIVE, eBhvr);
|
||||
m_Behaviours[eBhvr]++;
|
||||
rlvCmd.markRefCounted();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1283,6 +1284,7 @@ ERlvCmdRet RlvCommandHandlerBaseImpl<RLV_TYPE_ADDREM>::processCommand(const RlvC
|
|||
if (rlvCmd.isStrict())
|
||||
gRlvHandler.addException(rlvCmd.getObjectID(), RLV_BHVR_PERMISSIVE, eBhvr);
|
||||
gRlvHandler.m_Behaviours[eBhvr]++;
|
||||
rlvCmd.markRefCounted();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -860,9 +860,19 @@ bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, bool fStrictOnly) const
|
|||
|
||||
bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption, bool fStrictOnly) const
|
||||
{
|
||||
for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
|
||||
if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption() == strOption) && ((!fStrictOnly) || (itCmd->isStrict())) )
|
||||
for (const RlvCommand& rlvCmd : m_Commands)
|
||||
{
|
||||
// The specified behaviour is contained within the current object if:
|
||||
// - the (parsed) behaviour matches
|
||||
// - the option matches (or we're checking for an empty option and the command was reference counted)
|
||||
// - we're not matching on strict (or it is a strict command)
|
||||
if ( (rlvCmd.getBehaviourType() == eBehaviour) &&
|
||||
( (rlvCmd.getOption() == strOption) || ((strOption.empty()) && (rlvCmd.isRefCounted())) ) &&
|
||||
( (!fStrictOnly) ||(rlvCmd.isStrict()) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,12 +369,14 @@ public:
|
|||
ERlvCmdRet getReturnType() const { return m_eRet; }
|
||||
bool hasOption() const { return !m_strOption.empty(); }
|
||||
bool isBlocked() const { return (m_pBhvrInfo) ? m_pBhvrInfo->isBlocked() : false; }
|
||||
bool isRefCounted() const { return m_fRefCounted; }
|
||||
bool isStrict() const { return m_fStrict; }
|
||||
bool isValid() const { return m_fValid; }
|
||||
ERlvCmdRet processCommand() const { return (m_pBhvrInfo) ? m_pBhvrInfo->processCommand(*this) : RLV_RET_NO_PROCESSOR; }
|
||||
|
||||
protected:
|
||||
static bool parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam);
|
||||
bool markRefCounted() const { return m_fRefCounted = true; }
|
||||
|
||||
/*
|
||||
* Operators
|
||||
|
|
@ -395,9 +397,11 @@ protected:
|
|||
std::string m_strOption;
|
||||
std::string m_strParam;
|
||||
ERlvCmdRet m_eRet;
|
||||
mutable bool m_fRefCounted;
|
||||
|
||||
friend class RlvHandler;
|
||||
friend class RlvObject;
|
||||
template<ERlvParamType> friend struct RlvCommandHandlerBaseImpl;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue