home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 4 / CD_Magazyn_EXEC_nr_4.iso / Recent / dev / c / GSys.lha / gsys / gmisc / GChunkHandler.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-17  |  1.5 KB  |  74 lines

  1.  
  2. #ifndef GCHUNKHANDLER_H
  3. #define GCHUNKHANDLER_H
  4.  
  5. /*
  6.  
  7. TODO: Rewrite a lot of it.
  8.  
  9. */
  10.  
  11. #define SIZELONG 4
  12. #define SIZEWORD 2
  13. #define SIZEBYTE 1
  14.  
  15. #include "gsystem/GBuffer.h"
  16. #include "gsystem/GBufferMet.h"
  17.  
  18. class GChunk
  19. {
  20. public:
  21.     GChunk();
  22.     ~GChunk() {};
  23.  
  24.     class GChunk *Prev; 
  25.     class GChunk *Next;
  26.     GAPTR Start;
  27.     GAPTR End;
  28. private:
  29. };
  30.  
  31. GChunk::GChunk()
  32. {
  33.     Prev = NULL;
  34.     Next = NULL;
  35.     Start = NULL;
  36.     End = NULL;
  37. }
  38.  
  39. class    GChunkHandler
  40. {
  41. public:
  42. //    GChunkHandler(class GBuffer *GBUF, WORD SIZEID, WORD SIZESIZE, BOOL BACKWARDS);
  43. //    GChunkHandler(APTR DATA, WORD SIZEID, WORD SIZESIZE, BOOL BACKWARDS);
  44.     GChunkHandler(GSTRPTR filename);        // String 
  45.     GChunkHandler(GUWORD size);
  46.     GChunkHandler(GUWORD size, GSTRPTR name);    // The string will NOT be stored (not true:D)
  47.     ~GChunkHandler();
  48.  
  49.     
  50.     GAPTR Adjust(GWORD Size);
  51.     GAPTR EnterChunk();        /* NULL = No chunk, Size = 0 */
  52.     GAPTR NextChunk();    /* NULL = Not possible, out of range */
  53.     GAPTR ParentChunk();        /* Goes up a level */
  54.     GAPTR FindChunk(GUWORD FindID);    /* Finds chunk with the requested ID (use Enter() to enter) */
  55.     GAPTR FindChunk(GSTRPTR FindTextID, GUWORD SIZE);
  56.  
  57.     GAPTR GetEND();        /* Gets the end of the chunk */
  58.     GUWORD GetID();        /* Gets ID of current chunk */
  59.     GUWORD GetSIZE();    /* Gets SIZE of the current chunk */
  60.  
  61.     GUWORD GetLong(GAPTR DATA);
  62.     GUSHORT GetWord(GAPTR DATA);
  63.  
  64. private:
  65.     class    GChunk Root;
  66.     class    GChunk *Current;
  67.  
  68.     GSHORT    SizeOfID;
  69.     GSHORT    SizeOfSize;
  70.     BOOL    Backwards;
  71. };
  72.  
  73.  
  74. #endif /* GCHUNKHANDLER_H */