Add no-deprecated to warnings due to dynamic exceptions.
[anna.git] / example / dbos / workdir / filesystem / Abstract.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
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 //
7
8
9 #include "Abstract.hpp"
10
11 using namespace std;
12 using namespace anna;
13 using namespace workdir;
14
15 filesystem::Abstract::Abstract (const Abstract::ClassType::_v classType, const std::string& name) :
16    a_classType (classType),
17    a_name (name), a_parent (NULL) 
18 {
19    a_path = name;
20 }
21
22 filesystem::Abstract::Abstract (const Abstract::ClassType::_v classType, filesystem::Abstract* parent, const std::string& name) : 
23    a_classType (classType),
24    a_name (name), 
25    a_parent (parent) 
26
27    a_parent->a_children.push_back (this);
28    a_path = calculePath (parent, name);
29 }
30
31 /*virtual*/
32 filesystem::Abstract::~Abstract ()
33 {
34    for (child_iterator ii = child_begin (), maxii = child_end (); ii != maxii; ii ++)
35       delete child (ii);
36    
37    a_children.clear ();
38 }
39
40 /* static */
41 string filesystem::Abstract::calculePath (const filesystem::Abstract* parent, const std::string& shortPath) 
42    throw ()
43 {
44    string result;
45    
46    if (parent!= NULL) {
47       result = parent->a_path;
48       result += '/';
49    }
50    
51    return result += shortPath;
52 }