Main Page Class Hierarchy Compound List File List Compound Members File Members

# file.h

Go to the documentation of this file.

    00001
    00002
    00003 //
    00004 //      FILE.H                                          (c)     YoY'99                                          WEB: www.aestesis.org
    00005 //
    00008 #ifndef                                                 _FILE_H_
    00009 #define                                                 _FILE_H_
    00012 #include                                                <stdio.h>
    00013 #include                                                "types.h"
    00014 #include                                                "node.h"
    00017
    00018 //      If you use directly the variables in the class API, it's at your own risks. Prefer the methods...
    00019
    00022
    00023 #define                                                 guidFILE                                                (Afile::CI.guid)
    00024
    00027
    00028 class Afile : public Anode
    00029 {
    00030 public:
    00031         ADLL static ACI                         CI;
    00032         virtual ACI                                     *getCI                                                  ()                                              { return &CI; }
    00033
    00034                                                                 Afile                                                   (char *name)                    : Anode(name)   { offset=0; size=0; }
    00035         virtual                                         ~Afile                                                  ()                                              { }
    00036
    00037         virtual int                                     read                                                    (void *p, int s)                { offset+=s; return s; }
    00038         virtual int                                     write                                                   (void *p, int s)                { offset+=s; size=maxi(size, offset); return s; }
    00039
    00040         virtual bool                            writeString                                             (char *s)                               { offset+=strlen(s)+4; return TRUE; }
    00041         virtual bool                            readString                                              (char *s)=0;
    00042
    00043         virtual bool                            seek                                                    (int n)                                 { offset=n; return TRUE; }
    00044         virtual int                                     getSize                                                 ()                                              { return size; }
    00045
    00046         virtual bool                            isOK                                                    ()                                              { return true; }
    00047
    00048         // private
    00049
    00050         int                                                     offset;
    00051         int                                                     size;
    00052 };
    00053
    00056 #endif                                                  //_FILE_H_