- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
chxavcompositecommand.cpp
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:2k
源码类别:
Symbian
开发平台:
Visual C++
- /************************************************************************
- * 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();
- }
- }