DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_xmp.h00001 /*****************************************************************************/ 00002 // Copyright 2006-2008 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/dng_sdk_1_2/dng_sdk/source/dng_xmp.h#1 $ */ 00010 /* $DateTime: 2008/03/09 14:29:54 $ */ 00011 /* $Change: 431850 $ */ 00012 /* $Author: tknoll $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_xmp__ 00017 #define __dng_xmp__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_classes.h" 00022 #include "dng_types.h" 00023 #include "dng_xmp_sdk.h" 00024 00025 /*****************************************************************************/ 00026 00027 class dng_xmp 00028 { 00029 00030 protected: 00031 00032 // Sync option bits. 00033 00034 enum 00035 { 00036 ignoreXMP = 1, // Force XMP values to match non-XMP 00037 preferXMP = 2, // Prefer XMP values if conflict 00038 preferNonXMP = 4, // Prefer non-XMP values if conflict 00039 requireASCII = 8 // Non-XMP values must be ASCII 00040 }; 00041 00042 dng_memory_allocator &fAllocator; 00043 00044 dng_xmp_sdk *fSDK; 00045 00046 public: 00047 00048 dng_xmp (dng_memory_allocator &allocator); 00049 00050 dng_xmp (const dng_xmp &xmp); 00051 00052 virtual ~dng_xmp (); 00053 00054 void Parse (dng_host &host, 00055 const void *buffer, 00056 uint32 count); 00057 00058 virtual dng_memory_block * Serialize (bool asPacket = false, 00059 uint32 targetBytes = 0, 00060 uint32 padBytes = 4096, 00061 bool forJPEG = false) const; 00062 00063 bool HasMeta () const; 00064 00065 bool Exists (const char *ns, 00066 const char *path) const; 00067 00068 bool HasNameSpace (const char *ns) const; 00069 00070 bool IteratePaths (IteratePathsCallback *callback, 00071 void *callbackData, 00072 const char *ns = 0, 00073 const char *path = 0); 00074 00075 void Remove (const char *ns, 00076 const char *path); 00077 00078 void RemoveProperties (const char *ns); 00079 00080 void Set (const char *ns, 00081 const char *path, 00082 const char *text); 00083 00084 bool GetString (const char *ns, 00085 const char *path, 00086 dng_string &s) const; 00087 00088 void SetString (const char *ns, 00089 const char *path, 00090 const dng_string &s); 00091 00092 bool GetStringList (const char *ns, 00093 const char *path, 00094 dng_string_list &list) const; 00095 00096 void SetStringList (const char *ns, 00097 const char *path, 00098 const dng_string_list &list, 00099 bool isBag = false); 00100 00101 void SetStructField (const char *ns, 00102 const char *path, 00103 const char *fieldNS, 00104 const char *fieldName, 00105 const dng_string &s); 00106 00107 void SetStructField (const char *ns, 00108 const char *path, 00109 const char *fieldNS, 00110 const char *fieldName, 00111 const char *s); 00112 00113 void DeleteStructField (const char *ns, 00114 const char *path, 00115 const char *fieldNS, 00116 const char *fieldName); 00117 00118 bool GetStructField (const char *ns, 00119 const char *path, 00120 const char *fieldNS, 00121 const char *fieldName, 00122 dng_string &s) const; 00123 00124 void SetAltLangDefault (const char *ns, 00125 const char *path, 00126 const dng_string &s); 00127 00128 bool GetAltLangDefault (const char *ns, 00129 const char *path, 00130 dng_string &s) const; 00131 00132 bool GetBoolean (const char *ns, 00133 const char *path, 00134 bool &x) const; 00135 00136 void SetBoolean (const char *ns, 00137 const char *path, 00138 bool x); 00139 00140 bool Get_int32 (const char *ns, 00141 const char *path, 00142 int32 &x) const; 00143 00144 void Set_int32 (const char *ns, 00145 const char *path, 00146 int32 x, 00147 bool usePlus = false); 00148 00149 bool Get_uint32 (const char *ns, 00150 const char *path, 00151 uint32 &x) const; 00152 00153 void Set_uint32 (const char *ns, 00154 const char *path, 00155 uint32 x); 00156 00157 bool Get_real64 (const char *ns, 00158 const char *path, 00159 real64 &x) const; 00160 00161 void Set_real64 (const char *ns, 00162 const char *path, 00163 real64 x, 00164 uint32 places = 6, 00165 bool trim = true, 00166 bool usePlus = false); 00167 00168 bool Get_urational (const char *ns, 00169 const char *path, 00170 dng_urational &r) const; 00171 00172 void Set_urational (const char *ns, 00173 const char *path, 00174 const dng_urational &r); 00175 00176 bool Get_srational (const char *ns, 00177 const char *path, 00178 dng_srational &r) const; 00179 00180 void Set_srational (const char *ns, 00181 const char *path, 00182 const dng_srational &r); 00183 00184 bool GetFingerprint (const char *ns, 00185 const char *path, 00186 dng_fingerprint &print) const; 00187 00188 void SetFingerprint (const char *ns, 00189 const char *path, 00190 const dng_fingerprint &print); 00191 00192 dng_fingerprint GetIPTCDigest () const; 00193 00194 void SetIPTCDigest (dng_fingerprint &digest); 00195 00196 void IngestIPTC (dng_negative &negative, 00197 bool xmpIsNewer = false); 00198 00199 void RebuildIPTC (dng_negative &negative); 00200 00201 virtual void SyncExif (dng_exif &exif, 00202 const dng_exif *originalExif = NULL, 00203 bool doingUpdateFromXMP = false); 00204 00205 void UpdateDateTime (const dng_date_time_info &dt); 00206 00207 bool HasOrientation () const; 00208 00209 dng_orientation GetOrientation () const; 00210 00211 void ClearOrientation (); 00212 00213 void SetOrientation (const dng_orientation &orientation); 00214 00215 void SyncOrientation (dng_negative &negative, 00216 bool xmpIsMaster); 00217 00218 void ClearImageInfo (); 00219 00220 void SetImageSize (const dng_point &size); 00221 00222 void SetSampleInfo (uint32 samplesPerPixel, 00223 uint32 bitsPerSample); 00224 00225 void SetPhotometricInterpretation (uint32 pi); 00226 00227 void SetResolution (const dng_resolution &res); 00228 00229 void ComposeArrayItemPath (const char *ns, 00230 const char *arrayName, 00231 int32 itemNumber, 00232 dng_string &s) const; 00233 00234 void ComposeStructFieldPath (const char *ns, 00235 const char *structName, 00236 const char *fieldNS, 00237 const char *fieldName, 00238 dng_string &s) const; 00239 00240 int32 CountArrayItems (const char *ns, 00241 const char *path) const; 00242 00243 void AppendArrayItem (const char *ns, 00244 const char *arrayName, 00245 const char *itemValue, 00246 bool isBag = true, 00247 bool propIsStruct = false); 00248 00249 static dng_string EncodeFingerprint (const dng_fingerprint &f); 00250 00251 static dng_fingerprint DecodeFingerprint (const dng_string &s); 00252 00253 protected: 00254 00255 static void TrimDecimal (char *s); 00256 00257 static dng_string EncodeGPSVersion (uint32 version); 00258 00259 static uint32 DecodeGPSVersion (const dng_string &s); 00260 00261 static dng_string EncodeGPSCoordinate (const dng_string &ref, 00262 const dng_urational *coord); 00263 00264 static void DecodeGPSCoordinate (const dng_string &s, 00265 dng_string &ref, 00266 dng_urational *coord); 00267 00268 static dng_string EncodeGPSDateTime (const dng_string &dateStamp, 00269 const dng_urational *timeStamp); 00270 00271 static void DecodeGPSDateTime (const dng_string &s, 00272 dng_string &dateStamp, 00273 dng_urational *timeStamp); 00274 00275 bool SyncString (const char *ns, 00276 const char *path, 00277 dng_string &s, 00278 uint32 options = 0); 00279 00280 void SyncStringList (const char *ns, 00281 const char *path, 00282 dng_string_list &list, 00283 bool isBag = false, 00284 uint32 options = 0); 00285 00286 bool SyncAltLangDefault (const char *ns, 00287 const char *path, 00288 dng_string &s, 00289 uint32 options = 0); 00290 00291 void Sync_uint32 (const char *ns, 00292 const char *path, 00293 uint32 &x, 00294 bool isDefault = false, 00295 uint32 options = 0); 00296 00297 void Sync_uint32_array (const char *ns, 00298 const char *path, 00299 uint32 *data, 00300 uint32 &count, 00301 uint32 maxCount, 00302 uint32 options = 0); 00303 00304 void Sync_urational (const char *ns, 00305 const char *path, 00306 dng_urational &r, 00307 uint32 options = 0); 00308 00309 void Sync_srational (const char *ns, 00310 const char *path, 00311 dng_srational &r, 00312 uint32 options = 0); 00313 00314 void SyncIPTC (dng_iptc &iptc, 00315 uint32 options); 00316 00317 void SyncFlash (uint32 &flashState, 00318 uint32 &flashMask, 00319 uint32 options); 00320 00321 private: 00322 00323 // Hidden assignment operator. 00324 00325 dng_xmp & operator= (const dng_xmp &xmp); 00326 00327 }; 00328 00329 /*****************************************************************************/ 00330 00331 #endif 00332 00333 /*****************************************************************************/ | |||
