BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
3d07564
Branches
Tags
master
Blinker
src
noarch
ListTracker.h
created template class for tracking lists in directories, converted priority module to use this class
Stefan Schuermans
commited
3d07564
at 2011-12-10 22:52:36
ListTracker.h
Blame
History
Raw
/* Blinker Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #ifndef LISTTRACKER_H #define LISTTRACKER_H #include <list> #include <string> #include "Directory.h" #include "File.h" namespace Blinker { /** * @brief tracker of a list kept in a directory * @param[in] PARENT type of parent object * @param[in] TYPE type of objects to allocate for list entries * @param[in] FIDI if to track files or subdirs in directory (File or Directory) */ template<typename PARENT, typename TYPE, typename FIDI> class ListTracker { public: /// list entry struct Entry { std::string m_name; ///< name of list entry TYPE *m_pObj; ///< object }; /// list typedef std::list<Entry> List; /// list iterator typedef typename List::const_reverse_iterator ListIt; public: /** * @brief constructor * @param[in] parent parent object * @param[in] dir directory containing list and begin tracked */ ListTracker(PARENT &parent, const Directory &dir); /// destructor virtual ~ListTracker(); private: /// copy constructor disabled ListTracker(const ListTracker &that); /// assignment operator disabled const ListTracker & operator=(const ListTracker &that); public: /// initialize list by reading directory void init(); /// clear list void clear(); /// check for update of configuration void updateConfig(); protected: /// light update of list, i.e. check all entries in current list void updateListLight(); /// full update of list, i.e. scan files/subdirs in list directory void updateListFull(); public: PARENT &m_parent; ///< parent object Directory m_dir; ///< directory containing list and being tracked List m_list; ///< list begin tracked }; // class ListTracker } // namespace Blinker #endif // #ifndef LISTTRACKER_H