1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #include <string.h>
- #include "binio.h"
- #include "binfile.h"
- #include "fprovide.h"
- #ifdef __SYMBIAN32__
- #define stricmp strcasecmp
- #else
- #ifndef _WIN32
- #define stricmp strcasecmp
- #endif
- #endif
- bool CFileProvider::extension(const std::string &filename,
- const std::string &extension) {
- const char *fname = filename.c_str(), *ext = extension.c_str();
- if (strlen(fname) < strlen(ext) ||
- stricmp(fname + strlen(fname) - strlen(ext), ext))
- return false;
- else
- return true;
- }
- unsigned long CFileProvider::filesize(binistream *f) {
- unsigned long oldpos = f->pos(), size;
- f->seek(0, binio::End);
- size = f->pos();
- f->seek(oldpos, binio::Set);
- return size;
- }
- binistream *CProvider_Filesystem::open(std::string filename) const {
- binifstream *f = new binifstream(filename);
- if (!f) return 0;
- if (f->error()) {
- delete f;
- return 0;
- }
-
- f->setFlag(binio::BigEndian, false);
- f->setFlag(binio::FloatIEEE);
- return f;
- }
- void CProvider_Filesystem::close(binistream *f) const {
- binifstream *ff = (binifstream *)f;
- if (f) {
- ff->close();
- delete ff;
- }
- }
|