source: cpp/gdk/virtfile.h @ 105

Last change on this file since 105 was 81, checked in by Maciej Komosinski, 12 years ago

improved parsing of properties (e.g. in f0 genotypes)

  • Property svn:eol-style set to native
File size: 2.8 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
77#ifdef SHP //nie wiem co to robi i jak ma byc, ale sie kompiluje z tym undefem a bez nie. tak samo w cpp
78#undef feof
79#endif
80DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
81#ifdef __BORLANDC__
82#define feof(__f)     ((__f)->flags & _F_EOF)
83#endif
84#ifdef _MSC_VER
85#define feof(_stream)     ((_stream)->_flag & _IOEOF)
86#endif
87
88DLLEXP int fputc(int c,VirtFILE* f);
89DLLEXP int fputs(const char *s,VirtFILE* f);
90DLLEXP int fgetc(VirtFILE* f);
91DLLEXP int fseek(VirtFILE* f,long offset, int whence);
92DLLEXP int ftell(VirtFILE* f);
93DLLEXP void rewind(VirtFILE* f);
94DLLEXP int fflush(VirtFILE* f);
95DLLEXP char *fgets(char *s, int size, VirtFILE* f);
96DLLEXP int fprintf(VirtFILE* f,const char *format, ...);
97DLLEXP int fclose(VirtFILE* f);
98
99DLLEXP dirent* readdir(VirtDIR* d);
100DLLEXP int closedir(VirtDIR* d);
101
102#endif
Note: See TracBrowser for help on using the repository browser.