Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions include/exiv2/asfvideo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ class EXIV2API AsfVideo : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param max_recursion_depth An exception will be thrown if the file
contains headers that are nested more deeply than this number.
@param params Parameters that are passed through to Image's constructor.
*/

explicit AsfVideo(std::unique_ptr<BasicIo> io, size_t max_recursion_depth = 500);
explicit AsfVideo(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -187,7 +186,7 @@ class EXIV2API AsfVideo : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newAsfInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newAsfInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a Windows Asf Video.
EXIV2API bool isAsfType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/bmffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ class EXIV2API BmffImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
BmffImage(std::unique_ptr<BasicIo> io, bool create, size_t max_box_depth = 1000);
BmffImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//@{
Expand Down Expand Up @@ -168,7 +167,7 @@ class EXIV2API BmffImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newBmffInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newBmffInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a BMFF image.
EXIV2API bool isBmffType(BasicIo& iIo, bool advance);
Expand Down
5 changes: 3 additions & 2 deletions include/exiv2/bmpimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ class EXIV2API BmpImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param params Parameters that are passed through to Image's constructor.
*/
explicit BmpImage(std::unique_ptr<BasicIo> io);
explicit BmpImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -80,7 +81,7 @@ class EXIV2API BmpImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newBmpInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newBmpInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a Windows Bitmap image.
EXIV2API bool isBmpType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/cr2image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ class EXIV2API Cr2Image : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
Cr2Image(std::unique_ptr<BasicIo> io, bool create);
Cr2Image(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -104,7 +103,7 @@ class EXIV2API Cr2Parser {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newCr2Instance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newCr2Instance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a CR2 image.
EXIV2API bool isCr2Type(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/crwimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ class EXIV2API CrwImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
CrwImage(std::unique_ptr<BasicIo> io, bool create);
CrwImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -123,7 +122,7 @@ class EXIV2API CrwParser {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newCrwInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newCrwInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a CRW image.
EXIV2API bool isCrwType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/epsimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ class EXIV2API EpsImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
EpsImage(std::unique_ptr<BasicIo> io, bool create);
EpsImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -84,7 +83,7 @@ class EXIV2API EpsImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newEpsInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newEpsInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a EPS image.
EXIV2API bool isEpsType(BasicIo& iIo, bool advance);
Expand Down
5 changes: 3 additions & 2 deletions include/exiv2/gifimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class EXIV2API GifImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param params Parameters that are passed through to Image's constructor.
*/
explicit GifImage(std::unique_ptr<BasicIo> io);
explicit GifImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -80,7 +81,7 @@ class EXIV2API GifImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newGifInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newGifInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a GIF image.
EXIV2API bool isGifType(BasicIo& iIo, bool advance);
Expand Down
29 changes: 27 additions & 2 deletions include/exiv2/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@ using NativePreviewList = std::vector<NativePreview>;
*/
enum PrintStructureOption { kpsNone, kpsBasic, kpsXMP, kpsRecursive, kpsIccProfile, kpsIptcErase };

/*!
@brief Parameters for the Image constructor. A large number of classes
inherit from Image, and they all have a builder function that matches
the NewInstanceFct signature. This class makes it easier to add new
parameters to Image's constructor when we need to, because they can
be added as fields of this class.
*/
class EXIV2API ImageCtorParams {
public:
ImageCtorParams(bool create, size_t max_recursion_depth);

bool create() const {
return create_;
}

size_t max_recursion_depth() const {
return max_recursion_depth_;
}

private:
const bool create_;
const size_t max_recursion_depth_;
};

/*!
@brief Abstract base class defining the interface for an image. This is
the top-level interface to the Exiv2 library.
Expand All @@ -60,8 +84,9 @@ class EXIV2API Image {
@brief Constructor taking the image type, a bitmap of the supported
metadata types and an auto-pointer that owns an IO instance.
See subclass constructor doc.
@param params Parameters that are passed through to Image's constructor.
*/
Image(ImageType type, uint16_t supportedMetadata, std::unique_ptr<BasicIo> io);
Image(ImageType type, uint16_t supportedMetadata, std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//! Virtual Destructor
virtual ~Image();
//@}
Expand Down Expand Up @@ -507,7 +532,7 @@ class EXIV2API Image {
}; // class Image

//! Type for function pointer that creates new Image instances
using NewInstanceFct = Image::UniquePtr (*)(std::unique_ptr<BasicIo> io, bool create);
using NewInstanceFct = Image::UniquePtr (*)(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//! Type for function pointer that checks image types
using IsThisTypeFct = bool (*)(BasicIo& iIo, bool advance);

Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/jp2image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ class EXIV2API Jp2Image : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
Jp2Image(std::unique_ptr<BasicIo> io, bool create);
Jp2Image(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -97,7 +96,7 @@ class EXIV2API Jp2Image : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newJp2Instance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newJp2Instance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a JPEG-2000 image.
EXIV2API bool isJp2Type(BasicIo& iIo, bool advance);
Expand Down
22 changes: 10 additions & 12 deletions include/exiv2/jpgimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class EXIV2API JpegBase : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new image should be created (true).
@param params Parameters that are passed through to Image's constructor.
@param initData Data to initialize newly created images. Only used
when \em create is true. Should contain data for the smallest
when params specify creation. Should contain data for the smallest
valid image of the calling subclass.
@param dataSize Size of initData in bytes.
*/
JpegBase(ImageType type, std::unique_ptr<BasicIo> io, bool create, const byte initData[], size_t dataSize);
JpegBase(ImageType type, std::unique_ptr<BasicIo> io, const ImageCtorParams& params, const byte initData[],
size_t dataSize);
//@}

//! @name Accessors
Expand Down Expand Up @@ -148,10 +148,9 @@ class EXIV2API JpegImage : public JpegBase {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
JpegImage(std::unique_ptr<BasicIo> io, bool create);
JpegImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}
//! @name Accessors
//@{
Expand Down Expand Up @@ -212,10 +211,9 @@ class EXIV2API ExvImage : public JpegBase {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
ExvImage(std::unique_ptr<BasicIo> io, bool create);
ExvImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}
//! @name Accessors
//@{
Expand Down Expand Up @@ -249,15 +247,15 @@ class EXIV2API ExvImage : public JpegBase {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newJpegInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newJpegInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//! Check if the file iIo is a JPEG image.
EXIV2API bool isJpegType(BasicIo& iIo, bool advance);
/*!
@brief Create a new ExvImage instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newExvInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newExvInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//! Check if the file iIo is an EXV file
EXIV2API bool isExvType(BasicIo& iIo, bool advance);

Expand Down
5 changes: 3 additions & 2 deletions include/exiv2/matroskavideo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ class EXIV2API MatroskaVideo : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param params Parameters that are passed through to Image's constructor.
*/
explicit MatroskaVideo(std::unique_ptr<BasicIo> io);
explicit MatroskaVideo(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -180,7 +181,7 @@ class EXIV2API MatroskaVideo : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newMkvInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newMkvInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a Matroska Video.
EXIV2API bool isMkvType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/mrwimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class EXIV2API MrwImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
MrwImage(std::unique_ptr<BasicIo> io, bool create);
MrwImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -84,7 +83,7 @@ class EXIV2API MrwImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newMrwInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newMrwInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a MRW image.
EXIV2API bool isMrwType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/orfimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class EXIV2API OrfImage : public TiffImage {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
OrfImage(std::unique_ptr<BasicIo> io, bool create);
OrfImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -92,7 +91,7 @@ class EXIV2API OrfParser {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newOrfInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newOrfInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is an ORF image.
EXIV2API bool isOrfType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/pgfimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class EXIV2API PgfImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
PgfImage(std::unique_ptr<BasicIo> io, bool create);
PgfImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -84,7 +83,7 @@ class EXIV2API PgfImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newPgfInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newPgfInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a PGF image.
EXIV2API bool isPgfType(BasicIo& iIo, bool advance);
Expand Down
7 changes: 3 additions & 4 deletions include/exiv2/pngimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class EXIV2API PngImage : public Image {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
@param params Parameters that are passed through to Image's constructor.
*/
PngImage(std::unique_ptr<BasicIo> io, bool create);
PngImage(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);
//@}

//! @name Manipulators
Expand Down Expand Up @@ -85,7 +84,7 @@ class EXIV2API PngImage : public Image {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newPngInstance(std::unique_ptr<BasicIo> io, bool create);
EXIV2API Image::UniquePtr newPngInstance(std::unique_ptr<BasicIo> io, const ImageCtorParams& params);

//! Check if the file iIo is a PNG image.
EXIV2API bool isPngType(BasicIo& iIo, bool advance);
Expand Down
Loading
Loading