00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CVSSOURCETREE_H
00020 #define CVSSOURCETREE_H
00021
00022 #include "pandatoolbase.h"
00023
00024 #include "pvector.h"
00025 #include "pmap.h"
00026 #include "filename.h"
00027
00028 class CVSSourceDirectory;
00029
00030
00031
00032
00033
00034
00035 class CVSSourceTree {
00036 public:
00037 CVSSourceTree();
00038 ~CVSSourceTree();
00039
00040 void set_root(const Filename &root_path);
00041 bool scan(const Filename &key_filename);
00042
00043 CVSSourceDirectory *get_root() const;
00044 CVSSourceDirectory *find_directory(const Filename &path);
00045 CVSSourceDirectory *find_relpath(const string &relpath);
00046 CVSSourceDirectory *find_dirname(const string &dirname);
00047
00048 CVSSourceDirectory *choose_directory(const Filename &filename,
00049 CVSSourceDirectory *suggested_dir,
00050 bool force, bool interactive);
00051
00052 Filename get_root_fullpath();
00053 Filename get_root_dirname() const;
00054
00055 static bool temp_chdir(const Filename &path);
00056 static void restore_cwd();
00057
00058 public:
00059 void add_file(const Filename &filename, CVSSourceDirectory *dir);
00060
00061 private:
00062 typedef pvector<CVSSourceDirectory *> Directories;
00063
00064 CVSSourceDirectory *
00065 prompt_user(const string &filename, CVSSourceDirectory *suggested_dir,
00066 const Directories &dirs, bool force, bool interactive);
00067
00068 CVSSourceDirectory *ask_existing(const string &filename,
00069 CVSSourceDirectory *dir);
00070 CVSSourceDirectory *ask_existing(const string &filename,
00071 const Directories &dirs,
00072 CVSSourceDirectory *suggested_dir);
00073 CVSSourceDirectory *ask_new(const string &filename, CVSSourceDirectory *dir);
00074 CVSSourceDirectory *ask_any(const string &filename);
00075
00076 string prompt(const string &message);
00077
00078 static Filename get_actual_fullpath(const Filename &path);
00079 static Filename get_start_fullpath();
00080
00081 private:
00082 Filename _path;
00083 CVSSourceDirectory *_root;
00084
00085 typedef pmap<Filename, Directories> Filenames;
00086 Filenames _filenames;
00087
00088 static bool _got_start_fullpath;
00089 static Filename _start_fullpath;
00090 bool _got_root_fullpath;
00091 Filename _root_fullpath;
00092 };
00093
00094 #endif