Exiv2
preview.hpp
Go to the documentation of this file.
1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2018 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 */
27#ifndef PREVIEW_HPP_
28#define PREVIEW_HPP_
29
30// *****************************************************************************
31#include "exiv2lib_export.h"
32
33#include "image.hpp"
34
35// *****************************************************************************
36// namespace extensions
37namespace Exiv2 {
38
39// *****************************************************************************
40// class definitions
41
43 typedef int PreviewId;
44
48 struct EXIV2API PreviewProperties {
53#ifdef EXV_UNICODE_PATH
55 std::wstring wextension_;
56#endif
58 uint32_t size_;
60 uint32_t width_;
62 uint32_t height_;
65 };
66
68 typedef std::vector<PreviewProperties> PreviewPropertiesList;
69
73 class EXIV2API PreviewImage {
74 friend class PreviewManager;
75 public:
77
78
79 PreviewImage(const PreviewImage& rhs);
83
85
86
87 PreviewImage& operator=(const PreviewImage& rhs);
89
91
92
96 DataBuf copy() const;
100 const byte* pData() const;
104 uint32_t size() const;
115 long writeFile(const std::string& path) const;
116#ifdef EXV_UNICODE_PATH
121 long writeFile(const std::wstring& wpath) const;
122#endif
127 std::string mimeType() const;
132 std::string extension() const;
133#ifdef EXV_UNICODE_PATH
139 std::wstring wextension() const;
140#endif
144 uint32_t width() const;
148 uint32_t height() const;
152 PreviewId id() const;
154
155 private:
157 PreviewImage(const PreviewProperties& properties, DataBuf data);
158
159 PreviewProperties properties_;
160 byte* pData_;
161 uint32_t size_;
162
163 }; // class PreviewImage
164
168 class EXIV2API PreviewManager {
169 public:
171
172
173 explicit PreviewManager(const Image& image);
175
177
178
183 PreviewPropertiesList getPreviewProperties() const;
187 PreviewImage getPreviewImage(const PreviewProperties& properties) const;
189
190 private:
191 const Image& image_;
192
193 }; // class PreviewManager
194} // namespace Exiv2
195
196#endif // #ifndef PREVIEW_HPP_
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
Class that holds preview image properties and data buffer.
Definition: preview.hpp:73
Class for extracting preview images from image metadata.
Definition: preview.hpp:168
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
@ string
IPTC string type.
Definition: types.hpp:147
EXIV2API long writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition: basicio.cpp:2702
int PreviewId
Type of preview image.
Definition: preview.hpp:43
std::vector< PreviewProperties > PreviewPropertiesList
Container type to hold all preview images metadata.
Definition: preview.hpp:68
Preview image properties.
Definition: preview.hpp:48
uint32_t size_
Preview image size in bytes.
Definition: preview.hpp:58
std::string extension_
Preview image extension.
Definition: preview.hpp:52
uint32_t height_
Preview image height in pixels or 0 for unknown height.
Definition: preview.hpp:62
uint32_t width_
Preview image width in pixels or 0 for unknown width.
Definition: preview.hpp:60
PreviewId id_
Identifies type of preview image.
Definition: preview.hpp:64
std::string mimeType_
Preview image mime type.
Definition: preview.hpp:50