27#include "exiv2lib_export.h"
37#ifndef EXV_XPATH_MEMIO
38#define EXV_XPATH_MEMIO 0
102 virtual long write(
const byte* data,
long wcount) = 0;
120 virtual int putb(
byte data) = 0;
144 virtual long read(
byte* buf,
long rcount) = 0;
175 virtual int seek(int64_t offset,
Position pos) = 0;
189 virtual byte*
mmap(
bool isWriteable =
false) =0;
213 virtual size_t size()
const = 0;
219 virtual bool eof()
const = 0;
225 virtual std::string
path()
const =0;
226#ifdef EXV_UNICODE_PATH
231 virtual std::wstring wpath()
const =0;
277 void close() {
if (bio_.isopen()) bio_.close(); }
306 explicit FileIo(
const std::string& path);
307#ifdef EXV_UNICODE_PATH
313 FileIo(
const std::wstring& wpath);
334 int open(
const std::string& mode);
359 virtual long write(
const byte* data,
long wcount);
369 virtual long write(
BasicIo& src);
377 virtual int putb(
byte data);
388 virtual DataBuf read(
long rcount);
401 virtual long read(
byte* buf,
long rcount);
427 virtual void transfer(
BasicIo& src);
437 virtual int seek(int64_t offset,
Position pos);
439 virtual int seek(
long offset,
Position pos);
452 virtual byte* mmap(
bool isWriteable =
false);
460 virtual int munmap();
464 virtual void setPath(
const std::string& path);
465#ifdef EXV_UNICODE_PATH
471 virtual void setPath(
const std::wstring& wpath);
481 virtual long tell()
const;
488 virtual size_t size()
const;
490 virtual bool isopen()
const;
492 virtual int error()
const;
494 virtual bool eof()
const;
496 virtual std::string path()
const;
497#ifdef EXV_UNICODE_PATH
502 virtual std::wstring wpath()
const;
512 virtual void populateFakeData();
524 std::auto_ptr<Impl> p_;
554 MemIo(
const byte* data,
long size);
583 virtual long write(
const byte* data,
long wcount);
594 virtual long write(
BasicIo& src);
602 virtual int putb(
byte data);
613 virtual DataBuf read(
long rcount);
626 virtual long read(
byte* buf,
long rcount);
649 virtual void transfer(
BasicIo& src);
659 virtual int seek(int64_t offset,
Position pos);
661 virtual int seek(
long offset,
Position pos);
671 virtual byte* mmap(
bool =
false);
672 virtual int munmap();
681 virtual long tell()
const;
687 virtual size_t size()
const;
689 virtual bool isopen()
const;
691 virtual int error()
const;
693 virtual bool eof()
const;
695 virtual std::string path()
const;
696#ifdef EXV_UNICODE_PATH
701 virtual std::wstring wpath()
const;
711 virtual void populateFakeData();
724 std::auto_ptr<Impl> p_;
737 XPathIo(
const std::string& path);
738#ifdef EXV_UNICODE_PATH
744 XPathIo(
const std::wstring& wpath);
758 void ReadDataUri(
const std::string& path);
777 explicit XPathIo(
const std::string& orgPath);
778#ifdef EXV_UNICODE_PATH
784 XPathIo(
const std::wstring& wOrgPathpath);
796 virtual void transfer(
BasicIo& src);
808 static std::string writeDataToFile(
const std::string& orgPath);
809#ifdef EXV_UNICODE_PATH
815 static std::string writeDataToFile(
const std::wstring& wOrgPath);
822 std::string tempFilePath_;
861 virtual long write(
const byte* data,
long wcount);
876 virtual long write(
BasicIo& src);
882 virtual int putb(
byte data);
895 virtual DataBuf read(
long rcount);
910 virtual long read(
byte* buf,
long rcount);
934 virtual void transfer(
BasicIo& src);
944 virtual int seek(int64_t offset,
Position pos);
946 virtual int seek(
long offset,
Position pos);
952 virtual byte* mmap(
bool =
false);
957 virtual int munmap();
965 virtual long tell()
const;
971 virtual size_t size()
const;
973 virtual bool isopen()
const;
975 virtual int error()
const;
977 virtual bool eof()
const;
979 virtual std::string path()
const;
980#ifdef EXV_UNICODE_PATH
985 virtual std::wstring wpath()
const;
995 virtual void populateFakeData();
1028 HttpIo(
const std::string& url,
size_t blockSize = 1024);
1029#ifdef EXV_UNICODE_PATH
1035 HttpIo(
const std::wstring& wurl,
size_t blockSize = 1024);
1059 class EXIV2API CurlIo :
public RemoteIo {
1072 CurlIo(
const std::string& url,
size_t blockSize = 0);
1073#ifdef EXV_UNICODE_PATH
1079 CurlIo(
const std::wstring& wurl,
size_t blockSize = 0);
1086 long write(
const byte* data,
long wcount);
1092 long write(BasicIo& src);
1096 CurlIo(CurlIo& rhs);
1098 CurlIo& operator=(
const CurlIo& rhs);
1115 class EXIV2LIB_DEPRECATED_EXPORT SshIo :
public RemoteIo {
1128 SshIo(
const std::string& url,
size_t blockSize = 1024);
1129#ifdef EXV_UNICODE_PATH
1135 SshIo(
const std::wstring& wurl,
size_t blockSize = 1024);
1143 SshIo& operator=(
const SshIo& rhs);
1163 EXIV2API DataBuf
readFile(
const std::string& path);
1164#ifdef EXV_UNICODE_PATH
1169 EXIV2API DataBuf
readFile(
const std::wstring& wpath);
1176 EXIV2API
long writeFile(
const DataBuf& buf,
const std::string& path);
1177#ifdef EXV_UNICODE_PATH
1182 EXIV2API
long writeFile(
const DataBuf& buf,
const std::wstring& wpath);
1189 const std::string& replace);
1190#ifdef EXV_UNICODE_PATH
1197 const std::wstring& replace);
1203 EXIV2API
size_t curlWriter(
char* data,
size_t size,
size_t nmemb, std::string* writerData);
An interface for simple binary IO.
Definition: basicio.hpp:55
virtual bool isopen() const =0
Returns true if the IO source is open, otherwise false.
virtual int open()=0
Open the IO source using the default access mode. The default mode should allow for reading and writi...
Position
Seek starting positions.
Definition: basicio.hpp:61
virtual bool eof() const =0
Returns true if the IO position has reached the end, otherwise false.
virtual long write(BasicIo &src)=0
Write data that is read from another BasicIo instance to the IO source. Current IO position is advanc...
virtual void populateFakeData()
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain ...
Definition: basicio.hpp:241
virtual int seek(long offset, Position pos)=0
Move the current IO position.
virtual size_t size() const =0
Get the current size of the IO source in bytes.
virtual int getb()=0
Read one byte from the IO source. Current IO position is advanced by one byte.
byte * bigBlock_
this is allocated and populated by mmap()
Definition: basicio.hpp:246
virtual int close()=0
Close the IO source. After closing a BasicIo instance can not be read or written. Closing flushes any...
virtual std::string path() const =0
Return the path to the IO resource. Often used to form comprehensive error messages where only a Basi...
virtual DataBuf read(long rcount)=0
Read data from the IO source. Reading starts at the current IO position and the position is advanced ...
virtual int munmap()=0
Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes ...
virtual long write(const byte *data, long wcount)=0
Write data to the IO source. Current IO position is advanced by the number of bytes written.
BasicIo()
Default Constructor.
Definition: basicio.hpp:254
virtual void transfer(BasicIo &src)=0
Remove all data from this object's IO source and then transfer data from the src BasicIo object into ...
virtual int putb(byte data)=0
Write one byte to the IO source. Current IO position is advanced by one byte.
virtual int error() const =0
Returns 0 if the IO source is in a valid state, otherwise nonzero.
virtual long tell() const =0
Get the current IO position.
virtual long read(byte *buf, long rcount)=0
Read data from the IO source. Reading starts at the current IO position and the position is advanced ...
virtual byte * mmap(bool isWriteable=false)=0
Direct access to the IO data. For files, this is done by mapping the file into the process's address ...
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
Internal Pimpl structure of class FileIo.
Definition: basicio.cpp:89
Provides binary file IO by implementing the BasicIo interface.
Definition: basicio.hpp:296
Internal Pimpl structure of class HttpIo.
Definition: basicio.cpp:2031
Provides the http read/write access for the RemoteIo.
Definition: basicio.hpp:1015
virtual ~HttpIo()
Default Destructor.
Definition: basicio.hpp:1050
HttpIo & operator=(const HttpIo &rhs)
Assignment operator.
HttpIo(HttpIo &rhs)
Copy constructor.
Utility class that closes a BasicIo instance upon destruction. Meant to be used as a stack variable i...
Definition: basicio.hpp:264
IoCloser(BasicIo &bio)
Constructor, takes a BasicIo reference.
Definition: basicio.hpp:269
virtual ~IoCloser()
Destructor, closes the BasicIo reference.
Definition: basicio.hpp:271
void close()
Close the BasicIo if it is open.
Definition: basicio.hpp:277
BasicIo & bio_
The BasicIo reference.
Definition: basicio.hpp:282
Internal Pimpl structure of class MemIo.
Definition: basicio.cpp:1054
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write impleme...
Definition: basicio.hpp:540
Internal Pimpl abstract structure of class RemoteIo.
Definition: basicio.cpp:1587
Provides remote binary file IO by implementing the BasicIo interface. This is an abstract class....
Definition: basicio.hpp:832
RemoteIo()
Default Constructor.
Definition: basicio.hpp:1003
Impl * p_
Pointer to implementation.
Definition: basicio.hpp:1009
Provides binary IO for the data from stdin and data uri path.
Definition: basicio.hpp:761
static const std::string TEMP_FILE_EXT
The extension of the temporary file which is created when getting input data to read metadata....
Definition: basicio.hpp:767
static const std::string GEN_FILE_EXT
The extension of the generated file which is created when getting input data to add or modify the met...
Definition: basicio.hpp:772
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
EXIV2API std::string ReplaceStringInPlace(std::string subject, const std::string &search, const std::string &replace)
replace each substring of the subject that matches the given search string with the given replacement...
Definition: basicio.cpp:2723
EXIV2API long writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition: basicio.cpp:2703
EXIV2API DataBuf readFile(const std::string &path)
Read file path into a DataBuf, which is returned.
Definition: basicio.cpp:2665