22
33#include < classes/json.hpp>
44
5- bool JvmUserConfiguration::parse_configuration_json (const String& json_string, JvmUserConfiguration& json_config) {
5+ bool JvmUserConfiguration::parse_configuration_json (const godot:: String& json_string, JvmUserConfiguration& json_config) {
66 bool is_invalid = false ;
77 godot::JSON json;
88 godot::Error error {json.parse (json_string)};
9- Variant result {json.get_data ()};
9+ godot:: Variant result {json.get_data ()};
1010
11- if (error != godot::OK || result.get_type () != Variant::DICTIONARY) {
11+ if (error != godot::OK || result.get_type () != godot:: Variant::DICTIONARY) {
1212 JVM_ERR_FAIL_V_MSG (true , " Error parsing Godot Kotlin configuration file! Falling back to default configuration" );
1313 }
1414
1515 godot::Dictionary json_dict = result;
1616 if (json_dict.has (VM_TYPE_JSON_IDENTIFIER)) {
17- String value = json_dict[VM_TYPE_JSON_IDENTIFIER];
17+ godot:: String value = json_dict[VM_TYPE_JSON_IDENTIFIER];
1818 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , VM_TYPE_JSON_IDENTIFIER, value);
1919 if (value == AUTO_STRING) {
2020 json_config.vm_type = jni::JvmType::NONE;
@@ -31,7 +31,7 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
3131 json_dict.erase (VM_TYPE_JSON_IDENTIFIER);
3232 }
3333 if (json_dict.has (USE_DEBUG_JSON_IDENTIFIER)) {
34- String boolean = json_dict[USE_DEBUG_JSON_IDENTIFIER];
34+ godot:: String boolean = json_dict[USE_DEBUG_JSON_IDENTIFIER];
3535 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , USE_DEBUG_JSON_IDENTIFIER, boolean);
3636 if (boolean == TRUE_STRING) {
3737 json_config.use_debug = true ;
@@ -55,7 +55,7 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
5555 json_dict.erase (DEBUG_PORT_JSON_IDENTIFIER);
5656 }
5757 if (json_dict.has (DEBUG_ADDRESS_JSON_IDENTIFIER)) {
58- String address = json_dict[DEBUG_ADDRESS_JSON_IDENTIFIER];
58+ godot:: String address = json_dict[DEBUG_ADDRESS_JSON_IDENTIFIER];
5959 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , DEBUG_ADDRESS_JSON_IDENTIFIER, address);
6060 if (address.is_valid_ip_address () || address == " *" ) {
6161 json_config.jvm_debug_address = address;
@@ -66,7 +66,7 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
6666 json_dict.erase (DEBUG_ADDRESS_JSON_IDENTIFIER);
6767 }
6868 if (json_dict.has (WAIT_FOR_DEBUGGER_JSON_IDENTIFIER)) {
69- String boolean = json_dict[WAIT_FOR_DEBUGGER_JSON_IDENTIFIER];
69+ godot:: String boolean = json_dict[WAIT_FOR_DEBUGGER_JSON_IDENTIFIER];
7070 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , WAIT_FOR_DEBUGGER_JSON_IDENTIFIER, boolean);
7171 if (boolean == TRUE_STRING) {
7272 json_config.wait_for_debugger = true ;
@@ -101,7 +101,7 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
101101 json_dict.erase (MAX_STRING_SIZE_JSON_IDENTIFIER);
102102 }
103103 if (json_dict.has (DISABLE_GC_JSON_IDENTIFIER)) {
104- String boolean = json_dict[DISABLE_GC_JSON_IDENTIFIER];
104+ godot:: String boolean = json_dict[DISABLE_GC_JSON_IDENTIFIER];
105105 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , DISABLE_GC_JSON_IDENTIFIER, boolean);
106106 if (boolean == TRUE_STRING) {
107107 json_config.disable_gc = true ;
@@ -120,7 +120,7 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
120120 }
121121
122122 if (json_dict.has (VERSION_JSON_IDENTIFIER)) {
123- String version {json_dict[VERSION_JSON_IDENTIFIER]};
123+ godot:: String version {json_dict[VERSION_JSON_IDENTIFIER]};
124124 JVM_DEV_VERBOSE (" Value for json argument: %s -> %s" , VERSION_JSON_IDENTIFIER, version);
125125 if (version != JSON_ARGUMENT_VERSION) {
126126 JVM_LOG_WARNING (" Your existing jvm json configuration file was made for an older version of this binding. A "
@@ -136,8 +136,8 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
136136 if (!json_dict.is_empty ()) {
137137 godot::Array keys = json_dict.keys ();
138138 for (int i = 0 ; i < keys.size (); i++) {
139- String key = keys[i];
140- String value = json_dict[key];
139+ godot:: String key = keys[i];
140+ godot:: String value = json_dict[key];
141141 JVM_LOG_WARNING (" Invalid json configuration argument name: %s" , key);
142142 }
143143 is_invalid = true ;
@@ -146,11 +146,11 @@ bool JvmUserConfiguration::parse_configuration_json(const String& json_string, J
146146 return is_invalid;
147147}
148148
149- String JvmUserConfiguration::export_configuration_to_json (const JvmUserConfiguration& configuration) {
149+ godot:: String JvmUserConfiguration::export_configuration_to_json (const JvmUserConfiguration& configuration) {
150150 // This function assumes all values are valid.
151151 godot::Dictionary json;
152152
153- String vm_type_value;
153+ godot:: String vm_type_value;
154154 switch (configuration.vm_type ) {
155155 case jni::JvmType::NONE:
156156 vm_type_value = AUTO_STRING;
@@ -184,7 +184,7 @@ String JvmUserConfiguration::export_configuration_to_json(const JvmUserConfigura
184184 return godot::JSON::stringify (json, " " , true , false );
185185}
186186
187- godot::Error split_argument (const String& cmd_arg, String& identifier, String& value) {
187+ godot::Error split_argument (const godot:: String& cmd_arg, godot:: String& identifier, godot:: String& value) {
188188 godot::PackedStringArray jvm_debug_split {cmd_arg.split (" =" )};
189189
190190 if (jvm_debug_split.size () == 2 ) {
@@ -199,7 +199,7 @@ godot::Error split_argument(const String& cmd_arg, String& identifier, String& v
199199 return godot::OK;
200200}
201201
202- bool get_cmd_bool_or_default (const String& value, bool default_if_empty) {
202+ bool get_cmd_bool_or_default (const godot:: String& value, bool default_if_empty) {
203203 if (value.is_empty ()) {
204204 return default_if_empty;
205205 } else if (value == TRUE_STRING) {
@@ -211,15 +211,15 @@ bool get_cmd_bool_or_default(const String& value, bool default_if_empty) {
211211 }
212212}
213213
214- void JvmUserConfiguration::parse_command_line (const List<String>& args, godot::HashMap<String, Variant>& configuration_map) {
214+ void JvmUserConfiguration::parse_command_line (const godot:: List<godot:: String>& args, godot::HashMap<godot:: String, godot:: Variant>& configuration_map) {
215215 // We use a HashMap instead of JvmUserConfiguration so we can still make the difference between a
216216 // JvmUserConfiguration default value and the absence of the matching command line argument. Knowing this is
217217 // essential when merging with the json configuration later.
218218
219219 // Keep in sync with https://godot-kotl.in/en/latest/advanced/commandline-args/
220220 for (const auto & arg : args) {
221- String identifier;
222- String value;
221+ godot:: String identifier;
222+ godot:: String value;
223223 if (split_argument (arg, identifier, value) != godot::Error::OK) { continue ; }
224224
225225 if (identifier == VM_TYPE_CMD_IDENTIFIER) {
@@ -272,7 +272,7 @@ void JvmUserConfiguration::parse_command_line(const List<String>& args, godot::H
272272 configuration_map[DISABLE_GC_CMD_IDENTIFIER] = get_cmd_bool_or_default (value, TRUE_STRING);
273273 } else if (identifier == JVM_ARGUMENTS_CMD_IDENTIFIER) {
274274 godot::Array arr {};
275- for (String jvm_arg: value.split (" " )){
275+ for (godot:: String jvm_arg: value.split (" " )){
276276 arr.append (arg);
277277 }
278278 configuration_map[JVM_ARGUMENTS_CMD_IDENTIFIER] = arr;
@@ -285,11 +285,11 @@ void JvmUserConfiguration::parse_command_line(const List<String>& args, godot::H
285285}
286286
287287template <typename T>
288- void replace_json_value_by_cmd_value (const godot::HashMap<String, Variant>& map, T& json_value, const String& cmd_key) {
288+ void replace_json_value_by_cmd_value (const godot::HashMap<godot:: String, godot:: Variant>& map, T& json_value, const godot:: String& cmd_key) {
289289 if (map.has (cmd_key)) { json_value = godot::VariantCaster<T>::cast (map[cmd_key]); }
290290}
291291
292- void JvmUserConfiguration::merge_with_command_line (JvmUserConfiguration& json_config, const godot::HashMap<String, Variant>& cmd_map) {
292+ void JvmUserConfiguration::merge_with_command_line (JvmUserConfiguration& json_config, const godot::HashMap<godot:: String, godot:: Variant>& cmd_map) {
293293 replace_json_value_by_cmd_value (cmd_map, json_config.vm_type , VM_TYPE_CMD_IDENTIFIER);
294294 replace_json_value_by_cmd_value (cmd_map, json_config.jvm_debug_port , DEBUG_PORT_CMD_IDENTIFIER);
295295 replace_json_value_by_cmd_value (cmd_map, json_config.jvm_debug_address , DEBUG_ADDRESS_CMD_IDENTIFIER);
0 commit comments