27 #include "exiv2lib_export.h" 37 #ifndef EXV_XPATH_MEMIO 38 #define EXV_XPATH_MEMIO 0 83 virtual int open() = 0;
92 virtual int close() = 0;
102 virtual long write(
const byte* data,
long wcount) = 0;
112 virtual long write(
BasicIo& src) = 0;
120 virtual int putb(
byte data) = 0;
131 virtual DataBuf read(
long rcount) = 0;
144 virtual long read(
byte* buf,
long rcount) = 0;
151 virtual int getb() = 0;
165 virtual void transfer(
BasicIo& src) = 0;
174 #if defined(_MSC_VER) 175 virtual int seek(int64_t offset, Position pos) = 0;
177 virtual int seek(
long offset, Position pos) = 0;
189 virtual byte* mmap(
bool isWriteable =
false) =0;
196 virtual int munmap() =0;
207 virtual long tell()
const = 0;
213 virtual size_t size()
const = 0;
215 virtual bool isopen()
const = 0;
217 virtual int error()
const = 0;
219 virtual bool eof()
const = 0;
226 #ifdef EXV_UNICODE_PATH 231 virtual std::wstring wpath()
const =0;
253 BasicIo() : bigBlock_(NULL) {};
276 void close() {
if (bio_.isopen()) bio_.close(); }
307 #ifdef EXV_UNICODE_PATH 313 FileIo(
const std::wstring& wpath);
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);
436 #if defined(_MSC_VER) 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();
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;
497 #ifdef EXV_UNICODE_PATH 502 virtual std::wstring wpath()
const;
512 virtual void populateFakeData();
524 std::auto_ptr<Impl> p_;
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);
658 #if defined(_MSC_VER) 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;
696 #ifdef EXV_UNICODE_PATH 701 virtual std::wstring wpath()
const;
711 virtual void populateFakeData();
724 std::auto_ptr<Impl> p_;
738 #ifdef EXV_UNICODE_PATH 744 XPathIo(
const std::wstring& wpath);
778 #ifdef EXV_UNICODE_PATH 784 XPathIo(
const std::wstring& wOrgPathpath);
796 virtual void transfer(
BasicIo& src);
809 #ifdef EXV_UNICODE_PATH 815 static std::string writeDataToFile(
const std::wstring& wOrgPath);
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);
943 #if defined(_MSC_VER) 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;
980 #ifdef EXV_UNICODE_PATH 985 virtual std::wstring wpath()
const;
995 virtual void populateFakeData();
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);
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 1169 EXIV2API DataBuf
readFile(
const std::wstring& wpath);
1177 #ifdef EXV_UNICODE_PATH 1182 EXIV2API
long writeFile(
const DataBuf& buf,
const std::wstring& wpath);
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);
1206 #endif // #ifndef BASICIO_HPP_ An interface for simple binary IO.
Definition: basicio.hpp:55
byte * bigBlock_
this is allocated and populated by mmap()
Definition: basicio.hpp:246
EXIV2API long writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition: basicio.cpp:2702
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
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Provides remote binary file IO by implementing the BasicIo interface. This is an abstract class...
Definition: basicio.hpp:832
Provides binary file IO by implementing the BasicIo interface.
Definition: basicio.hpp:296
Internal Pimpl abstract structure of class RemoteIo.
Definition: basicio.cpp:1586
Impl * p_
Pointer to implementation.
Definition: basicio.hpp:1007
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:2722
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:105
Type definitions for Exiv2 and related functionality.
Provides the http read/write access for the RemoteIo.
Definition: basicio.hpp:1015
EXIV2API DataBuf readFile(const std::string &path)
Read file path into a DataBuf, which is returned.
Definition: basicio.cpp:2664
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
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Position
Seek starting positions.
Definition: basicio.hpp:61
Internal Pimpl structure of class FileIo.
Definition: basicio.cpp:89
Internal Pimpl structure of class MemIo.
Definition: basicio.cpp:1055
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write impleme...
Definition: basicio.hpp:540
BasicIo & bio_
The BasicIo reference.
Definition: basicio.hpp:282
IPTC string type.
Definition: types.hpp:147
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
Utility class that closes a BasicIo instance upon destruction. Meant to be used as a stack variable i...
Definition: basicio.hpp:264
virtual ~IoCloser()
Destructor, closes the BasicIo reference.
Definition: basicio.hpp:271
Internal Pimpl structure of class HttpIo.
Definition: basicio.cpp:2030
Provides binary IO for the data from stdin and data uri path.
Definition: basicio.hpp:761