1 //****************************************************************************//
2 // buffersource.h                                                            //
3 // Copyright (C) 2001-2003 Bruno 'Beosil' Heidelberger                       //
4 //****************************************************************************//
5 // This library is free software; you can redistribute it and/or modify it    //
6 // under the terms of the GNU Lesser General Public License as published by   //
7 // the Free Software Foundation; either version 2.1 of the License, or (at    //
8 // your option) any later version.                                            //
9 //****************************************************************************//
10 
11 #ifndef CAL_BUFFERSOURCE_H
12 #define CAL_BUFFERSOURCE_H
13 
14 //****************************************************************************//
15 // Includes                                                                   //
16 //****************************************************************************//
17 
18 #include "cal3d/global.h"
19 #include "cal3d/datasource.h"
20 #include <iostream>
21 
22 /**
23  * CalBufferSource class.
24  *
25  * This is an object designed to represent a source of Cal3d data as coming from
26  * a memory buffer.
27  */
28 
29 
30 class CAL3D_API CalBufferSource : public CalDataSource
31 {
32 public:
33    CalBufferSource(void* inputBuffer);
34    virtual ~CalBufferSource();
35 
36    virtual bool ok() const;
37    virtual void setError() const;
38    virtual bool readBytes(void* pBuffer, int length);
39    virtual bool readFloat(float& value);
40    virtual bool readShort(short& value);
41    virtual bool readInteger(int& value);
42    virtual bool readString(std::string& strValue);
43 
44 protected:
45 
46    void* mInputBuffer;
47    unsigned int mOffset;
48 
49 private:
50    CalBufferSource(); //Can't use this
51 };
52 
53 #endif
54