You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
606 lines
23 KiB
C++
606 lines
23 KiB
C++
21 years ago
|
// ***************************************************************** -*- C++ -*-
|
||
|
/*
|
||
|
* Copyright (C) 2004 Andreas Huggel <ahuggel@gmx.net>
|
||
|
*
|
||
|
* This program is part of the Exiv2 distribution.
|
||
|
*
|
||
|
* 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.
|
||
|
*/
|
||
|
/*!
|
||
|
@file basicio.hpp
|
||
|
@brief Simple binary IO abstraction
|
||
|
@version $Rev$
|
||
|
@author Brad Schick (brad)
|
||
|
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
|
||
|
@date 04-Dec-04, brad: created
|
||
|
*/
|
||
|
#ifndef BASICIO_HPP_
|
||
|
#define BASICIO_HPP_
|
||
|
|
||
|
// *****************************************************************************
|
||
|
// included header files
|
||
|
#include "types.hpp"
|
||
|
#include "error.hpp"
|
||
|
|
||
|
// + standard includes
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
#include <cstdio>
|
||
|
|
||
|
// *****************************************************************************
|
||
|
// namespace extensions
|
||
|
namespace Exiv2 {
|
||
|
|
||
|
// *****************************************************************************
|
||
|
// class definitions
|
||
|
|
||
|
/*!
|
||
|
@brief An interface for simple binary IO.
|
||
|
|
||
|
Designed to have semantics
|
||
|
and names similar to those of C style FILE* operations. Subclasses
|
||
|
should all behave the same so that they can be interchanged.
|
||
|
*/
|
||
|
class BasicIo
|
||
|
{
|
||
|
public:
|
||
|
//! BasicIo auto_ptr type
|
||
|
typedef std::auto_ptr<BasicIo> AutoPtr;
|
||
|
|
||
|
//! Seek starting positions
|
||
|
enum Position { beg, cur, end };
|
||
|
|
||
|
//! @name Creators
|
||
|
//@{
|
||
|
//! Destructor
|
||
|
virtual ~BasicIo() {}
|
||
|
//@}
|
||
|
|
||
|
//! @name Manipulators
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Open the IO source using the default access mode. The
|
||
|
default mode should allow for reading and writing.
|
||
|
|
||
|
This method can also be used to "reopen" an IO source which will
|
||
|
flush any unwritten data and reset the IO position to the start.
|
||
|
Subclasses may provide custom methods to allow for
|
||
|
opening IO sources differently.
|
||
|
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int open() = 0;
|
||
|
/*!
|
||
|
@brief Close the IO source. After closing a BasicIo instance can not
|
||
|
be read or written. Closing flushes any unwritten data. It is
|
||
|
safe to call close on a closed instance.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int close() = 0;
|
||
|
/*!
|
||
|
@brief Write data to the IO source. Current IO position is advanced
|
||
|
by the number of bytes written.
|
||
|
@param data Pointer to data. Data must be at least \em wcount
|
||
|
bytes long
|
||
|
@param wcount Number of bytes to be written.
|
||
|
@return Number of bytes written to IO source successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(const byte* data, long wcount) = 0;
|
||
|
/*!
|
||
|
@brief Write data that is read from another BasicIo instance to
|
||
|
the IO source. Current IO position is advanced by the number
|
||
|
of bytes written.
|
||
|
@param src Reference to another BasicIo instance. Reading start
|
||
|
at the source's current IO position
|
||
|
@return Number of bytes written to IO source successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(BasicIo& src) = 0;
|
||
|
/*!
|
||
|
@brief Write one byte to the IO source. Current IO position is
|
||
|
advanced by one byte.
|
||
|
@param data The single byte to be written.
|
||
|
@return The value of the byte written if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int putb(byte data) = 0;
|
||
|
/*!
|
||
|
@brief Read data from the IO source. Reading starts at the current
|
||
|
IO position and the position is advanced by the number of bytes
|
||
|
read.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return DataBuf instance containing the bytes read. Use the
|
||
|
DataBuf::size_ member to find the number of bytes read.
|
||
|
DataBuf::size_ will be 0 on failure.
|
||
|
*/
|
||
|
virtual DataBuf read(long rcount) = 0;
|
||
|
/*!
|
||
|
@brief Read data from the IO source. Reading starts at the current
|
||
|
IO position and the position is advanced by the number of bytes
|
||
|
read.
|
||
|
@param buf Pointer to a block of memory into which the read data
|
||
|
is stored. The memory block must be at least \em rcount bytes
|
||
|
long.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return Number of bytes read from IO source successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long read(byte *buf, long rcount) = 0;
|
||
|
/*!
|
||
|
@brief Read one byte from the IO source. Current IO position is
|
||
|
advanced by one byte.
|
||
|
@return The byte read from the IO source if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int getb() = 0;
|
||
|
/*!
|
||
|
@brief Remove all data from this object's IO source and then transfer
|
||
|
data from the \em src BasicIo object into this object.
|
||
|
|
||
|
The source object is invalidated by this operation and should not be
|
||
|
used after this method returns. This method exists primarily to
|
||
|
be used with the BasicIo::temporary() method.
|
||
|
|
||
|
@param src Reference to another BasicIo instance. The entire contents
|
||
|
of src are transferred to this object. The \em src object is
|
||
|
invalidated by the method.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int transfer(BasicIo& src) = 0;
|
||
|
/*!
|
||
|
@brief Move the current IO position.
|
||
|
@param offset Number of bytes to move the position relative
|
||
|
to the starting position specified by \em pos
|
||
|
@param pos Position from which the seek should start
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int seek(long offset, Position pos) = 0;
|
||
|
//@}
|
||
|
|
||
|
//! @name Accessors
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Get the current IO position.
|
||
|
@return Offset from the start of IO if successful;<BR>
|
||
|
-l if failure;
|
||
|
*/
|
||
|
virtual long tell() const = 0;
|
||
|
//!Returns true if the IO source is open, otherwise false.
|
||
|
virtual bool isopen() const = 0;
|
||
|
//!Returns 0 if the IO source is in a valid state, otherwise nonzero.
|
||
|
virtual int error() const = 0;
|
||
|
//!Returns true if the IO position has reach the end, otherwise false.
|
||
|
virtual bool eof() const = 0;
|
||
|
/*!
|
||
|
@brief Returns a temporary data storage location. This is often
|
||
|
needed to rewrite an IO source.
|
||
|
|
||
|
For example, data may be read from the original IO source, modified
|
||
|
in some way, and then saved to the temporary instance. After the
|
||
|
operation is complete, the BasicIo::transfer method can be used to
|
||
|
replace the original IO source with the modified version. Subclasses
|
||
|
are free to return any class that derives from BasicIo.
|
||
|
|
||
|
@return An instance of BasicIo on success;<BR>
|
||
|
Null pointer on failure;
|
||
|
*/
|
||
|
virtual BasicIo::AutoPtr temporary() const = 0;
|
||
|
//@}
|
||
|
|
||
|
protected:
|
||
|
//! @name Creators
|
||
|
//@{
|
||
|
//! Default Constructor
|
||
|
BasicIo() {}
|
||
|
//@}
|
||
|
}; // class BasicIo
|
||
|
|
||
|
/*!
|
||
|
@brief Utility class that closes a BasicIo instance upon destruction.
|
||
|
Meant to be used as a stack variable in functions that need to
|
||
|
ensure BasicIo instances get closed. Useful when functions return
|
||
|
errors from many locations.
|
||
|
*/
|
||
|
class IoCloser {
|
||
|
public:
|
||
|
//! @name Creators
|
||
|
//@{
|
||
|
//! Constructor, takes a BasicIo reference
|
||
|
IoCloser(BasicIo &bio) : bio_(bio) {}
|
||
|
//! Destructor, closes the BasicIo reference
|
||
|
~IoCloser() { close(); }
|
||
|
//@}
|
||
|
|
||
|
//! @name Manipulators
|
||
|
//@{
|
||
|
//! Close the BasicIo if it is open
|
||
|
void close() { if (bio_.isopen()) bio_.close(); }
|
||
|
//@}
|
||
|
|
||
|
// DATA
|
||
|
//! The BasicIo reference
|
||
|
BasicIo &bio_;
|
||
|
private:
|
||
|
// Not implemented
|
||
|
//! Copy constructor
|
||
|
IoCloser(const IoCloser&);
|
||
|
//! Assignment operator
|
||
|
IoCloser& operator=(const IoCloser&);
|
||
|
}; // class IoCloser
|
||
|
|
||
|
|
||
|
/*!
|
||
|
@brief Provides binary file IO by implementing the BasicIo
|
||
|
interface.
|
||
|
*/
|
||
|
class FileIo : public BasicIo
|
||
|
{
|
||
|
public:
|
||
|
//! @name Creators
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Constructor that accepts the file path on which IO will be
|
||
|
performed. The constructor does not open the file, and
|
||
|
therefore never failes.
|
||
|
@param path The full path of a file
|
||
|
*/
|
||
|
FileIo(const std::string& path);
|
||
|
//! Destructor. Flushes and closes an open file.
|
||
|
virtual ~FileIo();
|
||
|
//@}
|
||
|
|
||
|
//! @name Manipulators
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Open the file using using the specified mode.
|
||
|
|
||
|
This method can also be used to "reopen" a file which will flush any
|
||
|
unwritten data and reset the IO position to the start. Although
|
||
|
files can be opened in binary or text mode, this class has
|
||
|
only been tested carefully in binary mode.
|
||
|
|
||
|
@param mode Specified that type of access allowed on the file.
|
||
|
Valid values match those of the C fopen command exactly.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
int open( const std::string& mode);
|
||
|
/*!
|
||
|
@brief Open the file using using the default access mode of "r+b".
|
||
|
This method can also be used to "reopen" a file which will flush
|
||
|
any unwritten data and reset the IO position to the start.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int open();
|
||
|
/*!
|
||
|
@brief Flush and unwritten data and close the file . It is
|
||
|
safe to call close on an already closed instance.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int close();
|
||
|
/*!
|
||
|
@brief Write data to the file. The file position is advanced
|
||
|
by the number of bytes written.
|
||
|
@param data Pointer to data. Data must be at least \em wcount
|
||
|
bytes long
|
||
|
@param wcount Number of bytes to be written.
|
||
|
@return Number of bytes written to the file successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(const byte* data, long wcount);
|
||
|
/*!
|
||
|
@brief Write data that is read from another BasicIo instance to
|
||
|
the file. The file position is advanced by the number
|
||
|
of bytes written.
|
||
|
@param src Reference to another BasicIo instance. Reading start
|
||
|
at the source's current IO position
|
||
|
@return Number of bytes written to the file successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(BasicIo& src);
|
||
|
/*!
|
||
|
@brief Write one byte to the file. The file position is
|
||
|
advanced by one byte.
|
||
|
@param data The single byte to be written.
|
||
|
@return The value of the byte written if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int putb(byte data);
|
||
|
/*!
|
||
|
@brief Read data from the file. Reading starts at the current
|
||
|
file position and the position is advanced by the number of
|
||
|
bytes read.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return DataBuf instance containing the bytes read. Use the
|
||
|
DataBuf::size_ member to find the number of bytes read.
|
||
|
DataBuf::size_ will be 0 on failure.
|
||
|
*/
|
||
|
virtual DataBuf read(long rcount);
|
||
|
/*!
|
||
|
@brief Read data from the file. Reading starts at the current
|
||
|
file position and the position is advanced by the number of
|
||
|
bytes read.
|
||
|
@param buf Pointer to a block of memory into which the read data
|
||
|
is stored. The memory block must be at least \em rcount bytes
|
||
|
long.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return Number of bytes read from the file successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long read(byte *buf, long rcount);
|
||
|
/*!
|
||
|
@brief Read one byte from the file. The file position is
|
||
|
advanced by one byte.
|
||
|
@return The byte read from the file if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int getb();
|
||
|
/*!
|
||
|
@brief Remove the contents of the file and then transfer data from
|
||
|
the \em src BasicIo object into the empty file.
|
||
|
|
||
|
This method is optimized to simply rename the source file if the
|
||
|
source object is another FileIo instance. The source BasicIo object
|
||
|
is invalidated by this operation and should not be used after this
|
||
|
method returns. This method exists primarily to be used with
|
||
|
the BasicIo::temporary() method.
|
||
|
|
||
|
@param src Reference to another BasicIo instance. The entire contents
|
||
|
of src are transferred to this object. The \em src object is
|
||
|
invalidated by the method.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int transfer(BasicIo& src);
|
||
|
/*!
|
||
|
@brief Move the current file position.
|
||
|
@param offset Number of bytes to move the file position
|
||
|
relative to the starting position specified by \em pos
|
||
|
@param pos Position from which the seek should start
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int seek(long offset, Position pos);
|
||
|
//@}
|
||
|
|
||
|
//! @name Accessors
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Get the current file position.
|
||
|
@return Offset from the start of the file if successful;<BR>
|
||
|
-l if failure;
|
||
|
*/
|
||
|
virtual long tell() const;
|
||
|
//!Returns true if the file is open, otherwise false.
|
||
|
virtual bool isopen() const;
|
||
|
//!Returns 0 if the file is in a valid state, otherwise nonzero.
|
||
|
virtual int error() const;
|
||
|
//!Returns true if the file position has reach the end, otherwise false.
|
||
|
virtual bool eof() const;
|
||
|
/*!
|
||
|
@brief Returns a temporary data storage location. The actual type
|
||
|
returned depends upon the size of the file represented a FileIo
|
||
|
object. For small files, a MemIo is returned while for large files
|
||
|
a FileIo is returned. Callers should not rely on this behavior,
|
||
|
however, since it may change.
|
||
|
@return An instance of BasicIo on success;<BR>
|
||
|
Null pointer on failure;
|
||
|
*/
|
||
|
virtual BasicIo::AutoPtr temporary() const;
|
||
|
//@}
|
||
|
|
||
|
private:
|
||
|
// NOT IMPLEMENTED
|
||
|
//! Copy constructor
|
||
|
FileIo(FileIo& rhs);
|
||
|
//! Assignment operator
|
||
|
FileIo& operator=(const FileIo& rhs);
|
||
|
|
||
|
// Enumeration
|
||
|
enum OpMode { opRead, opWrite, opSeek };
|
||
|
|
||
|
// DATA
|
||
|
std::string path_;
|
||
|
std::string openMode_;
|
||
|
FILE *fp_;
|
||
|
OpMode opMode_;
|
||
|
}; // class FileIo
|
||
|
|
||
|
/*!
|
||
|
@brief Provides binary IO on blocks of memory by implementing the
|
||
|
BasicIo interface. The current implementation makes a copy of
|
||
|
any data passed to its constructors. If writes are performed, the
|
||
|
changed data can be retrieved using the read methods (since the
|
||
|
data used in construction is never modified).
|
||
|
|
||
|
@note If read only usage of this class is common, it might be worth
|
||
|
creating a specialized readonly class or changing this one to
|
||
|
have a readonly mode.
|
||
|
*/
|
||
|
class MemIo : public BasicIo
|
||
|
{
|
||
|
public:
|
||
|
//! @name Creators
|
||
|
//@{
|
||
|
//! Default constructor that results in an empty object
|
||
|
MemIo() { idx_ = 0; }
|
||
|
/*!
|
||
|
@brief Constructor that accepts a block of memory to be copied.
|
||
|
IO operations are performed on the copied memory.
|
||
|
@param data Pointer to data. Data must be at least \em size
|
||
|
bytes long
|
||
|
@param size Number of bytes to copy.
|
||
|
*/
|
||
|
MemIo(const byte* data, long size);
|
||
|
//! Destructor. Releases all managed memory
|
||
|
virtual ~MemIo() {}
|
||
|
//@}
|
||
|
|
||
|
//! @name Manipulators
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Memory IO is always open for reading and writing. This method
|
||
|
therefore only resets the IO position to the start.
|
||
|
@return 0
|
||
|
*/
|
||
|
virtual int open();
|
||
|
/*!
|
||
|
@brief Does nothing on MemIo objects.
|
||
|
@return 0
|
||
|
*/
|
||
|
virtual int close();
|
||
|
/*!
|
||
|
@brief Write data to the memory block. If needed, the size of the
|
||
|
internal memory block is expanded. The IO position is advanced
|
||
|
by the number of bytes written.
|
||
|
@param data Pointer to data. Data must be at least \em wcount
|
||
|
bytes long
|
||
|
@param wcount Number of bytes to be written.
|
||
|
@return Number of bytes written to the memory block successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(const byte* data, long wcount);
|
||
|
/*!
|
||
|
@brief Write data that is read from another BasicIo instance to
|
||
|
the memory block. If needed, the size of the internal memory
|
||
|
block is expanded. The IO position is advanced by the number
|
||
|
of bytes written.
|
||
|
@param src Reference to another BasicIo instance. Reading start
|
||
|
at the source's current IO position
|
||
|
@return Number of bytes written to the memory block successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long write(BasicIo& src);
|
||
|
/*!
|
||
|
@brief Write one byte to the memory block. The IO position is
|
||
|
advanced by one byte.
|
||
|
@param data The single byte to be written.
|
||
|
@return The value of the byte written if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int putb(byte data);
|
||
|
/*!
|
||
|
@brief Read data from the memory block. Reading starts at the current
|
||
|
IO position and the position is advanced by the number of
|
||
|
bytes read.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return DataBuf instance containing the bytes read. Use the
|
||
|
DataBuf::size_ member to find the number of bytes read.
|
||
|
DataBuf::size_ will be 0 on failure.
|
||
|
*/
|
||
|
virtual DataBuf read(long rcount);
|
||
|
/*!
|
||
|
@brief Read data from the memory block. Reading starts at the current
|
||
|
IO position and the position is advanced by the number of
|
||
|
bytes read.
|
||
|
@param buf Pointer to a block of memory into which the read data
|
||
|
is stored. The memory block must be at least \em rcount bytes
|
||
|
long.
|
||
|
@param rcount Maximum number of bytes to read. Fewer bytes may be
|
||
|
read if \em rcount bytes are not available.
|
||
|
@return Number of bytes read from the memory block successfully;<BR>
|
||
|
0 if failure;
|
||
|
*/
|
||
|
virtual long read(byte *buf, long rcount);
|
||
|
/*!
|
||
|
@brief Read one byte from the memory block. The IO position is
|
||
|
advanced by one byte.
|
||
|
@return The byte read from the memory block if successful;<BR>
|
||
|
EOF if failure;
|
||
|
*/
|
||
|
virtual int getb();
|
||
|
/*!
|
||
|
@brief Clear the memory clock and then transfer data from
|
||
|
the \em src BasicIo object into a new block of memory.
|
||
|
|
||
|
This method is optimized to simply swap memory block if the source
|
||
|
object is another MemIo instance. The source BasicIo instance
|
||
|
is invalidated by this operation and should not be used after this
|
||
|
method returns. This method exists primarily to be used with
|
||
|
the BasicIo::temporary() method.
|
||
|
|
||
|
@param src Reference to another BasicIo instance. The entire contents
|
||
|
of src are transferred to this object. The \em src object is
|
||
|
invalidated by the method.
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int transfer(BasicIo& src);
|
||
|
/*!
|
||
|
@brief Move the current IO position.
|
||
|
@param offset Number of bytes to move the IO position
|
||
|
relative to the starting position specified by \em pos
|
||
|
@param pos Position from which the seek should start
|
||
|
@return 0 if successful;<BR>
|
||
|
Nonzero if failure;
|
||
|
*/
|
||
|
virtual int seek(long offset, Position pos);
|
||
|
//@}
|
||
|
|
||
|
//! @name Accessors
|
||
|
//@{
|
||
|
/*!
|
||
|
@brief Get the current IO position.
|
||
|
@return Offset from the start of the memory block
|
||
|
*/
|
||
|
virtual long tell() const;
|
||
|
//!Always returns true
|
||
|
virtual bool isopen() const;
|
||
|
//!Always returns 0
|
||
|
virtual int error() const;
|
||
|
//!Returns true if the IO position has reach the end, otherwise false.
|
||
|
virtual bool eof() const;
|
||
|
/*!
|
||
|
@brief Returns a temporary data storage location. Currently returns
|
||
|
an empty MemIo object, but callers should not rely on this
|
||
|
behavior since it may change.
|
||
|
@return An instance of BasicIo on success;<BR>
|
||
|
Null pointer on failure;
|
||
|
*/
|
||
|
virtual BasicIo::AutoPtr temporary() const;
|
||
|
//@}
|
||
|
private:
|
||
|
// NOT IMPLEMENTED
|
||
|
//! Copy constructor
|
||
|
MemIo(MemIo& rhs);
|
||
|
//! Assignment operator
|
||
|
MemIo& operator=(const MemIo& rhs);
|
||
|
|
||
|
// Typedefs
|
||
|
typedef std::vector<byte> ByteVector;
|
||
|
|
||
|
// DATA
|
||
|
ByteVector data_;
|
||
|
ByteVector::size_type idx_;
|
||
|
|
||
|
//METHODS
|
||
|
void checkSize(long wcount);
|
||
|
}; // class MemIo
|
||
|
} // namespace Exiv2
|
||
|
|
||
|
#endif // #ifndef BASICIO_HPP_
|