- Cal3D 0.11 API Reference -

datasource.h
1//****************************************************************************//
2// datasource.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_DATASOURCE_H
12#define CAL_DATASOURCE_H
13
14//****************************************************************************//
15// Includes //
16//****************************************************************************//
17
18#include <string>
19
20#include "cal3d/global.h"
21
30class CAL3D_API CalDataSource
31{
32public:
33 // So... I started making some refactorings to the implementations of DataSource.
34 // It turns out all of the implementations of ok() would only return true. Since they
35 // all did the same thing, I lifted the implementation into the base class. Now, since
36 // it is always true, we can eliminate it. I think that it is better to always check the
37 // return values of the read*() functions, anyway, as ok()'s meaning is unclear (can we
38 // read in the future? did a read fail in the past?)
39 //
40 // When this ok() call is removed, make sure to check that any nearby read*() calls are
41 // actually testing the return value.
42 bool ok() { return true; }
43 virtual void setError() const = 0;
44 virtual bool readBytes(void* pBuffer, int length) = 0;
45 virtual bool readFloat(float& value) = 0;
46 virtual bool readShort(short& value) = 0;
47 virtual bool readInteger(int& value) = 0;
48 virtual bool readString(std::string& strValue) = 0;
49 virtual ~CalDataSource() {};
50};
51
52#endif
CalDataSource abstract interface class.
Definition datasource.h:31

Generated by The Cal3D Team with Doxygen 1.10.0