Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Directory.cc
r7 r9 4 4 #include "Node.h" 5 5 6 #include <iostream> 7 #include <iterator> 8 9 #include <errno.h> // Needed to check error state below. 10 #include <dirent.h> 11 6 12 namespace theplu{ 7 13 namespace svnstat{ 8 14 9 Directory::Directory(const std::string& name, Node* mother) 10 : Node(name,mother) 11 { 12 } 15 Directory::Directory(const std::string& path) 16 : Node(path) 17 { 18 DIR* directory=opendir(path.c_str()); 19 if (!directory) { 20 // Jari, throw exception 21 std::cerr << "ERROR: opendir() failed; terminating" << std::endl; 22 exit(1); 23 } 24 struct dirent* entry; 25 errno=0; 26 std::vector<std::string> entries; 27 while ((entry=readdir(directory))) 28 entries.push_back(std::string(entry->d_name)); // Jari, push backing 29 if (errno) { 30 // Jari, throw exception 31 std::cerr << "ERROR: readdir() failure; terminating" << std::endl; 32 exit(1); 33 } 34 closedir(directory); 13 35 14 bool Directory::parse(void) 15 { 16 for_each(daughters_.begin(),daughters_.end(), std::mem_fun(&Node::parse)); 17 return true; 18 } 36 copy(entries.begin(),entries.end(), 37 std::ostream_iterator<std::string>(std::cout,"\n")); 38 } 39 40 bool Directory::parse(void) 41 { 42 // Jari, where is the include for for_each? 43 for_each(nn_.begin(),nn_.end(), std::mem_fun(&Node::parse)); 44 return true; 45 } 19 46 20 47 }} // end of namespace svnstat and namespace theplu -
trunk/lib/Directory.h
r7 r9 11 11 namespace svnstat{ 12 12 13 /// 14 /// Class taking care of directories. Mainly containing pointers to 15 /// files in directory. 16 /// 17 class Directory : public Node 18 { 19 public: 20 /// 21 /// @brief Constructor 22 /// 23 Directory(const std::string& name, Node* mother); 24 25 bool parse(void); 26 27 private: 28 /// 29 /// @brief Copy Constructor 30 /// 31 Directory(const Directory& other); 32 33 std::vector<Node*> daughters_; 13 /// 14 /// Class taking care of directories. 15 /// 16 class Directory : public Node 17 { 18 public: 19 /// 20 /// @brief Constructor 21 /// 22 Directory(const std::string& path); 34 23 35 }; 24 /// 25 /// @brief Destructor 26 /// 27 ~Directory(void) {}; 28 29 bool parse(void); 30 31 private: 32 /// 33 /// @brief Copy Constructor, not implemented 34 /// 35 Directory(const Directory&); 36 37 std::vector<Node*> nn_; 38 }; 36 39 37 40 }} // end of namespace svnstat and namespace theplu -
trunk/lib/File.cc
r7 r9 13 13 namespace svnstat{ 14 14 15 File::File(const std::string& path, Node* mother)16 : Node(path,mother), binary_(false)17 {18 }19 20 15 bool File::blame() const 21 16 { -
trunk/lib/File.h
r7 r9 19 19 /// @brief Default Constructor 20 20 /// 21 File(const std::string& name, Node*); 22 21 inline File(const std::string& path) : Node(path), binary_(false) {} 22 23 23 /// 24 24 /// Parsing out information from svn repository … … 29 29 30 30 private: 31 /// 32 /// @brief Copy Constructor 33 /// 34 File(const File& c);31 /// 32 /// @brief Copy Constructor, not implemented 33 /// 34 File(const File&); 35 35 36 36 /// -
trunk/lib/Node.cc
r7 r9 12 12 namespace theplu{ 13 13 namespace svnstat{ 14 15 Node::Node(const std::string& path, Node* mother)16 : path_(path), mother_(mother)17 {18 info();19 }20 14 21 15 std::vector<u_int> Node::accumulated(void) const … … 52 46 vec.resize(rev+1); 53 47 for (; i<rev; i++) 54 vec[i]=0;48 vec[i]=0; 55 49 vec[rev]=1; 56 50 } … … 58 52 vec[rev]++; 59 53 stats_[user]=vec; 60 61 if (mother_)62 mother_->add(user,rev);63 54 } 64 55 … … 78 69 getline(ss,tag,':'); 79 70 if (tag == std::string("Repository UUID")) 80 ss >> uuid_;71 ss >> uuid_; 81 72 else if (tag == std::string("Last Changed Author")) 82 ss >> author_;73 ss >> author_; 83 74 else if (tag == std::string("Last Changed Rev")) 84 ss >> revision_;75 ss >> revision_; 85 76 } 86 77 -
trunk/lib/Node.h
r7 r9 20 20 /// @brief Constructor 21 21 /// 22 Node(const std::string& name, Node*); 22 inline Node(const std::string& path) : path_(path) { info(); } 23 23 24 virtual ~Node() {}; 24 /// 25 /// @brief Destructor 26 /// 27 virtual inline ~Node(void) {}; 25 28 26 29 /// … … 58 61 59 62 std::string author_; 60 Node* mother_;61 63 std::string path_; 62 64 u_int revision_; … … 65 67 std::string uuid_; 66 68 67 }; 69 private: 70 /// 71 /// @brief Copy Constructor, not implemented 72 /// 73 Node(const Node&); 74 }; 68 75 69 76 }} // end of namespace svnstat and namespace theplu
Note: See TracChangeset
for help on using the changeset viewer.