Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

vfile.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  VFILE.H                                                                             */
00003 /*                                                                                      */
00004 /*  Author: Eli Boling                                                                  */
00005 /*  Description: Virtual file interface                                                 */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00020 /*                                                                                      */
00021 /****************************************************************************************/
00022 #ifndef VFILE_H
00023 #define VFILE_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 #include        "basetype.h"
00030 
00031 typedef struct  geVFile                 geVFile;
00032 
00033 //--------- Finder (Directory) --------------
00034 typedef struct  geVFile_Finder  geVFile_Finder;
00035 
00036 typedef int                     geVFile_TypeIdentifier;
00037 typedef unsigned int    geVFile_Attributes;
00038 
00039 typedef struct  geVFile_Hints
00040 {
00041         void *  HintData;
00042         int             HintDataLength;
00043 }       geVFile_Hints;
00044 
00045 typedef struct  geVFile_Time
00046 {
00047         unsigned long   Time1;
00048         unsigned long   Time2;
00049 }       geVFile_Time;
00050 
00051 #define GE_VFILE_ATTRIB_READONLY        0x00000001
00052 #define GE_VFILE_ATTRIB_DIRECTORY       0x00000002
00053 
00054 typedef struct  geVFile_Properties
00055 {
00056         geVFile_Time                            Time;
00057         geVFile_Attributes              AttributeFlags;
00058         long                                    Size;
00059         geVFile_Hints                   Hints;
00060         char                                    Name[1024];
00061 }       geVFile_Properties;
00062 
00063 #ifdef _INC_WINDOWS
00064 GENESISAPI void GENESISCC geVFile_TimeToWin32FileTime(const geVFile_Time *, LPFILETIME Win32FileTime);
00065         // Converts a geVFile time to a Win32 FILETIME structure.  This API is the
00066         // way to get the file time into a format to do standardized date/time
00067         // operations on.  We do not provide date/time operations natively.
00068 #endif
00069 
00070 GENESISAPI geVFile_Finder * GENESISCC geVFile_CreateFinder(
00071         geVFile *               FileSystem,
00072         const char *    FileSpec);
00073         // Creates a finder object from which you can get iterated file names.
00074         // This is findfirst/findnext functionality.  
00075 
00076 GENESISAPI void GENESISCC geVFile_DestroyFinder(geVFile_Finder *Finder);
00077         // Destroys a Finder object
00078 
00079 GENESISAPI geBoolean GENESISCC geVFile_FinderGetNextFile(geVFile_Finder *Finder);
00080         // Tracks to the next file in the finder directory
00081 
00082 GENESISAPI geBoolean GENESISCC geVFile_FinderGetProperties(const geVFile_Finder *Finder, geVFile_Properties *Properties);
00083         // Gets the file properties from a geVFile_Finder.  You cannot set properties for
00084         // a file through a finder.  You have to set the properties through a geVFile.
00085 
00086 //--------- File System Operations ----
00087 
00088 typedef struct  geVFile_MemoryContext
00089 {
00090         void *  Data;
00091         int             DataLength;
00092 }       geVFile_MemoryContext;
00093 
00094 #define GE_VFILE_TYPE_DOS           ( (geVFile_TypeIdentifier) 1L )
00095 #define GE_VFILE_TYPE_MEMORY    ( (geVFile_TypeIdentifier) 2L )
00096 #define GE_VFILE_TYPE_VIRTUAL   ( (geVFile_TypeIdentifier) 3L )
00097 //#define GE_VFILE_TYPE_CVIRTUAL        ( (geVFile_TypeIdentifier) 4L )
00098 
00099 // First three flags are mutually exclusive.  Combining them will result in failure
00100 // returns for both geVFile_OpenNewSystem and geVFile_Open.
00101 #define GE_VFILE_OPEN_READONLY   0x00000001
00102 #define GE_VFILE_OPEN_UPDATE     0x00000002
00103 #define GE_VFILE_OPEN_CREATE     0x00000004
00104 
00105 #define GE_VFILE_OPEN_DIRECTORY  0x00000008
00106 
00107 
00108 GENESISAPI geVFile * GENESISCC geVFile_OpenNewSystem(
00109         geVFile *                                       FS,
00110         geVFile_TypeIdentifier  FileSystemType,  // { DOS, MEMORY, ETC ... },
00111         const char *                    Name, 
00112         void *                                  Context, 
00113         unsigned int                    OpenModeFlags);
00114         // Opens a file / file system.
00115 
00116 GENESISAPI geBoolean GENESISCC geVFile_UpdateContext(geVFile *FS, void *Context, int ContextSize);
00117 
00118 GENESISAPI geVFile * GENESISCC geVFile_GetContext(const geVFile *File);
00119         // Returns the outer context in which File was opened.
00120 
00121 GENESISAPI geVFile * GENESISCC geVFile_Open( 
00122         geVFile *                       FS,
00123         const char *    Name, 
00124         unsigned int    OpenModeFlags);
00125 
00126 /*
00127 typedef enum
00128 {
00129         geVFile_AppendPath,
00130         geVFile_PrependPath,
00131 }       geVFile_SearchOrder;
00132 */
00133 
00134 GENESISAPI geBoolean GENESISCC geVFile_AddPath(geVFile *FS1, const geVFile *FS2, geBoolean Append);
00135         // Appends (or prepends) the path associated with FS2 into FS1.
00136         //    Append==GE_TRUE   causes the FS2 to be searched AFTER FS1
00137         //    Append==GE_FALSE  causes the FS2 to be searched BEFORE FS1
00138 
00139 /*  perhaps geVFile_AppendPath and geVFile_PrependPath */
00140 
00141 
00142 GENESISAPI geBoolean GENESISCC geVFile_DeleteFile(geVFile *FS, const char *FileName);
00143         // Deletes a file within a file system.  Returns GE_TRUE on success, GE_FALSE
00144         // on failure.
00145 
00146 GENESISAPI geBoolean GENESISCC geVFile_RenameFile(geVFile *FS, const char *FileName, const char *NewName);
00147         // Renames a file within a file system.  Returns GE_TRUE on success, GE_FALSE
00148         // on failure.
00149 
00150 GENESISAPI geBoolean GENESISCC geVFile_FileExists(geVFile *FS, const char *FileName);
00151         // Returns GE_TRUE if the file FileName exists in FS, GE_FALSE otherwise.
00152         // Does not do any searching (?)
00153 
00154 //geVFile_VFileType geVFile_Register( all kinds of stuff );
00155 
00156 GENESISAPI geBoolean GENESISCC geVFile_Close (geVFile *File);
00157         // closes and destroys the File
00158 
00159 GENESISAPI void GENESISCC geVFile_CloseAPI (void);
00160 
00161 //---------- File Specific Operations -----------
00162 
00163 typedef enum
00164 {
00165         GE_VFILE_SEEKCUR        = 0,
00166         GE_VFILE_SEEKEND        = 1,
00167         GE_VFILE_SEEKSET        = 2
00168 }       geVFile_Whence;
00169 
00170 GENESISAPI geBoolean GENESISCC geVFile_GetS              (              geVFile *File, void *Buff, int MaxLen);
00171 GENESISAPI geBoolean GENESISCC geVFile_Read              (              geVFile *File, void *Buff, int Count);
00172 GENESISAPI geBoolean GENESISCC geVFile_Write             (              geVFile *File, const void *Buff, int Count);
00173 GENESISAPI geBoolean GENESISCC geVFile_Seek              (              geVFile *File, int where, geVFile_Whence Whence);
00174 GENESISAPI geBoolean GENESISCC geVFile_Printf            (              geVFile *File, const char *Format, ...);
00175 GENESISAPI geBoolean GENESISCC geVFile_EOF               (const geVFile *File);
00176 GENESISAPI geBoolean GENESISCC geVFile_Tell              (const geVFile *File, long *Position);
00177 GENESISAPI geBoolean GENESISCC geVFile_GetProperties(const geVFile *File, geVFile_Properties *Properties);
00178 //geBoolean geVFile_GetName(geVFile *File, char *Buff, int MaxBuffLen);
00179         // Gets the name of the file
00180 
00181 GENESISAPI geBoolean GENESISCC geVFile_Size              (const geVFile *File, long *Size);
00182 GENESISAPI geBoolean GENESISCC geVFile_SetSize           (              geVFile *File, long Size);
00183 GENESISAPI geBoolean GENESISCC geVFile_SetAttributes(           geVFile *File, geVFile_Attributes Attributes);
00184 GENESISAPI geBoolean GENESISCC geVFile_SetTime           (              geVFile *File, const geVFile_Time *Time);
00185 GENESISAPI geBoolean GENESISCC geVFile_SetHints  (              geVFile *File, const geVFile_Hints *Hints);
00186 
00187 
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191 
00192 #endif

Generated on Tue Sep 30 12:36:37 2003 for GTestAndEngine by doxygen 1.3.2