adobe / XMP-Toolkit-SDK

The XMP Toolkit allows you to integrate XMP functionality into your product or solution
BSD 3-Clause "New" or "Revised" License
203 stars 82 forks source link

What other options are there for defining TXMP_STRING_TYPE? #20

Closed amtopel closed 1 year ago

amtopel commented 4 years ago

I've only seen TXMP_STRING_TYPEdefined asstd::string. Are there any other options, like char* or std::wstring? When I try those, everything fails to compile. Thanks for your help.

maupadhyay commented 1 year ago

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

The string class must be suitable for at least UTF-8. This is the encoding used for all general values, and is the default encoding for serialized XMP. The string type must also be suitable for UTF-16 or UTF-32 if those serialization encodings are used. This mainly means tolerating embedded 0 bytes, which std::string does.

Reference: https://github.com/adobe/XMP-Toolkit-SDK/blob/e0955b272ab6035b2921fa2c649aca5ecfe5ab81/public/include/XMP.hpp#L27-L47 for more