All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.pro.felixo.protobuf.schemadocument.validation.ValidationScope.kt Maven / Gradle / Ivy

The newest version!
package pro.felixo.protobuf.schemadocument.validation

import pro.felixo.protobuf.schemadocument.SchemaElement

data class ValidationScope(
    val element: SchemaElement,
    val parent: ValidationScope?
) {
    override fun toString(): String =
        (parent?.toString()?.let { "$it -> " } ?: "") + element.elementType + " " + element.elementName
}

fun ValidationScope.sub(element: SchemaElement) = ValidationScope(element, this)

fun  rootValidationScope(
    element: SchemaElement,
    block: ValidationScope.() -> T
): T = ValidationScope(element, null).block()

fun  ValidationScope.validationScope(
    element: SchemaElement,
    block: ValidationScope.() -> T
): T = sub(element).block()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy