File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
app/src/main/java/com/osfans/trime/util/config Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -81,4 +81,6 @@ class Config(private val data: ConfigData = ConfigData()) {
8181 Timber .d(" read: $path " )
8282 return data.traverse(path)?.configMap
8383 }
84+
85+ fun getItem () = data.root
8486}
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ class ConfigList(private val list: YamlList) : ConfigItem(list) {
5858
5959 val items get() = list.items.map { convertFromYaml(it) }
6060
61+ operator fun iterator () = items.iterator()
62+
6163 override fun isEmpty () = list.items.isEmpty()
6264 override fun contentToString (): String = list.contentToString()
6365
@@ -71,12 +73,14 @@ class ConfigMap(private val map: YamlMap) : ConfigItem(map) {
7173 override fun isEmpty () = map.entries.isEmpty()
7274 override fun contentToString (): String = map.contentToString()
7375
74- fun hasKey (key : String ) = map.getKey(key) != null
76+ fun containsKey (key : String ) = map.getKey(key) != null
7577
7678 val entries get() = map.entries.entries.associate { (s, n) ->
7779 s.content to convertFromYaml(n)
7880 }
7981
82+ operator fun iterator () = entries.iterator()
83+
8084 @Suppress(" UNCHECKED_CAST" )
8185 operator fun <T : ConfigItem > get (key : String ): T ? =
8286 entries.entries.firstOrNull { it.key == key }?.value as T ?
You can’t perform that action at this time.
0 commit comments