1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef dbos_workdir_filesystem_Abstract_hpp
10 #define dbos_workdir_filesystem_Abstract_hpp
15 #include <anna/core/util/ExclusiveHash.hpp>
19 namespace filesystem {
25 struct ClassType { enum _v { Directory, File }; };
27 typedef std::vector <Abstract*> child_container;
28 typedef child_container::iterator child_iterator;
29 typedef child_container::const_iterator const_child_iterator;
33 Abstract* getParent () const throw () { return a_parent; }
34 ClassType::_v getClassType () const throw () { return a_classType; }
35 const std::string& getName () const throw () { return a_name; }
36 const std::string& getPath () const throw () { return a_path; }
38 int child_size () const throw () { return a_children.size (); }
40 child_iterator child_begin () throw () { return a_children.begin (); }
41 child_iterator child_end () throw () { return a_children.end (); }
42 static Abstract* child (child_iterator ii) throw () { return *ii; }
44 const_child_iterator child_begin () const throw () { return a_children.begin (); }
45 const_child_iterator child_end () const throw () { return a_children.end (); }
46 static const Abstract* child (const_child_iterator ii) throw () { return *ii; }
48 static std::string calculePath (const Abstract* parent, const std::string& shortPath) throw ();
50 virtual void print (const int level) const throw () = 0;
53 Abstract (const ClassType::_v, const std::string& name);
54 Abstract (const ClassType::_v, Abstract* parent, const std::string& name);
57 const ClassType::_v a_classType;
59 const std::string a_name;
61 child_container a_children;
63 Abstract (const Abstract&);