diff options
Diffstat (limited to '')
| -rw-r--r-- | src/file.h | 17 |
1 files changed, 16 insertions, 1 deletions
| @@ -3,7 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include <stdint.h> | 4 | #include <stdint.h> |
| 5 | 5 | ||
| 6 | #include "stream.h" | 6 | #include "bu/stream.h" |
| 7 | #include "bu/fstring.h" | ||
| 7 | 8 | ||
| 8 | namespace Bu | 9 | namespace Bu |
| 9 | { | 10 | { |
| @@ -11,6 +12,8 @@ namespace Bu | |||
| 11 | { | 12 | { |
| 12 | public: | 13 | public: |
| 13 | File( const char *sName, const char *sFlags ); | 14 | File( const char *sName, const char *sFlags ); |
| 15 | File( const Bu::FString &sName, const char *sFlags ); | ||
| 16 | File( int fd, const char *sFlags ); | ||
| 14 | virtual ~File(); | 17 | virtual ~File(); |
| 15 | 18 | ||
| 16 | virtual void close(); | 19 | virtual void close(); |
| @@ -23,6 +26,8 @@ namespace Bu | |||
| 23 | virtual void setPosEnd( long pos ); | 26 | virtual void setPosEnd( long pos ); |
| 24 | virtual bool isEOS(); | 27 | virtual bool isEOS(); |
| 25 | 28 | ||
| 29 | virtual void flush(); | ||
| 30 | |||
| 26 | virtual bool canRead(); | 31 | virtual bool canRead(); |
| 27 | virtual bool canWrite(); | 32 | virtual bool canWrite(); |
| 28 | virtual bool canSeek(); | 33 | virtual bool canSeek(); |
| @@ -30,6 +35,16 @@ namespace Bu | |||
| 30 | virtual bool isBlocking(); | 35 | virtual bool isBlocking(); |
| 31 | virtual void setBlocking( bool bBlocking=true ); | 36 | virtual void setBlocking( bool bBlocking=true ); |
| 32 | 37 | ||
| 38 | inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) | ||
| 39 | { | ||
| 40 | int afh_d = mkstemp( sName.getStr() ); | ||
| 41 | |||
| 42 | return Bu::File( afh_d, sFlags ); | ||
| 43 | } | ||
| 44 | |||
| 45 | void truncate( long nSize ); | ||
| 46 | void chmod( mode_t t ); | ||
| 47 | |||
| 33 | private: | 48 | private: |
| 34 | FILE *fh; | 49 | FILE *fh; |
| 35 | 50 | ||
