BinaryIO.h
Go to the documentation of this file.
/*
* steghide 0.5.1 - a steganography program
* Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef SH_BINARYIO_H
#define SH_BINARYIO_H
#include <cstdio>
#include <string>
#include "common.h"
class BinaryIO {
public:
enum MODE { READ, WRITE } ;
BinaryIO (void) ;
BinaryIO (const std::string& fn, MODE m) ;
~BinaryIO (void) ;
const std::string& getName (void) const
{ return Name ; } ;
bool is_open (void) const
{ return FileOpen ; } ;
bool is_std (void) const
{ return (getStream() != NULL && getName() == "") ; } ;
unsigned long getPos (void) const
{ return ftell(getStream()) ; } ;
bool eof (void) const ;
void open (const std::string& fn, MODE m) ;
void close (void) ;
BYTE read8 (void) ;
UWORD16 read16_le (void) ;
UWORD16 read16_be (void) ;
UWORD32 read32_le (void) ;
UWORD32 read32_be (void) ;
UWORD32 read_le (unsigned short n) ;
std::string readstring (unsigned int len) ;
void write8 (BYTE val) ;
void write16_le (UWORD16 val) ;
void write16_be (UWORD16 val) ;
void write32_le (UWORD32 val) ;
void write32_be (UWORD32 val) ;
void write_le (UWORD32 val, unsigned short n) ;
void writestring (const std::string& s) ;
FILE* getStream (void) const
{ return Stream ; } ;
protected:
void setStream (FILE* s)
{ Stream = s ; } ;
void setName (const std::string& fn)
{ Name = fn ; } ;
MODE getMode (void) const
{ return Mode ; } ;
void setMode (MODE m)
{ Mode = m ; } ;
private:
std::string Name ;
FILE *Stream ;
bool FileOpen ;
MODE Mode ;
void init (void) ;
void set_open (bool o)
{ FileOpen = o ; } ;
void checkForce (const std::string& fn) const ;
bool Fileexists (const std::string& fn) const ;
} ;
#endif /* ndef SH_BINARYIO_H */
BinaryIO::writestring
void writestring(const std::string &s)
Definition: BinaryIO.cc:318
BinaryIO::read32_be
UWORD32 read32_be(void)
Definition: BinaryIO.cc:204
BinaryIO::read_le
UWORD32 read_le(unsigned short n)
Definition: BinaryIO.cc:219
BinaryIO::write_le
void write_le(UWORD32 val, unsigned short n)
Definition: BinaryIO.cc:305
BinaryIO::FileOpen
bool FileOpen
Definition: BinaryIO.h:183
BinaryIO::eof
bool eof(void) const
Definition: BinaryIO.cc:123
BinaryIO::getPos
unsigned long getPos(void) const
Definition: BinaryIO.h:71
BinaryIO::read32_le
UWORD32 read32_le(void)
Definition: BinaryIO.cc:189
BinaryIO::Fileexists
bool Fileexists(const std::string &fn) const
Definition: BinaryIO.cc:52
BinaryIO::WRITE
Definition: BinaryIO.h:35
BinaryIO::~BinaryIO
~BinaryIO(void)
Definition: BinaryIO.cc:45
BinaryIO::setName
void setName(const std::string &fn)
Definition: BinaryIO.h:171
BinaryIO::write32_le
void write32_le(UWORD32 val)
Definition: BinaryIO.cc:281
BinaryIO::READ
Definition: BinaryIO.h:35
BinaryIO::read16_be
UWORD16 read16_be(void)
Definition: BinaryIO.cc:174
BYTE
unsigned char BYTE
Definition: common.h:47
BinaryIO::read16_le
UWORD16 read16_le(void)
Definition: BinaryIO.cc:159
UWORD16
unsigned short UWORD16
Definition: common.h:46
BinaryIO::write16_be
void write16_be(UWORD16 val)
Definition: BinaryIO.cc:269
BinaryIO::close
void close(void)
Definition: BinaryIO.cc:131
BinaryIO::MODE
MODE
Definition: BinaryIO.h:35
UWORD32
unsigned long UWORD32
Definition: common.h:45
BinaryIO::Name
std::string Name
Definition: BinaryIO.h:178
BinaryIO::open
void open(const std::string &fn, MODE m)
Definition: BinaryIO.cc:76
BinaryIO
provides methods for file i/o as needed by the rest of steghide
Definition: BinaryIO.h:33
BinaryIO::setStream
void setStream(FILE *s)
Definition: BinaryIO.h:168
BinaryIO::setMode
void setMode(MODE m)
Definition: BinaryIO.h:177
BinaryIO::getStream
FILE * getStream(void) const
Definition: BinaryIO.h:164
BinaryIO::write32_be
void write32_be(UWORD32 val)
Definition: BinaryIO.cc:293
BinaryIO::Mode
MODE Mode
Definition: BinaryIO.h:184
BinaryIO::readstring
std::string readstring(unsigned int len)
Definition: BinaryIO.cc:237
BinaryIO::write8
void write8(BYTE val)
Definition: BinaryIO.cc:247
BinaryIO::read8
BYTE read8(void)
Definition: BinaryIO.cc:146
BinaryIO::getName
const std::string & getName(void) const
Definition: BinaryIO.h:53
BinaryIO::checkForce
void checkForce(const std::string &fn) const
Definition: BinaryIO.cc:63
BinaryIO::is_open
bool is_open(void) const
Definition: BinaryIO.h:59
BinaryIO::write16_le
void write16_le(UWORD16 val)
Definition: BinaryIO.cc:257
common.h
BinaryIO::set_open
void set_open(bool o)
Definition: BinaryIO.h:188
BinaryIO::getMode
MODE getMode(void) const
Definition: BinaryIO.h:174
BinaryIO::init
void init(void)
Definition: BinaryIO.cc:27
BinaryIO::Stream
FILE * Stream
Definition: BinaryIO.h:182
BinaryIO::BinaryIO
BinaryIO(void)
Definition: BinaryIO.cc:34
BinaryIO::is_std
bool is_std(void) const
Definition: BinaryIO.h:65