/// <summary>Handles the iteration of the children or qualfier</summary>
 /// <param name="iterator">an iterator</param>
 /// <returns>Returns if there are more elements available.</returns>
 private bool IterateChildrenMethod(Iterator iterator)
 {
     if (this._enclosing.skipSiblings)
     {
         // setSkipSiblings(false);
         this._enclosing.skipSiblings = false;
         this.subIterator             = Sharpen.Collections.EmptyList().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if ((!this.subIterator.HasNext()) && iterator.HasNext())
     {
         XMPNode child = (XMPNode)iterator.Next();
         this.index++;
         this.subIterator = new XMPIteratorImpl.NodeIterator(this._enclosing, child, this.path, this.index);
     }
     if (this.subIterator.HasNext())
     {
         this.returnProperty = (XMPPropertyInfo)this.subIterator.Next();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
            /// <summary>
            /// Handles the iteration of the children or qualfier </summary>
            /// <param name="iterator"> an iterator </param>
            /// <returns> Returns if there are more elements available. </returns>
            private bool IterateChildren(IEnumerator iterator)
            {
                if (outerInstance.skipSiblings)
                {
                    // setSkipSiblings(false);
                    outerInstance.skipSiblings = false;
                    subIterator = EmptyList.GetEnumerator();
                }

                // create sub iterator for every child,
                // if its the first child visited or the former child is finished
                bool subIteratorMoveNext = subIterator.MoveNext();

                if (!subIteratorMoveNext && iterator.MoveNext())
                {
                    XMPNode child = (XMPNode)iterator.Current;
                    index++;
                    subIterator = new NodeIterator(outerInstance, child, path, index);
                }
                if (subIteratorMoveNext)
                {
                    returnProperty = (XMPPropertyInfo)subIterator.Current;
                    return(true);
                }
                return(false);
            }
 /// <exception cref="Com.Adobe.Xmp.XMPException"/>
 private static void ProcessXmpTags(XmpDirectory directory, XMPMeta xmpMeta)
 {
     // store the XMPMeta object on the directory in case others wish to use it
     directory.SetXMPMeta(xmpMeta);
     // read all the tags and send them to the directory
     // I've added some popular tags, feel free to add more tags
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagLensInfo, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagLens, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagCameraSerialNumber, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagFirmware, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagMake, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagModel, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagExposureTime, FmtString);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagExposureProgram, FmtInt);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagApertureValue, FmtRational);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagFNumber, FmtRational);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagFocalLength, FmtRational);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagShutterSpeed, FmtRational);
     ProcessXmpDateTag(xmpMeta, directory, XmpDirectory.TagDatetimeOriginal);
     ProcessXmpDateTag(xmpMeta, directory, XmpDirectory.TagDatetimeDigitized);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagRating, FmtDouble);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagLabel, FmtString);
     // this requires further research
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:title", XmpDirectory.TAG_TITLE, FMT_STRING);
     ProcessXmpTag(xmpMeta, directory, XmpDirectory.TagSubject, FmtStringArray);
     // processXmpDateTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:date", XmpDirectory.TAG_DATE);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:type", XmpDirectory.TAG_TYPE, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:description", XmpDirectory.TAG_DESCRIPTION, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:relation", XmpDirectory.TAG_RELATION, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:coverage", XmpDirectory.TAG_COVERAGE, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:creator", XmpDirectory.TAG_CREATOR, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:publisher", XmpDirectory.TAG_PUBLISHER, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:contributor", XmpDirectory.TAG_CONTRIBUTOR, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:rights", XmpDirectory.TAG_RIGHTS, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:format", XmpDirectory.TAG_FORMAT, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:identifier", XmpDirectory.TAG_IDENTIFIER, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:language", XmpDirectory.TAG_LANGUAGE, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:audience", XmpDirectory.TAG_AUDIENCE, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:provenance", XmpDirectory.TAG_PROVENANCE, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:rightsHolder", XmpDirectory.TAG_RIGHTS_HOLDER, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:instructionalMethod", XmpDirectory.TAG_INSTRUCTIONAL_METHOD,
     // FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:accrualMethod", XmpDirectory.TAG_ACCRUAL_METHOD, FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:accrualPeriodicity", XmpDirectory.TAG_ACCRUAL_PERIODICITY,
     // FMT_STRING);
     // processXmpTag(xmpMeta, directory, Schema.DUBLIN_CORE_SPECIFIC_PROPERTIES, "dc:accrualPolicy", XmpDirectory.TAG_ACCRUAL_POLICY, FMT_STRING);
     for (XMPIterator iterator = xmpMeta.Iterator(); iterator.HasNext();)
     {
         XMPPropertyInfo propInfo = (XMPPropertyInfo)iterator.Next();
         string          path     = propInfo.GetPath();
         string          value    = propInfo.GetValue();
         if (path != null && value != null)
         {
             directory.AddProperty(path, value);
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// Sets the returnProperty as next item or recurses into <code>hasNext()</code>. </summary>
 /// <returns> Returns if there is a next item to return.  </returns>
 protected internal virtual bool ReportNode()
 {
     state = ITERATE_CHILDREN;
     if (visitedNode.GetParent() != null &&
         (!outerInstance.GetOptions().IsJustLeafnodes() || !visitedNode.HasChildren()))
     {
         returnProperty = CreatePropertyInfo(visitedNode, outerInstance.GetBaseNS(), path);
         return(true);
     }
     return(MoveNext());
 }
 /// <summary>Calls hasNext() and returnes the prepared node.</summary>
 /// <remarks>
 /// Calls hasNext() and returnes the prepared node. Afterwards its set to null.
 /// The existance of returnProperty indicates if there is a next node, otherwise
 /// an exceptio is thrown.
 /// </remarks>
 /// <seealso cref="Sharpen.Iterator{E}.Next()"/>
 public virtual object Next()
 {
     if (this.HasNext())
     {
         XMPPropertyInfo result = this.returnProperty;
         this.returnProperty = null;
         return(result);
     }
     else
     {
         throw new NoSuchElementException("There are no more nodes to return");
     }
 }
 /// <summary>Sets the returnProperty as next item or recurses into <code>hasNext()</code>.</summary>
 /// <returns>Returns if there is a next item to return.</returns>
 protected internal virtual bool ReportNode()
 {
     this.state = XMPIteratorImpl.NodeIterator.IterateChildren;
     if (this.visitedNode.GetParent() != null && (!this._enclosing.GetOptions().IsJustLeafnodes() || !this.visitedNode.HasChildren()))
     {
         this.returnProperty = this.CreatePropertyInfo(this.visitedNode, this._enclosing.GetBaseNS(), this.path);
         return(true);
     }
     else
     {
         return(this.HasNext());
     }
 }
Exemple #7
0
 public virtual void SetXMPMeta([NotNull] XMPMeta xmpMeta)
 {
     _xmpMeta = xmpMeta;
     try
     {
         int valueCount = 0;
         for (Iterator i = _xmpMeta.Iterator(); i.HasNext();)
         {
             XMPPropertyInfo prop = (XMPPropertyInfo)i.Next();
             if (prop.GetPath() != null)
             {
                 //System.out.printf("%s = %s\n", prop.getPath(), prop.getValue());
                 valueCount++;
             }
         }
         SetInt(TagXmpValueCount, valueCount);
     }
     catch (XMPException)
     {
     }
 }
Exemple #8
0
 protected internal virtual void SetReturnProperty(XMPPropertyInfo value)
 {
     returnProperty = value;
 }
 /// <param name="returnProperty">the returnProperty to set</param>
 protected internal virtual void SetReturnProperty(XMPPropertyInfo returnProperty)
 {
     this.returnProperty = returnProperty;
 }
 /// <summary>Handles the iteration of the children or qualfier</summary>
 /// <param name="iterator">an iterator</param>
 /// <returns>Returns if there are more elements available.</returns>
 private bool IterateChildrenMethod(Iterator iterator)
 {
     if (this._enclosing.skipSiblings)
     {
         // setSkipSiblings(false);
         this._enclosing.skipSiblings = false;
         this.subIterator = Sharpen.Collections.EmptyList().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if ((!this.subIterator.HasNext()) && iterator.HasNext())
     {
         XMPNode child = (XMPNode)iterator.Next();
         this.index++;
         this.subIterator = new XMPIteratorImpl.NodeIterator(this._enclosing, child, this.path, this.index);
     }
     if (this.subIterator.HasNext())
     {
         this.returnProperty = (XMPPropertyInfo)this.subIterator.Next();
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <param name="returnProperty">the returnProperty to set</param>
 protected internal virtual void SetReturnProperty(XMPPropertyInfo returnProperty)
 {
     this.returnProperty = returnProperty;
 }
 /// <summary>Sets the returnProperty as next item or recurses into <code>hasNext()</code>.</summary>
 /// <returns>Returns if there is a next item to return.</returns>
 protected internal virtual bool ReportNode()
 {
     this.state = XMPIteratorImpl.NodeIterator.IterateChildren;
     if (this.visitedNode.GetParent() != null && (!this._enclosing.GetOptions().IsJustLeafnodes() || !this.visitedNode.HasChildren()))
     {
         this.returnProperty = this.CreatePropertyInfo(this.visitedNode, this._enclosing.GetBaseNS(), this.path);
         return true;
     }
     else
     {
         return this.HasNext();
     }
 }
 /// <summary>Calls hasNext() and returnes the prepared node.</summary>
 /// <remarks>
 /// Calls hasNext() and returnes the prepared node. Afterwards its set to null.
 /// The existance of returnProperty indicates if there is a next node, otherwise
 /// an exceptio is thrown.
 /// </remarks>
 /// <seealso cref="Sharpen.Iterator{E}.Next()"/>
 public virtual object Next()
 {
     if (this.HasNext())
     {
         XMPPropertyInfo result = this.returnProperty;
         this.returnProperty = null;
         return result;
     }
     else
     {
         throw new NoSuchElementException("There are no more nodes to return");
     }
 }