Profile: Apply profile values

This commit is contained in:
zt515
2017-12-15 21:54:53 +08:00
parent 8c320f51d4
commit 9bb1bdad0f
4 changed files with 58 additions and 25 deletions

View File

@ -30,6 +30,16 @@ class ConfigVisitor : IVisitorCallback {
return NeoLangArray.createFromContext(getContext(contextPath).getChild(arrayName))
}
fun getStringValue(path: Array<String>, name: String): String? {
val value = this.getAttribute(path, name)
return if (value.isValid()) value.asString() else null
}
fun getBooleanValue(path: Array<String>, name: String): Boolean? {
val value = this.getAttribute(path, name)
return if (value.isValid()) value.asString() == "true" else null
}
override fun onStart() {
currentContext = NeoLangContext("global")
rootContext = currentContext
@ -60,9 +70,4 @@ class ConfigVisitor : IVisitorCallback {
override fun getCurrentContext(): NeoLangContext {
return currentContext!!
}
fun getStringValue(path: Array<String>, name: String): String? {
val value = this.getAttribute(path, name)
return if (value.isValid()) value.asString() else null
}
}