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;
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;
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);
377 virtual int putb(
byte data);
401 virtual long read(
byte* buf,
long rcount);
452 virtual byte*
mmap(
bool isWriteable =
false);
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;
524 std::auto_ptr<Impl> p_;
583 virtual long write(
const byte* data,
long wcount);
602 virtual int putb(
byte data);
626 virtual long read(
byte* buf,
long rcount);
671 virtual byte*
mmap(
bool =
false);
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;
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);
809#ifdef EXV_UNICODE_PATH
822 std::string tempFilePath_;
861 virtual long write(
const byte* data,
long wcount);
882 virtual int putb(
byte data);
910 virtual long read(
byte* buf,
long rcount);
952 virtual byte*
mmap(
bool =
false);
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;
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);
1164#ifdef EXV_UNICODE_PATH
1177#ifdef EXV_UNICODE_PATH
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
virtual void setPath(const std::string &path)
close the file source and set a new path.
Definition basicio.cpp:552
int open(const std::string &mode)
Open the file using using the specified mode.
Definition basicio.cpp:958
virtual bool eof() const
Returns true if the file position has reached the end, otherwise false.
Definition basicio.cpp:1023
virtual void populateFakeData()
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain ...
Definition basicio.cpp:1049
virtual long tell() const
Get the current file position.
Definition basicio.cpp:928
virtual int error() const
Returns 0 if the file is in a valid state, otherwise nonzero.
Definition basicio.cpp:1018
virtual long write(const byte *data, long wcount)
Write data to the file. The file position is advanced by the number of bytes written.
Definition basicio.cpp:579
virtual DataBuf read(long rcount)
Read data from the file. Reading starts at the current file position and the position is advanced by ...
Definition basicio.cpp:992
virtual int putb(byte data)
Write one byte to the file. The file position is advanced by one byte.
Definition basicio.cpp:883
virtual void transfer(BasicIo &src)
Remove the contents of the file and then transfer data from the src BasicIo object into the empty fil...
Definition basicio.cpp:609
virtual int getb()
Read one byte from the file. The file position is advanced by one byte.
Definition basicio.cpp:1011
virtual bool isopen() const
Returns true if the file is open, otherwise false.
Definition basicio.cpp:976
FileIo(const std::string &path)
Constructor that accepts the file path on which IO will be performed. The constructor does not open t...
Definition basicio.cpp:361
virtual byte * mmap(bool isWriteable=false)
Map the file into the process's address space. The file must be open before mmap() is called....
Definition basicio.cpp:412
virtual int munmap()
Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes ...
Definition basicio.cpp:378
virtual size_t size() const
Flush any buffered writes and get the current file size in bytes.
Definition basicio.cpp:934
virtual int close()
Flush and unwritten data and close the file . It is safe to call close on an already closed instance.
Definition basicio.cpp:981
virtual std::string path() const
Returns the path of the file.
Definition basicio.cpp:1028
virtual int seek(long offset, Position pos)
Move the current file position.
Definition basicio.cpp:910
Internal Pimpl structure of class HttpIo.
Definition basicio.cpp:2031
virtual ~HttpIo()
Default Destructor.
Definition basicio.hpp:1050
HttpIo & operator=(const HttpIo &rhs)
Assignment operator.
HttpIo(const std::string &url, size_t blockSize=1024)
Constructor that accepts the http URL on which IO will be performed. The constructor does not open th...
Definition basicio.cpp:2184
HttpIo(HttpIo &rhs)
Copy constructor.
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
virtual int putb(byte data)
Write one byte to the memory block. The IO position is advanced by one byte.
Definition basicio.cpp:1282
virtual bool isopen() const
Always returns true.
Definition basicio.cpp:1365
virtual int open()
Memory IO is always open for reading and writing. This method therefore only resets the IO position t...
Definition basicio.cpp:1358
virtual std::string path() const
Returns a dummy path, indicating that memory access is used.
Definition basicio.cpp:1414
virtual int seek(long offset, Position pos)
Move the current IO position.
Definition basicio.cpp:1314
virtual void populateFakeData()
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain ...
Definition basicio.cpp:1426
virtual int close()
Does nothing on MemIo objects.
Definition basicio.cpp:1370
virtual long tell() const
Get the current IO position.
Definition basicio.cpp:1348
virtual byte * mmap(bool=false)
Allow direct access to the underlying data buffer. The buffer is not protected against write access i...
Definition basicio.cpp:1338
MemIo()
Default constructor that results in an empty object.
Definition basicio.cpp:1209
virtual long write(const byte *data, long wcount)
Write data to the memory block. If needed, the size of the internal memory block is expanded....
Definition basicio.cpp:1226
virtual DataBuf read(long rcount)
Read data from the memory block. Reading starts at the current IO position and the position is advanc...
Definition basicio.cpp:1375
virtual void transfer(BasicIo &src)
Clear the memory block and then transfer data from the src BasicIo object into a new block of memory.
Definition basicio.cpp:1237
virtual int getb()
Read one byte from the memory block. The IO position is advanced by one byte.
Definition basicio.cpp:1395
virtual int munmap()
Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes ...
Definition basicio.cpp:1343
virtual int error() const
Always returns 0.
Definition basicio.cpp:1404
virtual bool eof() const
Returns true if the IO position has reached the end, otherwise false.
Definition basicio.cpp:1409
virtual size_t size() const
Get the current memory buffer size in bytes.
Definition basicio.cpp:1353
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
virtual int getb()
Read one byte from the memory blocks. The IO position is advanced by one byte. If the memory block is...
Definition basicio.cpp:1891
virtual void populateFakeData()
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain ...
Definition basicio.cpp:2019
virtual bool isopen() const
Returns true if the memory area is allocated.
Definition basicio.cpp:1992
virtual int open()
Connect to the remote server, get the size of the remote file and allocate the array of blocksMap.
Definition basicio.cpp:1709
Impl * p_
Pointer to implementation.
Definition basicio.hpp:1009
virtual std::string path() const
Returns the URL of the file.
Definition basicio.cpp:2007
virtual int seek(long offset, Position pos)
Move the current IO position.
Definition basicio.cpp:1934
virtual int close()
Reset the IO position to the start. It does not release the data.
Definition basicio.cpp:1743
virtual DataBuf read(long rcount)
Read data from the memory blocks. Reading starts at the current IO position and the position is advan...
Definition basicio.cpp:1845
virtual int munmap()
Not support.
Definition basicio.cpp:1977
virtual long write(const byte *data, long wcount)
Not support this method.
Definition basicio.cpp:1759
virtual int putb(byte data)
Not support.
Definition basicio.cpp:1840
virtual int error() const
Always returns 0.
Definition basicio.cpp:1997
virtual byte * mmap(bool=false)
Not support.
Definition basicio.cpp:1954
virtual void transfer(BasicIo &src)
Remove the contents of the file and then transfer data from the src BasicIo object into the empty fil...
Definition basicio.cpp:1907
virtual bool eof() const
Returns true if the IO position has reached the end, otherwise false.
Definition basicio.cpp:2002
virtual size_t size() const
Get the current memory buffer size in bytes.
Definition basicio.cpp:1987
virtual long tell() const
Get the current IO position.
Definition basicio.cpp:1982
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
XPathIo(const std::string &orgPath)
Default constructor that reads data from stdin/data uri path and writes them to the temp file.
Definition basicio.cpp:1487
static std::string writeDataToFile(const std::string &orgPath)
Read the data from stdin/data uri path and write them to the file.
Definition basicio.cpp:1522
virtual void transfer(BasicIo &src)
Change the name of the temp file and make it untemporary before calling the method of superclass File...
Definition basicio.cpp:1506
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