Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

file.h

Go to the documentation of this file.
00001 // OMICRON ENGINE HEADER FILE
00002 //
00003 // --------------------------------------------------------------------------
00004 // Copyright (C) 2001-2002 by Bjoern Paetzel <kolrabi@gmx.de>
00005 //
00006 // This file is part of the Omicron Engine.
00007 //
00008 // The Omicron Engine is free software; you can redistribute it and/or modify
00009 // it under the terms of the  GNU General Public License  as published by the
00010 // Free Software Foundation;  either version  2  of the License,  or (at your
00011 // option) any later version.
00012 //
00013 // The Omicron Engine  is distributed in the hope that it will be useful, but
00014 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015 // or  FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License
00016 // for more details.
00017 //
00018 // You should have  received a copy of the  GNU General Public License  along
00019 // with The Omicron Engine;  if not,  write to the  Free Software Foundation,
00020 // Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
00021 //
00022 // --------------------------------------------------------------------------
00023 // Last modified:       $Date: 2002/12/07 19:02:17 $
00024 // By           :       $Author: kolrabi $
00025 // $Id: file.h,v 1.1.1.1 2002/12/07 19:02:17 kolrabi Exp $ 
00026 
00027 /*
00028 
00029   $Log: file.h,v $
00030   Revision 1.1.1.1  2002/12/07 19:02:17  kolrabi
00031   initial release
00032 
00033 
00034 */
00035 
00043 #include            "forward.h"
00044 
00045 #if !defined(MAX_PATH)
00046 #define             MAX_PATH            512
00047 #endif
00048 
00049 /****************************************************************************
00050  ****************************************************************************
00051  * TYPES ********************************************************************
00052  ****************************************************************************
00053  ****************************************************************************/
00054 
00055 #if !defined(OMICRON_TYPES_FILE_DEFINED)
00056 #define             OMICRON_TYPES_FILE_DEFINED
00057 
00062 typedef         struct fileentry_s
00063 {
00064     char        filename[128];          
00065 
00066 
00067     ulong       offset;                 
00068     ulong       size;                   
00069     ulong       realsize;               
00070 
00071 } fileentry_t;
00072  
00077 typedef         struct pak_header_s 
00078 {
00079     ulong       magic;                  
00080     ulong       entrycount;             
00081 } pak_header_t;
00082  
00087 typedef         struct file_s
00088 {
00089     char        *buf;                   
00090     ulong       size;                   
00091     ulong       pos;                    
00092     FILE        *f;                     
00093     int         asyncloading:1;         
00094 } file_t;
00095 
00101 class file_manager_c
00102 {
00103 protected:
00104 
00105     array_c <char>      *pak_names;
00106     array_c <file_t>    *files;
00107     list_c<file_t>      *async_files;   
00108 
00109     char            datadir[128];       
00110 
00111         friend ulong _win_mainloop();
00112 
00113     void
00114                 update();
00115 
00116 public:
00117 
00118                     file_manager_c();   
00119                     ~file_manager_c();  
00120 
00125     ulong
00126         load_pak(const char *filename);
00127 
00132     void
00133         unload_pak(ulong n);
00134 
00139     void
00140         close_paks();
00141 
00147     file_t *
00148         create();
00149 
00158     void
00159         resize(file_t *file, ulong newsize);
00160 
00169     file_t *
00170         load(const char *filename, bool async);
00171 
00176     void
00177         save(file_t *file, const char *filename);
00178 
00184     file_t *
00185         load_from_disk(const char *filename, bool async);
00186 
00192     file_t *
00193         load_from_pak(const char *filename);
00194 
00199     void
00200         close(file_t *file);
00201 
00207     ulong                               
00208         seek(file_t *file, slong offset, ulong origin);
00209 
00214     ulong
00215         tell(file_t *file);
00216 
00221     bool
00222         eof(file_t *file);
00223 
00229     ulong
00230         read(void *out, ulong size, ulong n, file_t *file);
00231 
00236     ulong
00237         getch(file_t *file);
00238 
00244     const char *
00245         gets(char *dst, ulong count, file_t *file);
00246 
00254     void
00255         getpixel(file_t *file, 
00256         char *r, char *g, char *b, char *a, char bpp);
00257 
00263     ulong
00264         write(void *buf, ulong size, ulong n, file_t *file);
00265 
00270     slong
00271         putch(slong ch, file_t *file);
00272 
00278     slong
00279         puts(const char *string, file_t *file);
00280 
00289     void                                
00290         putpixel(file_t *file, 
00291         char r, char g, char b, char a, char bpp);
00292 };
00293 
00294 #endif

Generated on Wed Dec 18 15:48:46 2002 for omicron engine by doxygen1.2.18