diff options
Diffstat (limited to 'src/file.h')
| -rw-r--r-- | src/file.h | 28 | 
1 files changed, 16 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* | 
| 2 | * Copyright (C) 2007-2010 Xagasoft, All rights reserved. | 2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | 
| 3 | * | 3 | * | 
| 4 | * This file is part of the libbu++ library and is released under the | 4 | * This file is part of the libbu++ library and is released under the | 
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. | 
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <sys/types.h> | 12 | #include <sys/types.h> | 
| 13 | 13 | ||
| 14 | #include "bu/stream.h" | 14 | #include "bu/stream.h" | 
| 15 | #include "bu/fstring.h" | 15 | #include "bu/string.h" | 
| 16 | #include "bu/exceptionbase.h" | 16 | #include "bu/exceptionbase.h" | 
| 17 | 17 | ||
| 18 | namespace Bu | 18 | namespace Bu | 
| @@ -26,19 +26,19 @@ namespace Bu | |||
| 26 | class File : public Bu::Stream | 26 | class File : public Bu::Stream | 
| 27 | { | 27 | { | 
| 28 | public: | 28 | public: | 
| 29 | File( const Bu::FString &sName, int iFlags ); | 29 | File( const Bu::String &sName, int iFlags ); | 
| 30 | File( int fd ); | 30 | File( int fd ); | 
| 31 | virtual ~File(); | 31 | virtual ~File(); | 
| 32 | 32 | ||
| 33 | virtual void close(); | 33 | virtual void close(); | 
| 34 | virtual size_t read( void *pBuf, size_t nBytes ); | 34 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | 
| 35 | virtual size_t write( const void *pBuf, size_t nBytes ); | 35 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | 
| 36 | using Stream::write; | 36 | using Stream::write; | 
| 37 | 37 | ||
| 38 | virtual long tell(); | 38 | virtual Bu::size tell(); | 
| 39 | virtual void seek( long offset ); | 39 | virtual void seek( Bu::size offset ); | 
| 40 | virtual void setPos( long pos ); | 40 | virtual void setPos( Bu::size pos ); | 
| 41 | virtual void setPosEnd( long pos ); | 41 | virtual void setPosEnd( Bu::size pos ); | 
| 42 | virtual bool isEos(); | 42 | virtual bool isEos(); | 
| 43 | virtual bool isOpen(); | 43 | virtual bool isOpen(); | 
| 44 | 44 | ||
| @@ -70,17 +70,21 @@ namespace Bu | |||
| 70 | /// Same as Write|Create|Truncate | 70 | /// Same as Write|Create|Truncate | 
| 71 | }; | 71 | }; | 
| 72 | 72 | ||
| 73 | virtual void setSize( long iSize ); | 73 | virtual void setSize( Bu::size iSize ); | 
| 74 | |||
| 75 | virtual size getSize() const; | ||
| 76 | virtual size getBlockSize() const; | ||
| 77 | virtual Bu::String getLocation() const; | ||
| 74 | 78 | ||
| 75 | /** | 79 | /** | 
| 76 | * Create a temp file and return its handle. The file is opened | 80 | * Create a temp file and return its handle. The file is opened | 
| 77 | * Read/Write. | 81 | * Read/Write. | 
| 78 | *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" | 82 | *@param sName (Bu::String) Give in the form: "/tmp/tmpfileXXXXXXXX" | 
| 79 | * It will alter your (sName) setting the 'X's to random | 83 | * It will alter your (sName) setting the 'X's to random | 
| 80 | * characters. | 84 | * characters. | 
| 81 | *@returns (Bu::File) A file object representing your temp file. | 85 | *@returns (Bu::File) A file object representing your temp file. | 
| 82 | */ | 86 | */ | 
| 83 | static Bu::File tempFile( Bu::FString &sName ); | 87 | static Bu::File tempFile( Bu::String &sName ); | 
| 84 | 88 | ||
| 85 | #ifndef WIN32 | 89 | #ifndef WIN32 | 
| 86 | /** | 90 | /** | 
