diff options
Diffstat (limited to 'src/Model/Sections.kt')
-rw-r--r-- | src/Model/Sections.kt | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/Model/Sections.kt b/src/Model/Sections.kt new file mode 100644 index 00000000..733c0d2f --- /dev/null +++ b/src/Model/Sections.kt @@ -0,0 +1,43 @@ +package org.jetbrains.dokka + +import org.jetbrains.jet.lang.descriptors.* +import org.jetbrains.jet.lang.resolve.BindingContext + +fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): DocumentationContent { + val docText = getDocumentationElements(descriptor).map { it.extractText() }.join("\n") + return DocumentationContent(docText, listOf()) +} + +class DocumentationContentSection(val label: String, val text: String) { + +} + +class DocumentationContent(val summary: String, val sections: List<DocumentationContentSection>) { + + override fun equals(other: Any?): Boolean { + if (other !is DocumentationContent) + return false + if (summary != other.summary) + return false + if (sections.size != other.sections.size) + return false + for (index in sections.indices) + if (sections[index] != other.sections[index]) + return false + + return true + } + + override fun hashCode(): Int { + return summary.hashCode() + sections.map { it.hashCode() }.sum() + } + + override fun toString(): String { + return "$summary | " + sections.joinToString() + } + + class object { + val Empty = DocumentationContent("", listOf()) + } +} + |