Exiv2
pentaxmn_int.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 PENTAXMN_INT_HPP_
28 #define PENTAXMN_INT_HPP_
29 
30 // *****************************************************************************
31 // included header files
32 #include "tags.hpp"
33 #include "tags_int.hpp"
34 #include "types.hpp"
35 
36 // + standard includes
37 #include <iostream>
38 #include <iomanip>
39 
40 // *****************************************************************************
41 // namespace extensions
42 namespace Exiv2 {
43  namespace Internal {
44 
45 // *****************************************************************************
46 // class definitions
47 
50  public:
52  static const TagInfo* tagList();
53 
55  static std::ostream& printVersion(std::ostream& os, const Value& value, const ExifData*);
57  static std::ostream& printResolution(std::ostream& os, const Value& value, const ExifData*);
59  static std::ostream& printDate(std::ostream& os, const Value& value, const ExifData*);
61  static std::ostream& printTime(std::ostream& os, const Value& value, const ExifData*);
63  static std::ostream& printExposure(std::ostream& os, const Value& value, const ExifData*);
65  static std::ostream& printFValue(std::ostream& os, const Value& value, const ExifData*);
67  static std::ostream& printFocalLength(std::ostream& os, const Value& value, const ExifData*);
69  static std::ostream& printCompensation(std::ostream& os, const Value& value, const ExifData*);
71  static std::ostream& printTemperature(std::ostream& os, const Value& value, const ExifData*);
73  static std::ostream& printFlashCompensation(std::ostream& os, const Value& value, const ExifData*);
75  static std::ostream& printBracketing(std::ostream& os, const Value& value, const ExifData*);
77  static std::ostream& printShutterCount(std::ostream& os, const Value& value, const ExifData*);
78 
79  private:
81  static const TagInfo tagInfo_[];
82  }; // class PentaxMakerNote
83 
88  template <int N, const TagDetails (&array)[N], int count, int ignoredcount, int ignoredcountmax>
89  std::ostream& printCombiTag(std::ostream& os, const Value& value, const ExifData* metadata)
90  {
91  std::ios::fmtflags f( os.flags() );
92  if ((value.count() != count && (value.count() < (count + ignoredcount) || value.count() > (count + ignoredcountmax))) || count > 4) {
93  return printValue(os, value, metadata);
94  }
95  unsigned long l = 0;
96  for (int c = 0; c < count; ++c) {
97  if (value.toLong(c) < 0 || value.toLong(c) > 255) {
98  return printValue(os, value, metadata);
99  }
100  l += (value.toLong(c) << ((count - c - 1) * 8));
101  }
102  const TagDetails* td = find(array, l);
103  if (td) {
104  os << exvGettext(td->label_);
105  }
106  else {
107  os << exvGettext("Unknown") << " (0x"
108  << std::setw(2 * count) << std::setfill('0')
109  << std::hex << l << std::dec << ")";
110  }
111 
112  os.flags(f);
113  return os;
114  }
115 
117 #define EXV_PRINT_COMBITAG(array, count, ignoredcount) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcount>
118 #define EXV_PRINT_COMBITAG_MULTI(array, count, ignoredcount, ignoredcountmax) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcountmax>
120 
121  } // namespace Internal
122 } // namespace Exiv2
123 
124 
125 #endif // #ifndef PENTAXMN_INT_HPP_
Helper structure for lookup tables for translations of numeric tag values to human readable labels...
Definition: tags_int.hpp:188
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
std::ostream & printValue(std::ostream &os, const Value &value, const ExifData *)
Default print function, using the Value output operator.
Definition: tags_int.cpp:2162
static std::ostream & printShutterCount(std::ostream &os, const Value &value, const ExifData *)
Print Pentax shutter count.
Definition: pentaxmn_int.cpp:1160
const char * label_
Translation of the tag value.
Definition: tags_int.hpp:190
static std::ostream & printResolution(std::ostream &os, const Value &value, const ExifData *)
Print Pentax resolution.
Definition: pentaxmn_int.cpp:1026
Type definitions for Exiv2 and related functionality.
static std::ostream & printTemperature(std::ostream &os, const Value &value, const ExifData *)
Print Pentax temperature.
Definition: pentaxmn_int.cpp:1095
const T * find(T(&src)[N], const K &key)
Find an element that matches key in the array src.
Definition: types.hpp:508
static std::ostream & printFValue(std::ostream &os, const Value &value, const ExifData *)
Print Pentax F value.
Definition: pentaxmn_int.cpp:1066
Exif tag and type information.
EXIV2API const char * exvGettext(const char *str)
Translate a string using the gettext framework. This wrapper hides all the implementation details fro...
Definition: types.cpp:576
MakerNote for Pentaxfilm cameras.
Definition: pentaxmn_int.hpp:49
static std::ostream & printFlashCompensation(std::ostream &os, const Value &value, const ExifData *)
Print Pentax flash compensation.
Definition: pentaxmn_int.cpp:1101
static std::ostream & printTime(std::ostream &os, const Value &value, const ExifData *)
Print Pentax time.
Definition: pentaxmn_int.cpp:1048
static std::ostream & printDate(std::ostream &os, const Value &value, const ExifData *)
Print Pentax date.
Definition: pentaxmn_int.cpp:1037
Common interface for all types of values used with metadata.
Definition: value.hpp:60
Internal Exif tag and type information.
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
static std::ostream & printExposure(std::ostream &os, const Value &value, const ExifData *)
Print Pentax exposure.
Definition: pentaxmn_int.cpp:1060
static std::ostream & printCompensation(std::ostream &os, const Value &value, const ExifData *)
Print Pentax compensation.
Definition: pentaxmn_int.cpp:1085
std::ostream & printCombiTag(std::ostream &os, const Value &value, const ExifData *metadata)
Print function to translate Pentax "combi-values" to a description by looking up a reference table...
Definition: pentaxmn_int.hpp:89
static std::ostream & printBracketing(std::ostream &os, const Value &value, const ExifData *)
Print Pentax bracketing.
Definition: pentaxmn_int.cpp:1111
Tag information.
Definition: tags.hpp:82
virtual long count() const =0
Return the number of components of the value.
static std::ostream & printFocalLength(std::ostream &os, const Value &value, const ExifData *)
Print Pentax focal length.
Definition: pentaxmn_int.cpp:1075
static std::ostream & printVersion(std::ostream &os, const Value &value, const ExifData *)
Print Pentax version.
Definition: pentaxmn_int.cpp:1015
static const TagInfo * tagList()
Return read-only list of built-in Pentaxfilm tags.
Definition: pentaxmn_int.cpp:1695
virtual long toLong(long n=0) const =0
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...