Panda3D
|
00001 // Filename: cvsSourceDirectory.h 00002 // Created by: drose (31Oct00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CVSSOURCEDIRECTORY_H 00016 #define CVSSOURCEDIRECTORY_H 00017 00018 #include "pandatoolbase.h" 00019 #include "filename.h" 00020 00021 #include "pvector.h" 00022 00023 class CVSSourceTree; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : CVSSourceDirectory 00027 // Description : This represents one particular directory in the 00028 // hierarchy of source directory files. We must scan 00029 // the source directory to identify where the related 00030 // files have previously been copied. 00031 // 00032 // The tree is maintained in a case-insensitive manner, 00033 // even on a non-Windows system, since you might want to 00034 // eventually check out the CVS tree onto a Windows 00035 // system--and if you do, you'll be sad if there are 00036 // case conflicts within the tree. So we make an effort 00037 // to ensure this doesn't happen by treating two files 00038 // with a different case as the same file. 00039 //////////////////////////////////////////////////////////////////// 00040 class CVSSourceDirectory { 00041 public: 00042 CVSSourceDirectory(CVSSourceTree *tree, CVSSourceDirectory *parent, 00043 const string &dirname); 00044 ~CVSSourceDirectory(); 00045 00046 string get_dirname() const; 00047 Filename get_fullpath() const; 00048 Filename get_path() const; 00049 Filename get_rel_to(const CVSSourceDirectory *other) const; 00050 00051 int get_num_children() const; 00052 CVSSourceDirectory *get_child(int n) const; 00053 00054 CVSSourceDirectory *find_relpath(const string &relpath); 00055 CVSSourceDirectory *find_dirname(const string &dirname); 00056 00057 public: 00058 bool scan(const Filename &directory, const string &key_filename); 00059 00060 private: 00061 CVSSourceTree *_tree; 00062 CVSSourceDirectory *_parent; 00063 string _dirname; 00064 int _depth; 00065 00066 typedef pvector<CVSSourceDirectory *> Children; 00067 Children _children; 00068 }; 00069 00070 #endif