libktorrent  2.1.1
Public Types | Public Member Functions | List of all members
bt::File Class Reference

Wrapper class for stdio's FILE. More...

#include <file.h>

Public Types

typedef QSharedPointer< FilePtr
 
enum  SeekPos { BEGIN, END, CURRENT }
 

Public Member Functions

 File ()
 
virtual ~File ()
 
void close ()
 
bool eof () const
 Check to see if we are at the end of the file.
 
QString errorString () const
 Get the error string.
 
void flush ()
 
bool open (const QString &file, const QString &mode)
 
Uint32 read (void *buf, Uint32 size)
 
Uint64 seek (SeekPos from, Int64 num)
 
Uint64 tell () const
 Get the current position in the file.
 
Uint32 write (const void *buf, Uint32 size)
 

Detailed Description

Author
Joris Guisson Wrapper class for stdio's FILE.

Definition at line 55 of file file.h.

Constructor & Destructor Documentation

◆ File()

bt::File::File ( )

Constructor.

◆ ~File()

virtual bt::File::~File ( )
virtual

Destructor, closes the file.

Member Function Documentation

◆ close()

void bt::File::close ( )

Close the file.

◆ flush()

void bt::File::flush ( )

Flush the file.

◆ open()

bool bt::File::open ( const QString &  file,
const QString &  mode 
)

Open the file similar to fopen

Parameters
fileFilename
modeMode
Returns
true upon succes

◆ read()

Uint32 bt::File::read ( void *  buf,
Uint32  size 
)

Read a bunch of data. If anything goes wrong an Error will be thrown.

Parameters
bufThe buffer to store the data
sizeSize of the buffer
Returns
The number of bytes read

◆ seek()

Uint64 bt::File::seek ( SeekPos  from,
Int64  num 
)

Seek in the file.

Parameters
fromPosition to seek from
numNumber of bytes to move
Returns
New position

◆ write()

Uint32 bt::File::write ( const void *  buf,
Uint32  size 
)

Write a bunch of data. If anything goes wrong an Error will be thrown.

Parameters
bufThe data
sizeSize of the data
Returns
The number of bytes written

The documentation for this class was generated from the following file: