Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsDirectoryCrawler.h
Go to the documentation of this file.
1 
10 #ifndef WS_DIRECTORY_CRAWLER_H__
11 #define WS_DIRECTORY_CRAWLER_H__
12 
13 #define BOOST_FILESYSTEM_NO_DEPRECATED
14 
15 #include <boost/filesystem.hpp>
16 
17 #include <iostream>
18 
19 #include <Logger/WsLogger.h>
20 
31 public:
35  WsDirectoryCrawler(const std::string& path);
36 
40  virtual ~WsDirectoryCrawler() = 0;
41 
45  int start();
46 
47 private:
51  int browse(const boost::filesystem::path& p);
52 
53 
54 protected:
58  std::string m_p;
59 
63  virtual int applyFile(const boost::filesystem::path& p) = 0;
64 
68  virtual int applyDirectory(const boost::filesystem::path& p) = 0;
69 
73  virtual void beginChild(const boost::filesystem::path& p) = 0;
74 
78  virtual void endChild(const boost::filesystem::path& p) = 0;
79 
83  bool m_isLoaded;
84 };
85 
86 #endif
Abstract class used to crawl a directory.
int browse(const boost::filesystem::path &p)
applies the required action if file or folder, and browse its children
int start()
Start crawling over all the files and directories/subdirectories.
WsDirectoryCrawler(const std::string &path)
Class constructor, this class is Abstract and must therefore be inherited.
virtual void endChild(const boost::filesystem::path &p)=0
this method is called when finished browsing the subdir
virtual int applyFile(const boost::filesystem::path &p)=0
this method is called by browse when the boost::filesystem::path is a file
virtual void beginChild(const boost::filesystem::path &p)=0
this method is called before browsing a subdirectory
virtual int applyDirectory(const boost::filesystem::path &p)=0
this method is called by browse when the boost::filesystem::path is a folder
virtual ~WsDirectoryCrawler()=0
Virtual destructor.