forked from Exiv2/exiv2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpentaxmn_int.hpp
118 lines (105 loc) · 5.06 KB
/
pentaxmn_int.hpp
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
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* 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.
*/
#ifndef PENTAXMN_INT_HPP_
#define PENTAXMN_INT_HPP_
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "tags_int.hpp"
#include "types.hpp"
// + standard includes
#include <iostream>
#include <iomanip>
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
namespace Internal {
// *****************************************************************************
// class definitions
//! MakerNote for Pentaxfilm cameras
class PentaxMakerNote {
public:
//! Return read-only list of built-in Pentaxfilm tags
static const TagInfo* tagList();
//! Print Pentax version
static std::ostream& printVersion(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax resolution
static std::ostream& printResolution(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax date
static std::ostream& printDate(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax time
static std::ostream& printTime(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax exposure
static std::ostream& printExposure(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax F value
static std::ostream& printFValue(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax focal length
static std::ostream& printFocalLength(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax compensation
static std::ostream& printCompensation(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax temperature
static std::ostream& printTemperature(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax flash compensation
static std::ostream& printFlashCompensation(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax bracketing
static std::ostream& printBracketing(std::ostream& os, const Value& value, const ExifData*);
//! Print Pentax shutter count
static std::ostream& printShutterCount(std::ostream& os, const Value& value, const ExifData*);
private:
//! Tag information
static const TagInfo tagInfo_[];
}; // class PentaxMakerNote
/*!
@brief Print function to translate Pentax "combi-values" to a description
by looking up a reference table.
*/
template <int N, const TagDetails (&array)[N], int count, int ignoredcount, int ignoredcountmax>
std::ostream& printCombiTag(std::ostream& os, const Value& value, const ExifData* metadata)
{
std::ios::fmtflags f( os.flags() );
if ((value.count() != count && (value.count() < (count + ignoredcount) || value.count() > (count + ignoredcountmax))) || count > 4) {
return printValue(os, value, metadata);
}
unsigned long l = 0;
for (int c = 0; c < count; ++c) {
if (value.toLong(c) < 0 || value.toLong(c) > 255) {
return printValue(os, value, metadata);
}
l += (value.toLong(c) << ((count - c - 1) * 8));
}
const TagDetails* td = find(array, l);
if (td) {
os << exvGettext(td->label_);
}
else {
os << exvGettext("Unknown") << " (0x"
<< std::setw(2 * count) << std::setfill('0')
<< std::hex << l << std::dec << ")";
}
os.flags(f);
return os;
}
//! Shortcut for the printCombiTag template which requires typing the array name only once.
#define EXV_PRINT_COMBITAG(array, count, ignoredcount) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcount>
//! Shortcut for the printCombiTag template which requires typing the array name only once.
#define EXV_PRINT_COMBITAG_MULTI(array, count, ignoredcount, ignoredcountmax) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcountmax>
} // namespace Internal
} // namespace Exiv2
#endif // #ifndef PENTAXMN_INT_HPP_