Panda3D
Loading...
Searching...
No Matches
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.
 
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.
 
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_dirname (const std::string &dirname)
 Returns the source directory that corresponds to the given local directory name, or NULL if there is no match.
 
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.
 
CVSSourceDirectoryget_root () const
 Returns the root directory of the hierarchy.
 
Filename get_root_dirname () const
 Returns the local directory name of the root of the tree.
 
Filename get_root_fullpath ()
 Returns the full path from the root to the top of the source hierarchy.
 
bool scan (const Filename &key_filename)
 Scans the complete source directory starting at the indicated pathname.
 
void set_root (const Filename &root_path)
 Sets the root of the source directory.
 

Static Public Member Functions

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

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.

Constructor & Destructor Documentation

◆ CVSSourceTree()

CVSSourceTree::CVSSourceTree ( )

Definition at line 39 of file cvsSourceTree.cxx.

◆ ~CVSSourceTree()

CVSSourceTree::~CVSSourceTree ( )

Definition at line 48 of file cvsSourceTree.cxx.

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

References downcase().

Referenced by CVSSourceDirectory::scan().

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

References downcase().

Referenced by CVSCopy::import().

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

References CVSSourceDirectory::find_relpath(), and 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 141 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 114 of file cvsSourceTree.cxx.

References CVSSourceDirectory::find_relpath(), and CVSSourceDirectory::get_dirname().

◆ get_root()

CVSSourceDirectory * CVSSourceTree::get_root ( ) const

Returns the root directory of the hierarchy.

Definition at line 81 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 188 of file cvsSourceTree.cxx.

References CVSSourceDirectory::get_dirname().

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

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

◆ restore_cwd()

void CVSSourceTree::restore_cwd ( )
static

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

Definition at line 225 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 70 of file cvsSourceTree.cxx.

References Filename::get_basename(), get_root_fullpath(), and CVSSourceDirectory::scan().

◆ 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 59 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 209 of file cvsSourceTree.cxx.

References Filename::to_os_specific().


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