Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
WsAbstractNode Class Referenceabstract

Contains Abstract metods on nodes and variables. More...

#include <WsAbstractNode.h>

Inheritance diagram for WsAbstractNode:
Inheritance graph
Collaboration diagram for WsAbstractNode:
Collaboration graph

Public Types

enum  ResourceType { Icones, Images, Templates }
 

Public Member Functions

virtual ~WsAbstractNode ()
 Virtual destructor. More...
 
virtual const path & getPath ()=0
 returns the relative path of the node More...
 
virtual const path & getFullPath ()=0
 returns the full path of the node More...
 
virtual string getName (const bool noExt=false)=0
 returns the name of the node More...
 
virtual const string getDisplayName (const bool noExt=false)=0
 returns the display name of the node More...
 
virtual int addChildDirectory (NodePtr f)=0
 adds a node as a child directory The Directory is added to the WsAbstractNode::m_dirVect More...
 
virtual int addChildFile (NodePtr f)=0
 adds a node as a child file The Directory is added to the WsAbstractNode::m_fileVect More...
 
virtual int addChildNode (NodePtr f)=0
 add a Node to the combined vect WsAbstractNode::m_combinedVect More...
 
virtual void setParent (NodePtr n)=0
 sets the parent of the node represented by this More...
 
virtual NodePtr getParent ()=0
 returns the parent node of this More...
 
virtual const vector< NodePtrgetFiles ()=0
 returns the list of all the file contained in the directory represented by this More...
 
virtual const vector< NodePtrgetDirectories ()=0
 returns the list of all the file contained in the file reprensented by this More...
 
virtual const vector< NodePtrgetAll ()=0
 combine the vector of files and directories into a single one More...
 
virtual NodePtr getNodeByName (const std::string &name)=0
 Searches for the NodePtr reprenting the filename. More...
 
virtual bool getDisplayInMenu ()=0
 returns true if the item should be displayed in the menu. This value is set in the configuration file of the node More...
 
virtual void setProperties (NodePropertiesPtr properties)=0
 set the properties of the node. The properties are a WsAbstractProperties object. More...
 
virtual NodePropertiesPtr getProperties ()=0
 get the properties of the node If the properties are not set (no conf found, or node retrieved from server) empty properties are returned. To get the properties for a node retrieved from server use WsUser::getProperties More...
 
virtual std::string getProperty (const std::string &section, const std::string &id, const std::string &def, bool recurse=false)=0
 get a node property reprensented by section/id If no value found, the value def is returned More...
 
virtual void sort ()=0
 sort the nodes using the sort number or the name if not provided More...
 
virtual bool isAllowed (const std::set< string > &gids)=0
 return true if one of the groups contained in gids has access to the node false otherwise If the node is retrieved from the daemon use WsUser::isAllowed instead More...
 
virtual bool isDirectory ()=0
 returns true if Node is a WsDirNode, false otherwise More...
 
virtual bool isRegularFile ()=0
 returns true if Node is a WsFileNode, false otherwise More...
 
virtual const time_t & getModifyDate ()=0
 returns the modification date of the file reprenseted by the node More...
 
virtual const time_t & getCreateDate ()=0
 returns the creation date of the file represented by the node More...
 
virtual void setCreateDate (const time_t &t)=0
 sets the creation date of the file. This method does not change the actual creation date of the file represented by the node More...
 
virtual void setModifyDate (const time_t &t)=0
 sets the modification date of the file. This method does not change the actual modification date of the file represented by the node More...
 
virtual void setSize (const uintmax_t &size)=0
 sets the file size in the node. Typically called by WsFileSystemTree when building the FileSystemTree More...
 
virtual const uintmax_t getSize ()=0
 returns the file size. If the Node is a WsDirNode, 0 is returned. if the global property dir_size is set to true, the number of items in the node is returned (one level) More...
 
virtual NodePtr eatPath (const std::string &path)=0
 resolves the path and returns the node reprenseted by this path The path should be starting from the rootPath otherwise the method won't be able to resolve it. More...
 

Public Attributes

WNodePtr m_parent
 
vector< NodePtrm_fileVect
 
vector< NodePtrm_dirVect
 
vector< NodePtrm_combinedVect
 
path m_fullPath
 
path m_relPath
 
uintmax_t m_size
 

Detailed Description

Contains Abstract metods on nodes and variables.

Abstract and is inherited by WsNode

Definition at line 51 of file WsAbstractNode.h.

Member Enumeration Documentation

Type of ressource

Enumerator
Icones 
Images 
Templates 

Definition at line 57 of file WsAbstractNode.h.

Constructor & Destructor Documentation

WsAbstractNode::~WsAbstractNode ( )
virtual

Virtual destructor.

Definition at line 15 of file WsAbstractNode.cpp.

Member Function Documentation

virtual int WsAbstractNode::addChildDirectory ( NodePtr  f)
pure virtual

adds a node as a child directory The Directory is added to the WsAbstractNode::m_dirVect

Parameters
fa NodePtr of the WsAbstractNode representing the directory
Returns
SUCCESS or FAILURE

Implemented in WsNode.

virtual int WsAbstractNode::addChildFile ( NodePtr  f)
pure virtual

adds a node as a child file The Directory is added to the WsAbstractNode::m_fileVect

Parameters
fa NodePtr of the WsAbstractNode representing the file

Implemented in WsNode.

virtual int WsAbstractNode::addChildNode ( NodePtr  f)
pure virtual

add a Node to the combined vect WsAbstractNode::m_combinedVect

Parameters
fa NodePtr of the WsAbstractNode representing the file or directory

Implemented in WsNode.

virtual NodePtr WsAbstractNode::eatPath ( const std::string &  path)
pure virtual

resolves the path and returns the node reprenseted by this path The path should be starting from the rootPath otherwise the method won't be able to resolve it.

Parameters
paththe path of the node we are searching starting from the rootPath
Returns
The corresponding NodePtr reprensenting the WsAbstractNode if found or an empty NodePtr

Implemented in WsNode.

virtual const vector<NodePtr> WsAbstractNode::getAll ( )
pure virtual

combine the vector of files and directories into a single one

Returns
the combined vector

Implemented in WsNode.

virtual const time_t& WsAbstractNode::getCreateDate ( )
pure virtual

returns the creation date of the file represented by the node

Implemented in WsNode.

virtual const vector<NodePtr> WsAbstractNode::getDirectories ( )
pure virtual

returns the list of all the file contained in the file reprensented by this

Returns
a list of Nodes containing these children

Implemented in WsNode.

virtual bool WsAbstractNode::getDisplayInMenu ( )
pure virtual

returns true if the item should be displayed in the menu. This value is set in the configuration file of the node

Implemented in WsNode, and WsFileNode.

virtual const string WsAbstractNode::getDisplayName ( const bool  noExt = false)
pure virtual

returns the display name of the node

Returns
the display name of the node if set in the configuration file of the node, otherwise WsAbstractNode::getName() is returned

Implemented in WsNode.

virtual const vector<NodePtr> WsAbstractNode::getFiles ( )
pure virtual

returns the list of all the file contained in the directory represented by this

Returns
a list of Nodes containing these children

Implemented in WsNode.

virtual const path& WsAbstractNode::getFullPath ( )
pure virtual

returns the full path of the node

Implemented in WsNode.

virtual const time_t& WsAbstractNode::getModifyDate ( )
pure virtual

returns the modification date of the file reprenseted by the node

Implemented in WsNode.

virtual string WsAbstractNode::getName ( const bool  noExt = false)
pure virtual

returns the name of the node

Returns
the name of the node. ie the text contained between the last '/' and the end

Implemented in WsNode.

virtual NodePtr WsAbstractNode::getNodeByName ( const std::string &  name)
pure virtual

Searches for the NodePtr reprenting the filename.

Parameters
namethe name of the node with the extension
Returns
the corresponding NodePtr or an empty NodePtr if not found

Implemented in WsNode.

virtual NodePtr WsAbstractNode::getParent ( )
pure virtual

returns the parent node of this

Returns
the parent Node, a NodePtr representing a WsDirNode if existing otherwise returns NULL

Implemented in WsNode.

virtual const path& WsAbstractNode::getPath ( )
pure virtual

returns the relative path of the node

Returns
the relative path of the node, ie the Full path without the rootPath

Implemented in WsNode.

virtual NodePropertiesPtr WsAbstractNode::getProperties ( )
pure virtual

get the properties of the node If the properties are not set (no conf found, or node retrieved from server) empty properties are returned. To get the properties for a node retrieved from server use WsUser::getProperties

See Also
WsUser::getProperties

Implemented in WsNode.

virtual std::string WsAbstractNode::getProperty ( const std::string &  section,
const std::string &  id,
const std::string &  def,
bool  recurse = false 
)
pure virtual

get a node property reprensented by section/id If no value found, the value def is returned

Parameters
sectionthe section of the key we are searching
idthe key we are searching
defthe default value to return if not found
recurseif set to true and no value found , the method will look for parent values until a value is found.

Implemented in WsNode.

virtual const uintmax_t WsAbstractNode::getSize ( )
pure virtual

returns the file size. If the Node is a WsDirNode, 0 is returned. if the global property dir_size is set to true, the number of items in the node is returned (one level)

Implemented in WsNode, WsDirNode, and WsFileNode.

virtual bool WsAbstractNode::isAllowed ( const std::set< string > &  gids)
pure virtual

return true if one of the groups contained in gids has access to the node false otherwise If the node is retrieved from the daemon use WsUser::isAllowed instead

Parameters
gidsa set of gids (Typically the gids of a user
Returns
true if one or more gid that have access are present in gids, false otherwise
See Also
WsUser::isAllowed

Implemented in WsFileNode, and WsDirNode.

virtual bool WsAbstractNode::isDirectory ( )
pure virtual

returns true if Node is a WsDirNode, false otherwise

Implemented in WsNode, WsFileNode, and WsDirNode.

virtual bool WsAbstractNode::isRegularFile ( )
pure virtual

returns true if Node is a WsFileNode, false otherwise

Implemented in WsNode, WsFileNode, and WsDirNode.

virtual void WsAbstractNode::setCreateDate ( const time_t &  t)
pure virtual

sets the creation date of the file. This method does not change the actual creation date of the file represented by the node

Implemented in WsNode.

virtual void WsAbstractNode::setModifyDate ( const time_t &  t)
pure virtual

sets the modification date of the file. This method does not change the actual modification date of the file represented by the node

Implemented in WsNode.

virtual void WsAbstractNode::setParent ( NodePtr  n)
pure virtual

sets the parent of the node represented by this

Parameters
nthe parent node that is a NodePtr representing a WsDirNode

Implemented in WsNode.

virtual void WsAbstractNode::setProperties ( NodePropertiesPtr  properties)
pure virtual

set the properties of the node. The properties are a WsAbstractProperties object.

Parameters
propertiesw WsNodeProperties representing the properties of the node. The object should be instanciated and values set in it

Implemented in WsNode.

virtual void WsAbstractNode::setSize ( const uintmax_t &  size)
pure virtual

sets the file size in the node. Typically called by WsFileSystemTree when building the FileSystemTree

Implemented in WsNode.

virtual void WsAbstractNode::sort ( )
pure virtual

sort the nodes using the sort number or the name if not provided

Implemented in WsNode.

Member Data Documentation

vector<NodePtr> WsAbstractNode::m_combinedVect

A combined vector of WsAbstractNode::m_fileVect and WsAbstractNode::m_dirVect It is built in the WsAbstractNode::sort() method

Definition at line 258 of file WsAbstractNode.h.

vector<NodePtr> WsAbstractNode::m_dirVect

The std::vector containing the children directories of the Node represented by this

Definition at line 253 of file WsAbstractNode.h.

vector<NodePtr> WsAbstractNode::m_fileVect

The std::vector containing the children files of the Node represented by this

Definition at line 249 of file WsAbstractNode.h.

path WsAbstractNode::m_fullPath

The full path of the Node (ie the rootPath + m_relPath)

Definition at line 262 of file WsAbstractNode.h.

WNodePtr WsAbstractNode::m_parent

The parent Node

Definition at line 245 of file WsAbstractNode.h.

path WsAbstractNode::m_relPath

The relative path of the Node (ie the path starting from the rootPath

Definition at line 266 of file WsAbstractNode.h.

uintmax_t WsAbstractNode::m_size

The size of the file represented by the node on disk

Definition at line 270 of file WsAbstractNode.h.


The documentation for this class was generated from the following files: