Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MarkdownElementSingleChild.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4
6{
11 {
12 private MarkdownElement child;
13
20 : base(Document)
21 {
23 this.child = NestedBlock.FirstChild;
24 else
25 this.child = Child;
26 }
27
32 {
33 get => this.child;
34 internal set => this.child = value;
35 }
36
40 public override IEnumerable<MarkdownElement> Children => new MarkdownElement[] { this.child };
41
50
57 public override bool ForEach(MarkdownElementHandler Callback, object State)
58 {
59 if (!Callback(this, State))
60 return false;
61
62 if (!(this.child is null) && !this.child.ForEach(Callback, State))
63 return false;
64
65 return true;
66 }
67
73 public override bool Equals(object obj)
74 {
75 return obj is MarkdownElementSingleChild x &&
76 (this.child?.Equals(x.child) ?? x.child is null) &&
77 base.Equals(obj);
78 }
79
84 public override int GetHashCode()
85 {
86 int h1 = base.GetHashCode();
87 int h2 = this.child?.GetHashCode() ?? 0;
88
89 h1 = ((h1 << 5) + h1) ^ h2;
90
91 return h1;
92 }
93
94 }
95}
Contains a markdown document. This markdown document class supports original markdown,...
Represents a nested block with no special formatting rules in a markdown document.
Definition: NestedBlock.cs:11
bool HasOneChild
If the element has only one child.
MarkdownElement FirstChild
First child, or null if none.
Abstract base class for all markdown elements.
virtual bool ForEach(MarkdownElementHandler Callback, object State)
Loops through all child-elements for the element.
override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
override int GetHashCode()
Serves as the default hash function.
MarkdownDocument Document
Markdown document.
Abstract base class for all markdown elements with one child element.
override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
MarkdownElementSingleChild(MarkdownDocument Document, MarkdownElement Child)
Abstract base class for all markdown elements with one child element.
override int GetHashCode()
Serves as the default hash function.
override IEnumerable< MarkdownElement > Children
Any children of the element.
abstract MarkdownElementSingleChild Create(MarkdownElement Child, MarkdownDocument Document)
Creates an object of the same type, and meta-data, as the current object, but with content defined by...
override bool ForEach(MarkdownElementHandler Callback, object State)
Loops through all child-elements for the element.
delegate bool MarkdownElementHandler(MarkdownElement Element, object State)
Delegate for markdown element callback methods.