aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Model/Content.kt
diff options
context:
space:
mode:
authorEugene Petrenko <eugene.petrenko@gmail.com>2018-09-11 14:03:29 +0300
committerEugene Petrenko <eugene.petrenko@gmail.com>2018-09-11 14:03:29 +0300
commita54070f5db04d05b48c369b211efe044fbc02a8d (patch)
treeaac5889906f49f68c39e1416ea39d4d19bad008e /core/src/main/kotlin/Model/Content.kt
parente29f1c966056b0f7ee31dd9bd7d55f9e526fa7fe (diff)
parent0df19264ccae3d294946caf634ee15eea0c4fe4a (diff)
downloaddokka-a54070f5db04d05b48c369b211efe044fbc02a8d.tar.gz
dokka-a54070f5db04d05b48c369b211efe044fbc02a8d.tar.bz2
dokka-a54070f5db04d05b48c369b211efe044fbc02a8d.zip
Merge remote-tracking branch 'zub/dev-multiplatf' into kotlin-website-jonnyzzz
Diffstat (limited to 'core/src/main/kotlin/Model/Content.kt')
-rw-r--r--core/src/main/kotlin/Model/Content.kt33
1 files changed, 32 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Model/Content.kt b/core/src/main/kotlin/Model/Content.kt
index 1f5bbc83..7c776bdb 100644
--- a/core/src/main/kotlin/Model/Content.kt
+++ b/core/src/main/kotlin/Model/Content.kt
@@ -9,7 +9,7 @@ object ContentEmpty : ContentNode {
}
open class ContentBlock() : ContentNode {
- val children = arrayListOf<ContentNode>()
+ open val children = arrayListOf<ContentNode>()
fun append(node: ContentNode) {
children.add(node)
@@ -27,6 +27,34 @@ open class ContentBlock() : ContentNode {
get() = children.sumBy { it.textLength }
}
+class NodeRenderContent(
+ val node: DocumentationNode,
+ val mode: LanguageService.RenderMode
+): ContentNode {
+ override val textLength: Int
+ get() = 0 //TODO: Clarify?
+}
+
+class LazyContentBlock(private val fillChildren: (ContentBlock) -> Unit) : ContentBlock() {
+ private var computed = false
+ override val children: ArrayList<ContentNode>
+ get() {
+ if (!computed) {
+ computed = true
+ fillChildren(this)
+ }
+ return super.children
+ }
+
+ override fun equals(other: Any?): Boolean {
+ return other is LazyContentBlock && other.fillChildren == fillChildren && super.equals(other)
+ }
+
+ override fun hashCode(): Int {
+ return super.hashCode() + 31 * fillChildren.hashCode()
+ }
+}
+
enum class IdentifierKind {
TypeName,
ParameterName,
@@ -120,6 +148,9 @@ class ContentExternalLink(val href : String) : ContentBlock() {
children.hashCode() * 31 + href.hashCode()
}
+data class ContentBookmark(val name: String): ContentBlock()
+data class ContentLocalLink(val href: String) : ContentBlock()
+
class ContentUnorderedList() : ContentBlock()
class ContentOrderedList() : ContentBlock()
class ContentListItem() : ContentBlock()