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

pandatool/src/progbase/withOutputFile.h

Go to the documentation of this file.
00001 // Filename: withOutputFile.h
00002 // Created by:  drose (11Apr01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef WITHOUTPUTFILE_H
00020 #define WITHOUTPUTFILE_H
00021 
00022 #include "pandatoolbase.h"
00023 
00024 #include "programBase.h"
00025 #include "filename.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : WithOutputFile
00029 // Description : This is the bare functionality (intended to be
00030 //               inherited from along with ProgramBase or some
00031 //               derivative) for a program that might generate an
00032 //               output file.
00033 //
00034 //               This provides the has_output_filename() and
00035 //               get_output_filename() methods.
00036 ////////////////////////////////////////////////////////////////////
00037 class WithOutputFile {
00038 public:
00039   WithOutputFile(bool allow_last_param, bool allow_stdout,
00040                  bool binary_output);
00041   virtual ~WithOutputFile();
00042 
00043   ostream &get_output();
00044   bool has_output_filename() const;
00045   Filename get_output_filename() const;
00046 
00047 protected:
00048   bool check_last_arg(ProgramBase::Args &args, int minimum_args);
00049   bool verify_output_file_safe() const;
00050 
00051 protected:
00052   bool _allow_last_param;
00053   bool _allow_stdout;
00054   bool _binary_output;
00055   string _preferred_extension;
00056   bool _got_output_filename;
00057   Filename _output_filename;
00058 
00059 private:
00060   ofstream _output_stream;
00061   ostream *_output_ptr;
00062 };
00063 
00064 #endif
00065 
00066 

Generated on Fri May 2 03:21:32 2003 for Panda-Tool by doxygen1.3