00001
00002
00003
00004
00005
00006
00007
00008 #ifndef INDRI_FILE_HPP
00009 #define INDRI_FILE_HPP
00010
00011 #include "indri/indri-platform.h"
00012 #include "indri/Mutex.hpp"
00013 #include <string>
00014 namespace indri
00015 {
00016 namespace file
00017 {
00018
00019 class File {
00020 private:
00021 #ifdef WIN32
00022 indri::thread::Mutex _mutex;
00023 HANDLE _handle;
00024 #else
00025 int _handle;
00026 #endif
00027
00028 public:
00029 File();
00030 ~File();
00031
00032 bool create( const std::string& filename );
00033 bool open( const std::string& filename );
00034 bool openRead( const std::string& filename );
00035 bool openTemporary( std::string& filename );
00036
00037 void close();
00038
00039 size_t read( void* buffer, UINT64 position, size_t length );
00040 size_t write( const void* buffer, UINT64 position, size_t length );
00041
00042 UINT64 size();
00043 };
00044 }
00045 }
00046
00047 #endif // INDRI_FILE_HPP
00048