/[svn]/libgig/trunk/src/RIFF.h
ViewVC logotype

Diff of /libgig/trunk/src/RIFF.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by schoenebeck, Sat Oct 25 20:15:04 2003 UTC revision 518 by schoenebeck, Sun May 8 16:19:34 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Christian Schoenebeck                           *   *   Copyright (C) 2003-2005 by Christian Schoenebeck                      *
6   *                         <cuse@users.sourceforge.net>                    *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 32  Line 32 
32  #include <map>  #include <map>
33  #include <iostream>  #include <iostream>
34    
35    #ifdef HAVE_CONFIG_H
36    # include <config.h>
37    #endif
38    
39  #if POSIX  #if POSIX
40  # include <sys/types.h>  # include <sys/types.h>
41  # include <sys/stat.h>  # include <sys/stat.h>
# Line 95  namespace RIFF { Line 99  namespace RIFF {
99              Chunk(FILE* hFile, unsigned long StartPos, bool EndianNative, List* Parent);              Chunk(FILE* hFile, unsigned long StartPos, bool EndianNative, List* Parent);
100              #endif // POSIX              #endif // POSIX
101              String         GetChunkIDString();              String         GetChunkIDString();
102              uint32_t       GetChunkID() { return ChunkID; };              uint32_t       GetChunkID() { return ChunkID; };            ///< Chunk ID in unsigned integer representation.
103              List*          GetParent()  { return pParent; };              List*          GetParent()  { return pParent; };            ///< Returns pointer to the chunk's parent list chunk.
104              unsigned long  GetSize()    { return ChunkSize; }; ///< Chunk size in bytes (without header, thus the chunk data body)              unsigned long  GetSize()    { return ChunkSize; };          ///< Chunk size in bytes (without header, thus the chunk data body)
105              unsigned long  GetPos()     { return ulPos; };     ///< Position within the chunk data body              unsigned long  GetPos()     { return ulPos; };              ///< Position within the chunk data body
106              unsigned long  GetFilePos() { return ulStartPos + ulPos; }; ///< Current, actual offset in file.              unsigned long  GetFilePos() { return ulStartPos + ulPos; }; ///< Current, actual offset in file.
107              unsigned long  SetPos(unsigned long Where, stream_whence_t Whence = stream_start);              unsigned long  SetPos(unsigned long Where, stream_whence_t Whence = stream_start);
108              unsigned long  RemainingBytes();              unsigned long  RemainingBytes();
# Line 118  namespace RIFF { Line 122  namespace RIFF {
122              uint32_t       ReadUint32();              uint32_t       ReadUint32();
123              void*          LoadChunkData();     ///< Load the whole chunk body in memory (on success returns a pointer to the data in RAM, else NULL).              void*          LoadChunkData();     ///< Load the whole chunk body in memory (on success returns a pointer to the data in RAM, else NULL).
124              void           ReleaseChunkData();  ///< Free loaded chunk body data from memory (RAM).              void           ReleaseChunkData();  ///< Free loaded chunk body data from memory (RAM).
125             ~Chunk();              virtual ~Chunk();
126          protected:          protected:
127              uint32_t      ChunkID;              uint32_t      ChunkID;
128              uint32_t      ChunkSize;            /* in bytes */              uint32_t      ChunkSize;            /* in bytes */
# Line 178  namespace RIFF { Line 182  namespace RIFF {
182              List(FILE* hFile, unsigned long StartPos, bool EndianNative, List* Parent);              List(FILE* hFile, unsigned long StartPos, bool EndianNative, List* Parent);
183              #endif // POSIX              #endif // POSIX
184              String       GetListTypeString();              String       GetListTypeString();
185              uint32_t     GetListType() { return ListType; }              uint32_t     GetListType() { return ListType; }   ///< Returns unsigned integer representation of the list's ID
186              Chunk*       GetSubChunk(uint32_t ChunkID); /* use this if you expect only one subchunk of that type in the list */              Chunk*       GetSubChunk(uint32_t ChunkID);
187              List*        GetSubList(uint32_t ListType); /* use this if you expect only one sublist chunk of that type in the list */              List*        GetSubList(uint32_t ListType);
188              Chunk*       GetFirstSubChunk();              Chunk*       GetFirstSubChunk();
189              Chunk*       GetNextSubChunk();              Chunk*       GetNextSubChunk();
190              List*        GetFirstSubList();              List*        GetFirstSubList();
# Line 189  namespace RIFF { Line 193  namespace RIFF {
193              unsigned int CountSubChunks(uint32_t ChunkID);              unsigned int CountSubChunks(uint32_t ChunkID);
194              unsigned int CountSubLists();              unsigned int CountSubLists();
195              unsigned int CountSubLists(uint32_t ListType);              unsigned int CountSubLists(uint32_t ListType);
196             ~List();              virtual ~List();
197          protected:          protected:
198              typedef std::map<uint32_t, RIFF::Chunk*>  ChunkMap;              typedef std::map<uint32_t, RIFF::Chunk*>  ChunkMap;
199              typedef std::list<Chunk*>                 ChunkList;              typedef std::list<Chunk*>                 ChunkList;
# Line 209  namespace RIFF { Line 213  namespace RIFF {
213      class File : public List {      class File : public List {
214          public:          public:
215              File(const String& path);              File(const String& path);
216             ~File();              virtual ~File();
217          private:          private:
218              unsigned long GetFileSize();              unsigned long GetFileSize();
219      };      };
# Line 224  namespace RIFF { Line 228  namespace RIFF {
228              virtual ~Exception() {};              virtual ~Exception() {};
229      };      };
230    
231        String libraryName();
232        String libraryVersion();
233    
234  } // namespace RIFF  } // namespace RIFF
235  #endif // __RIFF_H__  #endif // __RIFF_H__

Legend:
Removed from v.2  
changed lines
  Added in v.518

  ViewVC Help
Powered by ViewVC