Panda3D
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes

CVSCopy Class Reference

This is the base class for a family of programs that copy files, typically model files like .flt files and their associated textures, into a CVS-controlled source tree. More...

#include "cvsCopy.h"

Inheritance diagram for CVSCopy:
ProgramBase FltCopy MayaCopy TestCopy

List of all members.

Public Member Functions

bool continue_after_error ()
 Prompts the user (unless -f was specified) if he wants to continue the copy operation after some error has occurred.
CVSSourceTree::FilePath import (const Filename &source, void *extra_data, CVSSourceDirectory *suggested_dir)
 Checks for the given filename somewhere in the directory hierarchy, and chooses a place to import it.

Protected Types

typedef pmap< string,
CVSSourceTree::FilePath
CopiedFiles
typedef pvector< FilenameSourceFiles

Protected Member Functions

bool copy_binary_file (Filename source, Filename dest)
 Copies a file without modifying it or scanning it in any way.
virtual bool copy_file (const Filename &source, const Filename &dest, CVSSourceDirectory *dest_dir, void *extra_data, bool new_file)=0
bool cvs_add (const Filename &filename)
 Invokes CVS to add the indicated filename to the repository, if the user so requested.
virtual string filter_filename (const string &source)
 Given a source filename (including the basename only, without a dirname), return the appropriate corresponding filename within the source directory.
virtual bool handle_args (Args &args)
 Does something with the additional arguments on the command line (after all the -options have been parsed).
virtual bool post_command_line ()
 This is called after the command line has been completely processed, and it gives the program a chance to do some last-minute processing and validation of the options and arguments.
bool verify_binary_file (Filename source, Filename dest)
 Verifies that the file is identical and does not need to be recopied.
virtual bool verify_file (const Filename &source, const Filename &dest, CVSSourceDirectory *dest_dir, void *extra_data)
 Verifies that the file is identical and does not need to be recopied.

Static Protected Member Functions

static string protect_from_shell (const string &source)
 Inserts escape characters into the indicated source string to protect it from the shell, so that it may be given on the command line.

Protected Attributes

CopiedFiles _copied_files
string _cvs_binary
bool _force
bool _got_map_dirname
bool _got_model_dirname
bool _got_root_dirname
bool _interactive
Filename _key_filename
CVSSourceDirectory_map_dir
Filename _map_dirname
CVSSourceDirectory_model_dir
Filename _model_dirname
bool _no_cvs
Filename _root_dirname
SourceFiles _source_files
CVSSourceTree _tree
bool _user_aborted

Detailed Description

This is the base class for a family of programs that copy files, typically model files like .flt files and their associated textures, into a CVS-controlled source tree.

Definition at line 33 of file cvsCopy.h.


Member Function Documentation

bool CVSCopy::continue_after_error ( )

Prompts the user (unless -f was specified) if he wants to continue the copy operation after some error has occurred.

Returns true to continue, false otherwise.

Definition at line 168 of file cvsCopy.cxx.

Referenced by import().

bool CVSCopy::copy_binary_file ( Filename  source,
Filename  dest 
) [protected]

Copies a file without modifying it or scanning it in any way.

This is particularly useful for copying textures. This is provided as a convenience function for derived programs because so many model file formats will also require copying textures or other black-box files.

Definition at line 337 of file cvsCopy.cxx.

References Filename::open_read(), Filename::open_write(), Filename::set_binary(), and Filename::unlink().

Referenced by TestCopy::copy_file().

bool CVSCopy::cvs_add ( const Filename filename) [protected]

Invokes CVS to add the indicated filename to the repository, if the user so requested.

Returns true if successful, false if there is an error.

Definition at line 385 of file cvsCopy.cxx.

References Filename::get_basename(), Filename::get_dirname(), protect_from_shell(), CVSSourceTree::restore_cwd(), and CVSSourceTree::temp_chdir().

Referenced by import().

string CVSCopy::filter_filename ( const string &  source) [protected, virtual]

Given a source filename (including the basename only, without a dirname), return the appropriate corresponding filename within the source directory.

This may be used by derived classes to, for instance, strip a version number from the filename.

Reimplemented in MayaCopy.

Definition at line 462 of file cvsCopy.cxx.

Referenced by import().

bool CVSCopy::handle_args ( Args &  args) [protected, virtual]

Does something with the additional arguments on the command line (after all the -options have been parsed).

Returns true if the arguments are good, false otherwise.

Reimplemented from ProgramBase.

Definition at line 202 of file cvsCopy.cxx.

References Filename::from_os_specific().

CVSSourceTree::FilePath CVSCopy::import ( const Filename source,
void *  extra_data,
CVSSourceDirectory suggested_dir 
)

Checks for the given filename somewhere in the directory hierarchy, and chooses a place to import it.

Copies the file by calling copy_file().

Extra_data may be NULL or a pointer to some user-defined structure; CVSCopy simply passes it unchanged to copy_file(). It presumably gives the class a hint as to how the file should be copied. Suggested_dir is the suggested directory in which to copy the file, if it does not already exist elsewhere.

On success, returns the FilePath it was actually copied to. On failure, returns an invalid FilePath.

Definition at line 113 of file cvsCopy.cxx.

References CVSSourceTree::choose_directory(), continue_after_error(), cvs_add(), filter_filename(), Filename::get_basename(), Filename::get_fullpath(), and verify_file().

bool CVSCopy::post_command_line ( ) [protected, virtual]

This is called after the command line has been completely processed, and it gives the program a chance to do some last-minute processing and validation of the options and arguments.

It should return true if everything is fine, false if there is an error.

Reimplemented from ProgramBase.

Definition at line 227 of file cvsCopy.cxx.

References CVSSourceTree::find_directory(), CVSSourceTree::find_relpath(), and CVSSourceTree::get_root_dirname().

string CVSCopy::protect_from_shell ( const string &  source) [static, protected]

Inserts escape characters into the indicated source string to protect it from the shell, so that it may be given on the command line.

Returns the modified string.

Definition at line 418 of file cvsCopy.cxx.

Referenced by cvs_add().

bool CVSCopy::verify_binary_file ( Filename  source,
Filename  dest 
) [protected]

Verifies that the file is identical and does not need to be recopied.

Returns true if the files are identical, false if they differ.

Definition at line 283 of file cvsCopy.cxx.

References Filename::open_read(), and Filename::set_binary().

bool CVSCopy::verify_file ( const Filename source,
const Filename dest,
CVSSourceDirectory dest_dir,
void *  extra_data 
) [protected, virtual]

Verifies that the file is identical and does not need to be recopied.

Returns true if the files are identical, false if they differ.

Definition at line 270 of file cvsCopy.cxx.

Referenced by import().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations