Exiv2::XmpProperties Class Reference

XMP property reference, implemented as a static class. More...

#include <properties.hpp>

Public Types

using NsRegistry = std::map< std::string, XmpNsInfo >
 Type for the namespace registry.
 

Static Public Member Functions

static const char * propertyTitle (const XmpKey &key)
 Return the title (label) of the property. More...
 
static const char * propertyDesc (const XmpKey &key)
 Return the description of the property. More...
 
static TypeId propertyType (const XmpKey &key)
 Return the type for property key. The default for unknown keys is xmpText. More...
 
static const XmpPropertyInfopropertyInfo (const XmpKey &key)
 Return information for the property for key. More...
 
static std::string ns (const std::string &prefix)
 Return the namespace name for the schema associated with prefix. More...
 
static const char * nsDesc (const std::string &prefix)
 Return the namespace description for the schema associated with prefix. More...
 
static const XmpPropertyInfopropertyList (const std::string &prefix)
 Return read-only list of built-in properties for prefix. More...
 
static const XmpNsInfonsInfo (const std::string &prefix)
 Return information about a schema namespace for prefix. Always returns a valid pointer. More...
 
static std::string prefix (const std::string &ns)
 Return the (preferred) prefix for schema namespace ns. More...
 
static void printProperties (std::ostream &os, const std::string &prefix)
 Print a list of properties of a schema namespace to output stream os.
 
static std::ostream & printProperty (std::ostream &os, const std::string &key, const Value &value)
 Interpret and print the value of an XMP property.
 
static void registerNs (const std::string &ns, const std::string &prefix)
 Register namespace ns with preferred prefix prefix. More...
 
static void unregisterNs (const std::string &ns)
 Unregister a custom namespace ns. More...
 
static void unregisterNs ()
 Unregister all custom namespaces. More...
 
static const XmpNsInfolookupNsRegistry (const XmpNsInfo::Prefix &prefix)
 Get the registered namespace for a specific prefix from the registry.
 
static void registeredNamespaces (Exiv2::Dictionary &nsDict)
 Get all registered namespaces (for both Exiv2 and XMPsdk)
 

Static Public Attributes

static std::mutex mutex_
 Lock to be used while modifying properties. More...
 
static NsRegistry nsRegistry_
 Namespace registry.
 

Detailed Description

XMP property reference, implemented as a static class.

Member Function Documentation

◆ ns()

static std::string Exiv2::XmpProperties::ns ( const std::string &  prefix)
static

Return the namespace name for the schema associated with prefix.

Parameters
prefixPrefix
Returns
The namespace name
Exceptions
Errorif no namespace is registered with prefix.

◆ nsDesc()

static const char* Exiv2::XmpProperties::nsDesc ( const std::string &  prefix)
static

Return the namespace description for the schema associated with prefix.

Parameters
prefixPrefix
Returns
The namespace description
Exceptions
Errorif no namespace is registered with prefix.

◆ nsInfo()

static const XmpNsInfo* Exiv2::XmpProperties::nsInfo ( const std::string &  prefix)
static

Return information about a schema namespace for prefix. Always returns a valid pointer.

Parameters
prefixThe prefix
Returns
A pointer to the related information
Exceptions
Errorif no namespace is registered with prefix.

◆ prefix()

static std::string Exiv2::XmpProperties::prefix ( const std::string &  ns)
static

Return the (preferred) prefix for schema namespace ns.

Parameters
nsSchema namespace
Returns
The prefix or an empty string if namespace ns is not registered.

◆ propertyDesc()

static const char* Exiv2::XmpProperties::propertyDesc ( const XmpKey key)
static

Return the description of the property.

Parameters
keyThe property key
Returns
The description of the property, 0 if the key is of an unknown property.

◆ propertyInfo()

static const XmpPropertyInfo* Exiv2::XmpProperties::propertyInfo ( const XmpKey key)
static

Return information for the property for key.

If the key is a path to a nested property (one which contains a slash, like Xmp.MP.RegionInfo/MPRI:Regions), determines the innermost element (Xmp.MPRI.Regions) and returns its property information.

Parameters
keyThe property key
Returns
A pointer to the property information, 0 if the key is of an unknown property.

◆ propertyList()

static const XmpPropertyInfo* Exiv2::XmpProperties::propertyList ( const std::string &  prefix)
static

Return read-only list of built-in properties for prefix.

Parameters
prefixPrefix
Returns
Pointer to the built-in properties for prefix, may be 0 if none is configured in the namespace info.
Exceptions
Errorif no namespace is registered with prefix.

◆ propertyTitle()

static const char* Exiv2::XmpProperties::propertyTitle ( const XmpKey key)
static

Return the title (label) of the property.

Parameters
keyThe property key
Returns
The title (label) of the property, 0 if the key is of an unknown property.

◆ propertyType()

static TypeId Exiv2::XmpProperties::propertyType ( const XmpKey key)
static

Return the type for property key. The default for unknown keys is xmpText.

Parameters
keyThe property key
Returns
The type of the property

◆ registerNs()

static void Exiv2::XmpProperties::registerNs ( const std::string &  ns,
const std::string &  prefix 
)
static

Register namespace ns with preferred prefix prefix.

If the prefix is a known or previously registered prefix, the corresponding namespace URI is overwritten.

Note
This invalidates XMP keys generated with the previous prefix.
Examples
xmpsample.cpp.

◆ unregisterNs() [1/2]

static void Exiv2::XmpProperties::unregisterNs ( )
static

Unregister all custom namespaces.

The function only unregisters namespaces registered earlier, it does not unregister built-in namespaces.

Note
This invalidates XMP keys generated in any custom namespace.

◆ unregisterNs() [2/2]

static void Exiv2::XmpProperties::unregisterNs ( const std::string &  ns)
static

Unregister a custom namespace ns.

The function only has an effect if there is a namespace ns registered earlier, it does not unregister built-in namespaces.

Note
This invalidates XMP keys generated in this namespace.

Member Data Documentation

◆ mutex_

std::mutex Exiv2::XmpProperties::mutex_
static

Lock to be used while modifying properties.

Todo:
For a proper read-write lock, this shall be improved by a std::shared_timed_mutex (once C++14 is allowed) or std::shared_mutex (once C++17 is allowed). The read-access locks shall be updated to std::shared_lock then.

The documentation for this class was generated from the following file: