Exiv2
cr2header_int.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 */
27#ifndef CR2IMAGE_INT_HPP_
28#define CR2IMAGE_INT_HPP_
29
30// *****************************************************************************
31// included header files
32#include "tiffimage_int.hpp"
33
34// *****************************************************************************
35// namespace extensions
36namespace Exiv2 {
37 namespace Internal {
38
39// *****************************************************************************
40// class definitions
41
43 class Cr2Header : public TiffHeaderBase {
44 public:
46
47
48 explicit Cr2Header(ByteOrder byteOrder =littleEndian);
50 ~Cr2Header() override = default;
52
54
55 bool read(const byte* pData, uint32_t size) override;
57
59
60 DataBuf write() const override;
61 bool isImageTag(uint16_t tag, IfdId group, const PrimaryGroups* pPrimaryGroups) const override;
63
65 static uint32_t offset2addr() { return 12; }
66
67 private:
68 // DATA
69 uint32_t offset2_;
70 static constexpr auto cr2sig_ = "CR\2\0";
71 }; // class Cr2Header
72
73}} // namespace Internal, Exiv2
74
75#endif // #ifndef CR2IMAGE_INT_HPP_
Canon CR2 header structure.
Definition: cr2header_int.hpp:43
~Cr2Header() override=default
Destructor.
DataBuf write() const override
Return the image header in binary format. The caller owns this data and DataBuf ensures that it will ...
Definition: cr2header_int.cpp:34
static uint32_t offset2addr()
Return the address of offset2 from the start of the header.
Definition: cr2header_int.hpp:65
bool isImageTag(uint16_t tag, IfdId group, const PrimaryGroups *pPrimaryGroups) const override
Return true if the Exif tag from group is an image tag.
Definition: cr2header_int.cpp:58
bool read(const byte *pData, uint32_t size) override
Read the image header from a data buffer. Return false if the data buffer does not contain an image h...
Definition: cr2header_int.cpp:11
Cr2Header(ByteOrder byteOrder=littleEndian)
Default constructor.
Definition: cr2header_int.cpp:5
Abstract base class defining the interface of an image header. Used internally by classes for TIFF-ba...
Definition: tiffimage_int.hpp:52
virtual uint16_t tag() const
Return the tag value (magic number) which identifies the buffer as TIFF data.
Definition: tiffimage_int.cpp:2103
virtual uint32_t size() const
Return the size (in bytes) of the image header.
Definition: tiffimage_int.cpp:2098
virtual ByteOrder byteOrder() const
Return the byte order (little or big endian).
Definition: tiffimage_int.cpp:2078
std::vector< IfdId > PrimaryGroups
Type for a list of primary image groups.
Definition: tifffwd_int.hpp:101
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags_int.hpp:46
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: basicio.hpp:43
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:83
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:162