/// <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 = (IXmpPropertyInfo)_subIterator.Current;
                    return(true);
                }
                return(false);
            }
Esempio n. 2
0
 /// <summary>
 /// Get the value for items with the name without namespace
 /// </summary>
 /// <param name="property">IXmpPropertyInfo read from string</param>
 /// <param name="xmpName">xmpName, for example dc:subject[1]</param>
 /// <returns>value or null</returns>
 private static string GetNullNameSpace(IXmpPropertyInfo property, string xmpName)
 {
     if (property.Path == xmpName && !string.IsNullOrEmpty(property.Value) &&
         string.IsNullOrEmpty(property.Namespace))
     {
         return(property.Value);
     }
     return(null);
 }
Esempio n. 3
0
 /// <summary>Sets the returnProperty as next item or recurses into <c>hasNext()</c>.</summary>
 /// <returns>Returns if there is a next item to return.</returns>
 private bool ReportNode()
 {
     _state = IterateChildren;
     if (_visitedNode.Parent != null && (!_enclosing.Options.IsJustLeafNodes || !_visitedNode.HasChildren))
     {
         _returnProperty = CreatePropertyInfo(_visitedNode, _enclosing.BaseNamespace, _path);
         return(true);
     }
     return(HasNext());
 }
Esempio n. 4
0
 /// <summary>
 /// Get the value for items with the name with a namespace
 /// </summary>
 /// <param name="property">IXmpPropertyInfo read from string</param>
 /// <param name="xmpName">xmpName, for example dc:subject[1]</param>
 /// <returns>value or null</returns>
 private string GetContentNameSpace(IXmpPropertyInfo property, string xmpName)
 {
     if (property.Path == xmpName && !string.IsNullOrEmpty(property.Value) &&
         !string.IsNullOrEmpty(property.Namespace))
     // the difference it this ^^!^^
     {
         return(property.Value);
     }
     return(null);
 }
Esempio n. 5
0
 /// <summary>Calls hasNext() and returns the prepared node.</summary>
 /// <remarks>
 /// Calls hasNext() and returns the prepared node. Afterward it's set to null.
 /// The existence of returnProperty indicates if there is a next node, otherwise
 /// an exception is thrown.
 /// </remarks>
 public virtual object Next()
 {
     if (HasNext())
     {
         var result = _returnProperty;
         _returnProperty = null;
         return(result);
     }
     throw new InvalidOperationException("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()
 {
     _state = ITERATE_CHILDREN;
     if (_visitedNode.Parent != null &&
         (!_outerInstance.Options.JustLeafnodes || !_visitedNode.HasChildren()))
     {
         _returnProperty = CreatePropertyInfo(_visitedNode, _outerInstance.BaseNs, _path);
         return(true);
     }
     return(MoveNext());
 }
Esempio n. 7
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 IterateChildrenMethod(IIterator iterator)
 {
     if (_enclosing._skipSiblings)
     {
         // setSkipSiblings(false);
         _enclosing._skipSiblings = false;
         _subIterator             = Enumerable.Empty <object>().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if (!_subIterator.HasNext() && iterator.HasNext())
     {
         var child = (XmpNode)iterator.Next();
         _index++;
         _subIterator = new NodeIterator(_enclosing, child, _path, _index);
     }
     if (_subIterator.HasNext())
     {
         _returnProperty = (IXmpPropertyInfo)_subIterator.Next();
         return(true);
     }
     return(false);
 }
Esempio n. 8
0
 /// <param name="returnProperty">the returnProperty to set</param>
 protected void SetReturnProperty(IXmpPropertyInfo returnProperty) => _returnProperty = returnProperty;
Esempio n. 9
0
 /**
  * @param prop an <code>XmpPropertyInfo</code> from the <code>XmpIterator</code>.
  */
 private static void printPropertyInfo(IXmpPropertyInfo prop)
 {
     log.WriteLine("NS ({0})   PATH ({1})   VALUE ({2})  OPTIONS ({3})",
                   prop.Namespace, prop.Path, prop.Value, prop.Options.GetOptionsString());
 }
Esempio n. 10
0
 private TreeDirectory(IXmpPropertyInfo x)
 {
     Element = x;
 }
Esempio n. 11
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 = (IXmpPropertyInfo) _subIterator.Current;
                    return true;
                }
                return false;
            }
Esempio n. 12
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.Parent != null &&
         (!_outerInstance.Options.JustLeafnodes || !_visitedNode.HasChildren())) {
         _returnProperty = CreatePropertyInfo(_visitedNode, _outerInstance.BaseNs, _path);
         return true;
     }
     return MoveNext();
 }
Esempio n. 13
0
 private TreeDirectory(IXmpPropertyInfo x)
 {
     this.Element = x;
 }
Esempio n. 14
0
 /// <param name="returnProperty">the returnProperty to set</param>
 protected void SetReturnProperty(IXmpPropertyInfo returnProperty)
 {
     _returnProperty = returnProperty;
 }
Esempio n. 15
0
 /// <summary>Calls hasNext() and returns the prepared node.</summary>
 /// <remarks>
 /// Calls hasNext() and returns the prepared node. Afterward it's set to null.
 /// The existence of returnProperty indicates if there is a next node, otherwise
 /// an exception is thrown.
 /// </remarks>
 public virtual object Next()
 {
     if (HasNext())
     {
         var result = _returnProperty;
         _returnProperty = null;
         return result;
     }
     throw new InvalidOperationException("There are no more nodes to return");
 }
Esempio n. 16
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 IterateChildrenMethod(IIterator iterator)
 {
     if (_enclosing._skipSiblings)
     {
         // setSkipSiblings(false);
         _enclosing._skipSiblings = false;
         _subIterator = Enumerable.Empty<object>().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if ((!_subIterator.HasNext()) && iterator.HasNext())
     {
         var child = (XmpNode)iterator.Next();
         _index++;
         _subIterator = new NodeIterator(_enclosing, child, _path, _index);
     }
     if (_subIterator.HasNext())
     {
         _returnProperty = (IXmpPropertyInfo)_subIterator.Next();
         return true;
     }
     return false;
 }
Esempio n. 17
0
 /// <summary>Sets the returnProperty as next item or recurses into <c>hasNext()</c>.</summary>
 /// <returns>Returns if there is a next item to return.</returns>
 private bool ReportNode()
 {
     _state = IterateChildren;
     if (_visitedNode.Parent != null && (!_enclosing.Options.IsJustLeafNodes || !_visitedNode.HasChildren))
     {
         _returnProperty = CreatePropertyInfo(_visitedNode, _enclosing.BaseNamespace, _path);
         return true;
     }
     return HasNext();
 }
Esempio n. 18
0
 /**
  * @param prop an <code>XmpPropertyInfo</code> from the <code>XmpIterator</code>.
  */
 private static void printPropertyInfo(IXmpPropertyInfo prop)
 {
     log.WriteLine("NS ({0})   PATH ({1})   VALUE ({2})  OPTIONS ({3})",
         prop.Namespace, prop.Path, prop.Value, prop.Options.GetOptionsString());
 }