mirror of
https://github.com/libretro/RetroArch
synced 2025-02-05 15:40:04 +00:00
Add boolean support to Java config file.
This commit is contained in:
parent
71fe22f8ba
commit
bb95313175
@ -70,6 +70,10 @@ public class ConfigFile {
|
|||||||
map.put(key, value);
|
map.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBoolean(String key, boolean value) {
|
||||||
|
map.put(key, Boolean.toString(value));
|
||||||
|
}
|
||||||
|
|
||||||
public void setInt(String key, int value) {
|
public void setInt(String key, int value) {
|
||||||
map.put(key, Integer.toString(value));
|
map.put(key, Integer.toString(value));
|
||||||
}
|
}
|
||||||
@ -78,6 +82,10 @@ public class ConfigFile {
|
|||||||
map.put(key, Double.toString(value));
|
map.put(key, Double.toString(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean keyExists(String key) {
|
||||||
|
return map.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
public String getString(String key) {
|
public String getString(String key) {
|
||||||
Object ret = map.get(key);
|
Object ret = map.get(key);
|
||||||
if (ret != null)
|
if (ret != null)
|
||||||
@ -86,10 +94,6 @@ public class ConfigFile {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean keyExists(String key) {
|
|
||||||
return map.containsKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt(String key) throws NumberFormatException {
|
public int getInt(String key) throws NumberFormatException {
|
||||||
String str = getString(key);
|
String str = getString(key);
|
||||||
if (str != null)
|
if (str != null)
|
||||||
@ -105,4 +109,9 @@ public class ConfigFile {
|
|||||||
else
|
else
|
||||||
throw new NumberFormatException();
|
throw new NumberFormatException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBoolean(String key) {
|
||||||
|
String str = getString(key);
|
||||||
|
return Boolean.parseBoolean(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user