#include <TXMPUtils.hpp>
Static Public Member Functions | |
Path composition functions | |
These functions provide support for composing path expressions to deeply nested properties. The functions in TXMPMeta such as GetProperty , GetArrayItem , and GetStructField provide easy access to top level simple properties, items in top level arrays, and fields of top level structs. They do not provide convenient access to more complex things like fields several levels deep in a complex struct, or fields within an array of structs, or items of an array that is a field of a struct. These functions can also be used to compose paths to top level array items or struct fields so that you can use the binary accessors like GetProperty_Int .You can use these functions is to compose a complete path expression, or all but the last component. Suppose you have a property that is an array of integers within a struct. You can access one of the array items like this:
SXMPUtils::ComposeStructFieldPath ( schemaNS, "Struct", fieldNS, "Array", &path ); SXMPUtils::ComposeArrayItemPath ( schemaNS, path, index, &path ); exists = xmpObj.GetProperty_Int ( schemaNS, path, &value, &options ); You could also use this code if you want the string form of the integer:
SXMPUtils::ComposeStructFieldPath ( schemaNS, "Struct", fieldNS, "Array", &path ); xmpObj.GetArrayItem ( schemaNS, path, index, &value, &options );
| |
void | ComposeArrayItemPath (XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_Index itemIndex, tStringObj *fullPath) |
Compose the path expression for an item in an array. | |
void | ComposeStructFieldPath (XMP_StringPtr schemaNS, XMP_StringPtr structName, XMP_StringPtr fieldNS, XMP_StringPtr fieldName, tStringObj *fullPath) |
Compose the path expression for a field in a struct. | |
void | ComposeQualifierPath (XMP_StringPtr schemaNS, XMP_StringPtr propName, XMP_StringPtr qualNS, XMP_StringPtr qualName, tStringObj *fullPath) |
Compose the path expression for a qualifier. | |
void | ComposeLangSelector (XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr langName, tStringObj *fullPath) |
Compose the path expression to select an alternate item by language. | |
void | ComposeLangSelector (XMP_StringPtr schemaNS, XMP_StringPtr arrayName, const tStringObj &langName, tStringObj *fullPath) |
This form of ComposeLangSelector is a simple overload in the template that calls the above form passing langName.c_str() . | |
void | ComposeFieldSelector (XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr fieldNS, XMP_StringPtr fieldName, XMP_StringPtr fieldValue, tStringObj *fullPath) |
Compose the path expression to select an alternate item by a field's value. | |
void | ComposeFieldSelector (XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr fieldNS, XMP_StringPtr fieldName, const tStringObj &fieldValue, tStringObj *fullPath) |
This form of ComposeFieldSelector is a simple overload in the template that calls the above form passing fieldValue.c_str() . | |
Binary-String conversion functions | |
void | ConvertFromBool (bool binValue, tStringObj *strValue) |
Convert from Boolean to string. | |
void | ConvertFromInt (long binValue, XMP_StringPtr format, tStringObj *strValue) |
Convert from integer to string. | |
void | ConvertFromFloat (double binValue, XMP_StringPtr format, tStringObj *strValue) |
Convert from floating point to string. | |
void | ConvertFromDate (const XMP_DateTime &binValue, tStringObj *strValue) |
Convert from date/time to string. | |
bool | ConvertToBool (XMP_StringPtr strValue) |
Convert from string to Boolean. | |
bool | ConvertToBool (const tStringObj &strValue) |
This form of ConvertToBool is a simple overload in the template that calls the above form passing strValue.c_str() . | |
long | ConvertToInt (XMP_StringPtr strValue) |
Convert from string to integer. | |
long | ConvertToInt (const tStringObj &strValue) |
This form of ConvertToInt is a simple overload in the template that calls the above form passing strValue.c_str() . | |
long long | ConvertToInt64 (XMP_StringPtr strValue) |
Convert from string to 64 bit integer. | |
long long | ConvertToInt64 (const tStringObj &strValue) |
This form of ConvertToInt64 is a simple overload in the template that calls the above form passing strValue.c_str() . | |
double | ConvertToFloat (XMP_StringPtr strValue) |
Convert from string to floating point. | |
double | ConvertToFloat (const tStringObj &strValue) |
This form of ConvertToFloat is a simple overload in the template that calls the above form passing strValue.c_str() . | |
void | ConvertToDate (XMP_StringPtr strValue, XMP_DateTime *binValue) |
Convert from string to date/time. | |
void | ConvertToDate (const tStringObj &strValue, XMP_DateTime *binValue) |
This form of ConvertToDate is a simple overload in the template that calls the above form passing sstrValue.c_str() . | |
Date/Time functions | |
void | CurrentDateTime (XMP_DateTime *time) |
Obtain the current date and time. | |
void | SetTimeZone (XMP_DateTime *time) |
Set the local time zone. | |
void | ConvertToUTCTime (XMP_DateTime *time) |
Make sure a time is UTC. | |
void | ConvertToLocalTime (XMP_DateTime *time) |
Make sure a time is local. | |
int | CompareDateTime (const XMP_DateTime &left, const XMP_DateTime &right) |
Compare the order of two date/time values. | |
Base 64 Encoding and Decoding | |
void | EncodeToBase64 (XMP_StringPtr rawStr, XMP_StringLen rawLen, tStringObj *encodedStr) |
Convert from raw data to Base64 encoded string. | |
void | EncodeToBase64 (const tStringObj &rawStr, tStringObj *encodedStr) |
This form of EncodeToBase64 is a simple overload in the template that calls the above form passing rawStr.c_str() , and rawStr.size() . | |
void | DecodeFromBase64 (XMP_StringPtr encodedStr, XMP_StringLen encodedLen, tStringObj *rawStr) |
Decode from Base64 encoded string to raw data. | |
void | DecodeFromBase64 (const tStringObj &encodedStr, tStringObj *rawStr) |
This form of DecodeFromBase64 is a simple overload in the template that calls the above form passing encodedStr.c_str() , and encodedStr.size() . |
TXMPUtils
is the template class providing utility services for the XMP Toolkit. It should be instantiated with a string class such as std::string
. Please read the general toolkit usage notes for information about the overall architecture of the XMP API.
This is a class for C++ scoping purposes only. It has only static functions, you cannot create an object. These are all functions that layer cleanly on top of the core XMP toolkit. The template wraps a string class around the raw XMP API, so that output strings are automatically copied and access is fully thread safe. String objects are only necessary for output strings. Input strings are literals and passed as typical C const char *
.
The template parameter, class tStringObj
, must have the following member functions (which match those for std::string
):
tStringObj& assign ( const char * str, size_t len ) size_t size() const const char * c_str() const
|
Compare the order of two date/time values.
|
|
Compose the path expression for an item in an array.
|
|
Compose the path expression to select an alternate item by a field's value.
The path syntax allows two forms of "content addressing" that may be used to select an item in an array of alternatives. The form used in For example, consider a simple struct that has two fields, the name of a city and the URI of an FTP site in that city. Use this to create an array of download alternatives. You can show the user a popup built from the values of the city fields. You can then get the corresponding URI as follows:
ComposeFieldSelector ( schemaNS, "Downloads", fieldNS, "City", chosenCity, &path ); exists = GetStructField ( schemaNS, path, fieldNS, "URI", &uri );
|
|
Compose the path expression to select an alternate item by language.
The path syntax allows two forms of "content addressing" that may be used to select an item in an array of alternatives. The form used in
|
|
Compose the path expression for a qualifier.
|
|
Compose the path expression for a field in a struct.
|
|
Convert from Boolean to string.
|
|
Convert from date/time to string.
|
|
Convert from floating point to string.
|
|
Convert from integer to string.
|
|
Convert from string to Boolean.
|
|
Convert from string to date/time.
|
|
Convert from string to floating point.
|
|
Convert from string to integer.
|
|
Convert from string to 64 bit integer.
|
|
Make sure a time is local.
|
|
Make sure a time is UTC.
|
|
Obtain the current date and time.
|
|
Decode from Base64 encoded string to raw data.
|
|
Convert from raw data to Base64 encoded string.
|
|
Set the local time zone.
|