Loading...
Searching...
No Matches
iptc.hpp
Go to the documentation of this file.
// ***************************************************************** -*- 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 IPTC_HPP_
#define IPTC_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "metadatum.hpp"
#include "datasets.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class declarations
class ExifData;
// *****************************************************************************
// class definitions
class EXIV2API Iptcdatum : public Metadatum {
public:
explicit Iptcdatum(const IptcKey& key,
const Value* pValue =0);
Iptcdatum(const Iptcdatum& rhs);
virtual ~Iptcdatum();
Iptcdatum& operator=(const Iptcdatum& rhs);
Iptcdatum& operator=(const uint16_t& value);
Iptcdatum& operator=(const std::string& value);
Iptcdatum& operator=(const Value& value);
void setValue(const Value* pValue);
int setValue(const std::string& value);
long copy(byte* buf, ByteOrder byteOrder) const;
std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const;
std::string key() const;
std::string recordName() const;
uint16_t record() const;
const char* familyName() const;
std::string groupName() const;
std::string tagName() const;
std::string tagLabel() const;
uint16_t tag() const;
TypeId typeId() const;
const char* typeName() const;
long typeSize() const;
long count() const;
long size() const;
std::string toString() const;
std::string toString(long n) const;
long toLong(long n =0) const;
float toFloat(long n =0) const;
Rational toRational(long n =0) const;
Value::AutoPtr getValue() const;
const Value& value() const;
private:
// DATA
IptcKey::AutoPtr key_;
Value::AutoPtr value_;
}; // class Iptcdatum
typedef std::vector<Iptcdatum> IptcMetadata;
class EXIV2API IptcData {
public:
typedef IptcMetadata::iterator iterator;
typedef IptcMetadata::const_iterator const_iterator;
// Use the compiler generated constructors and assignment operator
Iptcdatum& operator[](const std::string& key);
int add(const IptcKey& key, Value* value);
int add(const Iptcdatum& iptcdatum);
iterator erase(iterator pos);
void clear() { iptcMetadata_.clear(); }
void sortByKey();
void sortByTag();
iterator begin() { return iptcMetadata_.begin(); }
iterator end() { return iptcMetadata_.end(); }
iterator findKey(const IptcKey& key);
iterator findId(uint16_t dataset,
uint16_t record = IptcDataSets::application2);
const_iterator begin() const { return iptcMetadata_.begin(); }
const_iterator end() const { return iptcMetadata_.end(); }
const_iterator findKey(const IptcKey& key) const;
const_iterator findId(uint16_t dataset,
uint16_t record = IptcDataSets::application2) const;
bool empty() const { return count() == 0; }
long count() const { return static_cast<long>(iptcMetadata_.size()); }
long size() const;
const char *detectCharset() const;
static void printStructure(std::ostream& out, const Slice<byte*>& bytes,uint32_t depth);
private:
// DATA
IptcMetadata iptcMetadata_;
}; // class IptcData
class EXIV2API IptcParser {
public:
static int decode(
IptcData& iptcData,
const byte* pData,
uint32_t size
);
static DataBuf encode(
const IptcData& iptcData
);
private:
// Constant data
static const byte marker_; // Dataset marker
}; // class IptcParser
} // namespace Exiv2
#endif // #ifndef IPTC_HPP_
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:193
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
Exiv2::IptcData
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:170
Exiv2::IptcData::begin
iterator begin()
Begin of the metadata.
Definition iptc.hpp:221
Exiv2::IptcData::iterator
IptcMetadata::iterator iterator
IptcMetadata iterator type.
Definition iptc.hpp:173
Exiv2::IptcData::begin
const_iterator begin() const
Begin of the metadata.
Definition iptc.hpp:240
Exiv2::IptcData::empty
bool empty() const
Return true if there is no IPTC metadata.
Definition iptc.hpp:255
Exiv2::IptcData::end
const_iterator end() const
End of the metadata.
Definition iptc.hpp:242
Exiv2::IptcData::end
iterator end()
End of the metadata.
Definition iptc.hpp:223
Exiv2::IptcData::const_iterator
IptcMetadata::const_iterator const_iterator
IptcMetadata const iterator type.
Definition iptc.hpp:175
Exiv2::IptcData::count
long count() const
Get the number of metadata entries.
Definition iptc.hpp:257
Exiv2::IptcData::clear
void clear()
Delete all Iptcdatum instances resulting in an empty container.
Definition iptc.hpp:215
Exiv2::IptcKey
Concrete keys for IPTC metadata.
Definition datasets.hpp:275
Exiv2::IptcKey::AutoPtr
std::auto_ptr< IptcKey > AutoPtr
Shortcut for an IptcKey auto pointer.
Definition datasets.hpp:278
Exiv2::IptcParser
Stateless parser class for IPTC data. Images use this class to decode and encode binary IPTC data.
Definition iptc.hpp:281
Exiv2::Iptcdatum
An IPTC metadatum ("dataset"), consisting of an IptcKey and a Value and methods to manipulate these.
Definition iptc.hpp:49
Exiv2::Metadatum
Abstract base class defining the interface to access information related to one metadata tag.
Definition metadatum.hpp:115
Exiv2::Value
Common interface for all types of values used with metadata.
Definition value.hpp:51
Exiv2::Value::AutoPtr
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition value.hpp:54
datasets.hpp
IPTC dataset and type information.
Exiv2::Internal::groupName
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition tags_int.cpp:2569
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition asfvideo.hpp:36
Exiv2::getValue
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition types.hpp:119
Exiv2::IptcMetadata
std::vector< Iptcdatum > IptcMetadata
Container type to hold all metadata.
Definition iptc.hpp:157
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian)
Definition types.hpp:102
Exiv2::Rational
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition types.hpp:99
Exiv2::setValue
Exiv2::Exifdatum & setValue(Exiv2::Exifdatum &exifDatum, const T &value)
Set the value of exifDatum to value. If the object already has a value, it is replaced....
Definition exif.cpp:194
Exiv2::toString
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition types.hpp:510
Exiv2::Slice
Slice (= view) for STL containers.
Definition slice.hpp:522