RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
CiffEntry.h
Go to the documentation of this file.
1/*
2 RawSpeed - RAW file decoder.
3
4 Copyright (C) 2009-2014 Klaus Post
5 Copyright (C) 2014 Pedro CĂ´rte-Real
6 Copyright (C) 2018 Roman Lebedev
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21*/
22
23#pragma once
24
25#include "rawspeedconfig.h"
26#include "adt/NORangesSet.h"
27#include "io/ByteStream.h"
28#include "tiff/CiffTag.h"
29#include <cstdint>
30#include <string>
31#include <string_view>
32#include <vector>
33
34namespace rawspeed {
35
36class Buffer;
37class CiffIFD; // IWYU pragma: keep
38template <typename T> class NORangesSet;
39
40/*
41 * Tag data type information.
42 */
43enum class CiffDataType : uint16_t {
44 BYTE = 0x0000, /* 8-bit unsigned integer */
45 ASCII = 0x0800, /* 8-bit bytes w/ last byte null */
46 SHORT = 0x1000, /* 16-bit unsigned integer */
47 LONG = 0x1800, /* 32-bit unsigned integer */
48 MIX = 0x2000, /* 32-bit unsigned integer */
49 SUB1 = 0x2800, /* 32-bit unsigned integer */
50 SUB2 = 0x3000, /* 32-bit unsigned integer */
51
52};
53
54class CiffEntry final {
55 friend class CiffIFD;
56
58
60
61public:
62 static CiffEntry Create(NORangesSet<Buffer>* valueDatas, ByteStream valueData,
63 ByteStream dirEntry);
64
65 [[nodiscard]] ByteStream getData() const { return data; }
66
67 [[nodiscard]] uint8_t getByte(uint32_t num = 0) const;
68 [[nodiscard]] uint32_t getU32(uint32_t num = 0) const;
69 [[nodiscard]] uint16_t getU16(uint32_t num = 0) const;
70
71 [[nodiscard]] std::string_view getString() const;
72 [[nodiscard]] std::vector<std::string> getStrings() const;
73
74 [[nodiscard]] uint32_t RAWSPEED_READONLY getElementSize() const;
75
76 [[nodiscard]] static uint32_t
77 getElementShift(CiffDataType type) RAWSPEED_READONLY;
78
79 // variables:
83
84 [[nodiscard]] bool RAWSPEED_READONLY isInt() const;
85 [[nodiscard]] bool RAWSPEED_READONLY isString() const;
86};
87
88} // namespace rawspeed
ByteStream data
Definition CiffEntry.h:57
static uint32_t getElementShift(CiffDataType type) RAWSPEED_READONLY
Definition CiffEntry.cpp:85
static CiffEntry Create(NORangesSet< Buffer > *valueDatas, ByteStream valueData, ByteStream dirEntry)
Definition CiffEntry.cpp:45
uint32_t RAWSPEED_READONLY getElementSize() const
friend class CiffIFD
Definition CiffEntry.h:55
std::vector< std::string > getStrings() const
CiffDataType type
Definition CiffEntry.h:81
uint32_t getU32(uint32_t num=0) const
std::string_view getString() const
CiffEntry(ByteStream data, CiffTag tag, CiffDataType type, uint32_t count)
Definition CiffEntry.cpp:41
ByteStream getData() const
Definition CiffEntry.h:65
uint8_t getByte(uint32_t num=0) const
CiffTag tag
Definition CiffEntry.h:80
uint16_t getU16(uint32_t num=0) const
bool RAWSPEED_READONLY isInt() const
uint32_t count
Definition CiffEntry.h:82
bool RAWSPEED_READONLY isString() const