chxavcompositecommand.cpp
来自「symbian 下的helix player源代码」· C++ 代码 · 共 89 行
CPP
89 行
/************************************************************************
* chxavcompositecommand.cpp
* -------------------------
*
* Synopsis:
*
*
* Implementation of aggregated command object
*
* commands (actions) are executed in order of addition
* copying the command object implies sharing a reference to the aggregated list
*
* Target:
* Symbian OS
*
*
* (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
*
************************************************************************/
// Symbian includes...
#include <e32std.h>
// Include from this project...
#include "chxavcompositecommand.h"
CHXAvCompositeCommand::CHXAvCompositeCommand(const CHXAvCompositeCommand& rhs) :
m_nextId(rhs.m_nextId)
{
// Copy the command list
LISTPOSITION pos = rhs.m_commands.GetHeadPosition();
while (pos != NULL)
{
CHXAvCommand *ptr = (CHXAvCommand *)rhs.m_commands.GetNext(pos);
AppendL(*ptr);
}
}
CHXAvCompositeCommand::~CHXAvCompositeCommand()
{
LISTPOSITION pos = m_commands.GetHeadPosition();
while (pos != NULL)
{
CHXAvCommand *ptr = (CHXAvCommand *)m_commands.GetNext(pos);
delete ptr;
}
}
////////////////////////////////////////
// add an action; becomes last command to be executed
// return id that can be used to remove command
// later on
//
CHXAvCompositeCommand::CID CHXAvCompositeCommand::AppendL(const CHXAvCommand& cmd)
{
CHXAvCommand *pCmd = cmd.CloneL();
m_commands.AddTail(pCmd);
return pCmd;
}
////////////////////////////////////////
// add an action; becomes last command to be executed
//
void CHXAvCompositeCommand::Remove(CID idCommand)
{
LISTPOSITION pos = m_commands.Find(idCommand, NULL);
if (pos != NULL)
m_commands.RemoveAt(pos);
delete (CHXAvCommand *)idCommand;
}
////////////////////////////////////////
// go through list of commands and execute each
// in order they were added
void CHXAvCompositeCommand::Execute()
{
LISTPOSITION pos = m_commands.GetHeadPosition();
while (pos != NULL)
{
CHXAvCommand *ptr = (CHXAvCommand *)m_commands.GetNext(pos);
if (ptr != NULL)
ptr->Execute();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?