 |
Exiv2
|
24 #include "exiv2lib_export.h"
27 #include "metadatum.hpp"
28 #include "properties.hpp"
62 const Value* pValue =0);
77 Xmpdatum& operator=(
const std::string& value);
82 Xmpdatum& operator=(
const char* value);
87 Xmpdatum& operator=(
const bool& value);
107 int setValue(
const std::string& value);
112 long copy(
byte* buf,
ByteOrder byteOrder)
const;
114 std::ostream& write(std::ostream& os,
const ExifData* pMetadata =0)
const;
121 std::string key()
const;
122 const char* familyName()
const;
126 std::string tagName()
const;
127 std::string tagLabel()
const;
129 uint16_t tag()
const;
131 const char* typeName()
const;
134 long typeSize()
const;
139 long toLong(
long n =0)
const;
140 float toFloat(
long n =0)
const;
141 Rational toRational(
long n =0)
const;
143 const Value& value()
const;
149 std::auto_ptr<Impl> p_;
169 XmpData() : xmpMetadata_(), xmpPacket_(), usePacket_(0) {}
186 Xmpdatum& operator[](
const std::string& key);
248 bool usePacket(
bool b) {
bool r = usePacket_; usePacket_=b ;
return r; };
250 void setPacket(
const std::string& xmpPacket) { xmpPacket_ = xmpPacket ; usePacket(
false); };
252 const std::string& xmpPacket()
const {
return xmpPacket_ ; };
259 std::string xmpPacket_ ;
272 omitPacketWrapper = 0x0010UL,
273 readOnlyPacket = 0x0020UL,
274 useCompactFormat = 0x0040UL,
275 includeThumbnailPad = 0x0100UL,
276 exactPacketLength = 0x0200UL,
277 writeAliasComments = 0x0400UL,
278 omitAllFormatting = 0x0800UL
293 static int decode(
XmpData& xmpData,
294 const std::string& xmpPacket);
312 static int encode( std::string& xmpPacket,
314 uint16_t formatFlags =useCompactFormat,
315 uint32_t padding =0);
326 typedef void (*XmpLockFct)(
void* pLockData,
bool lockUnlock);
385 static void terminate();
391 static void registerNs(
const std::string& ns,
392 const std::string& prefix);
398 static void unregisterNs(
const std::string& ns);
406 static bool initialized_;
407 static XmpLockFct xmpLockFct_;
408 static void* pLockData_;
436 #endif // #ifndef XMP_HPP_
std::auto_ptr< LangAltValue > AutoPtr
Shortcut for a LangAltValue auto pointer.
Definition: value.hpp:893
virtual ~Xmpdatum()
Destructor.
Definition: xmp.cpp:338
XmpData()
Default constructor.
Definition: xmp_exiv2.hpp:169
static TypeId propertyType(const XmpKey &key)
Return the type for property key. The default for unknown keys is xmpText.
StringVector::const_iterator StringVector_i
Class to provide a StringVector iterator.
Definition: datasets.hpp:398
void sortByKey()
Sort metadata by key.
Definition: xmp.cpp:513
Value::AutoPtr value_
Value.
Definition: xmp.cpp:295
const Value & value() const
Return a constant reference to the value.
Definition: xmp.cpp:427
Value type for simple arrays. Each item in the array is a simple value, without qualifiers....
Definition: value.hpp:797
std::ostream & write(std::ostream &os, const ExifData *pMetadata=0) const
Write the interpreted value to an output stream, return the stream.
Definition: xmp.cpp:439
Base class for all Exiv2 values used to store XMP property values.
Definition: value.hpp:624
std::vector< std::string > StringVector
typedef for string vector
Definition: datasets.hpp:390
XmpStruct xmpStruct() const
Return XMP struct, indicates if an XMP value is a structure.
Definition: value.cpp:649
Common interface for all types of values used with metadata.
Definition: value.hpp:51
void setValue(const Value *pValue)
Set the value. This method copies (clones) the value pointed to by pValue.
Definition: xmp.cpp:456
Xmpdatum & operator=(const Xmpdatum &rhs)
Assignment operator.
Definition: xmp.cpp:330
const char * typeName() const
Return the name of the type.
Definition: xmp.cpp:377
@ includeThumbnailPad
Include a padding allowance for a thumbnail image.
Definition: xmp_exiv2.hpp:275
Impl & operator=(const Impl &rhs)
Assignment.
Definition: xmp.cpp:310
Xmpdatum(const XmpKey &key, const Value *pValue=0)
Constructor for new tags created by an application. The Xmpdatum is created from a key / value pair....
Definition: xmp.cpp:320
Stateless parser class for XMP packets. Images use this class to parse and serialize XMP packets....
Definition: xmp_exiv2.hpp:268
@ omitAllFormatting
Omit all formatting whitespace.
Definition: xmp_exiv2.hpp:278
long copy(byte *buf, ByteOrder byteOrder) const
Not implemented. Calling this method will raise an exception.
Definition: xmp.cpp:433
std::vector< Xmpdatum > XmpMetadata
Container type to hold all metadata.
Definition: xmp_exiv2.hpp:154
XmpArrayType
XMP array types.
Definition: value.hpp:630
XmpFormatFlags
Options to control the format of the serialized XMP packet.
Definition: xmp_exiv2.hpp:271
XmpMetadata::iterator iterator
XmpMetadata iterator type.
Definition: xmp_exiv2.hpp:172
void clear()
Delete all Xmpdatum instances resulting in an empty container.
Definition: xmp.cpp:508
static AutoPtr create(TypeId typeId)
A (simple) factory to create a Value type.
Definition: value.cpp:93
iterator begin()
Begin of the metadata.
Definition: xmp.cpp:518
TypeId typeId() const
Return the type id of the value.
Definition: xmp.cpp:372
void setPacket(const std::string &xmpPacket)
setPacket
Definition: xmp_exiv2.hpp:250
XmpArrayType xmpArrayType() const
Return XMP array type, indicates if an XMP value is an array.
Definition: value.cpp:632
static std::string ns(const std::string &prefix)
Return the namespace name for the schema associated with prefix.
Value type for XMP language alternative properties.
Definition: value.hpp:890
Rational toRational(long n=0) const
Return the n-th component of the value converted to Rational. The return value is -1/1 if the value i...
Definition: xmp.cpp:417
Value type suitable for simple XMP properties and XMP nodes of complex types which are not parsed int...
Definition: value.hpp:715
std::auto_ptr< XmpTextValue > AutoPtr
Shortcut for a XmpTextValue auto pointer.
Definition: value.hpp:718
Information related to an XMP property. An XMP metadatum consists of an XmpKey and a Value and provid...
Definition: xmp_exiv2.hpp:45
Concrete keys for XMP metadata.
Definition: properties.hpp:230
Impl(const XmpKey &key, const Value *pValue)
Constructor.
Definition: xmp.cpp:298
ValueType value_
Map to store the language alternative values. The language qualifier is used as the key for the map e...
Definition: value.hpp:968
const char * familyName() const
Return the name of the metadata family (which is also the first part of the key)
Definition: xmp.cpp:347
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition: tags_int.cpp:2540
iterator findKey(const XmpKey &key)
Find the first Xmpdatum with the given key, return an iterator to it.
Definition: xmp.cpp:502
std::string groupName() const
Return the (preferred) schema namespace prefix.
Definition: xmp.cpp:352
long count() const
Return the number of components in the value.
Definition: xmp.cpp:387
@ readOnlyPacket
Default is a writeable packet.
Definition: xmp_exiv2.hpp:273
AutoPtr clone() const
Return an auto-pointer to a copy of itself (deep copy). The caller owns this copy and the auto-pointe...
Definition: value.hpp:110
static void terminate()
Terminate the XMP Toolkit and unregister custom namespaces.
Definition: xmp.cpp:703
@ invalidTypeId
Invalid type id.
Definition: types.hpp:146
static void unregisterNs()
Unregister all custom namespaces.
@ xmpBag
XMP bag type.
Definition: types.hpp:143
std::string toString() const
Return the value as a string.
Definition: xmp.cpp:397
@ useCompactFormat
Use a compact form of RDF.
Definition: xmp_exiv2.hpp:274
long count() const
Get the number of metadata entries.
Definition: xmp.cpp:533
@ omitPacketWrapper
Omit the XML packet wrapper.
Definition: xmp_exiv2.hpp:272
static int encode(std::string &xmpPacket, const XmpData &xmpData, uint16_t formatFlags=useCompactFormat, uint32_t padding=0)
Encode (serialize) XMP metadata from xmpData into a string xmpPacket. The XMP packet returned in the ...
Definition: xmp.cpp:1000
EXIV2API bool cmpMetadataByKey(const Metadatum &lhs, const Metadatum &rhs)
Compare two metadata by key. Return true if the key of metadatum lhs is less than that of rhs.
Definition: metadatum.cpp:77
@ langAlt
XMP language alternative type.
Definition: types.hpp:145
std::string key() const
Return the key of the Xmpdatum. The key is of the form 'Xmp.prefix.property'. Note however that the k...
Definition: xmp.cpp:342
XmpStruct
XMP structure indicator.
Definition: value.hpp:632
XmpKey::AutoPtr key_
Key.
Definition: xmp.cpp:294
void(* XmpLockFct)(void *pLockData, bool lockUnlock)
Lock/unlock function type.
Definition: xmp_exiv2.hpp:326
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition: xmp_exiv2.hpp:166
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition: types.hpp:99
bool empty() const
Return true if there is no XMP metadata.
Definition: xmp.cpp:528
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:119
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Definition: value.hpp:1363
static void registerNs(const std::string &ns, const std::string &prefix)
Register namespace ns with preferred prefix prefix.
long size() const
Return the size of the value in bytes.
Definition: xmp.cpp:392
static const char * typeName(TypeId typeId)
Return the name of the type, 0 if unknown.
Definition: types.cpp:102
bool usePacket(bool b)
set usePacket_
Definition: xmp_exiv2.hpp:248
#define EXV_WARNING
Shorthand for a temp warning log message object and return its ostringstream.
Definition: error.hpp:148
uint16_t tag() const
Properties don't have a tag number. Return 0.
Definition: xmp.cpp:367
XmpMetadata::const_iterator const_iterator
XmpMetadata const iterator type.
Definition: xmp_exiv2.hpp:174
@ writeAliasComments
Show aliases as XML comments.
Definition: xmp_exiv2.hpp:277
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:102
std::string tagName() const
Return the property name.
Definition: xmp.cpp:357
bool usePacket() const
are we to use the packet?
Definition: xmp_exiv2.hpp:245
static NsRegistry nsRegistry_
Namespace registry.
Definition: properties.hpp:218
@ exactPacketLength
The padding parameter is the overall packet length.
Definition: xmp_exiv2.hpp:276
Xmpdatum & operator[](const std::string &key)
Returns a reference to the Xmpdatum that is associated with a particular key. If XmpData does not alr...
Definition: xmp.cpp:474
std::auto_ptr< XmpArrayValue > AutoPtr
Shortcut for a XmpArrayValue auto pointer.
Definition: value.hpp:800
std::auto_ptr< XmpKey > AutoPtr
Shortcut for an XmpKey auto pointer.
Definition: properties.hpp:234
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:324
@ xmpText
XMP text type.
Definition: types.hpp:141
std::string tagLabel() const
Return a label for the tag.
Definition: xmp.cpp:362
static bool initialize(XmpParser::XmpLockFct xmpLockFct=0, void *pLockData=0)
Initialize the XMP Toolkit.
Definition: xmp.cpp:641
int add(const XmpKey &key, const Value *value)
Add an Xmpdatum from the supplied key and value pair. This method copies (clones) the value.
Definition: xmp.cpp:485
static std::string prefix(const std::string &ns)
Return the (preferred) prefix for schema namespace ns.
std::map< std::string, std::string > Dictionary
typedef for string:string map
Definition: datasets.hpp:364
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:193
Value::AutoPtr getValue() const
Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-poiner ...
Definition: xmp.cpp:422
void eraseFamily(XmpData::iterator &pos)
Delete the Xmpdatum at iterator position pos and update pos erases all following keys from the same f...
Definition: xmp.cpp:552
#define EXV_ERROR
Shorthand for a temp error log message object and return its ostringstream.
Definition: error.hpp:150
@ xmpSeq
XMP sequence type.
Definition: types.hpp:144
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition: types.hpp:510
long typeSize() const
The Exif typeSize doesn't make sense here. Return 0.
Definition: xmp.cpp:382
static std::ostream & printProperty(std::ostream &os, const std::string &key, const Value &value)
Interpret and print the value of an XMP property.
@ xmpAlt
XMP alternative type.
Definition: types.hpp:142
XMP property reference, implemented as a static class.
Definition: properties.hpp:85
#define EXV_INFO
Shorthand for a temp info log message object and return its ostringstream.
Definition: error.hpp:146
iterator end()
End of the metadata.
Definition: xmp.cpp:523
float toFloat(long n=0) const
Return the n-th component of the value converted to float. The return value is -1 if the value is not...
Definition: xmp.cpp:412
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition: value.hpp:54
static int decode(XmpData &xmpData, const std::string &xmpPacket)
Decode XMP metadata from an XMP packet xmpPacket into xmpData. The format of the XMP packet must foll...
Definition: xmp.cpp:887
Error class for exceptions, log message class.
Internal Pimpl structure of class Xmpdatum.
Definition: xmp.cpp:288
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
long toLong(long n=0) const
Return the n-th component of the value converted to long. The return value is -1 if the value is not ...
Definition: xmp.cpp:407