chxavfilesystemwatcher.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:2k
源码类别:
Symbian
开发平台:
C/C++
- /************************************************************************
- * chxavfilesystemwatcher.cpp
- * --------------------------
- *
- * Synopsis:
- * Manages active object and RFs to watch for file system events for a
- * given path.
- *
- * Notifications are forwarded to a single observer/client.
- *
- *
- * Target:
- * Symbian OS
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- // Symbian includes...
- #include <f32file.h>
- // Includes from this project...
- #include "chxavmisc.h"
- #include "hxsym_debug.h"
- #include "chxavfilesystemwatcher.h"
- CHXAvFileSystemWatcher::CHXAvFileSystemWatcher(RFs& fs)
- : m_fs(fs)
- , m_notifyType(ENotifyEntry)
- {
- }
- ///////////////////////////////////
- // dtor
- CHXAvFileSystemWatcher::~CHXAvFileSystemWatcher()
- {
- StopWatching();
- }
- ////////////////////////////////////////////////////////
- //
- void CHXAvFileSystemWatcher::ConstructL()
- {
- BaseConstructL();
- m_spWatchPath = KNullDesC().AllocL();
- }
- ////////////////////////////////////////////////////////
- // path can have wildcard to watch directories across
- // drives, e.g.:
- //
- // *:realnetworksdata
- // c:realnetworksdata
- //
- // **** you cannot watch from the root, e.g., 'c:'
- //
- void CHXAvFileSystemWatcher::SetWatchPathL(const TDesC& path)
- {
- // cleanup old stuff in case we are chaging the path
- StopWatching();
- m_spWatchPath = path.AllocL();
- DPRINTF(SYMP_FILE, ("CHXAvFileSystemWatcher::SetWatchPathL(): watching '%s'n", dbg::CharPtr(path)()));
- }
- ////////////////////////////////////////////////////////
- //
- void CHXAvFileSystemWatcher::DoIssueRequest(const CHXAvActiveCmplPtr& spActive)
- {
- if( m_spWatchPath->Length() > 0)
- {
- m_fs.NotifyChange(m_notifyType, spActive->Status(), *m_spWatchPath);
- }
- else
- {
- // no watch path; watch everything
- m_fs.NotifyChange(m_notifyType, spActive->Status());
- }
- }
- ////////////////////////////////////////////////////////
- //
- void CHXAvFileSystemWatcher::DoCancelRequest(const CHXAvActiveCmplPtr& spActive)
- {
- m_fs.NotifyChangeCancel(spActive->Status());
- }