35 string relp = fullPath.string().substr(rootPath.string().length());
37 if (rp.string() ==
"")
41 }
catch (std::out_of_range& exception) {
42 LOG(
ERROR) <<
"WsNode::WsNode() : Exception raised: " << exception.what();
49 NodePtr spThis = shared_from_this();
50 f.get()->setParent(spThis);
53 }
catch (bad_alloc e) {
54 LOG(
ERROR) <<
"WsNode::addChildDirectory() : " << e.what() << endl;
62 NodePtr spThis = shared_from_this();
63 f.get()->setParent(spThis);
66 }
catch (bad_alloc e) {
67 LOG(
ERROR) <<
"WsNode::addChildFile() : " << e.what() << endl;
77 }
catch (bad_alloc e) {
107 return this->
getPath().stem().string();
108 return this->
getPath().filename().string();
113 if (
m_properties.get()->get(
"global",
"display_name",
"") !=
"" )
114 return m_properties.get()->get(
"global",
"display_name",
"");
142 if ((*it).get()->getName() == name) {
148 if ((*it2).get()->getName() == name) {
152 LOG(
DEBUG) <<
"WsNode::getNodeByName() : Node not found " << name;
158 string r =
m_properties.get()->get(
"global",
"in_menu",
"false");
180 string WsNode::getProperty(
const std::string& section,
const std::string&
id,
const std::string& def,
bool recurse)
184 if ( prop ==
"" && recurse) {
186 if (parent.get() != 0) {
187 return parent.get()->getProperty(section,
id, def, recurse);
189 }
else return prop !=
"" ? prop : def;
199 if (this->
getProperty(
"global",
"sort",
"true") ==
"true") {
213 NodePtr sThis = shared_from_this();
218 name = path.substr(1);
221 if (name.find(
"/") != string::npos) {
222 sub = name.substr(0, name.find_first_of(
"/"));
223 name = name.substr(name.find_first_of(
"/"));
229 if (cur.get() == 0) {
230 LOG(
ERROR) <<
"WsNode::eatPath() : No such path " << path;
233 if (name ==
"" || name ==
"/") {
236 return cur.get()->eatPath(name);
boost::shared_ptr< WsAbstractNode > NodePtr
NodePtr eatPath(const std::string &path)
resolves the path and returns the node reprenseted by this path The path should be starting from the ...
const string getDisplayName(const bool noExt=false)
returns the display name of the node
const time_t & getCreateDate()
WsAbstractNode::getCreateDate()
std::string getProperty(const std::string §ion, const std::string &id, const std::string &def, bool recurse=false)
get a node property reprensented by section/id If no value found, the value def is returned ...
const path & getFullPath()
returns the full path of the node
Contains Abstract metods on nodes and variables.
void setModifyDate(const time_t &t)
sets the modification date of the file. This method does not change the actual modification date of t...
int addChildNode(NodePtr f)
add a Node to the combined vect WsAbstractNode::m_combinedVect
Node structure, must be inherited.
vector< NodePtr > m_combinedVect
boost::mutex * m_mutexSort
const vector< NodePtr > getFiles()
returns the list of all the file contained in the directory represented by this
void sort()
sort the nodes using the sort number or the name if not provided
NodePropertiesPtr getProperties()
get the properties of the node If the properties are not set (no conf found, or node retrieved from s...
void setProperties(NodePropertiesPtr properties)
set the properties of the node. The properties are a WsAbstractProperties object. ...
const time_t & getModifyDate()
returns the modification date of the file reprenseted by the node
vector< NodePtr > m_fileVect
const vector< NodePtr > getAll()
combine the vector of files and directories into a single one
int addChildDirectory(NodePtr f)
adds a node as a child directory The Directory is added to the WsAbstractNode::m_dirVect ...
NodePropertiesPtr m_properties
bool getDisplayInMenu()
returns true if the item should be displayed in the menu. This value is set in the configuration file...
void setParent(NodePtr n)
sets the parent of the node represented by this
const path & getPath()
returns the relative path of the node
NodePtr getParent()
returns the parent node of this
boost::shared_ptr< WsNodeProperties > NodePropertiesPtr
string getName(const bool noExt=false)
returns the name of the node
void setSize(const uintmax_t &size)
sets the file size in the node. Typically called by WsFileSystemTree when building the FileSystemTree...
const vector< NodePtr > getDirectories()
returns the list of all the file contained in the file reprensented by this
Compares two nodes and returns true or false depending on : If Sort order is asc in the node configur...
vector< NodePtr > m_dirVect
void setCreateDate(const time_t &t)
sets the creation date of the file. This method does not change the actual creation date of the file ...
NodePtr getNodeByName(const std::string &name)
Searches for the NodePtr reprenting the filename.
int addChildFile(NodePtr f)
adds a node as a child file The Directory is added to the WsAbstractNode::m_fileVect ...