- Cal3D 0.11 API Reference -

datasource.h

00001 //****************************************************************************//
00002 // datasource.h                                                              //
00003 // Copyright (C) 2001-2003 Bruno 'Beosil' Heidelberger                       //
00004 //****************************************************************************//
00005 // This library is free software; you can redistribute it and/or modify it    //
00006 // under the terms of the GNU Lesser General Public License as published by   //
00007 // the Free Software Foundation; either version 2.1 of the License, or (at    //
00008 // your option) any later version.                                            //
00009 //****************************************************************************//
00010 
00011 #ifndef CAL_DATASOURCE_H
00012 #define CAL_DATASOURCE_H
00013 
00014 //****************************************************************************//
00015 // Includes                                                                   //
00016 //****************************************************************************//
00017 
00018 #include <string>
00019 
00020 #include "cal3d/global.h"
00021 
00030 class CAL3D_API CalDataSource
00031 {
00032 public:
00033   // So...  I started making some refactorings to the implementations of DataSource.
00034   // It turns out all of the implementations of ok() would only return true.  Since they
00035   // all did the same thing, I lifted the implementation into the base class.  Now, since
00036   // it is always true, we can eliminate it.  I think that it is better to always check the
00037   // return values of the read*() functions, anyway, as ok()'s meaning is unclear (can we
00038   // read in the future?  did a read fail in the past?)
00039   //
00040   // When this ok() call is removed, make sure to check that any nearby read*() calls are
00041   // actually testing the return value.
00042   bool ok() { return true; }
00043   virtual void setError() const = 0;
00044   virtual bool readBytes(void* pBuffer, int length) = 0;
00045   virtual bool readFloat(float& value) = 0;
00046   virtual bool readShort(short& value) = 0;
00047   virtual bool readInteger(int& value) = 0;
00048   virtual bool readString(std::string& strValue) = 0;
00049   virtual ~CalDataSource() {};
00050 };
00051 
00052 #endif

Generated by The Cal3D Team with Doxygen 1.7.3