Rizin
unix-like reverse engineering framework and cli tools
izstream Class Reference

#include <zstream.h>

Public Member Functions

 izstream ()
 
 izstream (FILE *fp)
 
 izstream (const char *name)
 
 ~izstream ()
 
void open (const char *name)
 
void open (FILE *fp)
 
int close ()
 
int read (void *buf, size_t len)
 
const char * error (int *errnum)
 
gzFile fp ()
 

Private Attributes

gzFile m_fp
 

Detailed Description

Definition at line 51 of file zstream.h.

Constructor & Destructor Documentation

◆ izstream() [1/3]

izstream::izstream ( )
inline

Definition at line 54 of file zstream.h.

54 : m_fp(0) {}
gzFile m_fp
Definition: zstream.h:104

◆ izstream() [2/3]

izstream::izstream ( FILE *  fp)
inline

Definition at line 55 of file zstream.h.

55 : m_fp(0) { open(fp); }
gzFile fp()
Definition: zstream.h:101
void open(const char *name)
Definition: zstream.h:65

References fp(), and open().

◆ izstream() [3/3]

izstream::izstream ( const char *  name)
inline

Definition at line 56 of file zstream.h.

56 : m_fp(0) { open(name); }
Definition: z80asm.h:102

References open().

◆ ~izstream()

izstream::~izstream ( )
inline

Definition at line 57 of file zstream.h.

57 { close(); }
int close()
Definition: zstream.h:80

References close().

Member Function Documentation

◆ close()

int izstream::close ( )
inline

Definition at line 80 of file zstream.h.

80  {
81  int r = ::gzclose(m_fp);
82  m_fp = 0; return r;
83  }
#define r
Definition: crypto_rc6.c:12
int ZEXPORT gzclose(gzFile file)
Definition: gzclose.c:11

References gzclose(), m_fp, and r.

Referenced by open(), and ~izstream().

◆ error()

const char* izstream::error ( int errnum)
inline

Definition at line 97 of file zstream.h.

97  {
98  return ::gzerror(m_fp, errnum);
99  }
const char *ZEXPORT gzerror(gzFile file, int *errnum)
Definition: gzlib.c:534

References gzerror(), and m_fp.

◆ fp()

gzFile izstream::fp ( )
inline

Definition at line 101 of file zstream.h.

101 { return m_fp; }

References m_fp.

Referenced by izstream(), open(), operator>(), read(), and read_string().

◆ open() [1/2]

void izstream::open ( const char *  name)
inline

Definition at line 65 of file zstream.h.

65  {
66  if (m_fp) close();
67  m_fp = ::gzopen(name, "rb");
68  }
gzFile ZEXPORT gzopen(char *path, const char *mode) const
Definition: gzlib.c:272

References close(), gzopen(), and m_fp.

Referenced by izstream().

◆ open() [2/2]

void izstream::open ( FILE *  fp)
inline

Definition at line 70 of file zstream.h.

70  {
72  if (m_fp) close();
73  m_fp = ::gzdopen(fileno(fp), "rb");
74  }
gzFile ZEXPORT gzdopen(int fd, const char *mode)
Definition: gzlib.c:288
#define SET_BINARY_MODE(file)
Definition: zstream.h:37

References close(), fp(), gzdopen(), m_fp, and SET_BINARY_MODE.

◆ read()

int izstream::read ( void *  buf,
size_t  len 
)
inline

Definition at line 87 of file zstream.h.

87  {
89  }
size_t len
Definition: 6502dis.c:15
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)
Definition: gzread.c:375
voidpf void * buf
Definition: ioapi.h:138

References gzread(), len, and m_fp.

Member Data Documentation

◆ m_fp

gzFile izstream::m_fp
private

Definition at line 104 of file zstream.h.

Referenced by close(), error(), fp(), open(), and read().


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