00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_LIBFAT_FILE_H_
00028 #define CEYLAN_LIBFAT_FILE_H_
00029
00030
00031 #include "CeylanFile.h"
00032 #include "CeylanFileSystemCommon.h"
00033
00034
00035 #include <ctime>
00036 #include <string>
00037
00038
00039
00040
00041 namespace Ceylan
00042 {
00043
00044
00045 namespace System
00046 {
00047
00048
00049
00051 class CEYLAN_DLL LibfatFileException: public FileException
00052 {
00053
00054 public:
00055
00056 explicit LibfatFileException( const std::string & reason ) ;
00057
00058 virtual ~LibfatFileException() throw() ;
00059
00060 } ;
00061
00062
00063
00080 class CEYLAN_DLL LibfatFile: public File
00081 {
00082
00083
00084
00085 public:
00086
00087
00099 virtual ~LibfatFile() throw() ;
00100
00101
00102
00103
00104
00105
00106
00107
00112 virtual bool isOpen() const ;
00113
00114
00115
00124 virtual bool close() ;
00125
00126
00127
00136 virtual void saveAs( const std::string & newName ) ;
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00163 virtual time_t getLastChangeTime() const ;
00164
00165
00166
00192 virtual Size read( Ceylan::Byte * buffer, Size maxLength ) ;
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00216 virtual Size write( const std::string & message ) ;
00217
00218
00219
00236 virtual Size write( const Ceylan::Byte * buffer,
00237 Size maxLength ) ;
00238
00239
00240
00249 virtual Position tell() ;
00250
00251
00252
00262 virtual void seek( Position targetPosition ) ;
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00280 virtual void serialize( FileDescriptor fd ) const ;
00281
00282
00283
00290 FileDescriptor getFileDescriptor() const ;
00291
00292
00293
00294
00295
00296
00297
00298
00305 virtual StreamID getStreamID() const ;
00306
00307
00308
00309
00310
00311
00312
00313
00314
00327 virtual const std::string toString(
00328 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00366 static LibfatFile & Create( const std::string & filename,
00367 OpeningFlag createFlag = CreateToWriteBinary ) ;
00368
00369
00370
00389 static LibfatFile & Open( const std::string & filename,
00390 OpeningFlag openFlag = OpenToReadBinary ) ;
00391
00392
00393
00394
00395 protected:
00396
00397
00398
00429 explicit LibfatFile( const std::string & name,
00430 OpeningFlag openFlag = CreateToWriteBinary ) ;
00431
00432
00433
00459 LibfatFile( const std::string & name, Size length,
00460 FileDescriptor fd ) ;
00461
00462
00463
00464
00465
00466
00467
00468
00475 virtual FileSystemManager & getCorrespondingFileSystemManager()
00476 const ;
00477
00478
00479
00486 virtual void reopen() ;
00487
00488
00489
00491 std::string interpretState() const ;
00492
00493
00494
00495
00496
00497
00498
00512 static int ConvertToFileDescriptorOpenFlag(
00513 OpeningFlag openFlag ) ;
00514
00515
00516
00517
00518 private:
00519
00520
00521
00530 LibfatFile( const LibfatFile & source ) ;
00531
00532
00541 LibfatFile & operator = ( const LibfatFile & source ) ;
00542
00543
00544
00557 static void FromFDtoFD( FileDescriptor from,
00558 FileDescriptor to, Size length ) ;
00559
00560
00561
00566 FileDescriptor _fdes ;
00567
00568
00569 } ;
00570
00571
00572 }
00573
00574 }
00575
00576
00577
00578 #endif // CEYLAN_LIBFAT_FILE_H_
00579