|
Packit |
01d647 |
// ***************************************************************** -*- C++ -*-
|
|
Packit |
01d647 |
/*
|
|
Packit |
01d647 |
* Copyright (C) 2004-2018 Exiv2 authors
|
|
Packit |
01d647 |
* This program is part of the Exiv2 distribution.
|
|
Packit |
01d647 |
*
|
|
Packit |
01d647 |
* This program is free software; you can redistribute it and/or
|
|
Packit |
01d647 |
* modify it under the terms of the GNU General Public License
|
|
Packit |
01d647 |
* as published by the Free Software Foundation; either version 2
|
|
Packit |
01d647 |
* of the License, or (at your option) any later version.
|
|
Packit |
01d647 |
*
|
|
Packit |
01d647 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
01d647 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
01d647 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
01d647 |
* GNU General Public License for more details.
|
|
Packit |
01d647 |
*
|
|
Packit |
01d647 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
01d647 |
* along with this program; if not, write to the Free Software
|
|
Packit |
01d647 |
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
01d647 |
*/
|
|
Packit |
01d647 |
/*
|
|
Packit |
01d647 |
File: datasets.cpp
|
|
Packit |
01d647 |
Author(s): Brad Schick (brad) <brad@robotbattle.com>
|
|
Packit |
01d647 |
Gilles Caulier (gc) <caulier dot gilles at gmail dot com>
|
|
Packit |
01d647 |
History: 24-Jul-04, brad: created
|
|
Packit |
01d647 |
*/
|
|
Packit |
01d647 |
// *****************************************************************************
|
|
Packit |
01d647 |
// included header files
|
|
Packit |
01d647 |
#include "datasets.hpp"
|
|
Packit |
01d647 |
#include "error.hpp"
|
|
Packit |
01d647 |
#include "types.hpp"
|
|
Packit |
01d647 |
#include "value.hpp"
|
|
Packit |
01d647 |
#include "metadatum.hpp"
|
|
Packit |
01d647 |
#include "i18n.h" // NLS support.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
#include <iostream>
|
|
Packit |
01d647 |
#include <iomanip>
|
|
Packit |
01d647 |
#include <sstream>
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
// *****************************************************************************
|
|
Packit |
01d647 |
// class member definitions
|
|
Packit |
01d647 |
namespace Exiv2 {
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
DataSet::DataSet(
|
|
Packit |
01d647 |
uint16_t number,
|
|
Packit |
01d647 |
const char* name,
|
|
Packit |
01d647 |
const char* title,
|
|
Packit |
01d647 |
const char* desc,
|
|
Packit |
01d647 |
bool mandatory,
|
|
Packit |
01d647 |
bool repeatable,
|
|
Packit |
01d647 |
uint32_t minbytes,
|
|
Packit |
01d647 |
uint32_t maxbytes,
|
|
Packit |
01d647 |
TypeId type,
|
|
Packit |
01d647 |
uint16_t recordId,
|
|
Packit |
01d647 |
const char* photoshop
|
|
Packit |
01d647 |
)
|
|
Packit |
01d647 |
: number_(number), name_(name), title_(title), desc_(desc),
|
|
Packit |
01d647 |
mandatory_(mandatory), repeatable_(repeatable), minbytes_(minbytes),
|
|
Packit |
01d647 |
maxbytes_(maxbytes), type_(type), recordId_(recordId),
|
|
Packit |
01d647 |
photoshop_(photoshop)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
RecordInfo::RecordInfo(
|
|
Packit |
01d647 |
uint16_t recordId,
|
|
Packit |
01d647 |
const char* name,
|
|
Packit |
01d647 |
const char* desc
|
|
Packit |
01d647 |
)
|
|
Packit |
01d647 |
: recordId_(recordId), name_(name), desc_(desc)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const RecordInfo IptcDataSets::recordInfo_[] = {
|
|
Packit |
01d647 |
RecordInfo(IptcDataSets::invalidRecord, "(invalid)", N_("(invalid)")),
|
|
Packit |
01d647 |
RecordInfo(IptcDataSets::envelope, "Envelope", N_("IIM envelope record")),
|
|
Packit |
01d647 |
RecordInfo(IptcDataSets::application2, "Application2", N_("IIM application record 2")),
|
|
Packit |
01d647 |
};
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
static const DataSet envelopeRecord[] = {
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ModelVersion, "ModelVersion", N_("Model Version"),
|
|
Packit |
01d647 |
N_("A binary number identifying the version of the Information "
|
|
Packit |
01d647 |
"Interchange Model, Part I, utilised by the provider. Version "
|
|
Packit |
01d647 |
"numbers are assigned by IPTC and NAA organizations."),
|
|
Packit |
01d647 |
true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Destination, "Destination", N_("Destination"),
|
|
Packit |
01d647 |
N_("This DataSet is to accommodate some providers who require "
|
|
Packit |
01d647 |
"routing information above the appropriate OSI layers."),
|
|
Packit |
01d647 |
false, true, 0, 1024, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::FileFormat, "FileFormat", N_("File Format"),
|
|
Packit |
01d647 |
N_("A binary number representing the file format. The file format "
|
|
Packit |
01d647 |
"must be registered with IPTC or NAA with a unique number "
|
|
Packit |
01d647 |
"assigned to it. The information is used to route "
|
|
Packit |
01d647 |
"the data to the appropriate system and to allow the receiving "
|
|
Packit |
01d647 |
"system to perform the appropriate actions there to."),
|
|
Packit |
01d647 |
true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::FileVersion, "FileVersion", N_("File Version"),
|
|
Packit |
01d647 |
N_("A binary number representing the particular version of the File "
|
|
Packit |
01d647 |
"Format specified by <FileFormat> tag."),
|
|
Packit |
01d647 |
true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ServiceId, "ServiceId", N_("Service Id"),
|
|
Packit |
01d647 |
N_("Identifies the provider and product"),
|
|
Packit |
01d647 |
true, false, 0, 10, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::EnvelopeNumber, "EnvelopeNumber", N_("Envelope Number"),
|
|
Packit |
01d647 |
N_("The characters form a number that will be unique for the date "
|
|
Packit |
01d647 |
"specified in <DateSent> tag and for the Service Identifier "
|
|
Packit |
01d647 |
"specified by <ServiceIdentifier> tag. "
|
|
Packit |
01d647 |
"If identical envelope numbers appear with the same date and "
|
|
Packit |
01d647 |
"with the same Service Identifier, records 2-9 must be unchanged "
|
|
Packit |
01d647 |
"from the original. This is not intended to be a sequential serial "
|
|
Packit |
01d647 |
"number reception check."),
|
|
Packit |
01d647 |
true, false, 8, 8, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ProductId, "ProductId", N_("Product Id"),
|
|
Packit |
01d647 |
N_("Allows a provider to identify subsets of its overall service. Used "
|
|
Packit |
01d647 |
"to provide receiving organisation data on which to select, route, "
|
|
Packit |
01d647 |
"or otherwise handle data."),
|
|
Packit |
01d647 |
false, true, 0, 32, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::EnvelopePriority, "EnvelopePriority", N_("Envelope Priority"),
|
|
Packit |
01d647 |
N_("Specifies the envelope handling priority and not the editorial "
|
|
Packit |
01d647 |
"urgency (see <Urgency> tag). \"1\" indicates the most urgent, \"5\" "
|
|
Packit |
01d647 |
"the normal urgency, and \"8\" the least urgent copy. The numeral "
|
|
Packit |
01d647 |
"\"9\" indicates a User Defined Priority. The numeral \"0\" is reserved "
|
|
Packit |
01d647 |
"for future use."),
|
|
Packit |
01d647 |
false, false, 1, 1, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::DateSent, "DateSent", N_("Date Sent"),
|
|
Packit |
01d647 |
N_("Uses the format CCYYMMDD (century, year, month, day) as de-fined "
|
|
Packit |
01d647 |
"in ISO 8601 to indicate year, month and day the service sent the material."),
|
|
Packit |
01d647 |
true, false, 8, 8, Exiv2::date, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::TimeSent, "TimeSent", N_("Time Sent"),
|
|
Packit |
01d647 |
N_("Uses the format HHMMSS:HHMM where HHMMSS refers to "
|
|
Packit |
01d647 |
"local hour, minute and seconds and HHMM refers to hours and "
|
|
Packit |
01d647 |
"minutes ahead (+) or behind (-) Universal Coordinated Time as "
|
|
Packit |
01d647 |
"described in ISO 8601. This is the time the service sent the material."),
|
|
Packit |
01d647 |
false, false, 11, 11, Exiv2::time, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::CharacterSet, "CharacterSet", N_("Character Set"),
|
|
Packit |
01d647 |
N_("This tag consisting of one or more control functions used for the announcement, "
|
|
Packit |
01d647 |
"invocation or designation of coded character sets. The control functions follow "
|
|
Packit |
01d647 |
"the ISO 2022 standard and may consist of the escape control "
|
|
Packit |
01d647 |
"character and one or more graphic characters."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::UNO, "UNO", N_("Unique Name Object"),
|
|
Packit |
01d647 |
N_("This tag provide a globally unique "
|
|
Packit |
01d647 |
"identification for objects as specified in the IIM, independent of "
|
|
Packit |
01d647 |
"provider and for any media form. The provider must ensure the "
|
|
Packit |
01d647 |
"UNO is unique. Objects with the same UNO are identical."),
|
|
Packit |
01d647 |
false, false, 14, 80, Exiv2::string, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ARMId, "ARMId", N_("ARM Identifier"),
|
|
Packit |
01d647 |
N_("The DataSet identifies the Abstract Relationship Method identifier (ARM) "
|
|
Packit |
01d647 |
"which is described in a document registered by the originator of "
|
|
Packit |
01d647 |
"the ARM with the IPTC and NAA organizations."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ARMVersion, "ARMVersion", N_("ARM Version"),
|
|
Packit |
01d647 |
N_("This tag consisting of a binary number representing the particular "
|
|
Packit |
01d647 |
"version of the ARM specified by tag <ARMId>."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
|
|
Packit |
01d647 |
DataSet(0xffff, "(Invalid)", "(Invalid)",
|
|
Packit |
01d647 |
"(Invalid)", false, false, 0, 0, Exiv2::unsignedShort, IptcDataSets::envelope, "")
|
|
Packit |
01d647 |
};
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const DataSet* IptcDataSets::envelopeRecordList()
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return envelopeRecord;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
static const DataSet application2Record[] = {
|
|
Packit |
01d647 |
DataSet(IptcDataSets::RecordVersion, "RecordVersion", N_("Record Version"),
|
|
Packit |
01d647 |
N_("A binary number identifying the version of the Information "
|
|
Packit |
01d647 |
"Interchange Model, Part II, utilised by the provider. "
|
|
Packit |
01d647 |
"Version numbers are assigned by IPTC and NAA organizations."),
|
|
Packit |
01d647 |
true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ObjectType, "ObjectType", N_("Object Type"),
|
|
Packit |
01d647 |
N_("The Object Type is used to distinguish between different types "
|
|
Packit |
01d647 |
"of objects within the IIM. The first part is a number representing "
|
|
Packit |
01d647 |
"a language independent international reference to an Object Type "
|
|
Packit |
01d647 |
"followed by a colon separator. The second part, if used, is a text "
|
|
Packit |
01d647 |
"representation of the Object Type Number consisting of graphic "
|
|
Packit |
01d647 |
"characters plus spaces either in English or in the language of the "
|
|
Packit |
01d647 |
"service as indicated in tag <LanguageIdentifier>"),
|
|
Packit |
01d647 |
false, false, 3, 67, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ObjectAttribute, "ObjectAttribute", N_("Object Attribute"),
|
|
Packit |
01d647 |
N_("The Object Attribute defines the nature of the object "
|
|
Packit |
01d647 |
"independent of the Subject. The first part is a number representing "
|
|
Packit |
01d647 |
"a language independent international reference to an Object Attribute "
|
|
Packit |
01d647 |
"followed by a colon separator. The second part, if used, is a text "
|
|
Packit |
01d647 |
"representation of the Object Attribute Number consisting of graphic "
|
|
Packit |
01d647 |
"characters plus spaces either in English, or in the language of the "
|
|
Packit |
01d647 |
"service as indicated in tag <LanguageIdentifier>"),
|
|
Packit |
01d647 |
false, true, 4, 68, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ObjectName, "ObjectName", N_("Object Name"),
|
|
Packit |
01d647 |
N_("Used as a shorthand reference for the object. Changes to exist-ing "
|
|
Packit |
01d647 |
"data, such as updated stories or new crops on photos, should be "
|
|
Packit |
01d647 |
"identified in tag <EditStatus>."),
|
|
Packit |
01d647 |
false, false, 0, 64, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Document Title")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::EditStatus, "EditStatus", N_("Edit Status"),
|
|
Packit |
01d647 |
N_("Status of the object data, according to the practice of the provider."),
|
|
Packit |
01d647 |
false, false, 0, 64, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::EditorialUpdate, "EditorialUpdate", N_("Editorial Update"),
|
|
Packit |
01d647 |
N_("Indicates the type of update that this object provides to a "
|
|
Packit |
01d647 |
"previous object. The link to the previous object is made using "
|
|
Packit |
01d647 |
"the tags <ARMIdentifier> and <ARMVersion>, according to the practices of the provider."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Urgency, "Urgency", N_("Urgency"),
|
|
Packit |
01d647 |
N_("Specifies the editorial urgency of content and not necessarily the "
|
|
Packit |
01d647 |
"envelope handling priority (see tag <EnvelopePriority>). The \"1\" "
|
|
Packit |
01d647 |
"is most urgent, \"5\" normal and \"8\" denotes the least-urgent copy."),
|
|
Packit |
01d647 |
false, false, 1, 1, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Urgency")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Subject, "Subject", N_("Subject"),
|
|
Packit |
01d647 |
N_("The Subject Reference is a structured definition of the subject matter."),
|
|
Packit |
01d647 |
false, true, 13, 236, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Category, "Category", N_("Category"),
|
|
Packit |
01d647 |
N_("Identifies the subject of the object data in the opinion of the provider. "
|
|
Packit |
01d647 |
"A list of categories will be maintained by a regional registry, "
|
|
Packit |
01d647 |
"where available, otherwise by the provider."),
|
|
Packit |
01d647 |
false, false, 0, 3, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Category")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::SuppCategory, "SuppCategory", N_("Supplemental Category"),
|
|
Packit |
01d647 |
N_("Supplemental categories further refine the subject of an "
|
|
Packit |
01d647 |
"object data. A supplemental category may include "
|
|
Packit |
01d647 |
"any of the recognised categories as used in tag <Category>. Otherwise, "
|
|
Packit |
01d647 |
"selection of supplemental categories are left to the provider."),
|
|
Packit |
01d647 |
false, true, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Supplemental Categories")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::FixtureId, "FixtureId", N_("Fixture Id"),
|
|
Packit |
01d647 |
N_("Identifies object data that recurs often and predictably. Enables "
|
|
Packit |
01d647 |
"users to immediately find or recall such an object."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Keywords, "Keywords", N_("Keywords"),
|
|
Packit |
01d647 |
N_("Used to indicate specific information retrieval words. "
|
|
Packit |
01d647 |
"It is expected that a provider of various types of data that are related "
|
|
Packit |
01d647 |
"in subject matter uses the same keyword, enabling the receiving system "
|
|
Packit |
01d647 |
"or subsystems to search across all types of data for related material."),
|
|
Packit |
01d647 |
false, true, 0, 64, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Keywords")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::LocationCode, "LocationCode", N_("Location Code"),
|
|
Packit |
01d647 |
N_("Indicates the code of a country/geographical location referenced "
|
|
Packit |
01d647 |
"by the content of the object. Where ISO has established an appropriate "
|
|
Packit |
01d647 |
"country code under ISO 3166, that code will be used. When ISO 3166 does not "
|
|
Packit |
01d647 |
"adequately provide for identification of a location or a country, "
|
|
Packit |
01d647 |
"e.g. ships at sea, space, IPTC will assign an appropriate three-character "
|
|
Packit |
01d647 |
"code under the provisions of ISO 3166 to avoid conflicts."),
|
|
Packit |
01d647 |
false, true, 3, 3, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::LocationName, "LocationName", N_("Location Name"),
|
|
Packit |
01d647 |
N_("Provides a full, publishable name of a country/geographical "
|
|
Packit |
01d647 |
"location referenced by the content of the object, according to "
|
|
Packit |
01d647 |
"guidelines of the provider."),
|
|
Packit |
01d647 |
false, true, 0, 64, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ReleaseDate, "ReleaseDate", N_("Release Date"),
|
|
Packit |
01d647 |
N_("Designates in the form CCYYMMDD the earliest date the "
|
|
Packit |
01d647 |
"provider intends the object to be used. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 8, 8, Exiv2::date, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ReleaseTime, "ReleaseTime", N_("Release Time"),
|
|
Packit |
01d647 |
N_("Designates in the form HHMMSS:HHMM the earliest time the "
|
|
Packit |
01d647 |
"provider intends the object to be used. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 11, 11, Exiv2::time, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ExpirationDate, "ExpirationDate", N_("Expiration Date"),
|
|
Packit |
01d647 |
N_("Designates in the form CCYYMMDD the latest date the provider "
|
|
Packit |
01d647 |
"or owner intends the object data to be used. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 8, 8, Exiv2::date, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ExpirationTime, "ExpirationTime", N_("ExpirationTime"),
|
|
Packit |
01d647 |
N_("Designates in the form HHMMSS:HHMM the latest time the "
|
|
Packit |
01d647 |
"provider or owner intends the object data to be used. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 11, 11, Exiv2::time, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::SpecialInstructions, "SpecialInstructions", N_("Special Instructions"),
|
|
Packit |
01d647 |
N_("Other editorial instructions concerning the use of the object data, "
|
|
Packit |
01d647 |
"such as embargoes and warnings."),
|
|
Packit |
01d647 |
false, false, 0, 256, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Instructions")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ActionAdvised, "ActionAdvised", N_("Action Advised"),
|
|
Packit |
01d647 |
N_("Indicates the type of action that this object provides to a "
|
|
Packit |
01d647 |
"previous object. The link to the previous object is made using "
|
|
Packit |
01d647 |
"tags <ARMIdentifier> and <ARMVersion>, according to the practices of the provider."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ReferenceService, "ReferenceService", N_("Reference Service"),
|
|
Packit |
01d647 |
N_("Identifies the Service Identifier of a prior envelope to which the "
|
|
Packit |
01d647 |
"current object refers."),
|
|
Packit |
01d647 |
false, true, 0, 10, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ReferenceDate, "ReferenceDate", N_("Reference Date"),
|
|
Packit |
01d647 |
N_("Identifies the date of a prior envelope to which the current object refers."),
|
|
Packit |
01d647 |
false, true, 8, 8, Exiv2::date, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ReferenceNumber, "ReferenceNumber", N_("Reference Number"),
|
|
Packit |
01d647 |
N_("Identifies the Envelope Number of a prior envelope to which the current object refers."),
|
|
Packit |
01d647 |
false, true, 8, 8, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::DateCreated, "DateCreated", N_("Date Created"),
|
|
Packit |
01d647 |
N_("Represented in the form CCYYMMDD to designate the date the "
|
|
Packit |
01d647 |
"intellectual content of the object data was created rather than the "
|
|
Packit |
01d647 |
"date of the creation of the physical representation. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 8, 8, Exiv2::date, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Date Created")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::TimeCreated, "TimeCreated", N_("Time Created"),
|
|
Packit |
01d647 |
N_("Represented in the form HHMMSS:HHMM to designate the "
|
|
Packit |
01d647 |
"time the intellectual content of the object data current source "
|
|
Packit |
01d647 |
"material was created rather than the creation of the physical "
|
|
Packit |
01d647 |
"representation. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 11, 11, Exiv2::time, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::DigitizationDate, "DigitizationDate", N_("Digitization Date"),
|
|
Packit |
01d647 |
N_("Represented in the form CCYYMMDD to designate the date the "
|
|
Packit |
01d647 |
"digital representation of the object data was created. Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 8, 8, Exiv2::date, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::DigitizationTime, "DigitizationTime", N_("Digitization Time"),
|
|
Packit |
01d647 |
N_("Represented in the form HHMMSS:HHMM to designate the "
|
|
Packit |
01d647 |
"time the digital representation of the object data was created. "
|
|
Packit |
01d647 |
"Follows ISO 8601 standard."),
|
|
Packit |
01d647 |
false, false, 11, 11, Exiv2::time, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Program, "Program", N_("Program"),
|
|
Packit |
01d647 |
N_("Identifies the type of program used to originate the object data."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ProgramVersion, "ProgramVersion", N_("Program Version"),
|
|
Packit |
01d647 |
N_("Used to identify the version of the program mentioned in tag <Program>."),
|
|
Packit |
01d647 |
false, false, 0, 10, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ObjectCycle, "ObjectCycle", N_("Object Cycle"),
|
|
Packit |
01d647 |
N_("Used to identify the editorial cycle of object data."),
|
|
Packit |
01d647 |
false, false, 1, 1, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Byline, "Byline", N_("By-line"),
|
|
Packit |
01d647 |
N_("Contains name of the creator of the object data, e.g. writer, photographer "
|
|
Packit |
01d647 |
"or graphic artist."),
|
|
Packit |
01d647 |
false, true, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Author")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::BylineTitle, "BylineTitle", N_("By-line Title"),
|
|
Packit |
01d647 |
N_("A by-line title is the title of the creator or creators of an "
|
|
Packit |
01d647 |
"object data. Where used, a by-line title should follow the by-line it modifies."),
|
|
Packit |
01d647 |
false, true, 0, 32, Exiv2::string, IptcDataSets::application2, "Authors Position"),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::City, "City", N_("City"),
|
|
Packit |
01d647 |
N_("Identifies city of object data origin according to guidelines established "
|
|
Packit |
01d647 |
"by the provider."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("City")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::SubLocation, "SubLocation", N_("Sub Location"),
|
|
Packit |
01d647 |
N_("Identifies the location within a city from which the object data "
|
|
Packit |
01d647 |
"originates, according to guidelines established by the provider."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ProvinceState, "ProvinceState", N_("Province State"),
|
|
Packit |
01d647 |
N_("Identifies Province/State of origin according to guidelines "
|
|
Packit |
01d647 |
"established by the provider."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("State/Province")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::CountryCode, "CountryCode", N_("Country Code"),
|
|
Packit |
01d647 |
N_("Indicates the code of the country/primary location where the "
|
|
Packit |
01d647 |
"intellectual property of the object data was created, e.g. a photo "
|
|
Packit |
01d647 |
"was taken, an event occurred. Where ISO has established an appropriate "
|
|
Packit |
01d647 |
"country code under ISO 3166, that code will be used. When ISO 3166 does not "
|
|
Packit |
01d647 |
"adequately provide for identification of a location or a new "
|
|
Packit |
01d647 |
"country, e.g. ships at sea, space, IPTC will assign an "
|
|
Packit |
01d647 |
"appropriate three-character code under the provisions of "
|
|
Packit |
01d647 |
"ISO 3166 to avoid conflicts."),
|
|
Packit |
01d647 |
false, false, 3, 3, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::CountryName, "CountryName", N_("Country Name"),
|
|
Packit |
01d647 |
N_("Provides full, publishable, name of the country/primary location "
|
|
Packit |
01d647 |
"where the intellectual property of the object data was created, "
|
|
Packit |
01d647 |
"according to guidelines of the provider."),
|
|
Packit |
01d647 |
false, false, 0, 64, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Country")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::TransmissionReference, "TransmissionReference", N_("Transmission Reference"),
|
|
Packit |
01d647 |
N_("A code representing the location of original transmission according "
|
|
Packit |
01d647 |
"to practices of the provider."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Transmission Reference")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Headline, "Headline", N_("Headline"),
|
|
Packit |
01d647 |
N_("A publishable entry providing a synopsis of the contents of the object data."),
|
|
Packit |
01d647 |
false, false, 0, 256, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Headline")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Credit, "Credit", N_("Credit"),
|
|
Packit |
01d647 |
N_("Identifies the provider of the object data, not necessarily the owner/creator."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Credit")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Source, "Source", N_("Source"),
|
|
Packit |
01d647 |
N_("Identifies the original owner of the intellectual content of the "
|
|
Packit |
01d647 |
"object data. This could be an agency, a member of an agency or an individual."),
|
|
Packit |
01d647 |
false, false, 0, 32, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Source")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Copyright, "Copyright", N_("Copyright"),
|
|
Packit |
01d647 |
N_("Contains any necessary copyright notice."),
|
|
Packit |
01d647 |
false, false, 0, 128, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Copyright Notice")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Contact, "Contact", N_("Contact"),
|
|
Packit |
01d647 |
N_("Identifies the person or organisation which can provide further "
|
|
Packit |
01d647 |
"background information on the object data."),
|
|
Packit |
01d647 |
false, true, 0, 128, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Caption, "Caption", N_("Caption"),
|
|
Packit |
01d647 |
N_("A textual description of the object data."),
|
|
Packit |
01d647 |
false, false, 0, 2000, Exiv2::string, IptcDataSets::application2,
|
|
Packit |
01d647 |
N_("Description")),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Writer, "Writer", N_("Writer"),
|
|
Packit |
01d647 |
N_("Identification of the name of the person involved in the writing, "
|
|
Packit |
01d647 |
"editing or correcting the object data or caption/abstract."),
|
|
Packit |
01d647 |
false, true, 0, 32, Exiv2::string, IptcDataSets::application2, "Description writer"),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::RasterizedCaption, "RasterizedCaption", N_("Rasterized Caption"),
|
|
Packit |
01d647 |
N_("Contains the rasterized object data description and is used "
|
|
Packit |
01d647 |
"where characters that have not been coded are required for the caption."),
|
|
Packit |
01d647 |
false, false, 7360, 7360, Exiv2::undefined, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ImageType, "ImageType", N_("Image Type"),
|
|
Packit |
01d647 |
N_("Indicates the color components of an image."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::ImageOrientation, "ImageOrientation", N_("Image Orientation"),
|
|
Packit |
01d647 |
N_("Indicates the layout of an image."),
|
|
Packit |
01d647 |
false, false, 1, 1, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Language, "Language", N_("Language"),
|
|
Packit |
01d647 |
N_("Describes the major national language of the object, according "
|
|
Packit |
01d647 |
"to the 2-letter codes of ISO 639:1988. Does not define or imply "
|
|
Packit |
01d647 |
"any coded character set, but is used for internal routing, e.g. to "
|
|
Packit |
01d647 |
"various editorial desks."),
|
|
Packit |
01d647 |
false, false, 2, 3, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::AudioType, "AudioType", N_("Audio Type"),
|
|
Packit |
01d647 |
N_("Indicates the type of an audio content."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::AudioRate, "AudioRate", N_("Audio Rate"),
|
|
Packit |
01d647 |
N_("Indicates the sampling rate in Hertz of an audio content."),
|
|
Packit |
01d647 |
false, false, 6, 6, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::AudioResolution, "AudioResolution", N_("Audio Resolution"),
|
|
Packit |
01d647 |
N_("Indicates the sampling resolution of an audio content."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::AudioDuration, "AudioDuration", N_("Audio Duration"),
|
|
Packit |
01d647 |
N_("Indicates the duration of an audio content."),
|
|
Packit |
01d647 |
false, false, 6, 6, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::AudioOutcue, "AudioOutcue", N_("Audio Outcue"),
|
|
Packit |
01d647 |
N_("Identifies the content of the end of an audio object data, "
|
|
Packit |
01d647 |
"according to guidelines established by the provider."),
|
|
Packit |
01d647 |
false, false, 0, 64, Exiv2::string, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::PreviewFormat, "PreviewFormat", N_("Preview Format"),
|
|
Packit |
01d647 |
N_("A binary number representing the file format of the object data "
|
|
Packit |
01d647 |
"preview. The file format must be registered with IPTC or NAA organizations "
|
|
Packit |
01d647 |
"with a unique number assigned to it."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::PreviewVersion, "PreviewVersion", N_("Preview Version"),
|
|
Packit |
01d647 |
N_("A binary number representing the particular version of the "
|
|
Packit |
01d647 |
"object data preview file format specified in tag <PreviewFormat>."),
|
|
Packit |
01d647 |
false, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(IptcDataSets::Preview, "Preview", N_("Preview Data"),
|
|
Packit |
01d647 |
N_("Binary image preview data."),
|
|
Packit |
01d647 |
false, false, 0, 256000, Exiv2::undefined, IptcDataSets::application2, ""),
|
|
Packit |
01d647 |
DataSet(0xffff, "(Invalid)", N_("(Invalid)"),
|
|
Packit |
01d647 |
N_("(Invalid)"),
|
|
Packit |
01d647 |
false, false, 0, 0, Exiv2::unsignedShort, IptcDataSets::application2, "")
|
|
Packit |
01d647 |
};
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const DataSet* IptcDataSets::application2RecordList()
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return application2Record;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
static const DataSet unknownDataSet(0xffff, "Unknown dataset", N_("Unknown dataset"),
|
|
Packit |
01d647 |
N_("Unknown dataset"),
|
|
Packit |
01d647 |
false, true, 0, 0xffffffff, Exiv2::string,
|
|
Packit |
01d647 |
IptcDataSets::invalidRecord,
|
|
Packit |
01d647 |
N_("Unknown dataset"));
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
// Dataset lookup lists.This is an array with pointers to one list per IIM4 Record.
|
|
Packit |
01d647 |
// The record id is used as the index into the array.
|
|
Packit |
01d647 |
const DataSet* IptcDataSets::records_[] = {
|
|
Packit |
01d647 |
0,
|
|
Packit |
01d647 |
envelopeRecord, application2Record,
|
|
Packit |
01d647 |
0
|
|
Packit |
01d647 |
};
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
int IptcDataSets::dataSetIdx(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
if( recordId != envelope && recordId != application2 ) return -1;
|
|
Packit |
01d647 |
const DataSet* dataSet = records_[recordId];
|
|
Packit |
01d647 |
if (dataSet == 0) return -1;
|
|
Packit |
01d647 |
int idx;
|
|
Packit |
01d647 |
for (idx = 0; dataSet[idx].number_ != number; ++idx) {
|
|
Packit |
01d647 |
if (dataSet[idx].number_ == 0xffff) return -1;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
return idx;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
int IptcDataSets::dataSetIdx(const std::string& dataSetName, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
if( recordId != envelope && recordId != application2 ) return -1;
|
|
Packit |
01d647 |
const DataSet* dataSet = records_[recordId];
|
|
Packit |
01d647 |
if (dataSet == 0) return -1;
|
|
Packit |
01d647 |
int idx;
|
|
Packit |
01d647 |
for (idx = 0; dataSet[idx].name_ != dataSetName; ++idx) {
|
|
Packit |
01d647 |
if (dataSet[idx].number_ == 0xffff) return -1;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
return idx;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
TypeId IptcDataSets::dataSetType(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx == -1) return unknownDataSet.type_;
|
|
Packit |
01d647 |
return records_[recordId][idx].type_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcDataSets::dataSetName(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx != -1) return records_[recordId][idx].name_;
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::ostringstream os;
|
|
Packit |
01d647 |
os << "0x" << std::setw(4) << std::setfill('0') << std::right
|
|
Packit |
01d647 |
<< std::hex << number;
|
|
Packit |
01d647 |
return os.str();
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcDataSets::dataSetTitle(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx == -1) return unknownDataSet.title_;
|
|
Packit |
01d647 |
return records_[recordId][idx].title_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcDataSets::dataSetDesc(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx == -1) return unknownDataSet.desc_;
|
|
Packit |
01d647 |
return records_[recordId][idx].desc_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcDataSets::dataSetPsName(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx == -1) return unknownDataSet.photoshop_;
|
|
Packit |
01d647 |
return records_[recordId][idx].photoshop_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
bool IptcDataSets::dataSetRepeatable(uint16_t number, uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
int idx = dataSetIdx(number, recordId);
|
|
Packit |
01d647 |
if (idx == -1) return unknownDataSet.repeatable_;
|
|
Packit |
01d647 |
return records_[recordId][idx].repeatable_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
uint16_t IptcDataSets::dataSet(const std::string& dataSetName,
|
|
Packit |
01d647 |
uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
uint16_t dataSet;
|
|
Packit |
01d647 |
int idx = dataSetIdx(dataSetName, recordId);
|
|
Packit |
01d647 |
if (idx != -1) {
|
|
Packit |
01d647 |
// dataSetIdx checks the range of recordId
|
|
Packit |
01d647 |
dataSet = records_[recordId][idx].number_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
else {
|
|
Packit |
01d647 |
if (!isHex(dataSetName, 4, "0x")) throw Error(kerInvalidDataset, dataSetName);
|
|
Packit |
01d647 |
std::istringstream is(dataSetName);
|
|
Packit |
01d647 |
is >> std::hex >> dataSet;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
return dataSet;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcDataSets::recordName(uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
if (recordId == envelope || recordId == application2) {
|
|
Packit |
01d647 |
return recordInfo_[recordId].name_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::ostringstream os;
|
|
Packit |
01d647 |
os << "0x" << std::setw(4) << std::setfill('0') << std::right
|
|
Packit |
01d647 |
<< std::hex << recordId;
|
|
Packit |
01d647 |
return os.str();
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcDataSets::recordDesc(uint16_t recordId)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
if (recordId != envelope && recordId != application2) {
|
|
Packit |
01d647 |
return unknownDataSet.desc_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
return recordInfo_[recordId].desc_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
uint16_t IptcDataSets::recordId(const std::string& recordName)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
uint16_t i;
|
|
Packit |
01d647 |
for (i = application2; i > 0; --i) {
|
|
Packit |
01d647 |
if (recordInfo_[i].name_ == recordName) break;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
if (i == 0) {
|
|
Packit |
01d647 |
if (!isHex(recordName, 4, "0x")) throw Error(kerInvalidRecord, recordName);
|
|
Packit |
01d647 |
std::istringstream is(recordName);
|
|
Packit |
01d647 |
is >> std::hex >> i;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
return i;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
void IptcDataSets::dataSetList(std::ostream& os)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
const int count = sizeof(records_)/sizeof(records_[0]);
|
|
Packit |
01d647 |
for (int i=0; i < count; ++i) {
|
|
Packit |
01d647 |
const DataSet *record = records_[i];
|
|
Packit |
01d647 |
for (int j=0; record != 0 && record[j].number_ != 0xffff; ++j) {
|
|
Packit |
01d647 |
os << record[j] << "\n";
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
} // IptcDataSets::dataSetList
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcKey::familyName_ = "Iptc";
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey::IptcKey(const std::string& key)
|
|
Packit |
01d647 |
: key_(key)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
decomposeKey();
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey::IptcKey(uint16_t tag, uint16_t record)
|
|
Packit |
01d647 |
: tag_(tag), record_(record)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
makeKey();
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey::IptcKey(const IptcKey& rhs)
|
|
Packit |
01d647 |
: Key(rhs), tag_(rhs.tag_), record_(rhs.record_), key_(rhs.key_)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey::~IptcKey()
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey& IptcKey::operator=(const IptcKey& rhs)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
if (this == &rhs) return *this;
|
|
Packit |
01d647 |
Key::operator=(rhs);
|
|
Packit |
01d647 |
tag_ = rhs.tag_;
|
|
Packit |
01d647 |
record_ = rhs.record_;
|
|
Packit |
01d647 |
key_ = rhs.key_;
|
|
Packit |
01d647 |
return *this;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcKey::key() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return key_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
const char* IptcKey::familyName() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return familyName_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcKey::groupName() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return recordName();
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcKey::tagName() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return IptcDataSets::dataSetName(tag_, record_);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcKey::tagLabel() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return IptcDataSets::dataSetTitle(tag_, record_);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
uint16_t IptcKey::tag() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return tag_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::string IptcKey::recordName() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return IptcDataSets::recordName(record_);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
uint16_t IptcKey::record() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return record_;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey::AutoPtr IptcKey::clone() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return AutoPtr(clone_());
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
IptcKey* IptcKey::clone_() const
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
return new IptcKey(*this);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
void IptcKey::decomposeKey()
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
// Get the family name, record name and dataSet name parts of the key
|
|
Packit |
01d647 |
std::string::size_type pos1 = key_.find('.');
|
|
Packit |
01d647 |
if (pos1 == std::string::npos) throw Error(kerInvalidKey, key_);
|
|
Packit |
01d647 |
std::string familyName = key_.substr(0, pos1);
|
|
Packit |
01d647 |
if (0 != strcmp(familyName.c_str(), familyName_)) {
|
|
Packit |
01d647 |
throw Error(kerInvalidKey, key_);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
std::string::size_type pos0 = pos1 + 1;
|
|
Packit |
01d647 |
pos1 = key_.find('.', pos0);
|
|
Packit |
01d647 |
if (pos1 == std::string::npos) throw Error(kerInvalidKey, key_);
|
|
Packit |
01d647 |
std::string recordName = key_.substr(pos0, pos1 - pos0);
|
|
Packit |
01d647 |
if (recordName == "") throw Error(kerInvalidKey, key_);
|
|
Packit |
01d647 |
std::string dataSetName = key_.substr(pos1 + 1);
|
|
Packit |
01d647 |
if (dataSetName == "") throw Error(kerInvalidKey, key_);
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
// Use the parts of the key to find dataSet and recordId
|
|
Packit |
01d647 |
uint16_t recId = IptcDataSets::recordId(recordName);
|
|
Packit |
01d647 |
uint16_t dataSet = IptcDataSets::dataSet(dataSetName, recId);
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
// Possibly translate hex name parts (0xabcd) to real names
|
|
Packit |
01d647 |
recordName = IptcDataSets::recordName(recId);
|
|
Packit |
01d647 |
dataSetName = IptcDataSets::dataSetName(dataSet, recId);
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
tag_ = dataSet;
|
|
Packit |
01d647 |
record_ = recId;
|
|
Packit |
01d647 |
key_ = familyName + "." + recordName + "." + dataSetName;
|
|
Packit |
01d647 |
} // IptcKey::decomposeKey
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
void IptcKey::makeKey()
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
key_ = std::string(familyName_)
|
|
Packit |
01d647 |
+ "." + IptcDataSets::recordName(record_)
|
|
Packit |
01d647 |
+ "." + IptcDataSets::dataSetName(tag_, record_);
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
// *************************************************************************
|
|
Packit |
01d647 |
// free functions
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
std::ostream& operator<<(std::ostream& os, const DataSet& dataSet)
|
|
Packit |
01d647 |
{
|
|
Packit |
01d647 |
std::ios::fmtflags f( os.flags() );
|
|
Packit |
01d647 |
IptcKey iptcKey(dataSet.number_, dataSet.recordId_);
|
|
Packit |
01d647 |
os << dataSet.name_ << ", "
|
|
Packit |
01d647 |
<< std::dec << dataSet.number_ << ", "
|
|
Packit |
01d647 |
<< "0x" << std::setw(4) << std::setfill('0')
|
|
Packit |
01d647 |
<< std::right << std::hex << dataSet.number_ << ", "
|
|
Packit |
01d647 |
<< IptcDataSets::recordName(dataSet.recordId_) << ", "
|
|
Packit |
01d647 |
<< std::boolalpha << dataSet.mandatory_ << ", "
|
|
Packit |
01d647 |
<< dataSet.repeatable_ << ", "
|
|
Packit |
01d647 |
<< std::dec << dataSet.minbytes_ << ", "
|
|
Packit |
01d647 |
<< dataSet.maxbytes_ << ", "
|
|
Packit |
01d647 |
<< iptcKey.key() << ", "
|
|
Packit |
01d647 |
<< TypeInfo::typeName(
|
|
Packit |
01d647 |
IptcDataSets::dataSetType(dataSet.number_,
|
|
Packit |
01d647 |
dataSet.recordId_)) << ", "
|
|
Packit |
01d647 |
<< dataSet.desc_;
|
|
Packit |
01d647 |
os.flags(f);
|
|
Packit |
01d647 |
return os;
|
|
Packit |
01d647 |
}
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
} // namespace Exiv2
|