janwas
a859562ea7
- properly differentiate between buffer/offset alignment and length alignment (relevant since block size has been increased to 256k) - use VfsPath for most game paths instead of CStr - clean up timer interface and implementation - self-tests no longer crash - file_cache.cpp: fix for the case where allocation fails (prevent deleter from seeing a null pointer) - allocators: move all shared_ptr-related stuff to its own component; add DummySharedPtr - codec: disable checksums (important for performance at work) - File: made into an interface class to avoid export problems. not entirely sure about this.. - vfs_path.h, path.h, os_path.h: proper fix for using fs::change_extension and similar utility functions with derivatives of basic_path - lib_api: automatically link against import lib if building lib/ as a DLL - path_util: remove unused functions (this component is deprecated) - compiler.h: add INLINE - Xeromyces.cpp: pass PIVFS so that GetXMBPath works in self-test (should do this mostly everywhere rather than have one singleton g_VFS) This was SVN commit r5537.
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
/**
|
|
* =========================================================================
|
|
* File : file.h
|
|
* Project : 0 A.D.
|
|
* Description : simple POSIX file wrapper.
|
|
* =========================================================================
|
|
*/
|
|
|
|
// license: GPL; see lib/license.txt
|
|
|
|
#ifndef INCLUDED_FILE
|
|
#define INCLUDED_FILE
|
|
|
|
#include "path.h"
|
|
|
|
namespace ERR
|
|
{
|
|
const LibError FILE_ACCESS = -110200;
|
|
const LibError IO = -110201;
|
|
}
|
|
|
|
struct IFile
|
|
{
|
|
virtual LibError Open(const Path& pathname, char mode) = 0;
|
|
virtual void Close() = 0;
|
|
|
|
virtual const Path& Pathname() const = 0;
|
|
virtual char Mode() const = 0;
|
|
|
|
virtual LibError Issue(aiocb& req, off_t alignedOfs, u8* alignedBuf, size_t alignedSize) const = 0;
|
|
virtual LibError WaitUntilComplete(aiocb& req, u8*& alignedBuf, size_t& alignedSize) = 0;
|
|
|
|
virtual LibError Read(off_t ofs, u8* buf, size_t size) const = 0;
|
|
virtual LibError Write(off_t ofs, const u8* buf, size_t size) const = 0;
|
|
};
|
|
|
|
typedef shared_ptr<IFile> PIFile;
|
|
|
|
LIB_API PIFile CreateFile_Posix();
|
|
|
|
#endif // #ifndef INCLUDED_FILE
|