aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/model/Documentable.kt7
-rw-r--r--core/src/main/kotlin/model/aditionalExtras.kt11
-rw-r--r--core/src/main/kotlin/model/properties/properties.kt13
3 files changed, 23 insertions, 8 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 3bc1690b..9de06ba7 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -3,8 +3,6 @@ package org.jetbrains.dokka.model
import com.intellij.psi.PsiNamedElement
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.doc.DocumentationNode
-import org.jetbrains.dokka.model.properties.ExtraProperty
-import org.jetbrains.dokka.model.properties.MergeStrategy
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.PlatformData
@@ -335,6 +333,11 @@ sealed class Projection {
data class Nullable(val inner: Projection) : Projection()
}
+enum class ExtraModifiers {
+ STATIC, INLINE, INFIX, SUSPEND, REIFIED, CROSSINLINE, NOINLINE,
+ OVERRIDE, DATA, CONST, DYNAMIC, EXTERNAL, INNER, LATEINIT, OPERATOR, TAILREC, VARARG
+}
+
private fun String.shorten(maxLength: Int) = lineSequence().first().let {
if (it.length != length || it.length > maxLength) it.take(maxLength - 3) + "..." else it
}
diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/aditionalExtras.kt
new file mode 100644
index 00000000..69e89a2a
--- /dev/null
+++ b/core/src/main/kotlin/model/aditionalExtras.kt
@@ -0,0 +1,11 @@
+package org.jetbrains.dokka.model
+
+import org.jetbrains.dokka.model.properties.ExtraProperty
+
+class AdditionalModifiers(val content: List<ExtraModifiers>) : ExtraProperty<Documentable> {
+ object AdditionalKey : ExtraProperty.Key<Documentable, AdditionalModifiers>
+
+ override fun equals(other: Any?): Boolean = if (other is AdditionalModifiers) other.content == content else false
+ override fun hashCode() = content.hashCode()
+ override val key: ExtraProperty.Key<Documentable, *> = AdditionalKey
+} \ No newline at end of file
diff --git a/core/src/main/kotlin/model/properties/properties.kt b/core/src/main/kotlin/model/properties/properties.kt
index 83f8d63d..7010d0df 100644
--- a/core/src/main/kotlin/model/properties/properties.kt
+++ b/core/src/main/kotlin/model/properties/properties.kt
@@ -1,21 +1,22 @@
package org.jetbrains.dokka.model.properties
interface ExtraProperty<in C : Any> {
- interface Key<in C: Any, T: Any> {
+ interface Key<in C : Any, T : Any> {
fun mergeStrategyFor(left: T, right: T): MergeStrategy<C> = MergeStrategy.Fail {
throw NotImplementedError("Property merging for $this is not implemented")
}
}
+
val key: Key<C, *>
}
-interface CalculatedProperty<in C: Any, T: Any>: ExtraProperty.Key<C, T> {
+interface CalculatedProperty<in C : Any, T : Any> : ExtraProperty.Key<C, T> {
fun calculate(subject: C): T
}
sealed class MergeStrategy<in C> {
- class Replace<in C : Any>(val newProperty: ExtraProperty<C>): MergeStrategy<C>()
- object Remove: MergeStrategy<Any>()
- class Full<C: Any>(val merger: (preMerged: C, left: C, right: C) -> C): MergeStrategy<C>()
- class Fail(val error: () -> Nothing): MergeStrategy<Any>()
+ class Replace<in C : Any>(val newProperty: ExtraProperty<C>) : MergeStrategy<C>()
+ object Remove : MergeStrategy<Any>()
+ class Full<C : Any>(val merger: (preMerged: C, left: C, right: C) -> C) : MergeStrategy<C>()
+ class Fail(val error: () -> Nothing) : MergeStrategy<Any>()
}