Vault  4.1
vtypes_internal.h
00001 /*
00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved.
00003 This file is part of the Code Vault version 4.1
00004 http://www.bombaydigital.com/
00005 License: MIT. See LICENSE.md in the Vault top level directory.
00006 */
00007 
00008 #ifndef vtypes_internal_h
00009 #define vtypes_internal_h
00010 
00011 #include "vtypes.h"
00012 
00013 #include "vtypes_internal_platform.h"
00014 #include "vassert.h" // needed by many internal .cpp files
00015 
00016 #define READ_ONLY_MODE          (O_RDONLY | O_BINARY)
00017 #define READWRITE_MODE          (O_RDWR | O_CREAT | O_BINARY)
00018 #define WRITE_CREATE_MODE       (O_WRONLY | O_CREAT | O_TRUNC | O_BINARY) // Added O_TRUNC which should zero the file upon creation/opening
00019 #define OPEN_CREATE_PERMISSIONS (S_IRWXO | S_IRWXG | S_IRWXU)
00020 
00029 class VFileSystem {
00030     public:
00031     
00032         static int      mkdir(const VString& path, mode_t mode);                            
00033         static int      rename(const VString& oldName, const VString& newName);             
00034         static int      stat(const VString& path, struct stat* statData);                   
00035         static int      unlink(const VString& path);                                        
00036         static int      rmdir(const VString& path);                                         
00037 
00038         static int      open(const VString& path, int flags);                               
00039         static ssize_t  read(int fd, void* buffer, size_t numBytes);                        
00040         static ssize_t  write(int fd, const void* buffer, size_t numBytes);                 
00041         static off_t    lseek(int fd, off_t offset, int whence);                            
00042         static int      close(int fd);                                                      
00043 
00044         static FILE*    fopen(const VString& nativePath, const char* mode);                 
00045         static int      fclose(FILE* f);                                                    
00046         static size_t   fread(void* buffer, size_t size, size_t numItems, FILE* f);         
00047         static size_t   fwrite(const void* buffer, size_t size, size_t numItems, FILE* f);  
00048         static int      fseek(FILE* f, long int offset, int whence);                        
00049         static int      fflush(FILE* f);                                                    
00050         static long int ftell(FILE* f);                                                     
00051 
00052     private:
00053         VFileSystem(); // static functions only; not constructable
00054 };
00055 
00064 class VPlatformAPI {
00065     public:
00066     
00067         static VString  getcwd();
00068         static int      open(const VString& path, int flags, mode_t mode);
00069         static FILE*    fopen(const VString& path, const char* mode);
00070         static int      mkdir(const VString& path, mode_t mode);
00071         static int      rmdir(const VString& path);
00072         static int      unlink(const VString& path);
00073         static int      rename(const VString& oldName, const VString& newName);
00074         static int      stat(const VString& path, struct stat* buf);
00075 
00076     private:
00077         VPlatformAPI(); // static functions only; not constructable
00078 };
00079 
00080 #endif /* vtypes_internal_h */
00081 

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.