Skip to content
This repository
tree: 6ec00b3c1b
Fetching contributors…

Cannot retrieve contributors at this time

file 51 lines (41 sloc) 1.423 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
// Copyright (c) 2010-2011 Zipline Games, Inc. All Rights Reserved.
// http://getmoai.com

#ifndef USFILESTREAM_H
#define USFILESTREAM_H

#include <uslscore/USStream.h>

//================================================================//
// USFileStream
//================================================================//
class USFileStream :
public USStream {
protected:

ZLFILE* mFile;
size_t mLength;
u32 mCaps;

//----------------------------------------------------------------//
int SetCursor ( long offset );

public:

enum {
READ, // existing file just for reading (rb)
READ_WRITE, // existing file for reading and writing (rb+)
READ_WRITE_AFFIRM, // new or existing file for reading and writing (rb+, fallback on wb+)
READ_WRITE_NEW, // new file for reading and writing (wb+)
WRITE, // new file just for writing (wb)
};

static const u32 DEFAULT_FILE_MODE = READ;

//----------------------------------------------------------------//
void Close ();
void Flush ();
u32 GetCaps ();
size_t GetCursor ();
ZLFILE* GetFile ();
size_t GetLength ();
bool Open ( cc8* filename, u32 mode );
bool OpenRead ( cc8* filename );
bool OpenWrite ( cc8* filename );
size_t ReadBytes ( void* buffer, size_t size );
USFileStream ();
~USFileStream ();
size_t WriteBytes ( const void* buffer, size_t size );
};

#endif
Something went wrong with that request. Please try again.