IDAPython 9.0
Loading...
Searching...
No Matches
qfile_t Class Reference

A helper class to work with FILE related functions.

Inheritance diagram for qfile_t:

Public Member Functions

 __init__ (self, *args)
 init(self, rhs) -> qfile_t
 
"bool" opened (self)
 Checks if the file is opened or not.
 
"void" close (self)
 Closes the file.
 
"bool" open (self, "char const *" filename, "char const *" mode)
 Opens a file.
 
"FILE *" get_fp (self)
 get_fp(self) -> FILE *
 
"int" seek (self, *args)
 Set input source position.
 
"int64" tell (self)
 Returns the current position.
 
"PyObject *" readbytes (self, "int" size, "bool" big_endian)
 Similar to read() but it respect the endianness.
 
"PyObject *" read (self, "int" size)
 Reads from the file.
 
"PyObject *" gets (self, "int" size)
 Reads a line from the input file.
 
"int" writebytes (self, "PyObject *" py_buf, "bool" big_endian)
 Similar to write() but it respect the endianness.
 
"int" write (self, "PyObject *" py_buf)
 Writes to the file.
 
"int" puts (self, "char const *" str)
 puts(self, str) -> int
 
"int64" size (self)
 size(self) -> int64
 
"int" flush (self)
 flush(self) -> int
 
"PyObject *" filename (self)
 filename(self) -> PyObject *
 
"PyObject *" get_byte (self)
 Reads a single byte from the file.
 
"int" put_byte (self, "int" chr)
 Writes a single byte to the file.
 

Static Public Member Functions

"qfile_t *" from_fp ("FILE *" fp)
 from_fp(fp) -> qfile_t
 
"qfile_t *" from_capsule ("PyObject *" pycapsule)
 from_capsule(pycapsule) -> qfile_t
 
"qfile_t *" tmpfile ()
 A static method to construct an instance using a temporary file.
 

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* args )
Parameters
rhsqfile_t const &

init(self, pycapsule=None) -> qfile_t

Parameters
pycapsulePyObject *

Member Function Documentation

◆ close()

"void" close ( self)

◆ filename()

"PyObject *" filename ( self)

◆ flush()

"int" flush ( self)

◆ from_capsule()

"qfile_t *" from_capsule ( "PyObject *" pycapsule)
static
Parameters
pycapsulePyObject *

◆ from_fp()

"qfile_t *" from_fp ( "FILE *" fp)
static
Parameters
fpFILE *

◆ get_byte()

"PyObject *" get_byte ( self)

Returns None if EOF or the read byte

◆ get_fp()

"FILE *" get_fp ( self)

◆ gets()

"PyObject *" gets ( self,
"int" size )

Returns the read line or None

Parameters
lenthe maximum line length

◆ open()

"bool" open ( self,
"char const *" filename,
"char const *" mode )
Parameters
filenamethe file name
modeThe mode string, ala fopen() style
Returns
: Boolean

◆ opened()

"bool" opened ( self)

◆ put_byte()

"int" put_byte ( self,
"int" chr )
Parameters
chrthe byte value

◆ puts()

"int" puts ( self,
"char const *" str )
Parameters
strchar const *

◆ read()

"PyObject *" read ( self,
"int" size )

Returns the buffer or None

Parameters
sizethe maximum number of bytes to read
Returns
: a str, or None

◆ readbytes()

"PyObject *" readbytes ( self,
"int" size,
"bool" big_endian )
Parameters
sizethe maximum number of bytes to read
big_endianendianness
Returns
: a str, or None

◆ seek()

"int" seek ( self,
* args )
Parameters
offsetthe seek offset
whencethe position to seek from
Returns
: the new position (not 0 as fseek!)

◆ size()

"int64" size ( self)

◆ tell()

"int64" tell ( self)

◆ tmpfile()

"qfile_t *" tmpfile ( )
static

◆ write()

"int" write ( self,
"PyObject *" py_buf )

Returns 0 or the number of bytes written

Parameters
bufthe str to write
Returns
: result code

◆ writebytes()

"int" writebytes ( self,
"PyObject *" py_buf,
"bool" big_endian )
Parameters
bufthe str to write
big_endianendianness
Returns
: result code

Property Documentation

◆ thisown

thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
static

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