Panda3D
cvsSourceDirectory.h
1 // Filename: cvsSourceDirectory.h
2 // Created by: drose (31Oct00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CVSSOURCEDIRECTORY_H
16 #define CVSSOURCEDIRECTORY_H
17 
18 #include "pandatoolbase.h"
19 #include "filename.h"
20 
21 #include "pvector.h"
22 
23 class CVSSourceTree;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : CVSSourceDirectory
27 // Description : This represents one particular directory in the
28 // hierarchy of source directory files. We must scan
29 // the source directory to identify where the related
30 // files have previously been copied.
31 //
32 // The tree is maintained in a case-insensitive manner,
33 // even on a non-Windows system, since you might want to
34 // eventually check out the CVS tree onto a Windows
35 // system--and if you do, you'll be sad if there are
36 // case conflicts within the tree. So we make an effort
37 // to ensure this doesn't happen by treating two files
38 // with a different case as the same file.
39 ////////////////////////////////////////////////////////////////////
41 public:
43  const string &dirname);
45 
46  string get_dirname() const;
47  Filename get_fullpath() const;
48  Filename get_path() const;
49  Filename get_rel_to(const CVSSourceDirectory *other) const;
50 
51  int get_num_children() const;
52  CVSSourceDirectory *get_child(int n) const;
53 
54  CVSSourceDirectory *find_relpath(const string &relpath);
55  CVSSourceDirectory *find_dirname(const string &dirname);
56 
57 public:
58  bool scan(const Filename &directory, const string &key_filename);
59 
60 private:
61  CVSSourceTree *_tree;
62  CVSSourceDirectory *_parent;
63  string _dirname;
64  int _depth;
65 
67  Children _children;
68 };
69 
70 #endif
CVSSourceDirectory * find_dirname(const string &dirname)
Returns the source directory that corresponds to the given local directory name, or NULL if there is ...
int get_num_children() const
Returns the number of subdirectories below this directory.
CVSSourceDirectory * find_relpath(const string &relpath)
Returns the source directory that corresponds to the given relative path from this directory...
string get_dirname() const
Returns the local name of this particular directory.
Filename get_rel_to(const CVSSourceDirectory *other) const
Returns the relative path to the other directory from this one.
Filename get_path() const
Returns the relative pathname to this particular directory, as seen from the root of the tree...
Filename get_fullpath() const
Returns the full pathname to this particular directory.
This represents one particular directory in the hierarchy of source directory files.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This represents the root of the tree of source directory files.
Definition: cvsSourceTree.h:39
CVSSourceDirectory * get_child(int n) const
Returns the nth subdirectory below this directory.
bool scan(const Filename &directory, const string &key_filename)
Recursively scans the contents of the source directory.