Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

CVSSourceTree Class Reference

This represents the root of the tree of source directory files. More...

#include <cvsSourceTree.h>

List of all members.

Public Member Functions

 CVSSourceTree ()
 ~CVSSourceTree ()
void set_root (const Filename &root_path)
 Sets the root of the source directory.

bool scan (const Filename &key_filename)
 Scans the complete source directory starting at the indicated pathname.

CVSSourceDirectoryget_root () const
 Returns the root directory of the hierarchy.

CVSSourceDirectoryfind_directory (const Filename &path)
 Returns the source directory that corresponds to the given path, or NULL if there is no such directory in the source tree.

CVSSourceDirectoryfind_relpath (const string &relpath)
 Returns the source directory that corresponds to the given relative path from the root, or NULL if there is no match.

CVSSourceDirectoryfind_dirname (const string &dirname)
 Returns the source directory that corresponds to the given local directory name, or NULL if there is no match.

CVSSourceDirectorychoose_directory (const Filename &filename, CVSSourceDirectory *suggested_dir, bool force, bool interactive)
 Determines where an externally referenced model file of the indicated name should go.

Filename get_root_fullpath ()
 Returns the full path from the root to the top of the source hierarchy.

Filename get_root_dirname () const
 Returns the local directory name of the root of the tree.

void add_file (const Filename &filename, CVSSourceDirectory *dir)
 Adds a new file to the set of known files.


Static Public Member Functions

bool temp_chdir (const Filename &path)
 Temporarily changes the current directory to the named path.

void restore_cwd ()
 Restores the current directory after changing it from temp_chdir().


Private Types

typedef pvector< CVSSourceDirectory * > Directories
typedef pmap< Filename, DirectoriesFilenames

Private Member Functions

CVSSourceDirectoryprompt_user (const string &filename, CVSSourceDirectory *suggested_dir, const Directories &dirs, bool force, bool interactive)
 Prompts the user, if necessary, to choose a directory to import the given file into.

CVSSourceDirectoryask_existing (const string &filename, CVSSourceDirectory *dir)
 Asks the user if he wants to replace an existing file.

CVSSourceDirectoryask_existing (const string &filename, const Directories &dirs, CVSSourceDirectory *suggested_dir)
 Asks the user which of several existing files he wants to replace.

CVSSourceDirectoryask_new (const string &filename, CVSSourceDirectory *dir)
 Asks the user if he wants to replace an existing file.

CVSSourceDirectoryask_any (const string &filename)
 Asks the user to type in the name of the directory in which to store the file.

string prompt (const string &message)
 Issues a prompt to the user and waits for a typed response.


Static Private Member Functions

Filename get_actual_fullpath (const Filename &path)
 Determines the actual full path from the root to the named directory.

Filename get_start_fullpath ()
 Returns the full path from the root to the directory in which the user started the program.


Private Attributes

Filename _path
CVSSourceDirectory_root
Filenames _filenames
bool _got_root_fullpath
Filename _root_fullpath

Static Private Attributes

bool _got_start_fullpath = false
Filename _start_fullpath


Detailed Description

This represents the root of the tree of source directory files.

Definition at line 42 of file cvsSourceTree.h.


Member Typedef Documentation

typedef pvector<CVSSourceDirectory *> CVSSourceTree::Directories [private]
 

Definition at line 69 of file cvsSourceTree.h.

typedef pmap<Filename, Directories> CVSSourceTree::Filenames [private]
 

Definition at line 92 of file cvsSourceTree.h.


Constructor & Destructor Documentation

CVSSourceTree::CVSSourceTree  ) 
 

Definition at line 49 of file cvsSourceTree.cxx.

References _root, and NULL.

CVSSourceTree::~CVSSourceTree  ) 
 

Definition at line 62 of file cvsSourceTree.cxx.

References _path, Filename::empty(), and nassertv.


Member Function Documentation

void CVSSourceTree::add_file const Filename filename,
CVSSourceDirectory dir
 

Adds a new file to the set of known files.

This is normally called from CVSSourceDirectory::scan() and should not be called directly by the user.

Definition at line 293 of file cvsSourceTree.cxx.

CVSSourceDirectory * CVSSourceTree::ask_any const string &  filename  )  [private]
 

Asks the user to type in the name of the directory in which to store the file.

Definition at line 530 of file cvsSourceTree.cxx.

CVSSourceDirectory * CVSSourceTree::ask_existing const string &  filename,
const Directories dirs,
CVSSourceDirectory suggested_dir
[private]
 

Asks the user which of several existing files he wants to replace.

Definition at line 440 of file cvsSourceTree.cxx.

References find_directory(), find_dirname(), find_relpath(), nassertr, nout, NULL, and prompt().

CVSSourceDirectory * CVSSourceTree::ask_existing const string &  filename,
CVSSourceDirectory dir
[private]
 

Asks the user if he wants to replace an existing file.

Definition at line 411 of file cvsSourceTree.cxx.

References CVSSourceDirectory::get_path(), nassertr, nout, NULL, and prompt().

CVSSourceDirectory * CVSSourceTree::ask_new const string &  filename,
CVSSourceDirectory dir
[private]
 

Asks the user if he wants to replace an existing file.

Definition at line 501 of file cvsSourceTree.cxx.

References Filename::make_canonical(), and path.

CVSSourceDirectory * CVSSourceTree::choose_directory const Filename filename,
CVSSourceDirectory suggested_dir,
bool  force,
bool  interactive
 

Determines where an externally referenced model file of the indicated name should go.

It does this by looking for an existing model file of the same name; if a matching model is not found, or if multiple matching files are found, prompts the user for the directory, or uses suggested_dir.

Definition at line 225 of file cvsSourceTree.cxx.

CVSSourceDirectory * CVSSourceTree::find_directory const Filename path  ) 
 

Returns the source directory that corresponds to the given path, or NULL if there is no such directory in the source tree.

Definition at line 134 of file cvsSourceTree.cxx.

References _root, CVSSourceDirectory::find_relpath(), CVSSourceDirectory::get_dirname(), NULL, and size_t.

Referenced by ask_existing(), and CVSCopy::handle_args().

CVSSourceDirectory * CVSSourceTree::find_dirname const string &  dirname  ) 
 

Returns the source directory that corresponds to the given local directory name, or NULL if there is no match.

Definition at line 202 of file cvsSourceTree.cxx.

References _got_root_fullpath, _path, _root_fullpath, Filename::empty(), Filename, get_actual_fullpath(), and nassertr.

Referenced by ask_existing().

CVSSourceDirectory * CVSSourceTree::find_relpath const string &  relpath  ) 
 

Returns the source directory that corresponds to the given relative path from the root, or NULL if there is no match.

The relative path may or may not include the name of the root directory itself.

Definition at line 167 of file cvsSourceTree.cxx.

Referenced by ask_existing().

Filename CVSSourceTree::get_actual_fullpath const Filename path  )  [static, private]
 

Determines the actual full path from the root to the named directory.

Definition at line 603 of file cvsSourceTree.cxx.

Referenced by find_dirname(), and scan().

CVSSourceDirectory * CVSSourceTree::get_root  )  const
 

Returns the root directory of the hierarchy.

Definition at line 117 of file cvsSourceTree.cxx.

References NULL.

Filename CVSSourceTree::get_root_dirname  )  const
 

Returns the local directory name of the root of the tree.

Definition at line 275 of file cvsSourceTree.cxx.

Filename CVSSourceTree::get_root_fullpath  ) 
 

Returns the full path from the root to the top of the source hierarchy.

Definition at line 255 of file cvsSourceTree.cxx.

Referenced by CVSSourceDirectory::get_dirname(), scan(), and set_root().

Filename CVSSourceTree::get_start_fullpath  )  [static, private]
 

Returns the full path from the root to the directory in which the user started the program.

Definition at line 621 of file cvsSourceTree.cxx.

string CVSSourceTree::prompt const string &  message  )  [private]
 

Issues a prompt to the user and waits for a typed response.

Returns the response (which will not be empty).

Definition at line 568 of file cvsSourceTree.cxx.

Referenced by ask_existing(), prompt_user(), and restore_cwd().

CVSSourceDirectory * CVSSourceTree::prompt_user const string &  filename,
CVSSourceDirectory suggested_dir,
const Directories dirs,
bool  force,
bool  interactive
[private]
 

Prompts the user, if necessary, to choose a directory to import the given file into.

Definition at line 359 of file cvsSourceTree.cxx.

References CVSSourceDirectory::get_path(), nassertr, nout, NULL, and prompt().

void CVSSourceTree::restore_cwd  )  [static]
 

Restores the current directory after changing it from temp_chdir().

Definition at line 335 of file cvsSourceTree.cxx.

References CVSSourceDirectory::get_path(), nassertr, nout, NULL, and prompt().

bool CVSSourceTree::scan const Filename key_filename  ) 
 

Scans the complete source directory starting at the indicated pathname.

It is an error to call this more than once. Returns true on success, false if there is an error.

Definition at line 101 of file cvsSourceTree.cxx.

References get_actual_fullpath(), get_root_fullpath(), and path.

void CVSSourceTree::set_root const Filename root_path  ) 
 

Sets the root of the source directory.

This must be called before scan(), and should not be called more than once.

Definition at line 81 of file cvsSourceTree.cxx.

References _path, _root, Filename::get_basename(), get_root_fullpath(), nassertr, NULL, and CVSSourceDirectory::scan().

bool CVSSourceTree::temp_chdir const Filename path  )  [static]
 

Temporarily changes the current directory to the named path.

Returns true on success, false on failure. Call restore_cwd() to restore to the original directory later.

Definition at line 312 of file cvsSourceTree.cxx.


Member Data Documentation

Filenames CVSSourceTree::_filenames [private]
 

Definition at line 93 of file cvsSourceTree.h.

bool CVSSourceTree::_got_root_fullpath [private]
 

Definition at line 97 of file cvsSourceTree.h.

Referenced by find_dirname().

bool CVSSourceTree::_got_start_fullpath = false [static, private]
 

Definition at line 38 of file cvsSourceTree.cxx.

Filename CVSSourceTree::_path [private]
 

Definition at line 89 of file cvsSourceTree.h.

Referenced by find_dirname(), set_root(), and ~CVSSourceTree().

CVSSourceDirectory* CVSSourceTree::_root [private]
 

Definition at line 90 of file cvsSourceTree.h.

Referenced by CVSSourceTree(), find_directory(), and set_root().

Filename CVSSourceTree::_root_fullpath [private]
 

Definition at line 98 of file cvsSourceTree.h.

Referenced by find_dirname().

Filename CVSSourceTree::_start_fullpath [static, private]
 

Definition at line 39 of file cvsSourceTree.cxx.


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:26:03 2003 for Panda-Tool by doxygen1.3