Panda3D
Classes | Public Member Functions | Static Public Member Functions | List of all members
CVSSourceTree Class Reference

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

#include "cvsSourceTree.h"

Classes

class  FilePath
 

Public Member Functions

void add_file (const std::string &basename, CVSSourceDirectory *dir)
 Adds a new file to the set of known files. More...
 
FilePath choose_directory (const std::string &basename, CVSSourceDirectory *suggested_dir, bool force, bool interactive)
 Determines where an externally referenced model file of the indicated name should go. More...
 
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. More...
 
CVSSourceDirectoryfind_dirname (const std::string &dirname)
 Returns the source directory that corresponds to the given local directory name, or NULL if there is no match. More...
 
CVSSourceDirectoryfind_relpath (const std::string &relpath)
 Returns the source directory that corresponds to the given relative path from the root, or NULL if there is no match. More...
 
CVSSourceDirectoryget_root () const
 Returns the root directory of the hierarchy. More...
 
Filename get_root_dirname () const
 Returns the local directory name of the root of the tree. More...
 
Filename get_root_fullpath ()
 Returns the full path from the root to the top of the source hierarchy. More...
 
bool scan (const Filename &key_filename)
 Scans the complete source directory starting at the indicated pathname. More...
 
void set_root (const Filename &root_path)
 Sets the root of the source directory. More...
 

Static Public Member Functions

static void restore_cwd ()
 Restores the current directory after changing it from temp_chdir(). More...
 
static bool temp_chdir (const Filename &path)
 Temporarily changes the current directory to the named path. More...
 

Detailed Description

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

The tree is maintained in a case-insensitive manner, even on a non-Windows system, since you might want to eventually check out the CVS tree onto a Windows system–and if you do, you'll be sad if there are case conflicts within the tree. So we make an effort to ensure this doesn't happen by treating two files with a different case as the same file.

Definition at line 34 of file cvsSourceTree.h.

Member Function Documentation

◆ add_file()

void CVSSourceTree::add_file ( const std::string &  basename,
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 199 of file cvsSourceTree.cxx.

References downcase().

◆ choose_directory()

CVSSourceTree::FilePath CVSSourceTree::choose_directory ( const std::string &  basename,
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 153 of file cvsSourceTree.cxx.

References downcase().

◆ find_directory()

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 91 of file cvsSourceTree.cxx.

References get_root_fullpath().

◆ find_dirname()

CVSSourceDirectory * CVSSourceTree::find_dirname ( const std::string &  dirname)

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

Definition at line 142 of file cvsSourceTree.cxx.

References CVSSourceDirectory::find_dirname().

◆ find_relpath()

CVSSourceDirectory * CVSSourceTree::find_relpath ( const std::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 115 of file cvsSourceTree.cxx.

References CVSSourceDirectory::find_relpath().

◆ get_root()

CVSSourceDirectory * CVSSourceTree::get_root ( ) const

Returns the root directory of the hierarchy.

Definition at line 82 of file cvsSourceTree.cxx.

◆ get_root_dirname()

Filename CVSSourceTree::get_root_dirname ( ) const

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

Definition at line 189 of file cvsSourceTree.cxx.

◆ get_root_fullpath()

Filename CVSSourceTree::get_root_fullpath ( )

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

Definition at line 176 of file cvsSourceTree.cxx.

Referenced by find_directory(), and CVSSourceDirectory::get_fullpath().

◆ restore_cwd()

void CVSSourceTree::restore_cwd ( )
static

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

Definition at line 226 of file cvsSourceTree.cxx.

References Filename::to_os_specific().

◆ scan()

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 71 of file cvsSourceTree.cxx.

◆ set_root()

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 60 of file cvsSourceTree.cxx.

◆ temp_chdir()

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 210 of file cvsSourceTree.cxx.

References Filename::to_os_specific().


The documentation for this class was generated from the following files: