Original Post
This is a pure design issue, I have this thing that my code should _look_ nice and don't just work nice (which it does as it is but..)
First I have a base-class with two virtual callback functions which is called whenever the class needs bytes from file(or whatever the data comes from) and when the buffer is full and it needs to output data..
Then I have the class that actually needs to decompress data as a sub-class..
however, since there is multiple deflate datastreams in a png file and I must treat those different I use function pointers to
choose between different Get and Put functions..but it doesn't _look_ very nice to have those function pointers =p, is it any faster/cleaner way to do it?
/* Everything IMHO */ -Luctus [edited by - Luctus on December 5, 2002 8:26:45 AM]
class Deflate
{
private:
// Lot's of private things
protected:
virtual void Get( void *data, long size ) = 0;
virtual void Put( void *data, long size ) = 0;
public:
// Some public stuff
}
class Png : public Deflate
{
private:
typedef void (cPngImage::*ZFunc)( void *, long );
ZFunc _GetFunction;
ZFunc _PutFunction;
void Get( void *data, long size );
void Put( void *data, long size );
public:
bool Load( char *filename );
void Free( void );
}
/* Everything IMHO */ -Luctus [edited by - Luctus on December 5, 2002 8:26:45 AM]