Skip to content

Commit

Permalink
updated method comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Overrided committed Jun 21, 2024
1 parent 51716d1 commit e1807df
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
23 changes: 14 additions & 9 deletions Fb2.Document/Models/Base/Core/Fb2Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ public abstract class Fb2Container : Fb2Node
public override bool HasContent => content.Any();

/// <summary>
/// Container node loading mechanism. Loads attributes and sequentially calls `Load` on all child nodes.
/// Container Node loading mechanism. Loads <see cref="Content"/> and sequentially calls <see cref="Fb2Node.Load(XNode,Fb2Container?,bool, bool, bool)"/> on all child nodes.
/// </summary>
/// <param name="node">Node to load as Fb2Container</param>
/// <param name="preserveWhitespace">Indicates if whitespace chars (\t, \n, \r) should be preserved. By default `false`.</param>
/// <param name="loadUnsafe">Indicates whether "Unsafe" children should be loaded. By default `true`. </param>
/// <param name="node"><see cref="XNode"/> to load as <see cref="Fb2Container"/>.</param>
/// <param name="parentNode">Parent node (<see cref="Fb2Container"/>). By default <see langword="null"/>.</param>
/// <param name="preserveWhitespace">Indicates if whitespace characters (\t, \n, \r) should be preserved. By default <see langword="false"/>.</param>
/// <param name="loadUnsafe">Indicates whether "Unsafe" children should be loaded. By default <see langword="true"/>. </param>
/// <param name="loadNamespaceMetadata">Indicates wheter XML Namespace Metadata should be preserved. By default <see langword="true"/>.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="Fb2NodeLoadingException"></exception>
public override void Load(
[In] XNode node,
[In] Fb2Container? parentNode = null,
Expand Down Expand Up @@ -134,10 +138,11 @@ public override string ToString()
}

/// <summary>
/// Converts Fb2Container to <see cref="XElement"/> with regards to all attributes,
/// by calling `ToXml()` on every node in `Content`.
/// Converts <see cref="Fb2Container"/> to <see cref="XElement"/> with regards to all attributes,
/// by calling <see cref="ToXml(bool)"/> on every descendant node in <see cref="Content"/> recursively.
/// </summary>
/// <returns><see cref="XElement"/> reflected from given <see cref="Fb2Node"/>.</returns>
/// <param name="serializeUnsafeNodes">Indicates is "Unsafe" content should be serialized. By default <see langword="true"/>. </param>
/// <returns><see cref="XElement"/> reflected from given <see cref="Fb2Container"/>.</returns>
public override XElement ToXml(bool serializeUnsafeNodes = true)
{
var element = base.ToXml(serializeUnsafeNodes);
Expand Down Expand Up @@ -321,7 +326,7 @@ public Fb2Container AddContent(IEnumerable<Fb2Node> nodes)
}

/// <summary>
/// Adds new node to <see cref="Content"/> using node's `Name`.
/// Adds new node to <see cref="Content"/> using node's <see cref="Fb2Node.Name"/>.
/// </summary>
/// <param name="nodeName">Name to instantiate node by.</param>
/// <returns>Current container.</returns>
Expand All @@ -336,7 +341,7 @@ public Fb2Container AddContent(string nodeName)
}

/// <summary>
/// Adds given node to <see cref="Content"/>.
/// Adds given <paramref name="node"/> to <see cref="Content"/>.
/// </summary>
/// <param name="node">Child node to add to Content.</param>
/// <returns>Current container.</returns>
Expand Down
18 changes: 11 additions & 7 deletions Fb2.Document/Models/Base/Core/Fb2Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ public abstract class Fb2Element : Fb2Node
public override bool HasContent => !string.IsNullOrEmpty(content);

/// <summary>
/// Text node loading mechanism - formatting text and removal of unwanted characters.
/// Text node loading mechanism. Loads <see cref="Content"/> after formatting and removal of unwanted characters.
/// </summary>
/// <param name="node">Node to load as Fb2Element.</param>
/// <param name="preserveWhitespace">Indicates if whitespace chars (\t, \n, \r) should be preserved. By default <see langword="false"/>.</param>
/// <param name="loadUnsafe"> Is ignored by Fb2Element loading.</param>
/// <param name="node"><see cref="XNode"/> to load as <see cref="Fb2Element"/>.</param>
/// <param name="parentNode">Parent node (<see cref="Fb2Container"/>). By default <see langword="null"/>.</param>
/// <param name="preserveWhitespace">Indicates if whitespace characters (\t, \n, \r) should be preserved. By default <see langword="false"/>.</param>
/// <param name="loadUnsafe">Indicates whether "Unsafe" children should be loaded. By default <see langword="true"/>. </param>
/// <param name="loadNamespaceMetadata">Indicates whether XML Namespace Metadata should be preserved. By default <see langword="true"/>.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="Fb2NodeLoadingException"></exception>
/// <remarks>Original content of XNode is NOT preserved by default except for <see cref="Code" />.</remarks>
/// <remarks>Original content of <see cref="XNode"/> is <c>NOT preserved</c> except for <see cref="Code" />.</remarks>
public override void Load(
[In] XNode node,
[In] Fb2Container? parentNode = null,
Expand Down Expand Up @@ -140,9 +143,10 @@ public virtual Fb2Element ClearContent()
}

/// <summary>
/// Converts Fb2Element to XElement with regards to all attributes.
/// Converts <see cref="Fb2Element"/> to <see cref="XElement"/> with regards to all attributes.
/// </summary>
/// <returns>XElement reflected from given Fb2Element.</returns>
/// <param name="serializeUnsafeNodes">Indicates is "Unsafe" content should be serialized. By default <see langword="true"/>. </param>
/// <returns><see cref="XElement"/> reflected from given <see cref="Fb2Element"/>.</returns>
/// <remarks>
/// Only formatted content is serialized.
/// <para>Original symbols from string value of XNode passed to Load method can be replaced and/or removed during <see cref="Fb2Element.Load(XNode, bool, bool)"/>.</para>
Expand Down
13 changes: 8 additions & 5 deletions Fb2.Document/Models/Base/Core/Fb2Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ public abstract partial class Fb2Node : ICloneable
public Fb2NodeMetadata? NodeMetadata { get; set; }

/// <summary>
/// Basic Load of node - validation and populating Attributes.
/// Basic Load of node - <paramref name="node"/> validation and populating <see cref="Attributes"/> and <see cref="NodeMetadata"/>.
/// </summary>
/// <param name="node">XNode to load as <c>Fb2Node</c>.</param>
/// <param name="parentNode">Parent node of node being loaded, can be <see langword="null"/>.</param>
/// <param name="preserveWhitespace">Is ignored during <c>Fb2Node</c> loading.</param>
/// <param name="loadUnsafe">Is ignored during <c>Fb2Node</c> loading.</param>
/// <param name="node"><see cref="XNode"/> to load as <see cref="Fb2Node"/>.</param>
/// <param name="parentNode">Parent node (<see cref="Fb2Container"/>). By default <see langword="null"/>.</param>
/// <param name="preserveWhitespace">Indicates if whitespace characters (\t, \n, \r) should be preserved. By default <see langword="false"/>.</param>
/// <param name="loadUnsafe">Indicates whether "Unsafe" children should be loaded. By default <see langword="true"/>. </param>
/// <param name="loadNamespaceMetadata">Indicates wheter XML Namespace Metadata should be preserved. By default <see langword="true"/>.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="Fb2NodeLoadingException"></exception>
public virtual void Load(
[In] XNode node,
[In] Fb2Container? parentNode = null,
Expand Down Expand Up @@ -126,6 +128,7 @@ public virtual void Load(
/// <summary>
/// Basic method to serialize <see cref="Fb2Node"/> back to <see cref="XElement"/>.
/// </summary>
/// <param name="serializeUnsafeNodes">Indicates is "Unsafe" content should be serialized. By default <see langword="true"/>. </param>
/// <returns><see cref="XElement"/> instance with attributes reflecting <see cref="Attributes"/> property.</returns>
public virtual XElement ToXml(bool serializeUnsafeNodes = true)
{
Expand Down

0 comments on commit e1807df

Please sign in to comment.