Main Page | Modules | Compound List | File List | Compound Members | File Members

TXMPMeta.hpp

Go to the documentation of this file.
00001 #ifndef __TXMPMeta_hpp__
00002 #define __TXMPMeta_hpp__    1
00003 
00004 #if ( ! __XMP_hpp__ )
00005     #error "Do not directly include, use XMP.hpp"
00006 #endif
00007 
00008 // =================================================================================================
00009 // ADOBE SYSTEMS INCORPORATED
00010 // Copyright 2002-2005 Adobe Systems Incorporated
00011 // All Rights Reserved
00012 //
00013 // NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
00014 // of the Adobe license agreement accompanying it.
00015 // =================================================================================================
00016 
00017 //  ================================================================================================
00024 //  ================================================================================================
00025 
00026 //  ================================================================================================
00069 //  ================================================================================================
00070 
00071 template <class tStringObj> class TXMPIterator;
00072 template <class tStringObj> class TXMPUtils;
00073 
00074 // -------------------------------------------------------------------------------------------------
00075 
00076 template <class tStringObj>
00077 class TXMPMeta {
00078 
00079 public:
00080 
00081     // =============================================================================================
00082     // Initialization and termination
00083     // ==============================
00084 
00085     //  --------------------------------------------------------------------------------------------
00088 
00089     //  --------------------------------------------------------------------------------------------
00091 
00092     static void
00093     GetVersionInfo ( XMP_VersionInfo * info );
00094 
00095     //  --------------------------------------------------------------------------------------------
00100 
00101     static bool
00102     Initialize ( XMP_AllocateProc AllocateProc = 0,
00103                  XMP_DeleteProc   DeleteProc = 0 );
00104 
00105     //  --------------------------------------------------------------------------------------------
00107 
00108     static void
00109     Terminate();
00110 
00112 
00113     // =============================================================================================
00114     // Constuctors and destructor
00115     // =========================
00116 
00117     //  --------------------------------------------------------------------------------------------
00120 
00121     //  --------------------------------------------------------------------------------------------
00125 
00126     TXMPMeta();
00127 
00128     //  --------------------------------------------------------------------------------------------
00132 
00133     TXMPMeta ( const TXMPMeta<tStringObj> & original );
00134 
00135     //  --------------------------------------------------------------------------------------------
00140 
00141     void operator= ( const TXMPMeta<tStringObj> & rhs );
00142 
00143     //  --------------------------------------------------------------------------------------------
00149 
00150     TXMPMeta ( XMPMetaRef xmpRef );
00151 
00152     //  --------------------------------------------------------------------------------------------
00165 
00166     TXMPMeta ( XMP_StringPtr buffer,
00167                XMP_StringLen xmpSize );
00168 
00169     //  --------------------------------------------------------------------------------------------
00171 
00172     virtual ~TXMPMeta() throw();
00173 
00175 
00176     // =============================================================================================
00177     // Global state functions
00178     // ======================
00179 
00180     //  --------------------------------------------------------------------------------------------
00185 
00187 
00188     static XMP_OptionBits
00189     GetGlobalOptions();
00190 
00196 
00197     static void
00198     SetGlobalOptions ( XMP_OptionBits options );
00199 
00204 
00205     static void
00206     GetMemProcs ( XMP_AllocateProc * AllocateProc,
00207                   XMP_DeleteProc *   DeleteProc );
00208 
00210 
00211     //  --------------------------------------------------------------------------------------------
00214 
00218 
00219     static void
00220     RegisterAssertNotify ( XMP_AssertNotifyProc notifyProc,
00221                            void *               refCon );
00222 
00225 
00226     static void
00227     UnregisterAssertNotify ( XMP_AssertNotifyProc notifyProc );
00228 
00233 
00234     static void
00235     SendAssertNotify ( XMP_StringPtr message );
00236 
00238 
00239     //  --------------------------------------------------------------------------------------------
00244 
00246 
00247     static XMP_Status
00248     DumpNamespaces ( XMP_TextOutputProc outProc,
00249                      void *             refCon );
00250 
00252 
00253     static XMP_Status
00254     DumpAliases ( XMP_TextOutputProc outProc,
00255                   void *             refCon );
00256 
00260 
00261     static XMP_Status
00262     DumpPropertyTraits ( XMP_TextOutputProc outProc,
00263                          void *             refCon );
00264 
00266 
00267     //  --------------------------------------------------------------------------------------------
00277 
00278     //  --------------------------------------------------------------------------------------------
00296 
00297     static bool
00298     RegisterNamespace ( XMP_StringPtr namespaceURI,
00299                         XMP_StringPtr suggestedPrefix,
00300                         tStringObj *  registeredPrefix );
00301 
00302     //  --------------------------------------------------------------------------------------------
00313 
00314     static bool
00315     GetNamespacePrefix ( XMP_StringPtr namespaceURI,
00316                          tStringObj *  namespacePrefix );
00317 
00318     //  --------------------------------------------------------------------------------------------
00329 
00330     static bool
00331     GetNamespaceURI ( XMP_StringPtr namespacePrefix,
00332                       tStringObj *  namespaceURI );
00333 
00334     //  --------------------------------------------------------------------------------------------
00343 
00344     static void
00345     DeleteNamespace ( XMP_StringPtr namespaceURI );
00346 
00348 
00349     //  --------------------------------------------------------------------------------------------
00364 
00365     //  --------------------------------------------------------------------------------------------
00401 
00402     static void
00403     RegisterAlias ( XMP_StringPtr  aliasNS,
00404                     XMP_StringPtr  aliasProp,
00405                     XMP_StringPtr  actualNS,
00406                     XMP_StringPtr  actualProp,
00407                     XMP_OptionBits arrayForm = kXMP_NoOptions );
00408 
00409     //  --------------------------------------------------------------------------------------------
00435 
00436     static bool
00437     ResolveAlias ( XMP_StringPtr    aliasNS,
00438                    XMP_StringPtr    aliasProp,
00439                    tStringObj *     actualNS,
00440                    tStringObj *     actualProp,
00441                    XMP_OptionBits * arrayForm );
00442 
00443     //  --------------------------------------------------------------------------------------------
00454 
00455     static void
00456     DeleteAlias ( XMP_StringPtr aliasNS,
00457                   XMP_StringPtr aliasProp );
00458 
00459     //  --------------------------------------------------------------------------------------------
00466 
00467     static void
00468     RegisterStandardAliases ( XMP_StringPtr schemaNS );
00469 
00471 
00472     //  --------------------------------------------------------------------------------------------
00485 
00486     static void
00487     RegisterPropertyTraits ( XMP_StringPtr  schemaNS,
00488                              XMP_StringPtr  propName,
00489                              XMP_OptionBits options );
00490 
00491     // =============================================================================================
00492     // Basic property manipulation functions
00493     // =====================================
00494 
00495     // *** Should add discussion of schemaNS and propName prefix usage.
00496 
00497     //  --------------------------------------------------------------------------------------------
00559 
00560     //  --------------------------------------------------------------------------------------------
00582 
00583     bool
00584     GetProperty ( XMP_StringPtr    schemaNS,
00585                   XMP_StringPtr    propName,
00586                   tStringObj *     propValue,
00587                   XMP_OptionBits * options ) const;
00588 
00589     //  --------------------------------------------------------------------------------------------
00610 
00611     bool
00612     GetArrayItem ( XMP_StringPtr    schemaNS,
00613                    XMP_StringPtr    arrayName,
00614                    XMP_Index        itemIndex,
00615                    tStringObj *     itemValue,
00616                    XMP_OptionBits * options ) const;
00617 
00618     //  --------------------------------------------------------------------------------------------
00646 
00647     bool
00648     GetStructField ( XMP_StringPtr    schemaNS,
00649                      XMP_StringPtr    structName,
00650                      XMP_StringPtr    fieldNS,
00651                      XMP_StringPtr    fieldName,
00652                      tStringObj *     fieldValue,
00653                      XMP_OptionBits * options ) const;
00654 
00655     //  --------------------------------------------------------------------------------------------
00688 
00689     bool
00690     GetQualifier ( XMP_StringPtr    schemaNS,
00691                    XMP_StringPtr    propName,
00692                    XMP_StringPtr    qualNS,
00693                    XMP_StringPtr    qualName,
00694                    tStringObj *     qualValue,
00695                    XMP_OptionBits * options ) const;
00696 
00698 
00699     // =============================================================================================
00700 
00701     //  --------------------------------------------------------------------------------------------
00745 
00746     //  --------------------------------------------------------------------------------------------
00759 
00760     void
00761     SetProperty ( XMP_StringPtr  schemaNS,
00762                   XMP_StringPtr  propName,
00763                   XMP_StringPtr  propValue,
00764                   XMP_OptionBits options = 0 );
00765 
00766     //  --------------------------------------------------------------------------------------------
00769 
00770     void
00771     SetProperty ( XMP_StringPtr      schemaNS,
00772                   XMP_StringPtr      propName,
00773                   const tStringObj & propValue,
00774                   XMP_OptionBits     options = 0 );
00775 
00776     //  --------------------------------------------------------------------------------------------
00801 
00802     void
00803     SetArrayItem ( XMP_StringPtr  schemaNS,
00804                    XMP_StringPtr  arrayName,
00805                    XMP_Index      itemIndex,
00806                    XMP_StringPtr  itemValue,
00807                    XMP_OptionBits options = 0 );
00808 
00809     //  --------------------------------------------------------------------------------------------
00812 
00813     void
00814     SetArrayItem ( XMP_StringPtr      schemaNS,
00815                    XMP_StringPtr      arrayName,
00816                    XMP_Index          itemIndex,
00817                    const tStringObj & itemValue,
00818                    XMP_OptionBits     options = 0 );
00819 
00820     //  --------------------------------------------------------------------------------------------
00842 
00843     void
00844     AppendArrayItem ( XMP_StringPtr  schemaNS,
00845                       XMP_StringPtr  arrayName,
00846                       XMP_OptionBits arrayOptions,
00847                       XMP_StringPtr  itemValue,
00848                       XMP_OptionBits itemOptions = 0 );
00849 
00850     //  --------------------------------------------------------------------------------------------
00853 
00854     void
00855     AppendArrayItem ( XMP_StringPtr      schemaNS,
00856                       XMP_StringPtr      arrayName,
00857                       XMP_OptionBits     arrayOptions,
00858                       const tStringObj & itemValue,
00859                       XMP_OptionBits     itemOptions = 0 );
00860 
00861     //  --------------------------------------------------------------------------------------------
00886 
00887     void
00888     SetStructField ( XMP_StringPtr   schemaNS,
00889                      XMP_StringPtr   structName,
00890                      XMP_StringPtr   fieldNS,
00891                      XMP_StringPtr   fieldName,
00892                      XMP_StringPtr   fieldValue,
00893                      XMP_OptionBits  options = 0 );
00894 
00895     //  --------------------------------------------------------------------------------------------
00898 
00899     void
00900     SetStructField ( XMP_StringPtr      schemaNS,
00901                      XMP_StringPtr      structName,
00902                      XMP_StringPtr      fieldNS,
00903                      XMP_StringPtr      fieldName,
00904                      const tStringObj & fieldValue,
00905                      XMP_OptionBits     options = 0 );
00906 
00907     //  --------------------------------------------------------------------------------------------
00934 
00935     void
00936     SetQualifier ( XMP_StringPtr  schemaNS,
00937                    XMP_StringPtr  propName,
00938                    XMP_StringPtr  qualNS,
00939                    XMP_StringPtr  qualName,
00940                    XMP_StringPtr  qualValue,
00941                    XMP_OptionBits options = 0 );
00942 
00943     //  --------------------------------------------------------------------------------------------
00946 
00947     void
00948     SetQualifier ( XMP_StringPtr      schemaNS,
00949                    XMP_StringPtr      propName,
00950                    XMP_StringPtr      qualNS,
00951                    XMP_StringPtr      qualName,
00952                    const tStringObj & qualValue,
00953                    XMP_OptionBits     options = 0 );
00954 
00956 
00957     // =============================================================================================
00958 
00959     //  --------------------------------------------------------------------------------------------
00963 
00964     //  --------------------------------------------------------------------------------------------
00971 
00972     void
00973     DeleteProperty ( XMP_StringPtr schemaNS,
00974                      XMP_StringPtr propName );
00975 
00976     //  --------------------------------------------------------------------------------------------
00987 
00988     void
00989     DeleteArrayItem ( XMP_StringPtr schemaNS,
00990                       XMP_StringPtr arrayName,
00991                       XMP_Index     itemIndex );
00992 
00993     //  --------------------------------------------------------------------------------------------
01007 
01008     void
01009     DeleteStructField ( XMP_StringPtr schemaNS,
01010                         XMP_StringPtr structName,
01011                         XMP_StringPtr fieldNS,
01012                         XMP_StringPtr fieldName );
01013 
01014     //  --------------------------------------------------------------------------------------------
01028 
01029     void
01030     DeleteQualifier ( XMP_StringPtr schemaNS,
01031                       XMP_StringPtr propName,
01032                       XMP_StringPtr qualNS,
01033                       XMP_StringPtr qualName );
01034 
01035     //  --------------------------------------------------------------------------------------------
01043 
01044     bool
01045     DoesPropertyExist ( XMP_StringPtr schemaNS,
01046                         XMP_StringPtr propName ) const;
01047 
01048     //  --------------------------------------------------------------------------------------------
01060 
01061     bool
01062     DoesArrayItemExist ( XMP_StringPtr schemaNS,
01063                          XMP_StringPtr arrayName,
01064                          XMP_Index     itemIndex ) const;
01065 
01066     //  --------------------------------------------------------------------------------------------
01081 
01082     bool
01083     DoesStructFieldExist ( XMP_StringPtr schemaNS,
01084                            XMP_StringPtr structName,
01085                            XMP_StringPtr fieldNS,
01086                            XMP_StringPtr fieldName ) const;
01087 
01088     //  --------------------------------------------------------------------------------------------
01103 
01104     bool
01105     DoesQualifierExist ( XMP_StringPtr schemaNS,
01106                          XMP_StringPtr propName,
01107                          XMP_StringPtr qualNS,
01108                          XMP_StringPtr qualName ) const;
01109 
01111 
01112     // =============================================================================================
01113     // Specialized Get and Set functions
01114     // =================================
01115 
01116     //  --------------------------------------------------------------------------------------------
01171 
01172     //  --------------------------------------------------------------------------------------------
01200 
01201     bool
01202     GetLocalizedText ( XMP_StringPtr    schemaNS,
01203                        XMP_StringPtr    altTextName,
01204                        XMP_StringPtr    genericLang,
01205                        XMP_StringPtr    specificLang,
01206                        tStringObj *     actualLang,
01207                        tStringObj *     itemValue,
01208                        XMP_OptionBits * options ) const;
01209 
01210     //  --------------------------------------------------------------------------------------------
01251 
01252     void
01253     SetLocalizedText ( XMP_StringPtr  schemaNS,
01254                        XMP_StringPtr  altTextName,
01255                        XMP_StringPtr  genericLang,
01256                        XMP_StringPtr  specificLang,
01257                        XMP_StringPtr  itemValue,
01258                        XMP_OptionBits options = 0 );
01259 
01260     //  --------------------------------------------------------------------------------------------
01263 
01264     void
01265     SetLocalizedText ( XMP_StringPtr      schemaNS,
01266                        XMP_StringPtr      altTextName,
01267                        XMP_StringPtr      genericLang,
01268                        XMP_StringPtr      specificLang,
01269                        const tStringObj & itemValue,
01270                        XMP_OptionBits     options = 0 );
01271 
01273 
01274     // =============================================================================================
01275 
01276     //  --------------------------------------------------------------------------------------------
01284 
01285     //  --------------------------------------------------------------------------------------------
01299 
01300     bool
01301     GetProperty_Bool ( XMP_StringPtr    schemaNS,
01302                        XMP_StringPtr    propName,
01303                        bool *           propValue,
01304                        XMP_OptionBits * options ) const;
01305 
01306     //  --------------------------------------------------------------------------------------------
01320 
01321     bool
01322     GetProperty_Int ( XMP_StringPtr    schemaNS,
01323                       XMP_StringPtr    propName,
01324                       long *           propValue,
01325                       XMP_OptionBits * options ) const;
01326 
01327     //  --------------------------------------------------------------------------------------------
01341 
01342     bool
01343     GetProperty_Int64 ( XMP_StringPtr    schemaNS,
01344                         XMP_StringPtr    propName,
01345                         long long *      propValue,
01346                         XMP_OptionBits * options ) const;
01347 
01348     //  --------------------------------------------------------------------------------------------
01362 
01363     bool
01364     GetProperty_Float ( XMP_StringPtr    schemaNS,
01365                         XMP_StringPtr    propName,
01366                         double *         propValue,
01367                         XMP_OptionBits * options ) const;
01368 
01369     //  --------------------------------------------------------------------------------------------
01383 
01384     bool
01385     GetProperty_Date ( XMP_StringPtr    schemaNS,
01386                        XMP_StringPtr    propName,
01387                        XMP_DateTime *   propValue,
01388                        XMP_OptionBits * options ) const;
01389 
01390     //  --------------------------------------------------------------------------------------------
01401 
01402     void
01403     SetProperty_Bool ( XMP_StringPtr  schemaNS,
01404                        XMP_StringPtr  propName,
01405                        bool           propValue,
01406                        XMP_OptionBits options = 0 );
01407 
01408     //  --------------------------------------------------------------------------------------------
01418 
01419     void
01420     SetProperty_Int ( XMP_StringPtr  schemaNS,
01421                       XMP_StringPtr  propName,
01422                       long           propValue,
01423                       XMP_OptionBits options = 0 );
01424 
01425     //  --------------------------------------------------------------------------------------------
01435 
01436     void
01437     SetProperty_Int64 ( XMP_StringPtr  schemaNS,
01438                         XMP_StringPtr  propName,
01439                         long long      propValue,
01440                         XMP_OptionBits options = 0 );
01441 
01442     //  --------------------------------------------------------------------------------------------
01452 
01453     void
01454     SetProperty_Float ( XMP_StringPtr  schemaNS,
01455                         XMP_StringPtr  propName,
01456                         double         propValue,
01457                         XMP_OptionBits options = 0 );
01458 
01459     //  --------------------------------------------------------------------------------------------
01469 
01470     void
01471     SetProperty_Date ( XMP_StringPtr         schemaNS,
01472                        XMP_StringPtr         propName,
01473                        const XMP_DateTime &  propValue,
01474                        XMP_OptionBits        options = 0 );
01475 
01477 
01478     // =============================================================================================
01479     // Miscellaneous Member Functions
01480     // ==============================
01481 
01482     //  --------------------------------------------------------------------------------------------
01485 
01486     //  --------------------------------------------------------------------------------------------
01489 
01490     XMPMetaRef
01491     GetInternalRef() const;
01492 
01493     //  --------------------------------------------------------------------------------------------
01495 
01496     void
01497     GetObjectName ( tStringObj * name ) const;
01498 
01499     //  --------------------------------------------------------------------------------------------
01501 
01502     void
01503     SetObjectName ( XMP_StringPtr name );
01504 
01505     //  --------------------------------------------------------------------------------------------
01507 
01508     void
01509     SetObjectName ( tStringObj name );
01510 
01511     //  --------------------------------------------------------------------------------------------
01513 
01514     XMP_OptionBits
01515     GetObjectOptions() const;
01516 
01517     //  --------------------------------------------------------------------------------------------
01521 
01522     void
01523     SetObjectOptions ( XMP_OptionBits options );
01524 
01525     //  --------------------------------------------------------------------------------------------
01546 
01547     TXMPMeta
01548     Clone ( XMP_OptionBits options = 0 ) const;
01549 
01550     //  --------------------------------------------------------------------------------------------
01552 
01553     XMP_Index
01554     CountArrayItems ( XMP_StringPtr schemaNS,
01555                       XMP_StringPtr arrayName ) const;
01556 
01557     //  --------------------------------------------------------------------------------------------
01561 
01562     void
01563     MarkStaleProperties ( XMP_OptionBits options = 0 );
01564 
01565     //  --------------------------------------------------------------------------------------------
01567 
01568     XMP_Status
01569     DumpObject ( XMP_TextOutputProc outProc,
01570                  void *             refCon ) const;
01571 
01573 
01574     // =============================================================================================
01575 
01576     //  --------------------------------------------------------------------------------------------
01582 
01583     //  --------------------------------------------------------------------------------------------
01602 
01603     void
01604     ParseFromBuffer ( XMP_StringPtr  buffer,
01605                       XMP_StringLen  bufferSize,
01606                       XMP_OptionBits options = 0 );
01607 
01608     //  --------------------------------------------------------------------------------------------
01650 
01651     void
01652     SerializeToBuffer ( tStringObj *   rdfString,
01653                         XMP_OptionBits options,
01654                         XMP_StringLen  padding,
01655                         XMP_StringPtr  newline,
01656                         XMP_StringPtr  indent = "",
01657                         XMP_Index      baseIndent = 0 ) const;
01658 
01659     //  --------------------------------------------------------------------------------------------
01663 
01664     void
01665     SerializeToBuffer ( tStringObj *   rdfString,
01666                         XMP_OptionBits options = 0,
01667                         XMP_StringLen  padding = 0 ) const;
01668 
01670 
01671     // =============================================================================================
01672 
01673     XMPMetaRef xmpRef;  // *** Should be private, see below.
01674 
01675 private:
01676 
01677 #if 0   // *** VS.Net and gcc seem to not handle the friend declarations properly.
01678     friend class TXMPIterator <class tStringObj>;
01679     friend class TXMPUtils <class tStringObj>;
01680 #endif
01681 
01682 };  // class TXMPMeta
01683 
01684 #endif  // __TXMPMeta_hpp__

Generated on Mon Jan 2 12:25:54 2006 for Adobe XMP Toolkit by doxygen 1.3.3