source: cpp/gdk/virtfile.h @ 70

Last change on this file since 70 was 66, checked in by Maciej Komosinski, 14 years ago

set 'eol-style' to 'native'

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1// This file is a part of the Framsticks GDK library.
2// Copyright (C) 2002-2011  Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#ifndef _VIRTFILE_H_
6#define _VIRTFILE_H_
7
8#include <stdio.h>
9#include <stdarg.h>
10//#include <dirent.h>
11struct dirent;
12
13#ifdef DLLEXPORTACTIVE  //tylko w tym pliku uzyte
14#define DLLEXP __declspec(dllexport)
15#else
16#define DLLEXP
17#endif
18
19class DLLEXP VirtFileSystem;
20
21class DLLEXP VirtFILE
22{
23  public:
24virtual int Vread(void *ptr, size_t size, size_t nmemb)=0;
25virtual int Vwrite(const void *ptr, size_t size, size_t nmemb)=0;
26virtual int Veof()=0;
27virtual int Vputc(int c)=0;
28virtual int Vputs(const char *s)=0;
29virtual int Vgetc()=0;
30virtual int Vseek(long offset, int whence)=0;
31virtual int Vtell()=0;
32virtual void Vrewind()=0;
33virtual int Vflush()=0;
34virtual char *Vgets(char *s, int size)=0;
35virtual int Vprintf(const char *format, va_list args)=0;
36int printf(const char *format, ...);
37virtual const char *VgetPath() {return 0;} // 0=unspecified path
38virtual ~VirtFILE();
39static VirtFILE *Vstdin,*Vstdout,*Vstderr;
40static void setVstdin(VirtFILE *);
41static void setVstdout(VirtFILE *);
42static void setVstderr(VirtFILE *);
43static VirtFILE* getVstdin();
44static VirtFILE* getVstdout();
45static VirtFILE* getVstderr();
46static VirtFileSystem *vfs;
47static void selectFileSystem(VirtFileSystem *s);
48};
49
50class DLLEXP VirtDIR
51{
52  public:
53virtual ~VirtDIR() {}
54virtual dirent* Vreaddir() {return 0;}
55};
56
57class DLLEXP VirtFileSystem
58{
59public:
60virtual VirtFILE *Vfopen(const char* path,const char*mode);
61virtual int Vfexists(const char* path);
62virtual VirtDIR *Vopendir(const char* path);
63};
64
65DLLEXP VirtFILE *Vfopen(const char* path,const char*mode);
66DLLEXP VirtDIR *Vopendir(const char* path);
67DLLEXP int Vfexists(const char* path);
68
69DLLEXP int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f);
70DLLEXP int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f);
71#ifdef __BORLANDC__
72#undef feof
73#endif
74#ifdef _MSC_VER
75#undef feof
76#endif
77DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
78#ifdef __BORLANDC__
79#define feof(__f)     ((__f)->flags & _F_EOF)
80#endif
81#ifdef _MSC_VER
82#define feof(_stream)     ((_stream)->_flag & _IOEOF)
83#endif
84
85DLLEXP int fputc(int c,VirtFILE* f);
86DLLEXP int fputs(const char *s,VirtFILE* f);
87DLLEXP int fgetc(VirtFILE* f);
88DLLEXP int fseek(VirtFILE* f,long offset, int whence);
89DLLEXP int ftell(VirtFILE* f);
90DLLEXP void rewind(VirtFILE* f);
91DLLEXP int fflush(VirtFILE* f);
92DLLEXP char *fgets(char *s, int size, VirtFILE* f);
93DLLEXP int fprintf(VirtFILE* f,const char *format, ...);
94DLLEXP int fclose(VirtFILE* f);
95
96DLLEXP dirent* readdir(VirtDIR* d);
97DLLEXP int closedir(VirtDIR* d);
98
99#endif
Note: See TracBrowser for help on using the repository browser.