Wittyshare
0.2
|
Represents the file structure on disk. More...
#include <WsFileSystemTree.h>
Public Member Functions | |
WsFileSystemTree (const std::string &p, bool m=false) | |
Constructor for the FileSystemTree object. More... | |
~WsFileSystemTree () | |
int | start () |
crawls the diretory and sorts the children. It is called by WsDirectoryCrawler::start() More... | |
NodePtr | getRoot () |
returns the root of the WsFileSystemTree More... | |
NodePtr | eatPath (const std::string &p) |
int | getUseCount () |
returns the number of users that are using this fileSystemTree version More... | |
void | incrementUseCount () |
increments the number of uses of the tree by 1 More... | |
void | decrementUseCount () |
decrements the numbers of uses by one More... | |
const boost::filesystem::path & | getRootPath () const |
returns the boost::filesystem::path to the base directory where documents are stored More... | |
std::vector < boost::filesystem::path > & | getMonitorPaths () |
returns the std::vector containing the boost::filesystem::path that should be monitored by the WsUpdater Class More... | |
const std::string & | getStamp () |
returns the Tree unique stamp More... | |
int | insertNode (NodePtr newNode) |
inserts the node in the tree The node is inserted on the right place on the tree depending on it's path The node is not created in the filesystem. If the node path is incorrect, the node is not inserted and FAILURE is returned. Otherwise SUCCESS is returned More... | |
Protected Attributes | |
std::string | m_p |
bool | m_isLoaded |
Private Member Functions | |
int | applyFile (const boost::filesystem::path &filePath) |
this method is called by browse when the boost::filesystem::path is a file More... | |
int | applyDirectory (const boost::filesystem::path &dirPath) |
this method is called by browse when the boost::filesystem::path is a folder More... | |
void | beginChild (const boost::filesystem::path &p) |
this method is called before browsing a subdirectory More... | |
void | endChild (const boost::filesystem::path &p) |
this method is called when finished browsing the subdir More... | |
void | createStamp () |
creates unique stamp for the tree More... | |
Private Attributes | |
boost::filesystem::path | m_rootPath |
boost::mutex | m_lMutex |
std::vector < boost::filesystem::path > | m_monitorPaths |
std::string | m_stamp |
int | m_useCount |
bool | m_monitor |
NodePtr | m_root |
NodePtr | m_current |
Represents the file structure on disk.
Definition at line 36 of file WsFileSystemTree.h.
WsFileSystemTree::WsFileSystemTree | ( | const std::string & | p, |
bool | m = false |
||
) |
Constructor for the FileSystemTree object.
p | the root path of the directory (rootPath) |
m | monitor or not the filesystemtree using Gamin ? |
Definition at line 24 of file WsFileSystemTree.cpp.
WsFileSystemTree::~WsFileSystemTree | ( | ) |
Definition at line 32 of file WsFileSystemTree.cpp.
|
privatevirtual |
this method is called by browse when the boost::filesystem::path is a folder
creates the node for a directory
Implements WsDirectoryCrawler.
Definition at line 85 of file WsFileSystemTree.cpp.
|
privatevirtual |
this method is called by browse when the boost::filesystem::path is a file
creates the node for a file
Implements WsDirectoryCrawler.
Definition at line 55 of file WsFileSystemTree.cpp.
|
privatevirtual |
this method is called before browsing a subdirectory
Implements WsDirectoryCrawler.
Definition at line 118 of file WsFileSystemTree.cpp.
|
private |
creates unique stamp for the tree
Definition at line 234 of file WsFileSystemTree.cpp.
void WsFileSystemTree::decrementUseCount | ( | ) |
decrements the numbers of uses by one
Definition at line 208 of file WsFileSystemTree.cpp.
NodePtr WsFileSystemTree::eatPath | ( | const std::string & | p | ) |
Definition at line 143 of file WsFileSystemTree.cpp.
|
privatevirtual |
this method is called when finished browsing the subdir
Implements WsDirectoryCrawler.
Definition at line 123 of file WsFileSystemTree.cpp.
vector< path > & WsFileSystemTree::getMonitorPaths | ( | ) |
returns the std::vector containing the boost::filesystem::path that should be monitored by the WsUpdater Class
Definition at line 224 of file WsFileSystemTree.cpp.
NodePtr WsFileSystemTree::getRoot | ( | ) |
returns the root of the WsFileSystemTree
Definition at line 133 of file WsFileSystemTree.cpp.
const path & WsFileSystemTree::getRootPath | ( | ) | const |
returns the boost::filesystem::path to the base directory where documents are stored
Definition at line 80 of file WsFileSystemTree.cpp.
const string & WsFileSystemTree::getStamp | ( | ) |
returns the Tree unique stamp
Definition at line 229 of file WsFileSystemTree.cpp.
int WsFileSystemTree::getUseCount | ( | ) |
returns the number of users that are using this fileSystemTree version
Definition at line 164 of file WsFileSystemTree.cpp.
void WsFileSystemTree::incrementUseCount | ( | ) |
increments the number of uses of the tree by 1
Definition at line 193 of file WsFileSystemTree.cpp.
int WsFileSystemTree::insertNode | ( | NodePtr | newNode | ) |
inserts the node in the tree The node is inserted on the right place on the tree depending on it's path The node is not created in the filesystem. If the node path is incorrect, the node is not inserted and FAILURE is returned. Otherwise SUCCESS is returned
Definition at line 169 of file WsFileSystemTree.cpp.
int WsFileSystemTree::start | ( | ) |
crawls the diretory and sorts the children. It is called by WsDirectoryCrawler::start()
Definition at line 39 of file WsFileSystemTree.cpp.
|
private |
Current Node, used when building the tree to insert at the correct position
Definition at line 168 of file WsFileSystemTree.h.
|
protectedinherited |
Boolean set to true if the WsDirectoryCrawler::start method has been called and completed successfully
Definition at line 83 of file WsDirectoryCrawler.h.
|
private |
Definition at line 138 of file WsFileSystemTree.h.
|
private |
Definition at line 158 of file WsFileSystemTree.h.
|
private |
Monitored paths by gamin
Definition at line 143 of file WsFileSystemTree.h.
|
protectedinherited |
the boost::filesystem::path of the directory to crawl
Definition at line 58 of file WsDirectoryCrawler.h.
|
private |
Root Node
Definition at line 163 of file WsFileSystemTree.h.
|
private |
The rootPath (the path of the root folder
Definition at line 136 of file WsFileSystemTree.h.
|
private |
WsFileSystemTree stamp
Definition at line 148 of file WsFileSystemTree.h.
|
private |
Number of process using the tree (currently 1 because no multithreading in fsdaemon
Definition at line 153 of file WsFileSystemTree.h.