fileext.h

Go to the documentation of this file.
00001 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined FILEEXT_HEADER
00019 #define FILEEXT_HEADER
00020 
00024 
00025 #include "whiptk/whip_toolkit.h"
00026 #include "whiptk/compdata.h"
00027 #include "whiptk/gouraud_polyline.h"
00028 #include "whiptk/gouraud_polytri.h"
00029 #include "whiptk/unknown.h"
00030 
00035 
00036 
00042 class WHIPTK_API WT_FileExt : public WT_File
00043 {
00044 private:
00045     // Class action methods
00046     #define CALLBACK_MACRO(Upper, Lower)\
00047     static WT_Result process_##Lower (WT_##Upper & Lower, WT_File& file)\
00048         { return ((WT_FileExt&)file).process_##Lower(Lower); }
00049     CALLBACK_LIST
00050     #undef CALLBACK_MACRO
00051 
00052     // Class stream methods
00053     static WT_Result process_stream_open (WT_File& file)
00054         { return ((WT_FileExt&)file).process_stream_open(); }
00055     static WT_Result process_stream_close (WT_File& file)
00056         { return ((WT_FileExt&)file).process_stream_close(); }
00057     static WT_Result process_stream_read (WT_File& file, int desired_bytes, int& bytes_read, void* buffer)
00058         { return ((WT_FileExt&)file).process_stream_read(desired_bytes, bytes_read, buffer); }
00059     static WT_Result process_stream_write(WT_File& file, int size, void const* buffer)
00060         { return ((WT_FileExt&)file).process_stream_write(size, buffer); }
00061     static WT_Result process_stream_seek (WT_File& file, int distance, int& amount_seeked)
00062         { return ((WT_FileExt&)file).process_stream_seek(distance, amount_seeked); }
00063 
00064     static WT_Result process_stream_end_seek (WT_File& file)
00065         { return ((WT_FileExt&)file).process_stream_end_seek(); }
00066     static WT_Result process_stream_tell (WT_File& file, unsigned long *current_file_pointer_position)
00067         { return ((WT_FileExt&)file).process_stream_tell(current_file_pointer_position); }
00068 
00069 
00070 protected:
00071     // Instance action methods
00072 #ifndef DOXYGEN_EXCLUDE
00073     #define CALLBACK_MACRO(Upper, Lower)\
00074     virtual WT_Result process_##Lower (WT_##Upper & Lower)\
00075         { return WT_##Upper::default_process(Lower, *this); }
00076     CALLBACK_LIST
00077     #undef CALLBACK_MACRO
00078 #endif
00079 
00085     virtual WT_Result process_stream_close (void) { return default_close(*this); }
00086     virtual WT_Result process_stream_end_seek () { return default_end_seek(*this); }
00087     virtual WT_Result process_stream_open (void)  { return default_open(*this); }
00088     virtual WT_Result process_stream_read (int desired_bytes, int& bytes_read, void* buffer) { return default_read(*this, desired_bytes, bytes_read, buffer); }
00089     virtual WT_Result process_stream_seek (int distance, int& amount_seeked) { return default_seek(*this, distance, amount_seeked); }
00090     virtual WT_Result process_stream_tell (unsigned long *current_file_pointer_position) { return default_tell(*this, current_file_pointer_position); }
00091     virtual WT_Result process_stream_write(int size, void const* buffer) { return default_write(*this, size, buffer); }
00093 
00094 protected:
00096     WT_FileExt (void)
00097     {
00098         // set the action methods
00099         #define CALLBACK_MACRO(Upper, Lower)\
00100         m_##Lower##_action = process_##Lower;
00101         CALLBACK_LIST
00102         #undef CALLBACK_MACRO
00103 
00104         // set the stream methods
00105         m_stream_open_action  = process_stream_open;
00106         m_stream_close_action = process_stream_close;
00107         m_stream_read_action  = process_stream_read;
00108         m_stream_write_action = process_stream_write;
00109         m_stream_seek_action  = process_stream_seek;
00110         m_stream_end_seek_action    = process_stream_end_seek;
00111         m_stream_tell_action        = process_stream_tell;
00112     }
00113 
00114     // Deconstructs a WT_FileExt object.
00115     virtual ~WT_FileExt()
00116     {
00117         ;
00118     }
00119 };
00120 
00122 
00123 #endif // FILEEXT_HEADER

Generated on Tue Jan 6 22:41:12 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5