Exiv2
pgfimage.hpp
1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2021 Exiv2 authors
4 * This program is part of the Exiv2 distribution.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19 */
20#ifndef PGFIMAGE_HPP_
21#define PGFIMAGE_HPP_
22
23// *****************************************************************************
24#include "exiv2lib_export.h"
25
26// included header files
27#include "image.hpp"
28
29// *****************************************************************************
30// namespace extensions
31namespace Exiv2
32{
33
34// *****************************************************************************
35// class definitions
36
37 // Add PGF to the supported image formats
38 namespace ImageType
39 {
40 const int pgf = 17;
41 }
42
47 class EXIV2API PgfImage : public Image {
48 public:
50
51
66 PgfImage(BasicIo::UniquePtr io, bool create);
68
70
71 void readMetadata() override;
72 void writeMetadata() override;
74
76
77 std::string mimeType() const override
78 {
79 return "image/pgf";
80 }
82
84
85
86 PgfImage(const PgfImage& rhs) = delete;
88 PgfImage& operator=(const PgfImage& rhs) = delete;
89
90 private:
91 bool bSwap_; // true for bigEndian hardware, else false
99 void doWriteMetadata(BasicIo& outIo);
101 static byte readPgfMagicNumber(BasicIo& iIo);
103 uint32_t readPgfHeaderSize(BasicIo& iIo) const;
105 DataBuf readPgfHeaderStructure(BasicIo& iIo, int& width, int& height) const;
107
108 }; // class PgfImage
109
110// *****************************************************************************
111// template, inline and free functions
112
113 // These could be static private functions on Image subclasses but then
114 // ImageFactory needs to be made a friend.
120 EXIV2API Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create);
121
123 EXIV2API bool isPgfType(BasicIo& iIo, bool advance);
124
125} // namespace Exiv2
126
127#endif // #ifndef PGFIMAGE_HPP_
An interface for simple binary IO.
Definition: basicio.hpp:55
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition: image.hpp:81
Class to access PGF images. Exif and IPTC metadata are supported directly.
Definition: pgfimage.hpp:47
std::string mimeType() const override
Return the MIME type of the image.
Definition: pgfimage.hpp:77
PgfImage(const PgfImage &rhs)=delete
Copy constructor.
PgfImage & operator=(const PgfImage &rhs)=delete
Assignment operator.
const int pgf
PGF image type (see class PgfImage)
Definition: pgfimage.hpp:40
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: basicio.hpp:43
EXIV2API bool isPgfType(BasicIo &iIo, bool advance)
Check if the file iIo is a PGF image.
Definition: pgfimage.cpp:327
EXIV2API Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create)
Create a new PgfImage instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition: pgfimage.cpp:317
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:162