Exiv2::XPathIo Class Reference

Provides binary IO for the data from stdin and data uri path. More...

#include <basicio.hpp>

Inheritance diagram for Exiv2::XPathIo:

Public Member Functions

Creators
 XPathIo (const std::string &orgPath)
 Default constructor that reads data from stdin/data uri path and writes them to the temp file.
 
 ~XPathIo () override
 Destructor. Releases all managed memory and removes the temp file.
 
 XPathIo (const XPathIo &)=delete
 
XPathIooperator= (const XPathIo &)=delete
 
Manipulators
void transfer (BasicIo &src) override
 Change the name of the temp file and make it untemporary before calling the method of superclass FileIo::transfer.
 
- Public Member Functions inherited from Exiv2::FileIo
 FileIo (const std::string &path)
 Constructor that accepts the file path on which IO will be performed. The constructor does not open the file, and therefore never fails. More...
 
 ~FileIo () override
 Destructor. Flushes and closes an open file.
 
int open (const std::string &mode)
 Open the file using the specified mode. More...
 
int open () override
 Open the file using the default access mode of "rb". This method can also be used to "reopen" a file which will flush any unwritten data and reset the IO position to the start. More...
 
int close () override
 Flush and unwritten data and close the file . It is safe to call close on an already closed instance. More...
 
size_t write (const byte *data, size_t wcount) override
 Write data to the file. The file position is advanced by the number of bytes written. More...
 
size_t write (BasicIo &src) override
 Write data that is read from another BasicIo instance to the file. The file position is advanced by the number of bytes written. More...
 
int putb (byte data) override
 Write one byte to the file. The file position is advanced by one byte. More...
 
DataBuf read (size_t rcount) override
 Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read. More...
 
size_t read (byte *buf, size_t rcount) override
 Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read. More...
 
int getb () override
 Read one byte from the file. The file position is advanced by one byte. More...
 
int seek (int64_t offset, Position pos) override
 Move the current IO position. More...
 
bytemmap (bool isWriteable=false) override
 Map the file into the process's address space. The file must be open before mmap() is called. If the mapped area is writeable, changes may not be written back to the underlying file until munmap() is called. The pointer is valid only as long as the FileIo object exists. More...
 
int munmap () override
 Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes are written back to the underlying file. More...
 
virtual void setPath (const std::string &path)
 close the file source and set a new path.
 
size_t tell () const override
 Get the current file position. More...
 
size_t size () const override
 Flush any buffered writes and get the current file size in bytes. More...
 
bool isopen () const override
 Returns true if the file is open, otherwise false.
 
int error () const override
 Returns 0 if the file is in a valid state, otherwise nonzero.
 
bool eof () const override
 Returns true if the file position has reached the end, otherwise false.
 
const std::string & path () const noexcept override
 Returns the path of the file.
 
void populateFakeData () override
 Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain image-date (non-metadata/pixel data) More...
 
 FileIo (const FileIo &)=delete
 Copy constructor.
 
FileIooperator= (const FileIo &)=delete
 Assignment operator.
 
- Public Member Functions inherited from Exiv2::BasicIo
virtual ~BasicIo ()=default
 Destructor.
 
void readOrThrow (byte *buf, size_t rcount, ErrorCode err=ErrorCode::kerCorruptedMetadata)
 Safe version of read() that checks for errors and throws an exception if the read was unsuccessful. More...
 
void seekOrThrow (int64_t offset, Position pos, ErrorCode err)
 Safe version of seek() that checks for errors and throws an exception if the seek was unsuccessful. More...
 

Static Public Attributes

static constexpr auto TEMP_FILE_EXT = ".exiv2_temp"
 The extension of the temporary file which is created when getting input data to read metadata. This file will be deleted in destructor.
 
static constexpr auto GEN_FILE_EXT = ".exiv2"
 The extension of the generated file which is created when getting input data to add or modify the metadata.
 

Static methods

static std::string writeDataToFile (const std::string &orgPath)
 Read the data from stdin/data uri path and write them to the file. More...
 

Additional Inherited Members

- Public Types inherited from Exiv2::BasicIo
enum  Position { beg , cur , end }
 Seek starting positions.
 
using UniquePtr = std::unique_ptr< BasicIo >
 BasicIo auto_ptr type.
 
- Public Attributes inherited from Exiv2::BasicIo
bytebigBlock_ {}
 this is allocated and populated by mmap()
 

Detailed Description

Provides binary IO for the data from stdin and data uri path.

Member Function Documentation

◆ writeDataToFile()

static std::string Exiv2::XPathIo::writeDataToFile ( const std::string &  orgPath)
static

Read the data from stdin/data uri path and write them to the file.

Parameters
orgPathIt equals "-" if the input data's from stdin. Otherwise, it's data uri path.
Returns
the name of the new file.
Exceptions
Errorif it fails.

The documentation for this class was generated from the following file: