// finds an action, adding it if necessary CAction * CMUSHclientDoc::GetAction (const CString & strAction, const CString & strHint, const CString & strVariable) { // not needed if all these are empty if (strAction.IsEmpty () && strHint.IsEmpty () && strVariable.IsEmpty ()) return NULL; unsigned long iHash = MakeActionHash (strAction, strHint, strVariable); for (POSITION pos = m_ActionList.GetHeadPosition (); pos; ) { CAction * pAction = m_ActionList.GetNext (pos); if (pAction->m_iHash == iHash && pAction->m_strAction == strAction && pAction->m_strHint == strHint && pAction->m_strVariable == strVariable) { pAction->AddRef (); // one more user of it return pAction; } } // end of lookup loop // here when action not found CAction * pAction = new CAction (strAction, strHint, strVariable, this); pAction->AddRef (); m_ActionList.AddTail (pAction); return pAction; } // end of CMUSHclientDoc::GetAction