chxavactivewatcher.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:2k
- /************************************************************************
- * chxavactivewatcher.h
- * --------------------
- *
- * Synopsis:
- *
- * base class for classes that request active object
- * event notification from system services
- *
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- #ifndef _chxavactivewatcher_h_
- #define _chxavactivewatcher_h_
- // Include from this project...
- #include "chxavcommand.h"
- #include "chxavactivecompletiondispatch.h"
- #include "chxavcallback.h"
- // class CHXAvActiveWatcher
- class CHXAvActiveWatcher
- {
- protected:
- // ctor and dtor
- CHXAvActiveWatcher();
- virtual ~CHXAvActiveWatcher();
- void BaseConstructL(TInt activePriority = CActive::EPriorityStandard);
- private:
- // disallow assignment and copy
- CHXAvActiveWatcher(const CHXAvActiveWatcher& rhs);
- CHXAvActiveWatcher& operator=(const CHXAvActiveWatcher& rhs);
- public:
- // methods
- void SetEventActionL(const CHXAvCommand& cmd);
- void SetNotificationDelay(TUint msDelay);
- void WatchForNextEvent();
- void StartWatching();
- void StopWatching();
- bool IsWatching() const;
- protected:
- // implementation
- virtual void OnEvent(TInt status);
- virtual void OnCancelWatch(TInt status);
- virtual void ForwardEvent();
- virtual void DoIssueRequest(const CHXAvActiveCmplPtr& spActive) = 0;
- virtual void DoCancelRequest(const CHXAvActiveCmplPtr& spActive) = 0;
- private:
- // data
- CHXAvActiveCmplPtr m_spWatchObject;
- bool m_bKeepWatching;
- CHXAvCommandPtr m_spEventHandler;
- CHXAvCallback m_cbFowardEvent;
- TUint m_msForwardEventDelay;
- };
- ////////////////////////////////////////////
- // set the handler action to execute upon filesystem event
- inline
- void CHXAvActiveWatcher::SetEventActionL(const CHXAvCommand& cmd)
- {
- m_spEventHandler = cmd.CloneL();
- }
- ////////////////////////////////////////////
- //
- inline
- bool CHXAvActiveWatcher::IsWatching() const
- {
- return m_spWatchObject->IsActive() || m_cbFowardEvent.IsPending();
- }
- ////////////////////////////////////////////
- //
- inline
- void CHXAvActiveWatcher::SetNotificationDelay(TUint msDelay)
- {
- m_msForwardEventDelay = msDelay;
- }
- #endif // _chxavactivewatcher_h_