aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/ContentSourceSet.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/model/ContentSourceSet.kt')
-rw-r--r--core/src/main/kotlin/model/ContentSourceSet.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/src/main/kotlin/model/ContentSourceSet.kt b/core/src/main/kotlin/model/ContentSourceSet.kt
new file mode 100644
index 00000000..6eee4c94
--- /dev/null
+++ b/core/src/main/kotlin/model/ContentSourceSet.kt
@@ -0,0 +1,32 @@
+package org.jetbrains.dokka.model
+
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.Platform
+
+data class ContentSourceSet(
+ val sourceSetIDs: CompositeSourceSetID,
+ val displayName: String,
+ val analysisPlatform: Platform
+) {
+ constructor(sourceSet: DokkaSourceSet) : this(
+ sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID),
+ displayName = sourceSet.displayName,
+ analysisPlatform = sourceSet.analysisPlatform
+ )
+
+ operator fun contains(sourceSetID: DokkaSourceSetID): Boolean {
+ return sourceSetID in sourceSetIDs
+ }
+
+ operator fun contains(sourceSet: DokkaSourceSet): Boolean {
+ return sourceSet.sourceSetID in this
+ }
+}
+
+
+fun DokkaSourceSet.toContentSourceSet(): ContentSourceSet = ContentSourceSet(this)
+
+fun Iterable<DokkaSourceSet>.toContentSourceSets(): Set<ContentSourceSet> = map { it.toContentSourceSet() }.toSet()
+
+val Iterable<ContentSourceSet>.sourceSetIDs: List<DokkaSourceSetID> get() = this.flatMap { it.sourceSetIDs.all }