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 
00201 
00202     //  --------------------------------------------------------------------------------------------
00205 
00209 
00210     static void
00211     RegisterAssertNotify ( XMP_AssertNotifyProc notifyProc,
00212                            void *               refCon );
00213 
00216 
00217     static void
00218     UnregisterAssertNotify ( XMP_AssertNotifyProc notifyProc );
00219 
00224 
00225     static void
00226     SendAssertNotify ( XMP_StringPtr message );
00227 
00229 
00230     //  --------------------------------------------------------------------------------------------
00235 
00237 
00238     static XMP_Status
00239     DumpNamespaces ( XMP_TextOutputProc outProc,
00240                      void *             refCon );
00241 
00243 
00244     static XMP_Status
00245     DumpAliases ( XMP_TextOutputProc outProc,
00246                   void *             refCon );
00247 
00251 
00252     static XMP_Status
00253     DumpPropertyTraits ( XMP_TextOutputProc outProc,
00254                          void *             refCon );
00255 
00257 
00258     //  --------------------------------------------------------------------------------------------
00268 
00269     //  --------------------------------------------------------------------------------------------
00287 
00288     static bool
00289     RegisterNamespace ( XMP_StringPtr namespaceURI,
00290                         XMP_StringPtr suggestedPrefix,
00291                         tStringObj *  registeredPrefix );
00292 
00293     //  --------------------------------------------------------------------------------------------
00304 
00305     static bool
00306     GetNamespacePrefix ( XMP_StringPtr namespaceURI,
00307                          tStringObj *  namespacePrefix );
00308 
00309     //  --------------------------------------------------------------------------------------------
00320 
00321     static bool
00322     GetNamespaceURI ( XMP_StringPtr namespacePrefix,
00323                       tStringObj *  namespaceURI );
00324 
00325     //  --------------------------------------------------------------------------------------------
00334 
00335     static void
00336     DeleteNamespace ( XMP_StringPtr namespaceURI );
00337 
00339 
00340     //  --------------------------------------------------------------------------------------------
00355 
00356     //  --------------------------------------------------------------------------------------------
00392 
00393     static void
00394     RegisterAlias ( XMP_StringPtr  aliasNS,
00395                     XMP_StringPtr  aliasProp,
00396                     XMP_StringPtr  actualNS,
00397                     XMP_StringPtr  actualProp,
00398                     XMP_OptionBits arrayForm = kXMP_NoOptions );
00399 
00400     //  --------------------------------------------------------------------------------------------
00420 
00421     static bool
00422     ResolveAlias ( XMP_StringPtr    aliasNS,
00423                    XMP_StringPtr    aliasProp,
00424                    tStringObj *     actualNS,
00425                    tStringObj *     actualProp,
00426                    XMP_OptionBits * arrayForm );
00427 
00428     //  --------------------------------------------------------------------------------------------
00439 
00440     static void
00441     DeleteAlias ( XMP_StringPtr aliasNS,
00442                   XMP_StringPtr aliasProp );
00443 
00444     //  --------------------------------------------------------------------------------------------
00451 
00452     static void
00453     RegisterStandardAliases ( XMP_StringPtr schemaNS );
00454 
00456 
00457     //  --------------------------------------------------------------------------------------------
00470 
00471     static void
00472     RegisterPropertyTraits ( XMP_StringPtr  schemaNS,
00473                              XMP_StringPtr  propName,
00474                              XMP_OptionBits options );
00475 
00476     // =============================================================================================
00477     // Basic property manipulation functions
00478     // =====================================
00479 
00480     // *** Should add discussion of schemaNS and propName prefix usage.
00481 
00482     //  --------------------------------------------------------------------------------------------
00544 
00545     //  --------------------------------------------------------------------------------------------
00567 
00568     bool
00569     GetProperty ( XMP_StringPtr    schemaNS,
00570                   XMP_StringPtr    propName,
00571                   tStringObj *     propValue,
00572                   XMP_OptionBits * options ) const;
00573 
00574     //  --------------------------------------------------------------------------------------------
00595 
00596     bool
00597     GetArrayItem ( XMP_StringPtr    schemaNS,
00598                    XMP_StringPtr    arrayName,
00599                    XMP_Index        itemIndex,
00600                    tStringObj *     itemValue,
00601                    XMP_OptionBits * options ) const;
00602 
00603     //  --------------------------------------------------------------------------------------------
00631 
00632     bool
00633     GetStructField ( XMP_StringPtr    schemaNS,
00634                      XMP_StringPtr    structName,
00635                      XMP_StringPtr    fieldNS,
00636                      XMP_StringPtr    fieldName,
00637                      tStringObj *     fieldValue,
00638                      XMP_OptionBits * options ) const;
00639 
00640     //  --------------------------------------------------------------------------------------------
00673 
00674     bool
00675     GetQualifier ( XMP_StringPtr    schemaNS,
00676                    XMP_StringPtr    propName,
00677                    XMP_StringPtr    qualNS,
00678                    XMP_StringPtr    qualName,
00679                    tStringObj *     qualValue,
00680                    XMP_OptionBits * options ) const;
00681 
00683 
00684     // =============================================================================================
00685 
00686     //  --------------------------------------------------------------------------------------------
00730 
00731     //  --------------------------------------------------------------------------------------------
00744 
00745     void
00746     SetProperty ( XMP_StringPtr  schemaNS,
00747                   XMP_StringPtr  propName,
00748                   XMP_StringPtr  propValue,
00749                   XMP_OptionBits options = 0 );
00750 
00751     //  --------------------------------------------------------------------------------------------
00754 
00755     void
00756     SetProperty ( XMP_StringPtr      schemaNS,
00757                   XMP_StringPtr      propName,
00758                   const tStringObj & propValue,
00759                   XMP_OptionBits     options = 0 );
00760 
00761     //  --------------------------------------------------------------------------------------------
00786 
00787     void
00788     SetArrayItem ( XMP_StringPtr  schemaNS,
00789                    XMP_StringPtr  arrayName,
00790                    XMP_Index      itemIndex,
00791                    XMP_StringPtr  itemValue,
00792                    XMP_OptionBits options = 0 );
00793 
00794     //  --------------------------------------------------------------------------------------------
00797 
00798     void
00799     SetArrayItem ( XMP_StringPtr      schemaNS,
00800                    XMP_StringPtr      arrayName,
00801                    XMP_Index          itemIndex,
00802                    const tStringObj & itemValue,
00803                    XMP_OptionBits     options = 0 );
00804 
00805     //  --------------------------------------------------------------------------------------------
00827 
00828     void
00829     AppendArrayItem ( XMP_StringPtr  schemaNS,
00830                       XMP_StringPtr  arrayName,
00831                       XMP_OptionBits arrayOptions,
00832                       XMP_StringPtr  itemValue,
00833                       XMP_OptionBits itemOptions = 0 );
00834 
00835     //  --------------------------------------------------------------------------------------------
00838 
00839     void
00840     AppendArrayItem ( XMP_StringPtr      schemaNS,
00841                       XMP_StringPtr      arrayName,
00842                       XMP_OptionBits     arrayOptions,
00843                       const tStringObj & itemValue,
00844                       XMP_OptionBits     itemOptions = 0 );
00845 
00846     //  --------------------------------------------------------------------------------------------
00871 
00872     void
00873     SetStructField ( XMP_StringPtr   schemaNS,
00874                      XMP_StringPtr   structName,
00875                      XMP_StringPtr   fieldNS,
00876                      XMP_StringPtr   fieldName,
00877                      XMP_StringPtr   fieldValue,
00878                      XMP_OptionBits  options = 0 );
00879 
00880     //  --------------------------------------------------------------------------------------------
00883 
00884     void
00885     SetStructField ( XMP_StringPtr      schemaNS,
00886                      XMP_StringPtr      structName,
00887                      XMP_StringPtr      fieldNS,
00888                      XMP_StringPtr      fieldName,
00889                      const tStringObj & fieldValue,
00890                      XMP_OptionBits     options = 0 );
00891 
00892     //  --------------------------------------------------------------------------------------------
00919 
00920     void
00921     SetQualifier ( XMP_StringPtr  schemaNS,
00922                    XMP_StringPtr  propName,
00923                    XMP_StringPtr  qualNS,
00924                    XMP_StringPtr  qualName,
00925                    XMP_StringPtr  qualValue,
00926                    XMP_OptionBits options = 0 );
00927 
00928     //  --------------------------------------------------------------------------------------------
00931 
00932     void
00933     SetQualifier ( XMP_StringPtr      schemaNS,
00934                    XMP_StringPtr      propName,
00935                    XMP_StringPtr      qualNS,
00936                    XMP_StringPtr      qualName,
00937                    const tStringObj & qualValue,
00938                    XMP_OptionBits     options = 0 );
00939 
00941 
00942     // =============================================================================================
00943 
00944     //  --------------------------------------------------------------------------------------------
00948 
00949     //  --------------------------------------------------------------------------------------------
00956 
00957     void
00958     DeleteProperty ( XMP_StringPtr schemaNS,
00959                      XMP_StringPtr propName );
00960 
00961     //  --------------------------------------------------------------------------------------------
00972 
00973     void
00974     DeleteArrayItem ( XMP_StringPtr schemaNS,
00975                       XMP_StringPtr arrayName,
00976                       XMP_Index     itemIndex );
00977 
00978     //  --------------------------------------------------------------------------------------------
00992 
00993     void
00994     DeleteStructField ( XMP_StringPtr schemaNS,
00995                         XMP_StringPtr structName,
00996                         XMP_StringPtr fieldNS,
00997                         XMP_StringPtr fieldName );
00998 
00999     //  --------------------------------------------------------------------------------------------
01013 
01014     void
01015     DeleteQualifier ( XMP_StringPtr schemaNS,
01016                       XMP_StringPtr propName,
01017                       XMP_StringPtr qualNS,
01018                       XMP_StringPtr qualName );
01019 
01020     //  --------------------------------------------------------------------------------------------
01028 
01029     bool
01030     DoesPropertyExist ( XMP_StringPtr schemaNS,
01031                         XMP_StringPtr propName ) const;
01032 
01033     //  --------------------------------------------------------------------------------------------
01045 
01046     bool
01047     DoesArrayItemExist ( XMP_StringPtr schemaNS,
01048                          XMP_StringPtr arrayName,
01049                          XMP_Index     itemIndex ) const;
01050 
01051     //  --------------------------------------------------------------------------------------------
01066 
01067     bool
01068     DoesStructFieldExist ( XMP_StringPtr schemaNS,
01069                            XMP_StringPtr structName,
01070                            XMP_StringPtr fieldNS,
01071                            XMP_StringPtr fieldName ) const;
01072 
01073     //  --------------------------------------------------------------------------------------------
01088 
01089     bool
01090     DoesQualifierExist ( XMP_StringPtr schemaNS,
01091                          XMP_StringPtr propName,
01092                          XMP_StringPtr qualNS,
01093                          XMP_StringPtr qualName ) const;
01094 
01096 
01097     // =============================================================================================
01098     // Specialized Get and Set functions
01099     // =================================
01100 
01101     //  --------------------------------------------------------------------------------------------
01156 
01157     //  --------------------------------------------------------------------------------------------
01185 
01186     bool
01187     GetLocalizedText ( XMP_StringPtr    schemaNS,
01188                        XMP_StringPtr    altTextName,
01189                        XMP_StringPtr    genericLang,
01190                        XMP_StringPtr    specificLang,
01191                        tStringObj *     actualLang,
01192                        tStringObj *     itemValue,
01193                        XMP_OptionBits * options ) const;
01194 
01195     //  --------------------------------------------------------------------------------------------
01236 
01237     void
01238     SetLocalizedText ( XMP_StringPtr  schemaNS,
01239                        XMP_StringPtr  altTextName,
01240                        XMP_StringPtr  genericLang,
01241                        XMP_StringPtr  specificLang,
01242                        XMP_StringPtr  itemValue,
01243                        XMP_OptionBits options = 0 );
01244 
01245     //  --------------------------------------------------------------------------------------------
01248 
01249     void
01250     SetLocalizedText ( XMP_StringPtr      schemaNS,
01251                        XMP_StringPtr      altTextName,
01252                        XMP_StringPtr      genericLang,
01253                        XMP_StringPtr      specificLang,
01254                        const tStringObj & itemValue,
01255                        XMP_OptionBits     options = 0 );
01256 
01258 
01259     // =============================================================================================
01260 
01261     //  --------------------------------------------------------------------------------------------
01269 
01270     //  --------------------------------------------------------------------------------------------
01284 
01285     bool
01286     GetProperty_Bool ( XMP_StringPtr    schemaNS,
01287                        XMP_StringPtr    propName,
01288                        bool *           propValue,
01289                        XMP_OptionBits * options ) const;
01290 
01291     //  --------------------------------------------------------------------------------------------
01305 
01306     bool
01307     GetProperty_Int ( XMP_StringPtr    schemaNS,
01308                       XMP_StringPtr    propName,
01309                       long *           propValue,
01310                       XMP_OptionBits * options ) const;
01311 
01312     //  --------------------------------------------------------------------------------------------
01326 
01327     bool
01328     GetProperty_Int64 ( XMP_StringPtr    schemaNS,
01329                         XMP_StringPtr    propName,
01330                         long long *      propValue,
01331                         XMP_OptionBits * options ) const;
01332 
01333     //  --------------------------------------------------------------------------------------------
01347 
01348     bool
01349     GetProperty_Float ( XMP_StringPtr    schemaNS,
01350                         XMP_StringPtr    propName,
01351                         double *         propValue,
01352                         XMP_OptionBits * options ) const;
01353 
01354     //  --------------------------------------------------------------------------------------------
01368 
01369     bool
01370     GetProperty_Date ( XMP_StringPtr    schemaNS,
01371                        XMP_StringPtr    propName,
01372                        XMP_DateTime *   propValue,
01373                        XMP_OptionBits * options ) const;
01374 
01375     //  --------------------------------------------------------------------------------------------
01386 
01387     void
01388     SetProperty_Bool ( XMP_StringPtr  schemaNS,
01389                        XMP_StringPtr  propName,
01390                        bool           propValue,
01391                        XMP_OptionBits options = 0 );
01392 
01393     //  --------------------------------------------------------------------------------------------
01403 
01404     void
01405     SetProperty_Int ( XMP_StringPtr  schemaNS,
01406                       XMP_StringPtr  propName,
01407                       long           propValue,
01408                       XMP_OptionBits options = 0 );
01409 
01410     //  --------------------------------------------------------------------------------------------
01420 
01421     void
01422     SetProperty_Int64 ( XMP_StringPtr  schemaNS,
01423                         XMP_StringPtr  propName,
01424                         long long      propValue,
01425                         XMP_OptionBits options = 0 );
01426 
01427     //  --------------------------------------------------------------------------------------------
01437 
01438     void
01439     SetProperty_Float ( XMP_StringPtr  schemaNS,
01440                         XMP_StringPtr  propName,
01441                         double         propValue,
01442                         XMP_OptionBits options = 0 );
01443 
01444     //  --------------------------------------------------------------------------------------------
01454 
01455     void
01456     SetProperty_Date ( XMP_StringPtr         schemaNS,
01457                        XMP_StringPtr         propName,
01458                        const XMP_DateTime &  propValue,
01459                        XMP_OptionBits        options = 0 );
01460 
01462 
01463     // =============================================================================================
01464     // Miscellaneous Member Functions
01465     // ==============================
01466 
01467     //  --------------------------------------------------------------------------------------------
01470 
01471     //  --------------------------------------------------------------------------------------------
01474 
01475     XMPMetaRef
01476     GetInternalRef() const;
01477 
01478     //  --------------------------------------------------------------------------------------------
01480 
01481     void
01482     GetObjectName ( tStringObj * name ) const;
01483 
01484     //  --------------------------------------------------------------------------------------------
01486 
01487     void
01488     SetObjectName ( XMP_StringPtr name );
01489 
01490     //  --------------------------------------------------------------------------------------------
01492 
01493     void
01494     SetObjectName ( tStringObj name );
01495 
01496     //  --------------------------------------------------------------------------------------------
01498 
01499     XMP_OptionBits
01500     GetObjectOptions() const;
01501 
01502     //  --------------------------------------------------------------------------------------------
01506 
01507     void
01508     SetObjectOptions ( XMP_OptionBits options );
01509 
01510     //  --------------------------------------------------------------------------------------------
01531 
01532     TXMPMeta
01533     Clone ( XMP_OptionBits options = 0 ) const;
01534 
01535     //  --------------------------------------------------------------------------------------------
01537 
01538     XMP_Index
01539     CountArrayItems ( XMP_StringPtr schemaNS,
01540                       XMP_StringPtr arrayName ) const;
01541 
01542     //  --------------------------------------------------------------------------------------------
01546 
01547     void
01548     MarkStaleProperties ( XMP_OptionBits options = 0 );
01549 
01550     //  --------------------------------------------------------------------------------------------
01552 
01553     XMP_Status
01554     DumpObject ( XMP_TextOutputProc outProc,
01555                  void *             refCon ) const;
01556 
01558 
01559     // =============================================================================================
01560 
01561     //  --------------------------------------------------------------------------------------------
01567 
01568     //  --------------------------------------------------------------------------------------------
01587 
01588     void
01589     ParseFromBuffer ( XMP_StringPtr  buffer,
01590                       XMP_StringLen  bufferSize,
01591                       XMP_OptionBits options = 0 );
01592 
01593     //  --------------------------------------------------------------------------------------------
01635 
01636     void
01637     SerializeToBuffer ( tStringObj *   rdfString,
01638                         XMP_OptionBits options,
01639                         XMP_StringLen  padding,
01640                         XMP_StringPtr  newline,
01641                         XMP_StringPtr  indent = "",
01642                         XMP_Index      baseIndent = 0 ) const;
01643 
01644     //  --------------------------------------------------------------------------------------------
01648 
01649     void
01650     SerializeToBuffer ( tStringObj *   rdfString,
01651                         XMP_OptionBits options = 0,
01652                         XMP_StringLen  padding = 0 ) const;
01653 
01655 
01656     // =============================================================================================
01657 
01658     XMPMetaRef xmpRef;  // *** Should be private, see below.
01659 
01660 private:
01661 
01662 #if 0   // *** VS.Net and gcc seem to not handle the friend declarations properly.
01663     friend class TXMPIterator <class tStringObj>;
01664     friend class TXMPUtils <class tStringObj>;
01665 #endif
01666 
01667 };  // class TXMPMeta
01668 
01669 #endif  // __TXMPMeta_hpp__

Generated on Tue Jul 5 10:06:21 2005 for Adobe XMP Toolkit by doxygen 1.3.3