Clear() 공개 메소드

Resets the node.
public Clear ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// The internals for SetProperty() and related calls, used after the node is
        /// found or created.
        /// </summary>
        /// <param name="node">
        ///            the newly created node </param>
        /// <param name="value">
        ///            the node value, can be <code>null</code> </param>
        /// <param name="newOptions">
        ///            options for the new node, must not be <code>null</code>. </param>
        /// <param name="deleteExisting"> flag if the existing value is to be overwritten </param>
        /// <exception cref="XmpException"> thrown if options and value do not correspond </exception>
        internal virtual void SetNode(XmpNode node, object value, PropertyOptions newOptions, bool deleteExisting)
        {
            if (deleteExisting)
            {
                node.Clear();
            }

            // its checked by setOptions(), if the merged result is a valid options set
            node.Options.MergeWith(newOptions);

            if (!node.Options.CompositeProperty)
            {
                // This is setting the value of a leaf node.
                XmpNodeUtils.SetNodeValue(node, value);
            }
            else
            {
                if (value != null && value.ToString().Length > 0)
                {
                    throw new XmpException("Composite nodes can't have values", XmpError.BADXPATH);
                }

                node.RemoveChildren();
            }
        }
예제 #2
0
        /// <summary>
        /// The internals for SetProperty() and related calls, used after the node is
        /// found or created.
        /// </summary>
        /// <param name="node">
        ///            the newly created node </param>
        /// <param name="value">
        ///            the node value, can be <code>null</code> </param>
        /// <param name="newOptions">
        ///            options for the new node, must not be <code>null</code>. </param>
        /// <param name="deleteExisting"> flag if the existing value is to be overwritten </param>
        /// <exception cref="XmpException"> thrown if options and value do not correspond </exception>
        internal virtual void SetNode(XmpNode node, object value, PropertyOptions newOptions, bool deleteExisting) {
            if (deleteExisting) {
                node.Clear();
            }

            // its checked by setOptions(), if the merged result is a valid options set
            node.Options.MergeWith(newOptions);

            if (!node.Options.CompositeProperty) {
                // This is setting the value of a leaf node.
                XmpNodeUtils.SetNodeValue(node, value);
            }
            else {
                if (value != null && value.ToString().Length > 0) {
                    throw new XmpException("Composite nodes can't have values", XmpError.BADXPATH);
                }

                node.RemoveChildren();
            }
        }