commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
58
include/platform/filesystem/io_handle.cpp
Normal file
58
include/platform/filesystem/io_handle.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "filesystem/io_handle.h"
|
||||
#include "filesystem/io_base.h"
|
||||
|
||||
using namespace GS::IO;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
size_t Handle::GetSize()
|
||||
{
|
||||
size_t p = Tell();
|
||||
Seek(0, Base::SeekEnd);
|
||||
size_t s = Tell();
|
||||
Seek(p, Base::SeekStart);
|
||||
return s;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Handle::IsEOF()
|
||||
{ return Tell() >= GetSize(); }
|
||||
size_t Handle::Rewind()
|
||||
{ return Seek(0, Base::SeekStart); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
size_t Handle::Tell()
|
||||
{ return io_sys.IsValid() ? io_sys->Tell(this) : 0; }
|
||||
size_t Handle::Seek(ptrdiff_t offset, Base::SeekRef seek_ref)
|
||||
{ return io_sys.IsValid() ? io_sys->Seek(this, offset, seek_ref) : 0; }
|
||||
|
||||
size_t Handle::Read(void *p, size_t size)
|
||||
{ return io_sys.IsValid() ? io_sys->Read(this, p, size) : 0; }
|
||||
size_t Handle::Write(const void *p, size_t size)
|
||||
{ return io_sys.IsValid() ? io_sys->Write(this, p, size) : 0; }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Handle &Handle::operator << (const char *s)
|
||||
{
|
||||
if (s)
|
||||
Write(s, strlen(s));
|
||||
return *this;
|
||||
}
|
||||
Handle &Handle::operator << (char *s)
|
||||
{ return *this << ((const char *)s); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Handle::Handle(Base *io) : io_sys(io) {}
|
||||
Handle::~Handle() {}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user