/usr/include/exiv2/preview.hpp is in libexiv2-dev 0.25-3.1+deb9u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | // ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2015 Andreas Huggel <ahuggel@gmx.net>
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
/*!
@file preview.hpp
@brief Classes to access all preview images embedded in an image.
@version $Rev: 3091 $
@author Vladimir Nadvornik (vn)
<a href="mailto:nadvornik@suse.cz">nadvornik@suse.cz</a>
@date 18-Sep-08, vn: created
*/
#ifndef PREVIEW_HPP_
#define PREVIEW_HPP_
// *****************************************************************************
// included header files
#include "types.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include <string>
#include <vector>
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
//! Type of preview image.
typedef int PreviewId;
/*!
@brief Preview image properties.
*/
struct EXIV2API PreviewProperties {
//! Preview image mime type.
std::string mimeType_;
//! Preview image extension.
std::string extension_;
#ifdef EXV_UNICODE_PATH
//! Unicode preview image extension in an std::wstring
std::wstring wextension_;
#endif
//! Preview image size in bytes.
uint32_t size_;
//! Preview image width in pixels or 0 for unknown width.
uint32_t width_;
//! Preview image height in pixels or 0 for unknown height.
uint32_t height_;
//! Identifies type of preview image.
PreviewId id_;
};
//! Container type to hold all preview images metadata.
typedef std::vector<PreviewProperties> PreviewPropertiesList;
/*!
@brief Class that holds preview image properties and data buffer.
*/
class EXIV2API PreviewImage {
friend class PreviewManager;
public:
//! @name Constructors
//@{
//! Copy constructor
PreviewImage(const PreviewImage& rhs);
//! Destructor.
~PreviewImage();
//@}
//! @name Manipulators
//@{
//! Assignment operator
PreviewImage& operator=(const PreviewImage& rhs);
//@}
//! @name Accessors
//@{
/*!
@brief Return a copy of the preview image data. The caller owns
this copy and %DataBuf ensures that it will be deleted.
*/
DataBuf copy() const;
/*!
@brief Return a pointer to the image data for read-only access.
*/
const byte* pData() const;
/*!
@brief Return the size of the preview image in bytes.
*/
uint32_t size() const;
/*!
@brief Write the thumbnail image to a file.
A filename extension is appended to \em path according to the image
type of the preview image, so \em path should not include an extension.
The function will overwrite an existing file of the same name.
@param path File name of the preview image without extension.
@return The number of bytes written.
*/
long writeFile(const std::string& path) const;
#ifdef EXV_UNICODE_PATH
/*!
@brief Like writeFile() but accepts a unicode path in an std::wstring.
@note This function is only available on Windows.
*/
long writeFile(const std::wstring& wpath) const;
#endif
/*!
@brief Return the MIME type of the preview image, usually either
\c "image/tiff" or \c "image/jpeg".
*/
std::string mimeType() const;
/*!
@brief Return the file extension for the format of the preview image
(".tif" or ".jpg").
*/
std::string extension() const;
#ifdef EXV_UNICODE_PATH
/*!
@brief Like extension() but returns the unicode encoded extension in
an std::wstring.
@note This function is only available on Windows.
*/
std::wstring wextension() const;
#endif
/*!
@brief Return the width of the preview image in pixels.
*/
uint32_t width() const;
/*!
@brief Return the height of the preview image in pixels.
*/
uint32_t height() const;
/*!
@brief Return the preview image type identifier.
*/
PreviewId id() const;
//@}
private:
//! Private constructor
EXV_DLLLOCAL PreviewImage(const PreviewProperties& properties, DataBuf data);
PreviewProperties properties_; //!< Preview image properties
byte* pData_; //!< Pointer to the preview image data
uint32_t size_; //!< Size of the preview image data
}; // class PreviewImage
/*!
@brief Class for extracting preview images from image metadata.
*/
class EXIV2API PreviewManager {
public:
//! @name Constructors
//@{
//! Constructor.
PreviewManager(const Image& image);
//@}
//! @name Accessors
//@{
/*!
@brief Return the properties of all preview images in a list
sorted by preview width * height, starting with the smallest
preview image.
*/
PreviewPropertiesList getPreviewProperties() const;
/*!
@brief Return the preview image for the given preview properties.
*/
PreviewImage getPreviewImage(const PreviewProperties& properties) const;
//@}
private:
const Image& image_;
}; // class PreviewManager
} // namespace Exiv2
#endif // #ifndef PREVIEW_HPP_
|