Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsAbstractNode.h
Go to the documentation of this file.
1 
14 #ifndef WS_ABSTRACT_NODE_H__
15 #define WS_ABSTRACT_NODE_H__
16 #define BOOST_FILESYSTEM_NO_DEPRECATED
17 
18 
19 
20 #include <boost/filesystem.hpp>
21 #include <boost/shared_ptr.hpp>
22 #include <boost/enable_shared_from_this.hpp>
23 using namespace boost::filesystem;
24 
26 #include <Logger/WsLogger.h>
27 
28 #include <iostream>
29 #include <list>
30 #include <vector>
31 
32 using namespace std;
33 
38 
39 /* Typedef used to swith easily from boost to C++11 */
40 typedef boost::shared_ptr<WsAbstractNode> NodePtr;
41 typedef boost::weak_ptr<WsAbstractNode> WNodePtr;
42 
43 typedef boost::shared_ptr<WsNodeProperties> NodePropertiesPtr;
44 
51 class WsAbstractNode : public boost::enable_shared_from_this<WsAbstractNode> {
52 public:
53 
57  enum ResourceType { Icones, Images, Templates };
58 
62  virtual ~WsAbstractNode();
63 
69  virtual const path& getPath() = 0;
70 
74  virtual const path& getFullPath() = 0;
75 
80  virtual string getName(const bool noExt = false) = 0;
81 
86  virtual const string getDisplayName(const bool noExt = false) = 0;
87 
94  virtual int addChildDirectory(NodePtr f) = 0;
95 
101  virtual int addChildFile(NodePtr f) = 0;
102 
107  virtual int addChildNode(NodePtr f) = 0;
108 
113  virtual void setParent(NodePtr n) = 0;
114 
119  virtual NodePtr getParent() = 0;
120 
125  virtual const vector<NodePtr> getFiles() = 0;
126 
131  virtual const vector<NodePtr> getDirectories() = 0;
132 
137  virtual const vector<NodePtr> getAll() = 0;
138 
144  virtual NodePtr getNodeByName(const std::string& name) = 0;
145 
149  virtual bool getDisplayInMenu() = 0;
150 
156  virtual void setProperties(NodePropertiesPtr properties) = 0 ;
157 
164  virtual NodePropertiesPtr getProperties() = 0;
165 
174  virtual std::string getProperty(const std::string& section, const std::string& id, const std::string& def, bool recurse = false) = 0;
175 
179  virtual void sort() = 0;
180 
189  virtual bool isAllowed(const std::set<string>& gids) = 0;
190 
194  virtual bool isDirectory() = 0;
195 
199  virtual bool isRegularFile() = 0;
200 
204  virtual const time_t& getModifyDate() = 0;
205 
209  virtual const time_t& getCreateDate() = 0;
210 
215  virtual void setCreateDate(const time_t& t) = 0;
216 
221  virtual void setModifyDate(const time_t& t) = 0;
222 
226  virtual void setSize(const uintmax_t& size) = 0;
227 
232  virtual const uintmax_t getSize() = 0;
233 
240  virtual NodePtr eatPath(const std::string& path) = 0;
241 
249  vector<NodePtr> m_fileVect;
253  vector<NodePtr> m_dirVect;
258  vector<NodePtr> m_combinedVect;
266  path m_relPath;
270  uintmax_t m_size;
271 
272 };
273 
274 #endif
boost::shared_ptr< WsAbstractNode > NodePtr
boost::weak_ptr< WsAbstractNode > WNodePtr
Contains Abstract metods on nodes and variables.
vector< NodePtr > m_combinedVect
vector< NodePtr > m_fileVect
boost::shared_ptr< WsNodeProperties > NodePropertiesPtr
uintmax_t m_size
vector< NodePtr > m_dirVect