Exiv2
tags.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  */
28 #ifndef TAGS_HPP_
29 #define TAGS_HPP_
30 
31 // *****************************************************************************
32 #include "exiv2lib_export.h"
33 
34 // included header files
35 #include "metadatum.hpp"
36 
37 // + standard includes
38 #include <string>
39 #include <iosfwd>
40 #include <memory>
41 
42 // *****************************************************************************
43 // namespace extensions
44 namespace Exiv2 {
45 
46 // *****************************************************************************
47 // class declarations
48  class ExifData;
49  class ExifKey;
50  class Value;
51  struct TagInfo;
52 
53 // *****************************************************************************
54 // type definitions
55 
57  typedef std::ostream& (*PrintFct)(std::ostream&, const Value&, const ExifData* pExifData);
59  typedef const TagInfo* (*TagListFct)();
60 
61 // *****************************************************************************
62 // class definitions
63 
65  struct EXIV2API GroupInfo {
66  struct GroupName;
67  bool operator==(int ifdId) const;
68  bool operator==(const GroupName& groupName) const;
69  int ifdId_;
70  const char* ifdName_;
71  const char* groupName_;
73  };
74 
76  struct EXIV2API GroupInfo::GroupName {
77  explicit GroupName(const std::string& groupName);
79  };
80 
82  struct EXIV2API TagInfo {
84  TagInfo(
85  uint16_t tag,
86  const char* name,
87  const char* title,
88  const char* desc,
89  int ifdId,
90  int sectionId,
91  TypeId typeId,
92  int16_t count,
93  PrintFct printFct
94  );
95  uint16_t tag_;
96  const char* name_;
97  const char* title_;
98  const char* desc_;
99  int ifdId_;
102  int16_t count_;
104  }; // struct TagInfo
105 
107  class EXIV2API ExifTags {
109  ExifTags();
111  ExifTags(const ExifTags& rhs);
113  ExifTags& operator=(const ExifTags& rhs);
114 
115  public:
117  static const GroupInfo* groupList();
119  static const TagInfo* tagList(const std::string& groupName);
121  static void taglist(std::ostream& os);
123  static void taglist(std::ostream& os, const std::string& groupName);
124 
126  static const char* sectionName(const ExifKey& key);
128  static uint16_t defaultCount(const ExifKey& key);
130  static const char* ifdName(const std::string& groupName);
131 
135  static bool isMakerGroup(const std::string& groupName);
141  static bool isExifGroup(const std::string& groupName);
142 
143  }; // class ExifTags
144 
148  class EXIV2API ExifKey : public Key {
149  public:
151  typedef std::auto_ptr<ExifKey> AutoPtr;
152 
154 
155 
163  explicit ExifKey(const std::string& key);
173  ExifKey(uint16_t tag, const std::string& groupName);
180  explicit ExifKey(const TagInfo& ti);
181 
183  ExifKey(const ExifKey& rhs);
185  virtual ~ExifKey();
187 
189 
190 
193  ExifKey& operator=(const ExifKey& rhs);
195  void setIdx(int idx);
197 
199 
200  virtual std::string key() const;
201  virtual const char* familyName() const;
202  virtual std::string groupName() const;
204  int ifdId() const;
205  virtual std::string tagName() const;
206  virtual uint16_t tag() const;
207  virtual std::string tagLabel() const;
209  std::string tagDesc() const; // Todo: should be in the base class
211  TypeId defaultTypeId() const; // Todo: should be in the base class
212 
213  AutoPtr clone() const;
215  int idx() const;
217 
218  private:
220  virtual ExifKey* clone_() const;
221 
222  private:
223  // Pimpl idiom
224  struct Impl;
225  std::auto_ptr<Impl> p_;
226 
227  }; // class ExifKey
228 
229 // *****************************************************************************
230 // free functions
231 
233  EXIV2API std::ostream& operator<<(std::ostream& os, const TagInfo& ti);
234 
235 } // namespace Exiv2
236 
237 #endif // #ifndef TAGS_HPP_
Exiv2::ExifTags::defaultCount
static uint16_t defaultCount(const ExifKey &key)
Return the default number of components (not bytes!) key has. (0=any, -1=count not known)
Definition: tags.cpp:154
pentaxmn_int.hpp
Pentax MakerNote implemented according to the specification http://www.gvsoft.homedns....
Exiv2::Internal::SectionInfo::name_
const char * name_
Section name (one word)
Definition: tags_int.hpp:181
Exiv2::ExifKey::Impl::tagInfo_
const TagInfo * tagInfo_
Tag info.
Definition: tags.cpp:249
Exiv2::Key::operator=
Key & operator=(const Key &rhs)
Assignment operator. Protected so that it can only be used by subclasses but not directly.
Definition: metadatum.cpp:49
olympusmn_int.hpp
Olympus makernote tags. References: [1] Exif file format, Appendix 1: MakerNote of Olympus Digicams ...
nikonmn_int.hpp
Nikon makernote tags. References: [1] MakerNote EXIF Tag of the Nikon 990 by Max Lyons [2] Exif fil...
Exiv2::ExifKey::ExifKey
ExifKey(const std::string &key)
Constructor to create an Exif key from a key string.
Definition: tags.cpp:348
Exiv2::Internal::taglist
void taglist(std::ostream &os, IfdId ifdId)
Print the list of tags for ifdId to the output stream os.
Definition: tags_int.cpp:2101
Exiv2::GroupInfo::tagList_
TagListFct tagList_
Tag list.
Definition: tags.hpp:72
Exiv2::ExifKey::Impl::Impl
Impl()
Default constructor.
Definition: tags.cpp:259
Exiv2::ExifKey::tagLabel
virtual std::string tagLabel() const
Return a label for the tag.
Definition: tags.cpp:394
Exiv2::Value
Common interface for all types of values used with metadata.
Definition: value.hpp:60
metadatum.hpp
Provides abstract base classes Metadatum and Key.
Exiv2::GroupInfo::ifdId_
int ifdId_
IFD id.
Definition: tags.hpp:69
Exiv2::TagListFct
const typedef TagInfo *(* TagListFct)()
A function returning a tag list.
Definition: tags.hpp:59
Exiv2::ExifKey::Impl::decomposeKey
void decomposeKey(const std::string &key)
Parse and convert the key string into tag and IFD Id. Updates data members if the string can be decom...
Definition: tags.cpp:275
Exiv2::GroupInfo::ifdName_
const char * ifdName_
IFD name.
Definition: tags.hpp:70
Exiv2::Key::AutoPtr
std::auto_ptr< Key > AutoPtr
Shortcut for a Key auto pointer.
Definition: metadatum.hpp:58
Exiv2::Internal::IfdId
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags_int.hpp:54
types.hpp
Type definitions for Exiv2 and related functionality.
sigmamn_int.hpp
Sigma and Foveon MakerNote implemented according to the specification SIGMA and FOVEON EXIF MakerNote...
Exiv2::GroupInfo
The details of an Exif group. Groups include IFDs and binary arrays.
Definition: tags.hpp:65
minoltamn_int.hpp
Minolta MakerNote implemented using the following references: Minolta Makernote Format Specification...
Exiv2::ExifKey::tagName
virtual std::string tagName() const
Return the name of the tag (which is also the third part of the key)
Definition: tags.cpp:389
Exiv2::TagInfo::name_
const char * name_
One word tag label.
Definition: tags.hpp:96
Exiv2::Internal::tagList
const TagInfo * tagList(IfdId ifdId)
Return the tag list for ifdId.
Definition: tags_int.cpp:2111
Exiv2::ExifKey::Impl::tag_
uint16_t tag_
Tag value.
Definition: tags.cpp:250
Exiv2::asciiString
@ asciiString
Exif ASCII type, 8-bit byte.
Definition: types.hpp:132
Exiv2::GroupInfo::groupName_
const char * groupName_
Group name, unique for each group.
Definition: tags.hpp:71
Exiv2::Internal::iopTagList
const TagInfo * iopTagList()
Return read-only list of built-in IOP tags.
Definition: tags_int.cpp:2037
Exiv2::ExifKey::Impl::groupName_
std::string groupName_
The group name.
Definition: tags.cpp:253
Exiv2::TagInfo::ifdId_
int ifdId_
Link to the (preferred) IFD.
Definition: tags.hpp:99
Exiv2::ExifKey::operator=
ExifKey & operator=(const ExifKey &rhs)
Assignment operator.
Definition: tags.cpp:361
Exiv2::ExifTags::groupList
static const GroupInfo * groupList()
Return read-only list of built-in groups.
Definition: tags.cpp:179
samsungmn_int.hpp
Samsung makernote tags. References: [1] ExifTool by Phil Harvey.
Exiv2::ExifKey::Impl::makeKey
void makeKey(uint16_t tag, IfdId ifdId, const TagInfo *tagInfo)
Set the key corresponding to the tag, ifdId and tagInfo. The key is of the form 'Exif....
Definition: tags.cpp:311
Exiv2::Internal::groupName
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition: tags_int.cpp:2158
canonmn_int.hpp
Canon makernote tags. References: [1] EXIF MakerNote of Canon by David Burren [2] Canon makernote t...
Exiv2::ExifKey::idx
int idx() const
Return the index (unique id of this key within the original Exif data, 0 if not set)
Definition: tags.cpp:432
Exiv2::PrintFct
std::ostream &(* PrintFct)(std::ostream &, const Value &, const ExifData *pExifData)
Type for a function pointer for functions interpreting the tag value.
Definition: tags.hpp:57
Exiv2::ExifKey::Impl::idx_
int idx_
Unique id of the Exif key in the image.
Definition: tags.cpp:252
Exiv2::Internal::TagVocabulary::operator==
bool operator==(const std::string &key) const
Comparison operator for use with the find template.
Definition: tags.cpp:97
Exiv2::Key
Abstract base class defining the Key of a metadatum. Keys are used to identify and group metadata.
Definition: metadatum.hpp:55
Exiv2::TagInfo::typeId_
TypeId typeId_
Type id.
Definition: tags.hpp:101
Exiv2::ExifTags::isMakerGroup
static bool isMakerGroup(const std::string &groupName)
Return true if groupName is a makernote group.
Definition: tags.cpp:167
Exiv2::ExifKey::tagDesc
std::string tagDesc() const
Return the tag description.
Definition: tags.cpp:400
Exiv2::ExifTags::isExifGroup
static bool isExifGroup(const std::string &groupName)
Return true if groupName is a TIFF or Exif IFD, else false. This is used to differentiate between sta...
Definition: tags.cpp:173
Exiv2::TagInfo::count_
int16_t count_
The number of values (not bytes!), 0=any, -1=count not known.
Definition: tags.hpp:102
Exiv2::ExifKey::groupName
virtual std::string groupName() const
Return the name of the group (the second part of the key)
Definition: tags.cpp:384
Exiv2::ExifKey::defaultTypeId
TypeId defaultTypeId() const
Return the default type id for this tag.
Definition: tags.cpp:406
Exiv2::Internal::printValue
std::ostream & printValue(std::ostream &os, const Value &value, const ExifData *)
Default print function, using the Value output operator.
Definition: tags_int.cpp:2165
Exiv2::GroupInfo::operator==
bool operator==(int ifdId) const
Comparison operator for IFD id.
Definition: tags.cpp:121
Exiv2::ExifKey
Concrete keys for Exif metadata and access to Exif tag reference data.
Definition: tags.hpp:148
Exiv2::Internal::ifdName
const char * ifdName(IfdId ifdId)
Return the name of the IFD.
Definition: tags_int.cpp:2151
Exiv2::ExifKey::AutoPtr
std::auto_ptr< ExifKey > AutoPtr
Shortcut for an ExifKey auto pointer.
Definition: tags.hpp:151
Exiv2::ExifTags::tagList
static const TagInfo * tagList(const std::string &groupName)
Return read-only list of built-in groupName tags.
Definition: tags.cpp:184
Exiv2::operator<<
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition: datasets.cpp:709
Exiv2::Internal::isMakerIfd
bool isMakerIfd(IfdId ifdId)
Return true if ifdId is a makernote IFD id. (Note: returns false for makerIfd)
Definition: tags_int.cpp:2063
Exiv2::Internal::tagNumber
uint16_t tagNumber(const std::string &tagName, IfdId ifdId)
Return the tag number for one combination of IFD id and tagName. If the tagName is not known,...
Definition: tags_int.cpp:2214
Exiv2::ExifKey::familyName
virtual const char * familyName() const
Return an identifier for the type of metadata (the first part of the key)
Definition: tags.cpp:379
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::ExifKey::key
virtual std::string key() const
Return the key of the metadatum as a string. The key is of the form 'familyName.groupName....
Definition: tags.cpp:374
Exiv2::Internal::TagVocabulary::voc_
const char * voc_
Vocabulary string.
Definition: tags_int.hpp:211
value.hpp
Value interface and concrete subclasses.
convert.hpp
Exif and IPTC conversions to and from XMP.
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:130
Exiv2::TypeInfo::typeName
static const char * typeName(TypeId typeId)
Return the name of the type, 0 if unknown.
Definition: types.cpp:107
Exiv2::ExifTags::ifdName
static const char * ifdName(const std::string &groupName)
Return the name of the IFD for the group.
Definition: tags.cpp:161
Exiv2::TagInfo
Tag information.
Definition: tags.hpp:82
Exiv2::Internal::exifTagList
const TagInfo * exifTagList()
Return read-only list of built-in Exif IFD tags.
Definition: tags_int.cpp:1761
Exiv2::ExifKey::Impl::key_
std::string key_
Key
Definition: tags.cpp:254
Exiv2::Internal::operator==
bool operator==(const TagDetails &td, const LensTypeAndFocalLengthAndMaxAperture &ltfl)
Compare tag details with a lens entry.
Definition: canonmn_int.cpp:1991
Exiv2::ExifKey::Impl::tagName
std::string tagName() const
Return the name of the tag.
Definition: tags.cpp:264
Exiv2::Internal::gpsTagList
const TagInfo * gpsTagList()
Return read-only list of built-in GPS tags.
Definition: tags_int.cpp:1934
Exiv2::ExifKey::Impl::ifdId_
IfdId ifdId_
The IFD associated with this tag.
Definition: tags.cpp:251
sonymn_int.hpp
Sony MakerNote implemented using the following references: Sony Makernote list by Phil Harvey Email...
Exiv2::Internal::ifdTagList
const TagInfo * ifdTagList()
Return read-only list of built-in IFD0/1 tags.
Definition: tags_int.cpp:1429
Exiv2::ExifKey::ifdId
int ifdId() const
Return the IFD id as an integer. (Do not use, this is meant for library internal use....
Definition: tags.cpp:427
Exiv2::ExifKey::~ExifKey
virtual ~ExifKey()
Destructor.
Definition: tags.cpp:359
Exiv2::TagInfo::TagInfo
TagInfo(uint16_t tag, const char *name, const char *title, const char *desc, int ifdId, int sectionId, TypeId typeId, int16_t count, PrintFct printFct)
Constructor.
Definition: tags.cpp:131
Exiv2::ExifTags::taglist
static void taglist(std::ostream &os)
Print a list of all standard Exif tags to output stream.
Definition: tags.cpp:189
Exiv2::TagInfo::printFct_
PrintFct printFct_
Pointer to tag print function.
Definition: tags.hpp:103
Exiv2::TagInfo::desc_
const char * desc_
Short tag description.
Definition: tags.hpp:98
Exiv2::ExifKey::setIdx
void setIdx(int idx)
Set the index.
Definition: tags.cpp:369
Exiv2::Internal::tagInfo
const TagInfo * tagInfo(uint16_t tag, IfdId ifdId)
Return the tag info for tag and ifdId.
Definition: tags_int.cpp:2118
tags_int.hpp
Internal Exif tag and type information.
Exiv2::ExifKey::tag
virtual uint16_t tag() const
Return the tag number.
Definition: tags.cpp:412
Exiv2::Error
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:323
Exiv2::sectionInfo
const SectionInfo sectionInfo[]
List of all defined Exif sections.
panasonicmn_int.hpp
Panasonic MakerNote implemented using the following references: Panasonic MakerNote Information by To...
tags.hpp
Exif tag and type information.
Exiv2::TagInfo::tag_
uint16_t tag_
Tag.
Definition: tags.hpp:95
Exiv2::string
@ string
IPTC string type.
Definition: types.hpp:147
Exiv2::ExifTags::sectionName
static const char * sectionName(const ExifKey &key)
Return the name of the section for an Exif key.
Definition: tags.cpp:147
Exiv2::TagInfo::sectionId_
int sectionId_
Section id.
Definition: tags.hpp:100
Exiv2::ExifKey::Impl
Internal Pimpl structure with private members and data of class ExifKey.
Definition: tags.cpp:217
Exiv2::GroupInfo::g_
std::string g_
Group name.
Definition: tags.hpp:78
casiomn_int.hpp
Casio MakerNote implemented using the following references: Casio MakerNote Information by GVsoft,...
Exiv2::TagInfo::title_
const char * title_
Tag title.
Definition: tags.hpp:97
fujimn_int.hpp
Fujifilm MakerNote implemented according to the specification in Appendix 4: Makernote of Fujifilm of...
Exiv2::ExifTags
Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
Definition: tags.hpp:107
Exiv2::Internal::groupId
IfdId groupId(const std::string &groupName)
Return the group id for a group name.
Definition: tags_int.cpp:2143
Exiv2::ExifKey::Impl::familyName_
static const char * familyName_
"Exif"
Definition: tags.cpp:247
futils.hpp
Basic file utility functions required by Exiv2.
Exiv2::Internal::isExifIfd
bool isExifIfd(IfdId ifdId)
Return true if ifdId is an Exif IFD id.
Definition: tags_int.cpp:2073
error.hpp
Error class for exceptions, log message class.
Exiv2::ExifData
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434