#include <withOutputFile.h>
Inheritance diagram for WithOutputFile:
Public Member Functions | |
WithOutputFile (bool allow_last_param, bool allow_stdout, bool binary_output) | |
virtual | ~WithOutputFile () |
ostream & | get_output () |
Returns an output stream that corresponds to the user's intended egg file output--either stdout, or the named output file. | |
bool | has_output_filename () const |
Returns true if the user specified an output filename, false otherwise (e.g. | |
Filename | get_output_filename () const |
If has_output_filename() returns true, this is the filename that the user specified. | |
Protected Member Functions | |
bool | check_last_arg (ProgramBase::Args &args, int minimum_args) |
Checks if the last filename on the argument list is a file with the expected extension (if _allow_last_param was set true), and removes it from the argument list if it is. | |
bool | verify_output_file_safe () const |
This is called when the output file is given as the last parameter on the command line. | |
Protected Attributes | |
bool | _allow_last_param |
bool | _allow_stdout |
bool | _binary_output |
string | _preferred_extension |
bool | _got_output_filename |
Filename | _output_filename |
Private Attributes | |
ofstream | _output_stream |
ostream * | _output_ptr |
This provides the has_output_filename() and get_output_filename() methods.
Definition at line 49 of file withOutputFile.h.
|
Definition at line 35 of file withOutputFile.cxx. |
|
Definition at line 52 of file withOutputFile.cxx. References _allow_stdout, _got_output_filename, _output_filename, _output_ptr, _output_stream, Filename::c_str(), Filename::make_dir(), nassertr, NULL, and ostream. |
|
Checks if the last filename on the argument list is a file with the expected extension (if _allow_last_param was set true), and removes it from the argument list if it is. Returns true if the arguments are good, false if something is invalid. minimum_args is the number of arguments we know must be input parameters and therefore cannot be interpreted as output filenames. Definition at line 159 of file withOutputFile.cxx. References _got_output_filename, _output_filename, Filename::exists(), nassertr, and nout. Referenced by EggWriter::post_process_egg_file(), and ImageWriter::write_image(). |
|
Returns an output stream that corresponds to the user's intended egg file output--either stdout, or the named output file.
Definition at line 68 of file withOutputFile.cxx. References _output_filename, and Filename::set_binary(). |
|
If has_output_filename() returns true, this is the filename that the user specified. Otherwise, it returns the empty string. Definition at line 127 of file withOutputFile.cxx. References _allow_last_param, _allow_stdout, _got_output_filename, _output_filename, _preferred_extension, Filename::from_os_specific(), Filename::get_extension(), nout, and verify_output_file_safe(). |
|
Returns true if the user specified an output filename, false otherwise (e.g. the output file is implicitly stdout). Definition at line 110 of file withOutputFile.cxx. |
|
This is called when the output file is given as the last parameter on the command line. Since this is a fairly dangerous way to specify the output file (it's easy to accidentally overwrite an input file this way), the convention is to disallow this syntax if the output file already exists. This function will test if the output file exists, and issue a warning message if it does, returning false. If all is well, it will return true. Definition at line 217 of file withOutputFile.cxx. Referenced by get_output_filename(). |
|
Definition at line 64 of file withOutputFile.h. Referenced by get_output_filename(). |
|
Definition at line 65 of file withOutputFile.h. Referenced by get_output_filename(), and ~WithOutputFile(). |
|
Definition at line 66 of file withOutputFile.h. |
|
Definition at line 68 of file withOutputFile.h. Referenced by SomethingToEgg::apply_parameters(), check_last_arg(), FltTrans::FltTrans(), get_output_filename(), EggWriter::post_process_egg_file(), and ~WithOutputFile(). |
|
Definition at line 69 of file withOutputFile.h. Referenced by SomethingToEgg::apply_parameters(), check_last_arg(), FltTrans::FltTrans(), get_output(), get_output_filename(), EggWriter::post_process_egg_file(), and ~WithOutputFile(). |
|
Reimplemented in EggWriter. Definition at line 73 of file withOutputFile.h. Referenced by ~WithOutputFile(). |
|
Reimplemented in EggWriter. Definition at line 72 of file withOutputFile.h. Referenced by ~WithOutputFile(). |
|
Definition at line 67 of file withOutputFile.h. Referenced by FltTrans::FltTrans(), and get_output_filename(). |