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-2007 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 //  ================================================================================================
00063 //  ================================================================================================
00064 
00065 template <class tStringObj> class TXMPIterator;
00066 template <class tStringObj> class TXMPUtils;
00067 
00068 // -------------------------------------------------------------------------------------------------
00069 
00070 template <class tStringObj>
00071 class TXMPMeta {
00072 
00073 public:
00074 
00075     // =============================================================================================
00076     // Initialization and termination
00077     // ==============================
00078 
00079     //  --------------------------------------------------------------------------------------------
00082 
00083     //  --------------------------------------------------------------------------------------------
00085 
00086     static void
00087     GetVersionInfo ( XMP_VersionInfo * info );
00088 
00089     //  --------------------------------------------------------------------------------------------
00094 
00095     static bool
00096     Initialize();
00097     //  --------------------------------------------------------------------------------------------
00099 
00100     static void
00101     Terminate();
00102 
00104 
00105     // =============================================================================================
00106     // Constuctors and destructor
00107     // =========================
00108 
00109     //  --------------------------------------------------------------------------------------------
00112 
00113     //  --------------------------------------------------------------------------------------------
00117 
00118     TXMPMeta();
00119 
00120     //  --------------------------------------------------------------------------------------------
00124 
00125     TXMPMeta ( const TXMPMeta<tStringObj> & original );
00126 
00127     //  --------------------------------------------------------------------------------------------
00132 
00133     void operator= ( const TXMPMeta<tStringObj> & rhs );
00134 
00135     //  --------------------------------------------------------------------------------------------
00141 
00142     TXMPMeta ( XMPMetaRef xmpRef );
00143 
00144     //  --------------------------------------------------------------------------------------------
00157 
00158     TXMPMeta ( XMP_StringPtr buffer,
00159                XMP_StringLen xmpSize );
00160 
00161     //  --------------------------------------------------------------------------------------------
00163 
00164     virtual ~TXMPMeta() throw();
00165 
00167 
00168     // =============================================================================================
00169     // Global state functions
00170     // ======================
00171 
00172     //  --------------------------------------------------------------------------------------------
00177 
00179 
00180     static XMP_OptionBits
00181     GetGlobalOptions();
00182 
00188 
00189     static void
00190     SetGlobalOptions ( XMP_OptionBits options );
00191 
00193 
00194     //  --------------------------------------------------------------------------------------------
00199 
00201 
00202     static XMP_Status
00203     DumpNamespaces ( XMP_TextOutputProc outProc,
00204                      void *             refCon );
00205 
00207 
00208     static XMP_Status
00209     DumpAliases ( XMP_TextOutputProc outProc,
00210                   void *             refCon );
00211 
00213 
00214     //  --------------------------------------------------------------------------------------------
00224 
00225     //  --------------------------------------------------------------------------------------------
00243 
00244     static bool
00245     RegisterNamespace ( XMP_StringPtr namespaceURI,
00246                         XMP_StringPtr suggestedPrefix,
00247                         tStringObj *  registeredPrefix );
00248 
00249     //  --------------------------------------------------------------------------------------------
00260 
00261     static bool
00262     GetNamespacePrefix ( XMP_StringPtr namespaceURI,
00263                          tStringObj *  namespacePrefix );
00264 
00265     //  --------------------------------------------------------------------------------------------
00276 
00277     static bool
00278     GetNamespaceURI ( XMP_StringPtr namespacePrefix,
00279                       tStringObj *  namespaceURI );
00280 
00281     //  --------------------------------------------------------------------------------------------
00290 
00291     static void
00292     DeleteNamespace ( XMP_StringPtr namespaceURI );
00293 
00295 
00296     //  --------------------------------------------------------------------------------------------
00311 
00312     //  --------------------------------------------------------------------------------------------
00348 
00349     static void
00350     RegisterAlias ( XMP_StringPtr  aliasNS,
00351                     XMP_StringPtr  aliasProp,
00352                     XMP_StringPtr  actualNS,
00353                     XMP_StringPtr  actualProp,
00354                     XMP_OptionBits arrayForm = kXMP_NoOptions );
00355 
00356     //  --------------------------------------------------------------------------------------------
00382 
00383     static bool
00384     ResolveAlias ( XMP_StringPtr    aliasNS,
00385                    XMP_StringPtr    aliasProp,
00386                    tStringObj *     actualNS,
00387                    tStringObj *     actualProp,
00388                    XMP_OptionBits * arrayForm );
00389 
00390     //  --------------------------------------------------------------------------------------------
00401 
00402     static void
00403     DeleteAlias ( XMP_StringPtr aliasNS,
00404                   XMP_StringPtr aliasProp );
00405 
00406     //  --------------------------------------------------------------------------------------------
00413 
00414     static void
00415     RegisterStandardAliases ( XMP_StringPtr schemaNS );
00416 
00418 
00419     // =============================================================================================
00420     // Basic property manipulation functions
00421     // =====================================
00422 
00423     // *** Should add discussion of schemaNS and propName prefix usage.
00424 
00425     //  --------------------------------------------------------------------------------------------
00484 
00485     //  --------------------------------------------------------------------------------------------
00507 
00508     bool
00509     GetProperty ( XMP_StringPtr    schemaNS,
00510                   XMP_StringPtr    propName,
00511                   tStringObj *     propValue,
00512                   XMP_OptionBits * options ) const;
00513 
00514     //  --------------------------------------------------------------------------------------------
00535 
00536     bool
00537     GetArrayItem ( XMP_StringPtr    schemaNS,
00538                    XMP_StringPtr    arrayName,
00539                    XMP_Index        itemIndex,
00540                    tStringObj *     itemValue,
00541                    XMP_OptionBits * options ) const;
00542 
00543     //  --------------------------------------------------------------------------------------------
00571 
00572     bool
00573     GetStructField ( XMP_StringPtr    schemaNS,
00574                      XMP_StringPtr    structName,
00575                      XMP_StringPtr    fieldNS,
00576                      XMP_StringPtr    fieldName,
00577                      tStringObj *     fieldValue,
00578                      XMP_OptionBits * options ) const;
00579 
00580     //  --------------------------------------------------------------------------------------------
00613 
00614     bool
00615     GetQualifier ( XMP_StringPtr    schemaNS,
00616                    XMP_StringPtr    propName,
00617                    XMP_StringPtr    qualNS,
00618                    XMP_StringPtr    qualName,
00619                    tStringObj *     qualValue,
00620                    XMP_OptionBits * options ) const;
00621 
00623 
00624     // =============================================================================================
00625 
00626     //  --------------------------------------------------------------------------------------------
00670 
00671     //  --------------------------------------------------------------------------------------------
00684 
00685     void
00686     SetProperty ( XMP_StringPtr  schemaNS,
00687                   XMP_StringPtr  propName,
00688                   XMP_StringPtr  propValue,
00689                   XMP_OptionBits options = 0 );
00690 
00691     //  --------------------------------------------------------------------------------------------
00694 
00695     void
00696     SetProperty ( XMP_StringPtr      schemaNS,
00697                   XMP_StringPtr      propName,
00698                   const tStringObj & propValue,
00699                   XMP_OptionBits     options = 0 );
00700 
00701     //  --------------------------------------------------------------------------------------------
00726 
00727     void
00728     SetArrayItem ( XMP_StringPtr  schemaNS,
00729                    XMP_StringPtr  arrayName,
00730                    XMP_Index      itemIndex,
00731                    XMP_StringPtr  itemValue,
00732                    XMP_OptionBits options = 0 );
00733 
00734     //  --------------------------------------------------------------------------------------------
00737 
00738     void
00739     SetArrayItem ( XMP_StringPtr      schemaNS,
00740                    XMP_StringPtr      arrayName,
00741                    XMP_Index          itemIndex,
00742                    const tStringObj & itemValue,
00743                    XMP_OptionBits     options = 0 );
00744 
00745     //  --------------------------------------------------------------------------------------------
00767 
00768     void
00769     AppendArrayItem ( XMP_StringPtr  schemaNS,
00770                       XMP_StringPtr  arrayName,
00771                       XMP_OptionBits arrayOptions,
00772                       XMP_StringPtr  itemValue,
00773                       XMP_OptionBits itemOptions = 0 );
00774 
00775     //  --------------------------------------------------------------------------------------------
00778 
00779     void
00780     AppendArrayItem ( XMP_StringPtr      schemaNS,
00781                       XMP_StringPtr      arrayName,
00782                       XMP_OptionBits     arrayOptions,
00783                       const tStringObj & itemValue,
00784                       XMP_OptionBits     itemOptions = 0 );
00785 
00786     //  --------------------------------------------------------------------------------------------
00811 
00812     void
00813     SetStructField ( XMP_StringPtr   schemaNS,
00814                      XMP_StringPtr   structName,
00815                      XMP_StringPtr   fieldNS,
00816                      XMP_StringPtr   fieldName,
00817                      XMP_StringPtr   fieldValue,
00818                      XMP_OptionBits  options = 0 );
00819 
00820     //  --------------------------------------------------------------------------------------------
00823 
00824     void
00825     SetStructField ( XMP_StringPtr      schemaNS,
00826                      XMP_StringPtr      structName,
00827                      XMP_StringPtr      fieldNS,
00828                      XMP_StringPtr      fieldName,
00829                      const tStringObj & fieldValue,
00830                      XMP_OptionBits     options = 0 );
00831 
00832     //  --------------------------------------------------------------------------------------------
00859 
00860     void
00861     SetQualifier ( XMP_StringPtr  schemaNS,
00862                    XMP_StringPtr  propName,
00863                    XMP_StringPtr  qualNS,
00864                    XMP_StringPtr  qualName,
00865                    XMP_StringPtr  qualValue,
00866                    XMP_OptionBits options = 0 );
00867 
00868     //  --------------------------------------------------------------------------------------------
00871 
00872     void
00873     SetQualifier ( XMP_StringPtr      schemaNS,
00874                    XMP_StringPtr      propName,
00875                    XMP_StringPtr      qualNS,
00876                    XMP_StringPtr      qualName,
00877                    const tStringObj & qualValue,
00878                    XMP_OptionBits     options = 0 );
00879 
00881 
00882     // =============================================================================================
00883 
00884     //  --------------------------------------------------------------------------------------------
00888 
00889     //  --------------------------------------------------------------------------------------------
00896 
00897     void
00898     DeleteProperty ( XMP_StringPtr schemaNS,
00899                      XMP_StringPtr propName );
00900 
00901     //  --------------------------------------------------------------------------------------------
00912 
00913     void
00914     DeleteArrayItem ( XMP_StringPtr schemaNS,
00915                       XMP_StringPtr arrayName,
00916                       XMP_Index     itemIndex );
00917 
00918     //  --------------------------------------------------------------------------------------------
00932 
00933     void
00934     DeleteStructField ( XMP_StringPtr schemaNS,
00935                         XMP_StringPtr structName,
00936                         XMP_StringPtr fieldNS,
00937                         XMP_StringPtr fieldName );
00938 
00939     //  --------------------------------------------------------------------------------------------
00953 
00954     void
00955     DeleteQualifier ( XMP_StringPtr schemaNS,
00956                       XMP_StringPtr propName,
00957                       XMP_StringPtr qualNS,
00958                       XMP_StringPtr qualName );
00959 
00960     //  --------------------------------------------------------------------------------------------
00968 
00969     bool
00970     DoesPropertyExist ( XMP_StringPtr schemaNS,
00971                         XMP_StringPtr propName ) const;
00972 
00973     //  --------------------------------------------------------------------------------------------
00985 
00986     bool
00987     DoesArrayItemExist ( XMP_StringPtr schemaNS,
00988                          XMP_StringPtr arrayName,
00989                          XMP_Index     itemIndex ) const;
00990 
00991     //  --------------------------------------------------------------------------------------------
01006 
01007     bool
01008     DoesStructFieldExist ( XMP_StringPtr schemaNS,
01009                            XMP_StringPtr structName,
01010                            XMP_StringPtr fieldNS,
01011                            XMP_StringPtr fieldName ) const;
01012 
01013     //  --------------------------------------------------------------------------------------------
01028 
01029     bool
01030     DoesQualifierExist ( XMP_StringPtr schemaNS,
01031                          XMP_StringPtr propName,
01032                          XMP_StringPtr qualNS,
01033                          XMP_StringPtr qualName ) const;
01034 
01036 
01037     // =============================================================================================
01038     // Specialized Get and Set functions
01039     // =================================
01040 
01041     //  --------------------------------------------------------------------------------------------
01094 
01095     //  --------------------------------------------------------------------------------------------
01123 
01124     bool
01125     GetLocalizedText ( XMP_StringPtr    schemaNS,
01126                        XMP_StringPtr    altTextName,
01127                        XMP_StringPtr    genericLang,
01128                        XMP_StringPtr    specificLang,
01129                        tStringObj *     actualLang,
01130                        tStringObj *     itemValue,
01131                        XMP_OptionBits * options ) const;
01132 
01133     //  --------------------------------------------------------------------------------------------
01174 
01175     void
01176     SetLocalizedText ( XMP_StringPtr  schemaNS,
01177                        XMP_StringPtr  altTextName,
01178                        XMP_StringPtr  genericLang,
01179                        XMP_StringPtr  specificLang,
01180                        XMP_StringPtr  itemValue,
01181                        XMP_OptionBits options = 0 );
01182 
01183     //  --------------------------------------------------------------------------------------------
01186 
01187     void
01188     SetLocalizedText ( XMP_StringPtr      schemaNS,
01189                        XMP_StringPtr      altTextName,
01190                        XMP_StringPtr      genericLang,
01191                        XMP_StringPtr      specificLang,
01192                        const tStringObj & itemValue,
01193                        XMP_OptionBits     options = 0 );
01194 
01196 
01197     // =============================================================================================
01198 
01199     //  --------------------------------------------------------------------------------------------
01207 
01208     //  --------------------------------------------------------------------------------------------
01222 
01223     bool
01224     GetProperty_Bool ( XMP_StringPtr    schemaNS,
01225                        XMP_StringPtr    propName,
01226                        bool *           propValue,
01227                        XMP_OptionBits * options ) const;
01228 
01229     //  --------------------------------------------------------------------------------------------
01243 
01244     bool
01245     GetProperty_Int ( XMP_StringPtr    schemaNS,
01246                       XMP_StringPtr    propName,
01247                       long *           propValue,
01248                       XMP_OptionBits * options ) const;
01249 
01250     //  --------------------------------------------------------------------------------------------
01264 
01265     bool
01266     GetProperty_Int64 ( XMP_StringPtr    schemaNS,
01267                         XMP_StringPtr    propName,
01268                         long long *      propValue,
01269                         XMP_OptionBits * options ) const;
01270 
01271     //  --------------------------------------------------------------------------------------------
01285 
01286     bool
01287     GetProperty_Float ( XMP_StringPtr    schemaNS,
01288                         XMP_StringPtr    propName,
01289                         double *         propValue,
01290                         XMP_OptionBits * options ) const;
01291 
01292     //  --------------------------------------------------------------------------------------------
01306 
01307     bool
01308     GetProperty_Date ( XMP_StringPtr    schemaNS,
01309                        XMP_StringPtr    propName,
01310                        XMP_DateTime *   propValue,
01311                        XMP_OptionBits * options ) const;
01312 
01313     //  --------------------------------------------------------------------------------------------
01324 
01325     void
01326     SetProperty_Bool ( XMP_StringPtr  schemaNS,
01327                        XMP_StringPtr  propName,
01328                        bool           propValue,
01329                        XMP_OptionBits options = 0 );
01330 
01331     //  --------------------------------------------------------------------------------------------
01341 
01342     void
01343     SetProperty_Int ( XMP_StringPtr  schemaNS,
01344                       XMP_StringPtr  propName,
01345                       long           propValue,
01346                       XMP_OptionBits options = 0 );
01347 
01348     //  --------------------------------------------------------------------------------------------
01358 
01359     void
01360     SetProperty_Int64 ( XMP_StringPtr  schemaNS,
01361                         XMP_StringPtr  propName,
01362                         long long      propValue,
01363                         XMP_OptionBits options = 0 );
01364 
01365     //  --------------------------------------------------------------------------------------------
01375 
01376     void
01377     SetProperty_Float ( XMP_StringPtr  schemaNS,
01378                         XMP_StringPtr  propName,
01379                         double         propValue,
01380                         XMP_OptionBits options = 0 );
01381 
01382     //  --------------------------------------------------------------------------------------------
01392 
01393     void
01394     SetProperty_Date ( XMP_StringPtr         schemaNS,
01395                        XMP_StringPtr         propName,
01396                        const XMP_DateTime &  propValue,
01397                        XMP_OptionBits        options = 0 );
01398 
01400 
01401     // =============================================================================================
01402     // Miscellaneous Member Functions
01403     // ==============================
01404 
01405     //  --------------------------------------------------------------------------------------------
01408 
01409     //  --------------------------------------------------------------------------------------------
01412 
01413     XMPMetaRef
01414     GetInternalRef() const;
01415 
01416     //  --------------------------------------------------------------------------------------------
01418 
01419     void
01420     GetObjectName ( tStringObj * name ) const;
01421 
01422     //  --------------------------------------------------------------------------------------------
01424 
01425     void
01426     SetObjectName ( XMP_StringPtr name );
01427 
01428     //  --------------------------------------------------------------------------------------------
01430 
01431     void
01432     SetObjectName ( tStringObj name );
01433 
01434     //  --------------------------------------------------------------------------------------------
01436 
01437     XMP_OptionBits
01438     GetObjectOptions() const;
01439 
01440     //  --------------------------------------------------------------------------------------------
01444 
01445     void
01446     SetObjectOptions ( XMP_OptionBits options );
01447 
01448     //  --------------------------------------------------------------------------------------------
01469 
01470     TXMPMeta
01471     Clone ( XMP_OptionBits options = 0 ) const;
01472 
01473     //  --------------------------------------------------------------------------------------------
01475 
01476     XMP_Index
01477     CountArrayItems ( XMP_StringPtr schemaNS,
01478                       XMP_StringPtr arrayName ) const;
01479 
01480     //  --------------------------------------------------------------------------------------------
01482 
01483     XMP_Status
01484     DumpObject ( XMP_TextOutputProc outProc,
01485                  void *             refCon ) const;
01486 
01488 
01489     // =============================================================================================
01490 
01491     //  --------------------------------------------------------------------------------------------
01497 
01498     //  --------------------------------------------------------------------------------------------
01517 
01518     void
01519     ParseFromBuffer ( XMP_StringPtr  buffer,
01520                       XMP_StringLen  bufferSize,
01521                       XMP_OptionBits options = 0 );
01522 
01523     //  --------------------------------------------------------------------------------------------
01565 
01566     void
01567     SerializeToBuffer ( tStringObj *   rdfString,
01568                         XMP_OptionBits options,
01569                         XMP_StringLen  padding,
01570                         XMP_StringPtr  newline,
01571                         XMP_StringPtr  indent = "",
01572                         XMP_Index      baseIndent = 0 ) const;
01573 
01574     //  --------------------------------------------------------------------------------------------
01578 
01579     void
01580     SerializeToBuffer ( tStringObj *   rdfString,
01581                         XMP_OptionBits options = 0,
01582                         XMP_StringLen  padding = 0 ) const;
01583 
01585 
01586     // =============================================================================================
01587 
01588     XMPMetaRef xmpRef;  // *** Should be private, see below.
01589 
01590 private:
01591 
01592 #if 0   // *** VS.Net and gcc seem to not handle the friend declarations properly.
01593     friend class TXMPIterator <class tStringObj>;
01594     friend class TXMPUtils <class tStringObj>;
01595 #endif
01596 
01597 };  // class TXMPMeta
01598 
01599 #endif  // __TXMPMeta_hpp__

Generated on Thu May 3 14:54:57 2007 for Adobe XMP Toolkit by  doxygen 1.5.1