mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Merge pull request #99328 from AThousandShips/use_find_char
Use `(r)find_char` instead of `(r)find` for single characters
This commit is contained in:
commit
973f16aef1
@ -194,7 +194,7 @@ String ProjectSettings::localize_path(const String &p_path) const {
|
||||
|
||||
return cwd.replace_first(res_path, "res://");
|
||||
} else {
|
||||
int sep = path.rfind("/");
|
||||
int sep = path.rfind_char('/');
|
||||
if (sep == -1) {
|
||||
return "res://" + path;
|
||||
}
|
||||
@ -300,7 +300,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
|
||||
}
|
||||
|
||||
{ // Feature overrides.
|
||||
int dot = p_name.operator String().find(".");
|
||||
int dot = p_name.operator String().find_char('.');
|
||||
if (dot != -1) {
|
||||
Vector<String> s = p_name.operator String().split(".");
|
||||
|
||||
@ -435,7 +435,7 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
|
||||
for (const _VCSort &E : vclist) {
|
||||
String prop_info_name = E.name;
|
||||
int dot = prop_info_name.find(".");
|
||||
int dot = prop_info_name.find_char('.');
|
||||
if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
|
||||
prop_info_name = prop_info_name.substr(0, dot);
|
||||
}
|
||||
@ -1092,7 +1092,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
|
||||
String category = E.name;
|
||||
String name = E.name;
|
||||
|
||||
int div = category.find("/");
|
||||
int div = category.find_char('/');
|
||||
|
||||
if (div < 0) {
|
||||
category = "";
|
||||
|
@ -163,7 +163,7 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, co
|
||||
|
||||
for (int i = 0; i < p_breakpoints.size(); i++) {
|
||||
const String &bp = p_breakpoints[i];
|
||||
int sp = bp.rfind(":");
|
||||
int sp = bp.rfind_char(':');
|
||||
ERR_CONTINUE_MSG(sp == -1, vformat("Invalid breakpoint: '%s', expected file:line format.", bp));
|
||||
|
||||
singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
|
||||
|
@ -171,7 +171,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
||||
|
||||
} else {
|
||||
String key_value = line.get_slicec(' ', 1);
|
||||
int value_pos = key_value.find("=");
|
||||
int value_pos = key_value.find_char('=');
|
||||
|
||||
if (value_pos < 0) {
|
||||
print_line("Error: Invalid set format. Use: set key=value");
|
||||
@ -344,7 +344,7 @@ Pair<String, int> LocalDebugger::to_breakpoint(const String &p_line) {
|
||||
String breakpoint_part = p_line.get_slicec(' ', 1);
|
||||
Pair<String, int> breakpoint;
|
||||
|
||||
int last_colon = breakpoint_part.rfind(":");
|
||||
int last_colon = breakpoint_part.rfind_char(':');
|
||||
if (last_colon < 0) {
|
||||
print_line("Error: Invalid breakpoint format. Expected [source:line]");
|
||||
return breakpoint;
|
||||
|
@ -338,7 +338,7 @@ void RemoteDebugger::_send_stack_vars(List<String> &p_names, List<Variant> &p_va
|
||||
}
|
||||
|
||||
Error RemoteDebugger::_try_capture(const String &p_msg, const Array &p_data, bool &r_captured) {
|
||||
const int idx = p_msg.find(":");
|
||||
const int idx = p_msg.find_char(':');
|
||||
r_captured = false;
|
||||
if (idx < 0) { // No prefix, unknown message.
|
||||
return OK;
|
||||
@ -610,7 +610,7 @@ void RemoteDebugger::poll_events(bool p_is_idle) {
|
||||
ERR_CONTINUE(arr[1].get_type() != Variant::ARRAY);
|
||||
|
||||
const String cmd = arr[0];
|
||||
const int idx = cmd.find(":");
|
||||
const int idx = cmd.find_char(':');
|
||||
bool parsed = false;
|
||||
if (idx < 0) { // Not prefix, use scripts capture.
|
||||
capture_parse("core", cmd, arr[1], parsed);
|
||||
|
@ -224,7 +224,7 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) {
|
||||
uint16_t debug_port = 6007;
|
||||
|
||||
if (debug_host.contains(":")) {
|
||||
int sep_pos = debug_host.rfind(":");
|
||||
int sep_pos = debug_host.rfind_char(':');
|
||||
debug_port = debug_host.substr(sep_pos + 1).to_int();
|
||||
debug_host = debug_host.substr(0, sep_pos);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
|
||||
String name = pi.name.substr(pi.name.find_char('/') + 1, pi.name.length());
|
||||
r_options->push_back(name.quote());
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void InputMap::get_argument_options(const StringName &p_function, int p_idx, Lis
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
|
||||
String name = pi.name.substr(pi.name.find_char('/') + 1, pi.name.length());
|
||||
r_options->push_back(name.quote());
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ void InputMap::load_from_project_settings() {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
|
||||
String name = pi.name.substr(pi.name.find_char('/') + 1, pi.name.length());
|
||||
|
||||
Dictionary action = GLOBAL_GET(pi.name);
|
||||
float deadzone = action.has("deadzone") ? (float)action["deadzone"] : DEFAULT_DEADZONE;
|
||||
|
@ -155,9 +155,9 @@ Error DirAccess::make_dir_recursive(const String &p_dir) {
|
||||
} else if (full_dir.begins_with("user://")) {
|
||||
base = "user://";
|
||||
} else if (full_dir.is_network_share_path()) {
|
||||
int pos = full_dir.find("/", 2);
|
||||
int pos = full_dir.find_char('/', 2);
|
||||
ERR_FAIL_COND_V(pos < 0, ERR_INVALID_PARAMETER);
|
||||
pos = full_dir.find("/", pos + 1);
|
||||
pos = full_dir.find_char('/', pos + 1);
|
||||
ERR_FAIL_COND_V(pos < 0, ERR_INVALID_PARAMETER);
|
||||
base = full_dir.substr(0, pos + 1);
|
||||
} else if (full_dir.begins_with("/")) {
|
||||
|
@ -101,7 +101,7 @@ Error HTTPClient::verify_headers(const Vector<String> &p_headers) {
|
||||
for (int i = 0; i < p_headers.size(); i++) {
|
||||
String sanitized = p_headers[i].strip_edges();
|
||||
ERR_FAIL_COND_V_MSG(sanitized.is_empty(), ERR_INVALID_PARAMETER, vformat("Invalid HTTP header at index %d: empty.", i));
|
||||
ERR_FAIL_COND_V_MSG(sanitized.find(":") < 1, ERR_INVALID_PARAMETER,
|
||||
ERR_FAIL_COND_V_MSG(sanitized.find_char(':') < 1, ERR_INVALID_PARAMETER,
|
||||
vformat("Invalid HTTP header at index %d: String must contain header-value pair, delimited by ':', but was: '%s'.", i, p_headers[i]));
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() {
|
||||
get_response_headers(&rh);
|
||||
Dictionary ret;
|
||||
for (const String &s : rh) {
|
||||
int sp = s.find(":");
|
||||
int sp = s.find_char(':');
|
||||
if (sp == -1) {
|
||||
continue;
|
||||
}
|
||||
|
@ -508,11 +508,11 @@ Error HTTPClientTCP::poll() {
|
||||
continue;
|
||||
}
|
||||
if (s.begins_with("content-length:")) {
|
||||
body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int();
|
||||
body_size = s.substr(s.find_char(':') + 1, s.length()).strip_edges().to_int();
|
||||
body_left = body_size;
|
||||
|
||||
} else if (s.begins_with("transfer-encoding:")) {
|
||||
String encoding = header.substr(header.find(":") + 1, header.length()).strip_edges();
|
||||
String encoding = header.substr(header.find_char(':') + 1, header.length()).strip_edges();
|
||||
if (encoding == "chunked") {
|
||||
chunked = true;
|
||||
}
|
||||
|
@ -661,12 +661,12 @@ bool PList::load_string(const String &p_string, String &r_err_out) {
|
||||
List<Ref<PListNode>> stack;
|
||||
String key;
|
||||
while (pos >= 0) {
|
||||
int open_token_s = p_string.find("<", pos);
|
||||
int open_token_s = p_string.find_char('<', pos);
|
||||
if (open_token_s == -1) {
|
||||
r_err_out = "Unexpected end of data. No tags found.";
|
||||
return false;
|
||||
}
|
||||
int open_token_e = p_string.find(">", open_token_s);
|
||||
int open_token_e = p_string.find_char('>', open_token_s);
|
||||
pos = open_token_e;
|
||||
|
||||
String token = p_string.substr(open_token_s + 1, open_token_e - open_token_s - 1);
|
||||
@ -676,7 +676,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) {
|
||||
}
|
||||
String value;
|
||||
if (token[0] == '?' || token[0] == '!') { // Skip <?xml ... ?> and <!DOCTYPE ... >
|
||||
int end_token_e = p_string.find(">", open_token_s);
|
||||
int end_token_e = p_string.find_char('>', open_token_s);
|
||||
pos = end_token_e;
|
||||
continue;
|
||||
}
|
||||
@ -769,7 +769,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) {
|
||||
r_err_out = vformat("Mismatched <%s> tag.", token);
|
||||
return false;
|
||||
}
|
||||
int end_token_e = p_string.find(">", end_token_s);
|
||||
int end_token_e = p_string.find_char('>', end_token_s);
|
||||
pos = end_token_e;
|
||||
String end_token = p_string.substr(end_token_s + 2, end_token_e - end_token_s - 2);
|
||||
if (end_token != token) {
|
||||
|
@ -1206,7 +1206,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
|
||||
|
||||
int best_score = 0;
|
||||
for (int i = 0; i < res_remaps.size(); i++) {
|
||||
int split = res_remaps[i].rfind(":");
|
||||
int split = res_remaps[i].rfind_char(':');
|
||||
if (split == -1) {
|
||||
continue;
|
||||
}
|
||||
@ -1498,11 +1498,11 @@ Vector<String> ResourceLoader::list_directory(const String &p_directory) {
|
||||
}
|
||||
} else {
|
||||
if (d.ends_with(".import") || d.ends_with(".remap") || d.ends_with(".uid")) {
|
||||
d = d.substr(0, d.rfind("."));
|
||||
d = d.substr(0, d.rfind_char('.'));
|
||||
}
|
||||
|
||||
if (d.ends_with(".gdc")) {
|
||||
d = d.substr(0, d.rfind("."));
|
||||
d = d.substr(0, d.rfind_char('.'));
|
||||
d += ".gd";
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
|
||||
// Record plural rule.
|
||||
int p_start = config.find("Plural-Forms");
|
||||
if (p_start != -1) {
|
||||
int p_end = config.find("\n", p_start);
|
||||
int p_end = config.find_char('\n', p_start);
|
||||
translation->set_plural_rule(config.substr(p_start, p_end - p_start));
|
||||
}
|
||||
} else {
|
||||
@ -224,7 +224,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
|
||||
// Record plural rule.
|
||||
int p_start = config.find("Plural-Forms");
|
||||
if (p_start != -1) {
|
||||
int p_end = config.find("\n", p_start);
|
||||
int p_end = config.find_char('\n', p_start);
|
||||
translation->set_plural_rule(config.substr(p_start, p_end - p_start));
|
||||
plural_forms = translation->get_plural_forms();
|
||||
}
|
||||
@ -324,7 +324,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
|
||||
Vector<String> configs = config.split("\n");
|
||||
for (int i = 0; i < configs.size(); i++) {
|
||||
String c = configs[i].strip_edges();
|
||||
int p = c.find(":");
|
||||
int p = c.find_char(':');
|
||||
if (p == -1) {
|
||||
continue;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ NodePath::NodePath(const String &p_path) {
|
||||
bool absolute = (path[0] == '/');
|
||||
bool last_is_slash = true;
|
||||
int slices = 0;
|
||||
int subpath_pos = path.find(":");
|
||||
int subpath_pos = path.find_char(':');
|
||||
|
||||
if (subpath_pos != -1) {
|
||||
int from = subpath_pos + 1;
|
||||
|
@ -227,11 +227,11 @@ void TranslationPO::set_plural_rule(const String &p_plural_rule) {
|
||||
// Set plural_forms and plural_rule.
|
||||
// p_plural_rule passed in has the form "Plural-Forms: nplurals=2; plural=(n >= 2);".
|
||||
|
||||
int first_semi_col = p_plural_rule.find(";");
|
||||
plural_forms = p_plural_rule.substr(p_plural_rule.find("=") + 1, first_semi_col - (p_plural_rule.find("=") + 1)).to_int();
|
||||
int first_semi_col = p_plural_rule.find_char(';');
|
||||
plural_forms = p_plural_rule.substr(p_plural_rule.find_char('=') + 1, first_semi_col - (p_plural_rule.find_char('=') + 1)).to_int();
|
||||
|
||||
int expression_start = p_plural_rule.find("=", first_semi_col) + 1;
|
||||
int second_semi_col = p_plural_rule.rfind(";");
|
||||
int expression_start = p_plural_rule.find_char('=', first_semi_col) + 1;
|
||||
int second_semi_col = p_plural_rule.rfind_char(';');
|
||||
plural_rule = p_plural_rule.substr(expression_start, second_semi_col - expression_start).strip_edges();
|
||||
|
||||
// Setup the cache to make evaluating plural rule faster later on.
|
||||
|
@ -246,27 +246,27 @@ Error String::parse_url(String &r_scheme, String &r_host, int &r_port, String &r
|
||||
base = base.substr(pos + 3, base.length() - pos - 3);
|
||||
}
|
||||
}
|
||||
pos = base.find("#");
|
||||
pos = base.find_char('#');
|
||||
// Fragment
|
||||
if (pos != -1) {
|
||||
r_fragment = base.substr(pos + 1);
|
||||
base = base.substr(0, pos);
|
||||
}
|
||||
pos = base.find("/");
|
||||
pos = base.find_char('/');
|
||||
// Path
|
||||
if (pos != -1) {
|
||||
r_path = base.substr(pos, base.length() - pos);
|
||||
base = base.substr(0, pos);
|
||||
}
|
||||
// Host
|
||||
pos = base.find("@");
|
||||
pos = base.find_char('@');
|
||||
if (pos != -1) {
|
||||
// Strip credentials
|
||||
base = base.substr(pos + 1, base.length() - pos - 1);
|
||||
}
|
||||
if (base.begins_with("[")) {
|
||||
// Literal IPv6
|
||||
pos = base.rfind("]");
|
||||
pos = base.rfind_char(']');
|
||||
if (pos == -1) {
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
@ -277,7 +277,7 @@ Error String::parse_url(String &r_scheme, String &r_host, int &r_port, String &r
|
||||
if (base.get_slice_count(":") > 2) {
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
pos = base.rfind(":");
|
||||
pos = base.rfind_char(':');
|
||||
if (pos == -1) {
|
||||
r_host = base;
|
||||
base = "";
|
||||
@ -2641,7 +2641,7 @@ int64_t String::to_int() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int to = (find(".") >= 0) ? find(".") : length();
|
||||
int to = (find_char('.') >= 0) ? find_char('.') : length();
|
||||
|
||||
int64_t integer = 0;
|
||||
int64_t sign = 1;
|
||||
@ -4580,7 +4580,7 @@ String String::simplify_path() const {
|
||||
if (p == -1) {
|
||||
p = s.find(":\\");
|
||||
}
|
||||
if (p != -1 && p < s.find("/")) {
|
||||
if (p != -1 && p < s.find_char('/')) {
|
||||
drive = s.substr(0, p + 2);
|
||||
s = s.substr(p + 2);
|
||||
}
|
||||
@ -5025,7 +5025,7 @@ String String::xml_unescape() const {
|
||||
|
||||
String String::pad_decimals(int p_digits) const {
|
||||
String s = *this;
|
||||
int c = s.find(".");
|
||||
int c = s.find_char('.');
|
||||
|
||||
if (c == -1) {
|
||||
if (p_digits <= 0) {
|
||||
@ -5049,7 +5049,7 @@ String String::pad_decimals(int p_digits) const {
|
||||
|
||||
String String::pad_zeros(int p_digits) const {
|
||||
String s = *this;
|
||||
int end = s.find(".");
|
||||
int end = s.find_char('.');
|
||||
|
||||
if (end == -1) {
|
||||
end = s.length();
|
||||
@ -5316,7 +5316,7 @@ String String::validate_filename() const {
|
||||
}
|
||||
|
||||
bool String::is_valid_ip_address() const {
|
||||
if (find(":") >= 0) {
|
||||
if (find_char(':') >= 0) {
|
||||
Vector<String> ip = split(":");
|
||||
for (int i = 0; i < ip.size(); i++) {
|
||||
const String &n = ip[i];
|
||||
@ -5386,13 +5386,13 @@ String String::get_base_dir() const {
|
||||
// Windows UNC network share path.
|
||||
if (end == 0) {
|
||||
if (is_network_share_path()) {
|
||||
basepos = find("/", 2);
|
||||
basepos = find_char('/', 2);
|
||||
if (basepos == -1) {
|
||||
basepos = find("\\", 2);
|
||||
basepos = find_char('\\', 2);
|
||||
}
|
||||
int servpos = find("/", basepos + 1);
|
||||
int servpos = find_char('/', basepos + 1);
|
||||
if (servpos == -1) {
|
||||
servpos = find("\\", basepos + 1);
|
||||
servpos = find_char('\\', basepos + 1);
|
||||
}
|
||||
if (servpos != -1) {
|
||||
end = servpos + 1;
|
||||
@ -5416,7 +5416,7 @@ String String::get_base_dir() const {
|
||||
rs = *this;
|
||||
}
|
||||
|
||||
int sep = MAX(rs.rfind("/"), rs.rfind("\\"));
|
||||
int sep = MAX(rs.rfind_char('/'), rs.rfind_char('\\'));
|
||||
if (sep == -1) {
|
||||
return base;
|
||||
}
|
||||
@ -5425,7 +5425,7 @@ String String::get_base_dir() const {
|
||||
}
|
||||
|
||||
String String::get_file() const {
|
||||
int sep = MAX(rfind("/"), rfind("\\"));
|
||||
int sep = MAX(rfind_char('/'), rfind_char('\\'));
|
||||
if (sep == -1) {
|
||||
return *this;
|
||||
}
|
||||
@ -5434,8 +5434,8 @@ String String::get_file() const {
|
||||
}
|
||||
|
||||
String String::get_extension() const {
|
||||
int pos = rfind(".");
|
||||
if (pos < 0 || pos < MAX(rfind("/"), rfind("\\"))) {
|
||||
int pos = rfind_char('.');
|
||||
if (pos < 0 || pos < MAX(rfind_char('/'), rfind_char('\\'))) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -5533,8 +5533,8 @@ String String::validate_node_name() const {
|
||||
}
|
||||
|
||||
String String::get_basename() const {
|
||||
int pos = rfind(".");
|
||||
if (pos < 0 || pos < MAX(rfind("/"), rfind("\\"))) {
|
||||
int pos = rfind_char('.');
|
||||
if (pos < 0 || pos < MAX(rfind_char('/'), rfind_char('\\'))) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ Error AudioDriverALSA::init_output_device() {
|
||||
status = snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
|
||||
} else {
|
||||
String device = output_device_name;
|
||||
int pos = device.find(";");
|
||||
int pos = device.find_char(';');
|
||||
if (pos != -1) {
|
||||
device = device.substr(0, pos);
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ String OS_Unix::get_locale() const {
|
||||
}
|
||||
|
||||
String locale = get_environment("LANG");
|
||||
int tp = locale.find(".");
|
||||
int tp = locale.find_char('.');
|
||||
if (tp != -1) {
|
||||
locale = locale.substr(0, tp);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) const {
|
||||
return cdir;
|
||||
} else {
|
||||
if (_get_root_string().is_empty()) {
|
||||
int pos = cdir.find(":");
|
||||
int pos = cdir.find_char(':');
|
||||
if (pos != -1) {
|
||||
return cdir.substr(pos + 1);
|
||||
}
|
||||
@ -344,7 +344,7 @@ String DirAccessWindows::get_filesystem_type() const {
|
||||
return "Network Share";
|
||||
}
|
||||
|
||||
int unit_end = path.find(":");
|
||||
int unit_end = path.find_char(':');
|
||||
ERR_FAIL_COND_V(unit_end == -1, String());
|
||||
String unit = path.substr(0, unit_end + 1) + "\\";
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool FileAccessWindows::is_path_invalid(const String &p_path) {
|
||||
// Check for invalid operating system file.
|
||||
String fname = p_path.get_file().to_lower();
|
||||
|
||||
int dot = fname.find(".");
|
||||
int dot = fname.find_char('.');
|
||||
if (dot != -1) {
|
||||
fname = fname.substr(0, dot);
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
||||
}
|
||||
|
||||
String base_path = animation->track_get_path(i);
|
||||
int end = base_path.find(":");
|
||||
int end = base_path.find_char(':');
|
||||
if (end != -1) {
|
||||
base_path = base_path.substr(0, end + 1);
|
||||
}
|
||||
|
@ -4340,7 +4340,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
|
||||
if (track_path == np) {
|
||||
actual_value = value; // All good.
|
||||
} else {
|
||||
int sep = track_path.rfind(":");
|
||||
int sep = track_path.rfind_char(':');
|
||||
if (sep != -1) {
|
||||
String base_path = track_path.substr(0, sep);
|
||||
if (base_path == np) {
|
||||
@ -6495,7 +6495,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||
path = NodePath(node->get_path().get_names(), path.get_subnames(), true); // Store full path instead for copying.
|
||||
} else {
|
||||
text = path;
|
||||
int sep = text.find(":");
|
||||
int sep = text.find_char(':');
|
||||
if (sep != -1) {
|
||||
text = text.substr(sep + 1, text.length());
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ void ConnectDialog::set_dst_node(Node *p_node) {
|
||||
StringName ConnectDialog::get_dst_method_name() const {
|
||||
String txt = dst_method->get_text();
|
||||
if (txt.contains("(")) {
|
||||
txt = txt.left(txt.find("(")).strip_edges();
|
||||
txt = txt.left(txt.find_char('(')).strip_edges();
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
|
@ -160,13 +160,13 @@ bool CreateDialog::_should_hide_type(const StringName &p_type) const {
|
||||
|
||||
String script_path = ScriptServer::get_global_class_path(p_type);
|
||||
if (script_path.begins_with("res://addons/")) {
|
||||
int i = script_path.find("/", 13); // 13 is length of "res://addons/".
|
||||
int i = script_path.find_char('/', 13); // 13 is length of "res://addons/".
|
||||
while (i > -1) {
|
||||
const String plugin_path = script_path.substr(0, i).path_join("plugin.cfg");
|
||||
if (FileAccess::exists(plugin_path)) {
|
||||
return !EditorNode::get_singleton()->is_addon_plugin_enabled(plugin_path);
|
||||
}
|
||||
i = script_path.find("/", i + 1);
|
||||
i = script_path.find_char('/', i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ Dictionary DebugAdapterParser::req_initialize(const Dictionary &p_params) const
|
||||
for (List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
|
||||
String breakpoint = E->get();
|
||||
|
||||
String path = breakpoint.left(breakpoint.find(":", 6)); // Skip initial part of path, aka "res://"
|
||||
String path = breakpoint.left(breakpoint.find_char(':', 6)); // Skip initial part of path, aka "res://"
|
||||
int line = breakpoint.substr(path.size()).to_int();
|
||||
|
||||
DebugAdapterProtocol::get_singleton()->on_debug_breakpoint_toggled(path, line, true);
|
||||
|
@ -160,9 +160,9 @@ void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_d
|
||||
} else {
|
||||
// If the script is built-in, it can be opened only if the scene is loaded in memory.
|
||||
int i = file.find("::");
|
||||
int j = file.rfind("(", i);
|
||||
int j = file.rfind_char('(', i);
|
||||
if (j > -1) { // If the script is named, the string is "name (file)", so we need to extract the path.
|
||||
file = file.substr(j + 1, file.find(")", i) - j - 1);
|
||||
file = file.substr(j + 1, file.find_char(')', i) - j - 1);
|
||||
}
|
||||
Ref<PackedScene> ps = ResourceLoader::load(file.get_slice("::", 0));
|
||||
stack_script = ResourceLoader::load(file);
|
||||
@ -183,9 +183,9 @@ void EditorDebuggerNode::_text_editor_stack_clear(const ScriptEditorDebugger *p_
|
||||
} else {
|
||||
// If the script is built-in, it can be opened only if the scene is loaded in memory.
|
||||
int i = file.find("::");
|
||||
int j = file.rfind("(", i);
|
||||
int j = file.rfind_char('(', i);
|
||||
if (j > -1) { // If the script is named, the string is "name (file)", so we need to extract the path.
|
||||
file = file.substr(j + 1, file.find(")", i) - j - 1);
|
||||
file = file.substr(j + 1, file.find_char(')', i) - j - 1);
|
||||
}
|
||||
Ref<PackedScene> ps = ResourceLoader::load(file.get_slice("::", 0));
|
||||
stack_script = ResourceLoader::load(file);
|
||||
|
@ -382,7 +382,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) {
|
||||
text = ".";
|
||||
} else {
|
||||
text = text.replace("/root/", "");
|
||||
int slash = text.find("/");
|
||||
int slash = text.find_char('/');
|
||||
if (slash < 0) {
|
||||
text = ".";
|
||||
} else {
|
||||
|
@ -471,7 +471,7 @@ void DependencyRemoveDialog::_find_localization_remaps_of_removed_files(Vector<R
|
||||
for (int j = 0; j < remap_keys.size(); j++) {
|
||||
PackedStringArray remapped_files = remaps[remap_keys[j]];
|
||||
for (int k = 0; k < remapped_files.size(); k++) {
|
||||
int splitter_pos = remapped_files[k].rfind(":");
|
||||
int splitter_pos = remapped_files[k].rfind_char(':');
|
||||
String res_path = remapped_files[k].substr(0, splitter_pos);
|
||||
if (res_path == path) {
|
||||
String locale_name = remapped_files[k].substr(splitter_pos + 1);
|
||||
|
@ -142,7 +142,7 @@ void DirectoryCreateDialog::config(const String &p_base_dir, const Callable &p_a
|
||||
validation_panel->update();
|
||||
|
||||
if (p_mode == MODE_FILE) {
|
||||
int extension_pos = p_default_name.rfind(".");
|
||||
int extension_pos = p_default_name.rfind_char('.');
|
||||
if (extension_pos > -1) {
|
||||
dir_path->select(0, extension_pos);
|
||||
return;
|
||||
|
@ -130,14 +130,14 @@ void EditorAssetInstaller::open_asset(const String &p_path, bool p_autoskip_topl
|
||||
|
||||
// Create intermediate directories if they aren't reported by unzip.
|
||||
// We are only interested in subfolders, so skip the root slash.
|
||||
int separator = source_name.find("/", 1);
|
||||
int separator = source_name.find_char('/', 1);
|
||||
while (separator != -1) {
|
||||
String dir_name = source_name.substr(0, separator + 1);
|
||||
if (!dir_name.is_empty() && !asset_files.has(dir_name)) {
|
||||
asset_files.insert(dir_name);
|
||||
}
|
||||
|
||||
separator = source_name.find("/", separator + 1);
|
||||
separator = source_name.find_char('/', separator + 1);
|
||||
}
|
||||
|
||||
if (!source_name.is_empty() && !asset_files.has(source_name)) {
|
||||
@ -214,7 +214,7 @@ void EditorAssetInstaller::_rebuild_source_tree() {
|
||||
|
||||
TreeItem *parent_item;
|
||||
|
||||
int separator = path.rfind("/");
|
||||
int separator = path.rfind_char('/');
|
||||
if (separator == -1) {
|
||||
parent_item = root;
|
||||
} else {
|
||||
@ -313,7 +313,7 @@ void EditorAssetInstaller::_rebuild_destination_tree() {
|
||||
|
||||
TreeItem *parent_item;
|
||||
|
||||
int separator = path.rfind("/");
|
||||
int separator = path.rfind_char('/');
|
||||
if (separator == -1) {
|
||||
parent_item = root;
|
||||
} else {
|
||||
|
@ -249,7 +249,7 @@ void EditorFolding::_do_object_unfolds(Object *p_object, HashSet<Ref<Resource>>
|
||||
}
|
||||
}
|
||||
} else { //path
|
||||
int last = E.name.rfind("/");
|
||||
int last = E.name.rfind_char('/');
|
||||
if (last != -1) {
|
||||
bool can_revert = EditorPropertyRevert::can_property_revert(p_object, E.name);
|
||||
if (can_revert) {
|
||||
|
@ -148,7 +148,7 @@ static String _contextualize_class_specifier(const String &p_class_specifier, co
|
||||
|
||||
// Here equal length + begins_with from above implies p_class_specifier == p_edited_class :)
|
||||
if (p_class_specifier.length() == p_edited_class.length()) {
|
||||
int rfind = p_class_specifier.rfind(".");
|
||||
int rfind = p_class_specifier.rfind_char('.');
|
||||
if (rfind == -1) { // Single identifier
|
||||
return p_class_specifier;
|
||||
}
|
||||
@ -234,7 +234,7 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
||||
enum_class_name = "@GlobalScope";
|
||||
enum_name = link;
|
||||
} else {
|
||||
const int dot_pos = link.rfind(".");
|
||||
const int dot_pos = link.rfind_char('.');
|
||||
if (dot_pos >= 0) {
|
||||
enum_class_name = link.left(dot_pos);
|
||||
enum_name = link.substr(dot_pos + 1);
|
||||
@ -3252,7 +3252,7 @@ EditorHelpBit::HelpData EditorHelpBit::_get_property_help_data(const StringName
|
||||
enum_class_name = "@GlobalScope";
|
||||
enum_name = property.enumeration;
|
||||
} else {
|
||||
const int dot_pos = property.enumeration.rfind(".");
|
||||
const int dot_pos = property.enumeration.rfind_char('.');
|
||||
if (dot_pos >= 0) {
|
||||
enum_class_name = property.enumeration.left(dot_pos);
|
||||
enum_name = property.enumeration.substr(dot_pos + 1);
|
||||
@ -3619,7 +3619,7 @@ void EditorHelpBit::_meta_clicked(const String &p_select) {
|
||||
enum_class_name = "@GlobalScope";
|
||||
enum_name = link;
|
||||
} else {
|
||||
const int dot_pos = link.rfind(".");
|
||||
const int dot_pos = link.rfind_char('.');
|
||||
if (dot_pos >= 0) {
|
||||
enum_class_name = link.left(dot_pos);
|
||||
enum_name = link.substr(dot_pos + 1);
|
||||
|
@ -3131,7 +3131,7 @@ void EditorInspector::update_tree() {
|
||||
|
||||
if (!array_prefix.is_empty()) {
|
||||
path = path.trim_prefix(array_prefix);
|
||||
int char_index = path.find("/");
|
||||
int char_index = path.find_char('/');
|
||||
if (char_index >= 0) {
|
||||
path = path.right(-char_index - 1);
|
||||
} else {
|
||||
@ -3171,10 +3171,10 @@ void EditorInspector::update_tree() {
|
||||
}
|
||||
|
||||
// Get the property label's string.
|
||||
String name_override = (path.contains("/")) ? path.substr(path.rfind("/") + 1) : path;
|
||||
String name_override = (path.contains("/")) ? path.substr(path.rfind_char('/') + 1) : path;
|
||||
String feature_tag;
|
||||
{
|
||||
const int dot = name_override.find(".");
|
||||
const int dot = name_override.find_char('.');
|
||||
if (dot != -1) {
|
||||
feature_tag = name_override.substr(dot);
|
||||
name_override = name_override.substr(0, dot);
|
||||
@ -3189,7 +3189,7 @@ void EditorInspector::update_tree() {
|
||||
const String property_label_string = EditorPropertyNameProcessor::get_singleton()->process_name(name_override, name_style, p.name, doc_name) + feature_tag;
|
||||
|
||||
// Remove the property from the path.
|
||||
int idx = path.rfind("/");
|
||||
int idx = path.rfind_char('/');
|
||||
if (idx > -1) {
|
||||
path = path.left(idx);
|
||||
} else {
|
||||
@ -3320,7 +3320,7 @@ void EditorInspector::update_tree() {
|
||||
array_element_prefix = class_name_components[0];
|
||||
editor_inspector_array = memnew(EditorInspectorArray(all_read_only));
|
||||
|
||||
String array_label = path.contains("/") ? path.substr(path.rfind("/") + 1) : path;
|
||||
String array_label = path.contains("/") ? path.substr(path.rfind_char('/') + 1) : path;
|
||||
array_label = EditorPropertyNameProcessor::get_singleton()->process_name(property_label_string, property_name_style, p.name, doc_name);
|
||||
int page = per_array_page.has(array_element_prefix) ? per_array_page[array_element_prefix] : 0;
|
||||
editor_inspector_array->setup_with_move_element_function(object, array_label, array_element_prefix, page, c, use_folding);
|
||||
|
@ -253,8 +253,8 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
|
||||
// append that to yield "folder/foo.tscn".
|
||||
if (difference > 0) {
|
||||
String parent = full_path.substr(0, difference);
|
||||
int slash_idx = parent.rfind("/");
|
||||
slash_idx = parent.rfind("/", slash_idx - 1);
|
||||
int slash_idx = parent.rfind_char('/');
|
||||
slash_idx = parent.rfind_char('/', slash_idx - 1);
|
||||
parent = (slash_idx >= 0 && parent.length() > 1) ? parent.substr(slash_idx + 1) : parent;
|
||||
r_filenames.write[set_idx] = parent + r_filenames[set_idx];
|
||||
}
|
||||
|
@ -740,10 +740,10 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint
|
||||
// The format of p_hint_string is:
|
||||
// subType/subTypeHint:nextSubtype ... etc.
|
||||
if (!p_hint_string.is_empty()) {
|
||||
int hint_subtype_separator = p_hint_string.find(":");
|
||||
int hint_subtype_separator = p_hint_string.find_char(':');
|
||||
if (hint_subtype_separator >= 0) {
|
||||
String subtype_string = p_hint_string.substr(0, hint_subtype_separator);
|
||||
int slash_pos = subtype_string.find("/");
|
||||
int slash_pos = subtype_string.find_char('/');
|
||||
if (slash_pos >= 0) {
|
||||
subtype_hint = PropertyHint(subtype_string.substr(slash_pos + 1, subtype_string.size() - slash_pos - 1).to_int());
|
||||
subtype_string = subtype_string.substr(0, slash_pos);
|
||||
@ -1006,10 +1006,10 @@ void EditorPropertyDictionary::setup(PropertyHint p_hint, const String &p_hint_s
|
||||
PackedStringArray types = p_hint_string.split(";");
|
||||
if (types.size() > 0 && !types[0].is_empty()) {
|
||||
String key = types[0];
|
||||
int hint_key_subtype_separator = key.find(":");
|
||||
int hint_key_subtype_separator = key.find_char(':');
|
||||
if (hint_key_subtype_separator >= 0) {
|
||||
String key_subtype_string = key.substr(0, hint_key_subtype_separator);
|
||||
int slash_pos = key_subtype_string.find("/");
|
||||
int slash_pos = key_subtype_string.find_char('/');
|
||||
if (slash_pos >= 0) {
|
||||
key_subtype_hint = PropertyHint(key_subtype_string.substr(slash_pos + 1, key_subtype_string.size() - slash_pos - 1).to_int());
|
||||
key_subtype_string = key_subtype_string.substr(0, slash_pos);
|
||||
@ -1025,10 +1025,10 @@ void EditorPropertyDictionary::setup(PropertyHint p_hint, const String &p_hint_s
|
||||
}
|
||||
if (types.size() > 1 && !types[1].is_empty()) {
|
||||
String value = types[1];
|
||||
int hint_value_subtype_separator = value.find(":");
|
||||
int hint_value_subtype_separator = value.find_char(':');
|
||||
if (hint_value_subtype_separator >= 0) {
|
||||
String value_subtype_string = value.substr(0, hint_value_subtype_separator);
|
||||
int slash_pos = value_subtype_string.find("/");
|
||||
int slash_pos = value_subtype_string.find_char('/');
|
||||
if (slash_pos >= 0) {
|
||||
value_subtype_hint = PropertyHint(value_subtype_string.substr(slash_pos + 1, value_subtype_string.size() - slash_pos - 1).to_int());
|
||||
value_subtype_string = value_subtype_string.substr(0, slash_pos);
|
||||
|
@ -96,7 +96,7 @@ class SectionedInspectorFilter : public Object {
|
||||
List<PropertyInfo> pinfo;
|
||||
edited->get_property_list(&pinfo);
|
||||
for (PropertyInfo &pi : pinfo) {
|
||||
int sp = pi.name.find("/");
|
||||
int sp = pi.name.find_char('/');
|
||||
|
||||
if (pi.name == "resource_path" || pi.name == "resource_name" || pi.name == "resource_local_to_scene" || pi.name.begins_with("script/") || pi.name.begins_with("_global_script")) { //skip resource stuff
|
||||
continue;
|
||||
@ -255,7 +255,7 @@ void SectionedInspector::update_category_list() {
|
||||
continue;
|
||||
}
|
||||
|
||||
int sp = pi.name.find("/");
|
||||
int sp = pi.name.find_char('/');
|
||||
if (sp == -1) {
|
||||
pi.name = "global/" + pi.name;
|
||||
}
|
||||
|
@ -240,8 +240,8 @@ EngineUpdateLabel::VersionType EngineUpdateLabel::_get_version_type(const String
|
||||
}
|
||||
|
||||
String EngineUpdateLabel::_extract_sub_string(const String &p_line) const {
|
||||
int j = p_line.find("\"") + 1;
|
||||
return p_line.substr(j, p_line.find("\"", j) - j);
|
||||
int j = p_line.find_char('"') + 1;
|
||||
return p_line.substr(j, p_line.find_char('"', j) - j);
|
||||
}
|
||||
|
||||
void EngineUpdateLabel::_notification(int p_what) {
|
||||
|
@ -137,7 +137,7 @@ bool FileSystemList::edit_selected() {
|
||||
|
||||
String name = get_item_text(s);
|
||||
line_editor->set_text(name);
|
||||
line_editor->select(0, name.rfind("."));
|
||||
line_editor->select(0, name.rfind_char('.'));
|
||||
|
||||
popup_edit_commited = false; // Start edit popup processing.
|
||||
popup_editor->popup();
|
||||
@ -2432,7 +2432,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
||||
|
||||
if (to_rename.is_file) {
|
||||
String name = to_rename.path.get_file();
|
||||
tree->set_editor_selection(0, name.rfind("."));
|
||||
tree->set_editor_selection(0, name.rfind_char('.'));
|
||||
} else {
|
||||
String name = to_rename.path.left(-1).get_file(); // Removes the "/" suffix for folders.
|
||||
tree->set_editor_selection(0, name.length());
|
||||
@ -3658,10 +3658,10 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
|
||||
tree_item->select(0);
|
||||
} else {
|
||||
// Find parent folder.
|
||||
fpath = fpath.substr(0, fpath.rfind("/") + 1);
|
||||
fpath = fpath.substr(0, fpath.rfind_char('/') + 1);
|
||||
if (fpath.size() > String("res://").size()) {
|
||||
fpath = fpath.left(fpath.size() - 2); // Remove last '/'.
|
||||
const int slash_idx = fpath.rfind("/");
|
||||
const int slash_idx = fpath.rfind_char('/');
|
||||
fpath = fpath.substr(slash_idx + 1, fpath.size() - slash_idx - 1);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void EditorFileDialog::popup_file_dialog() {
|
||||
}
|
||||
|
||||
void EditorFileDialog::_focus_file_text() {
|
||||
int lp = file->get_text().rfind(".");
|
||||
int lp = file->get_text().rfind_char('.');
|
||||
if (lp != -1) {
|
||||
file->select(0, lp);
|
||||
file->grab_focus();
|
||||
@ -1263,7 +1263,7 @@ void EditorFileDialog::set_current_path(const String &p_path) {
|
||||
if (!p_path.size()) {
|
||||
return;
|
||||
}
|
||||
int pos = MAX(p_path.rfind("/"), p_path.rfind("\\"));
|
||||
int pos = MAX(p_path.rfind_char('/'), p_path.rfind_char('\\'));
|
||||
if (pos == -1) {
|
||||
set_current_file(p_path);
|
||||
} else {
|
||||
|
@ -199,7 +199,7 @@ Error ResourceImporterImageFont::import(ResourceUID::ID p_source_id, const Strin
|
||||
case STEP_OFF_Y_BEGIN: {
|
||||
// Read advance and offset.
|
||||
if (range[c] == ' ') {
|
||||
int next = range.find(" ", c + 1);
|
||||
int next = range.find_char(' ', c + 1);
|
||||
if (next < c) {
|
||||
next = range.length();
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ void LocalizationEditor::_filesystem_files_moved(const String &p_old_file, const
|
||||
bool remapped_files_updated = false;
|
||||
|
||||
for (int j = 0; j < remapped_files.size(); j++) {
|
||||
int splitter_pos = remapped_files[j].rfind(":");
|
||||
int splitter_pos = remapped_files[j].rfind_char(':');
|
||||
String res_path = remapped_files[j].substr(0, splitter_pos);
|
||||
|
||||
if (res_path == p_old_file) {
|
||||
@ -482,7 +482,7 @@ void LocalizationEditor::_filesystem_file_removed(const String &p_file) {
|
||||
for (int i = 0; i < remap_keys.size() && !remaps_changed; i++) {
|
||||
PackedStringArray remapped_files = remaps[remap_keys[i]];
|
||||
for (int j = 0; j < remapped_files.size() && !remaps_changed; j++) {
|
||||
int splitter_pos = remapped_files[j].rfind(":");
|
||||
int splitter_pos = remapped_files[j].rfind_char(':');
|
||||
String res_path = remapped_files[j].substr(0, splitter_pos);
|
||||
remaps_changed = p_file == res_path;
|
||||
if (remaps_changed) {
|
||||
@ -567,7 +567,7 @@ void LocalizationEditor::update_translations() {
|
||||
PackedStringArray selected = remaps[keys[i]];
|
||||
for (int j = 0; j < selected.size(); j++) {
|
||||
const String &s2 = selected[j];
|
||||
int qp = s2.rfind(":");
|
||||
int qp = s2.rfind_char(':');
|
||||
String path = s2.substr(0, qp);
|
||||
String locale = s2.substr(qp + 1, s2.length());
|
||||
|
||||
|
@ -907,7 +907,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
if (headers[i].findn("ETag:") == 0) { // Save etag
|
||||
String cache_filename_base = EditorPaths::get_singleton()->get_cache_dir().path_join("assetimage_" + image_queue[p_queue_id].image_url.md5_text());
|
||||
String new_etag = headers[i].substr(headers[i].find(":") + 1, headers[i].length()).strip_edges();
|
||||
String new_etag = headers[i].substr(headers[i].find_char(':') + 1, headers[i].length()).strip_edges();
|
||||
Ref<FileAccess> file = FileAccess::open(cache_filename_base + ".etag", FileAccess::WRITE);
|
||||
if (file.is_valid()) {
|
||||
file->store_line(new_etag);
|
||||
|
@ -282,7 +282,7 @@ void ScriptTextEditor::_warning_clicked(const Variant &p_line) {
|
||||
CodeEdit *text_editor = code_editor->get_text_editor();
|
||||
String prev_line = line > 0 ? text_editor->get_line(line - 1) : "";
|
||||
if (prev_line.contains("@warning_ignore")) {
|
||||
const int closing_bracket_idx = prev_line.find(")");
|
||||
const int closing_bracket_idx = prev_line.find_char(')');
|
||||
const String text_to_insert = ", " + code.quote(quote_style);
|
||||
text_editor->insert_text(text_to_insert, line - 1, closing_bracket_idx);
|
||||
} else {
|
||||
@ -1205,7 +1205,7 @@ void ScriptTextEditor::_update_connected_methods() {
|
||||
|
||||
// Account for inner classes by stripping the class names from the method,
|
||||
// starting from the right since our inner class might be inside of another inner class.
|
||||
int pos = raw_name.rfind(".");
|
||||
int pos = raw_name.rfind_char('.');
|
||||
if (pos != -1) {
|
||||
name = raw_name.substr(pos + 1);
|
||||
}
|
||||
|
@ -1970,7 +1970,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
|
||||
// -- func c(var a, var b) -> func c(a, b)
|
||||
if (line.contains("func ") && line.contains("var ")) {
|
||||
int start = line.find("func ");
|
||||
start = line.substr(start).find("(") + start;
|
||||
start = line.substr(start).find_char('(') + start;
|
||||
int end = get_end_parenthesis(line.substr(start)) + 1;
|
||||
if (end > -1) {
|
||||
Vector<String> parts = parse_arguments(line.substr(start, end));
|
||||
@ -2120,12 +2120,12 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
|
||||
}
|
||||
}
|
||||
// -- func _init(p_x:int).(p_x): -> func _init(p_x:int):\n\tsuper(p_x) Object # https://github.com/godotengine/godot/issues/70542
|
||||
if (line.contains(" _init(") && line.rfind(":") > 0) {
|
||||
if (line.contains(" _init(") && line.rfind_char(':') > 0) {
|
||||
// func _init(p_arg1).(super4, super5, super6)->void:
|
||||
// ^--^indent ^super_start super_end^
|
||||
int indent = line.count("\t", 0, line.find("func"));
|
||||
int super_start = line.find(".(");
|
||||
int super_end = line.rfind(")");
|
||||
int super_end = line.rfind_char(')');
|
||||
if (super_start > 0 && super_end > super_start) {
|
||||
line = line.substr(0, super_start) + line.substr(super_end + 1) + "\n" + String("\t").repeat(indent + 1) + "super" + line.substr(super_start + 1, super_end - super_start);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void ScriptCreateDialog::_notification(int p_what) {
|
||||
|
||||
void ScriptCreateDialog::_path_hbox_sorted() {
|
||||
if (is_visible()) {
|
||||
int filename_start_pos = file_path->get_text().rfind("/") + 1;
|
||||
int filename_start_pos = file_path->get_text().rfind_char('/') + 1;
|
||||
int filename_end_pos = file_path->get_text().get_basename().length();
|
||||
|
||||
if (!is_built_in) {
|
||||
|
@ -103,7 +103,7 @@ void ShaderCreateDialog::_update_language_info() {
|
||||
|
||||
void ShaderCreateDialog::_path_hbox_sorted() {
|
||||
if (is_visible()) {
|
||||
int filename_start_pos = initial_base_path.rfind("/") + 1;
|
||||
int filename_start_pos = initial_base_path.rfind_char('/') + 1;
|
||||
int filename_end_pos = initial_base_path.length();
|
||||
|
||||
if (!is_built_in) {
|
||||
|
@ -1598,7 +1598,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
} else if (arg.ends_with("project.godot")) {
|
||||
String path;
|
||||
String file = arg;
|
||||
int sep = MAX(file.rfind("/"), file.rfind("\\"));
|
||||
int sep = MAX(file.rfind_char('/'), file.rfind_char('\\'));
|
||||
if (sep == -1) {
|
||||
path = ".";
|
||||
} else {
|
||||
@ -4145,7 +4145,7 @@ int Main::start() {
|
||||
local_game_path = "res://" + local_game_path;
|
||||
|
||||
} else {
|
||||
int sep = local_game_path.rfind("/");
|
||||
int sep = local_game_path.rfind_char('/');
|
||||
|
||||
if (sep == -1) {
|
||||
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
@ -140,7 +140,7 @@ void GDScriptDocGen::_doctype_from_gdtype(const GDType &p_gdtype, String &r_type
|
||||
r_enum = String(p_gdtype.native_type).replace("::", ".");
|
||||
if (r_enum.begins_with("res://")) {
|
||||
r_enum = r_enum.trim_prefix("res://");
|
||||
int dot_pos = r_enum.rfind(".");
|
||||
int dot_pos = r_enum.rfind_char('.');
|
||||
if (dot_pos >= 0) {
|
||||
r_enum = r_enum.left(dot_pos).quote() + r_enum.substr(dot_pos);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
||||
}
|
||||
if (from + end_key_length > line_length) {
|
||||
// If it's key length and there is a '\', dont skip to highlight esc chars.
|
||||
if (str.find("\\", from) >= 0) {
|
||||
if (str.find_char('\\', from) >= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
||||
for (; from < line_length; from++) {
|
||||
if (line_length - from < end_key_length) {
|
||||
// Don't break if '\' to highlight esc chars.
|
||||
if (str.find("\\", from) < 0) {
|
||||
if (str.find_char('\\', from) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3472,7 +3472,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
|
||||
}
|
||||
String arg = arg_itr->name;
|
||||
if (arg.contains(":")) {
|
||||
arg = arg.substr(0, arg.find(":"));
|
||||
arg = arg.substr(0, arg.find_char(':'));
|
||||
}
|
||||
method_hint += arg;
|
||||
if (use_type_hint) {
|
||||
|
@ -80,7 +80,7 @@ static bool _get_blender_version(const String &p_path, int &r_major, int &r_mino
|
||||
}
|
||||
pipe = pipe.substr(bl);
|
||||
pipe = pipe.replace_first("Blender ", "");
|
||||
int pp = pipe.find(".");
|
||||
int pp = pipe.find_char('.');
|
||||
if (pp == -1) {
|
||||
if (r_err) {
|
||||
*r_err = vformat(TTR("Couldn't extract version information from Blender executable at: %s."), p_path);
|
||||
@ -96,7 +96,7 @@ static bool _get_blender_version(const String &p_path, int &r_major, int &r_mino
|
||||
return false;
|
||||
}
|
||||
|
||||
int pp2 = pipe.find(".", pp + 1);
|
||||
int pp2 = pipe.find_char('.', pp + 1);
|
||||
r_minor = pp2 > pp ? pipe.substr(pp + 1, pp2 - pp - 1).to_int() : 0;
|
||||
|
||||
return true;
|
||||
|
@ -689,7 +689,7 @@ void GLTFDocument::_compute_node_heights(Ref<GLTFState> p_state) {
|
||||
}
|
||||
|
||||
static Vector<uint8_t> _parse_base64_uri(const String &p_uri) {
|
||||
int start = p_uri.find(",");
|
||||
int start = p_uri.find_char(',');
|
||||
ERR_FAIL_COND_V(start == -1, Vector<uint8_t>());
|
||||
|
||||
CharString substr = p_uri.substr(start + 1).ascii();
|
||||
|
@ -2817,7 +2817,7 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const
|
||||
if (p_path.begins_with("csharp://")) {
|
||||
// This is a virtual path used by generic types, extract the real path.
|
||||
real_path = "res://" + p_path.trim_prefix("csharp://");
|
||||
real_path = real_path.substr(0, real_path.rfind(":"));
|
||||
real_path = real_path.substr(0, real_path.rfind_char(':'));
|
||||
}
|
||||
|
||||
Ref<CSharpScript> scr;
|
||||
|
@ -190,7 +190,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
||||
|
||||
int pos = 0;
|
||||
while (pos < bbcode.length()) {
|
||||
int brk_pos = bbcode.find("[", pos);
|
||||
int brk_pos = bbcode.find_char('[', pos);
|
||||
|
||||
if (brk_pos < 0) {
|
||||
brk_pos = bbcode.length();
|
||||
@ -210,7 +210,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
||||
break;
|
||||
}
|
||||
|
||||
int brk_end = bbcode.find("]", brk_pos + 1);
|
||||
int brk_end = bbcode.find_char(']', brk_pos + 1);
|
||||
|
||||
if (brk_end == -1) {
|
||||
String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
|
||||
@ -239,7 +239,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
||||
output.append("[");
|
||||
pos = brk_pos + 1;
|
||||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find(" ");
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
|
||||
@ -385,7 +385,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
||||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag == "url") {
|
||||
int end = bbcode.find("[", brk_end);
|
||||
int end = bbcode.find_char('[', brk_end);
|
||||
if (end == -1) {
|
||||
end = bbcode.length();
|
||||
}
|
||||
@ -403,7 +403,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
||||
pos = brk_end + 1;
|
||||
tag_stack.push_front("url");
|
||||
} else if (tag == "img") {
|
||||
int end = bbcode.find("[", brk_end);
|
||||
int end = bbcode.find_char('[', brk_end);
|
||||
if (end == -1) {
|
||||
end = bbcode.length();
|
||||
}
|
||||
@ -455,7 +455,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
|
||||
int pos = 0;
|
||||
while (pos < bbcode.length()) {
|
||||
int brk_pos = bbcode.find("[", pos);
|
||||
int brk_pos = bbcode.find_char('[', pos);
|
||||
|
||||
if (brk_pos < 0) {
|
||||
brk_pos = bbcode.length();
|
||||
@ -488,7 +488,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
break;
|
||||
}
|
||||
|
||||
int brk_end = bbcode.find("]", brk_pos + 1);
|
||||
int brk_end = bbcode.find_char(']', brk_pos + 1);
|
||||
|
||||
if (brk_end == -1) {
|
||||
if (!line_del) {
|
||||
@ -551,7 +551,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
xml_output.append("[");
|
||||
pos = brk_pos + 1;
|
||||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find(" ");
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
|
||||
@ -696,7 +696,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag == "code" || tag.begins_with("code ")) {
|
||||
int end = bbcode.find("[", brk_end);
|
||||
int end = bbcode.find_char('[', brk_end);
|
||||
if (end == -1) {
|
||||
end = bbcode.length();
|
||||
}
|
||||
@ -751,7 +751,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag == "url") {
|
||||
int end = bbcode.find("[", brk_end);
|
||||
int end = bbcode.find_char('[', brk_end);
|
||||
if (end == -1) {
|
||||
end = bbcode.length();
|
||||
}
|
||||
@ -772,7 +772,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
||||
pos = brk_end + 1;
|
||||
tag_stack.push_front("url");
|
||||
} else if (tag == "img") {
|
||||
int end = bbcode.find("[", brk_end);
|
||||
int end = bbcode.find_char('[', brk_end);
|
||||
if (end == -1) {
|
||||
end = bbcode.length();
|
||||
}
|
||||
@ -1619,7 +1619,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
|
||||
|
||||
bool enum_in_static_class = false;
|
||||
|
||||
if (enum_proxy_name.find(".") > 0) {
|
||||
if (enum_proxy_name.find_char('.') > 0) {
|
||||
enum_in_static_class = true;
|
||||
String enum_class_name = enum_proxy_name.get_slicec('.', 0);
|
||||
enum_proxy_name = enum_proxy_name.get_slicec('.', 1);
|
||||
|
@ -116,7 +116,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = prop.name.substr(prop.name.find("/") + 1, prop.name.length());
|
||||
String name = prop.name.substr(prop.name.find_char('/') + 1, prop.name.length());
|
||||
suggestions.push_back(quoted(name));
|
||||
}
|
||||
} break;
|
||||
|
@ -212,7 +212,7 @@ String relative_to_impl(const String &p_path, const String &p_relative_to) {
|
||||
#ifdef WINDOWS_ENABLED
|
||||
String get_drive_letter(const String &p_norm_path) {
|
||||
int idx = p_norm_path.find(":/");
|
||||
if (idx != -1 && idx < p_norm_path.find("/")) {
|
||||
if (idx != -1 && idx < p_norm_path.find_char('/')) {
|
||||
return p_norm_path.substr(0, idx + 1);
|
||||
}
|
||||
return String();
|
||||
|
@ -375,7 +375,7 @@ void ReplicationEditor::_add_pressed() {
|
||||
return;
|
||||
}
|
||||
|
||||
int idx = np_text.find(":");
|
||||
int idx = np_text.find_char(':');
|
||||
if (idx == -1) {
|
||||
np_text = ".:" + np_text;
|
||||
} else if (idx == 0) {
|
||||
@ -554,7 +554,7 @@ void ReplicationEditor::_add_property(const NodePath &p_property, bool p_spawn,
|
||||
Node *root_node = current && !current->get_root_path().is_empty() ? current->get_node(current->get_root_path()) : nullptr;
|
||||
Ref<Texture2D> icon = _get_class_icon(root_node);
|
||||
if (root_node) {
|
||||
String path = prop.substr(0, prop.find(":"));
|
||||
String path = prop.substr(0, prop.find_char(':'));
|
||||
String subpath = prop.substr(path.size());
|
||||
Node *node = root_node->get_node_or_null(path);
|
||||
if (!node) {
|
||||
|
@ -53,7 +53,7 @@ void ImageLoaderSVG::_replace_color_property(const HashMap<Color, Color> &p_colo
|
||||
int pos = r_string.find(p_prefix);
|
||||
while (pos != -1) {
|
||||
pos += prefix_len; // Skip prefix.
|
||||
int end_pos = r_string.find("\"", pos);
|
||||
int end_pos = r_string.find_char('"', pos);
|
||||
ERR_FAIL_COND_MSG(end_pos == -1, vformat("Malformed SVG string after property \"%s\".", p_prefix));
|
||||
const String color_code = r_string.substr(pos, end_pos - pos);
|
||||
if (color_code != "none" && !color_code.begins_with("url(")) {
|
||||
|
@ -1564,7 +1564,7 @@ void EditorExportPlatformAndroid::_fix_resources(const Ref<EditorExportPreset> &
|
||||
str = get_project_name(package_name);
|
||||
|
||||
} else {
|
||||
String lang = str.substr(str.rfind("-") + 1, str.length()).replace("-", "_");
|
||||
String lang = str.substr(str.rfind_char('-') + 1, str.length()).replace("-", "_");
|
||||
if (appnames.has(lang)) {
|
||||
str = appnames[lang];
|
||||
} else {
|
||||
|
@ -970,7 +970,7 @@ Error EditorExportPlatformMacOS::_notarize(const Ref<EditorExportPreset> &p_pres
|
||||
return Error::FAILED;
|
||||
} else {
|
||||
print_verbose("rcodesign (" + p_path + "):\n" + str);
|
||||
int next_nl = str.find("\n", rq_offset);
|
||||
int next_nl = str.find_char('\n', rq_offset);
|
||||
String request_uuid = (next_nl == -1) ? str.substr(rq_offset + 23, -1) : str.substr(rq_offset + 23, next_nl - rq_offset - 23);
|
||||
add_message(EXPORT_MESSAGE_INFO, TTR("Notarization"), vformat(TTR("Notarization request UUID: \"%s\""), request_uuid));
|
||||
add_message(EXPORT_MESSAGE_INFO, TTR("Notarization"), TTR("The notarization process generally takes less than an hour."));
|
||||
@ -1054,7 +1054,7 @@ Error EditorExportPlatformMacOS::_notarize(const Ref<EditorExportPreset> &p_pres
|
||||
return Error::FAILED;
|
||||
} else {
|
||||
print_verbose("notarytool (" + p_path + "):\n" + str);
|
||||
int next_nl = str.find("\n", rq_offset);
|
||||
int next_nl = str.find_char('\n', rq_offset);
|
||||
String request_uuid = (next_nl == -1) ? str.substr(rq_offset + 4, -1) : str.substr(rq_offset + 4, next_nl - rq_offset - 4);
|
||||
add_message(EXPORT_MESSAGE_INFO, TTR("Notarization"), vformat(TTR("Notarization request UUID: \"%s\""), request_uuid));
|
||||
add_message(EXPORT_MESSAGE_INFO, TTR("Notarization"), TTR("The notarization process generally takes less than an hour."));
|
||||
|
@ -80,7 +80,7 @@ void WebToolsEditorPlugin::_download_zip() {
|
||||
const String output_path = String("/tmp").path_join(output_name);
|
||||
|
||||
zipFile zip = zipOpen2(output_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io);
|
||||
const String base_path = resource_path.substr(0, resource_path.rfind("/")) + "/";
|
||||
const String base_path = resource_path.substr(0, resource_path.rfind_char('/')) + "/";
|
||||
_zip_recursive(resource_path, base_path, zip);
|
||||
zipClose(zip, nullptr);
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ void FileDialog::popup_file_dialog() {
|
||||
}
|
||||
|
||||
void FileDialog::_focus_file_text() {
|
||||
int lp = file->get_text().rfind(".");
|
||||
int lp = file->get_text().rfind_char('.');
|
||||
if (lp != -1) {
|
||||
file->select(0, lp);
|
||||
if (file->is_inside_tree() && !is_part_of_edited_scene()) {
|
||||
@ -1001,7 +1001,7 @@ void FileDialog::set_current_path(const String &p_path) {
|
||||
if (!p_path.size()) {
|
||||
return;
|
||||
}
|
||||
int pos = MAX(p_path.rfind("/"), p_path.rfind("\\"));
|
||||
int pos = MAX(p_path.rfind_char('/'), p_path.rfind_char('\\'));
|
||||
if (pos == -1) {
|
||||
set_current_file(p_path);
|
||||
} else {
|
||||
|
@ -4845,7 +4845,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
|
||||
String tooltip;
|
||||
bool size_in_percent = false;
|
||||
if (!bbcode_value.is_empty()) {
|
||||
int sep = bbcode_value.find("x");
|
||||
int sep = bbcode_value.find_char('x');
|
||||
if (sep == -1) {
|
||||
width = bbcode_value.to_int();
|
||||
} else {
|
||||
|
@ -87,7 +87,7 @@ String HTTPRequest::get_header_value(const PackedStringArray &p_headers, const S
|
||||
|
||||
String lowwer_case_header_name = p_header_name.to_lower();
|
||||
for (int i = 0; i < p_headers.size(); i++) {
|
||||
if (p_headers[i].find(":") > 0) {
|
||||
if (p_headers[i].find_char(':') > 0) {
|
||||
Vector<String> parts = p_headers[i].split(":", false, 1);
|
||||
if (parts.size() > 1 && parts[0].strip_edges().to_lower() == lowwer_case_header_name) {
|
||||
value = parts[1].strip_edges();
|
||||
|
@ -182,7 +182,7 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const
|
||||
// Heuristically check if this is a synthetic property (whatever/0, whatever/1, etc.)
|
||||
// because they are not in the class DB yet must have a default (null).
|
||||
String prop_str = String(p_property);
|
||||
int p = prop_str.rfind("/");
|
||||
int p = prop_str.rfind_char('/');
|
||||
if (p != -1 && p < prop_str.length() - 1) {
|
||||
bool all_digits = true;
|
||||
for (int i = p + 1; i < prop_str.length(); i++) {
|
||||
|
@ -1734,7 +1734,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
||||
while (true) {
|
||||
String line = f->get_line();
|
||||
|
||||
int delimiter = line.find(" ");
|
||||
int delimiter = line.find_char(' ');
|
||||
String type = line.substr(0, delimiter);
|
||||
int pos = delimiter + 1;
|
||||
HashMap<String, String> keys;
|
||||
@ -1744,7 +1744,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
||||
}
|
||||
|
||||
while (pos < line.size()) {
|
||||
int eq = line.find("=", pos);
|
||||
int eq = line.find_char('=', pos);
|
||||
if (eq == -1) {
|
||||
break;
|
||||
}
|
||||
@ -1752,14 +1752,14 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
||||
int end = -1;
|
||||
String value;
|
||||
if (line[eq + 1] == '"') {
|
||||
end = line.find("\"", eq + 2);
|
||||
end = line.find_char('"', eq + 2);
|
||||
if (end == -1) {
|
||||
break;
|
||||
}
|
||||
value = line.substr(eq + 2, end - 1 - eq - 1);
|
||||
pos = end + 1;
|
||||
} else {
|
||||
end = line.find(" ", eq + 1);
|
||||
end = line.find_char(' ', eq + 1);
|
||||
if (end == -1) {
|
||||
end = line.size();
|
||||
}
|
||||
|
@ -1315,7 +1315,7 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String sname = p_name;
|
||||
|
||||
if (sname.begins_with("surface_")) {
|
||||
int sl = sname.find("/");
|
||||
int sl = sname.find_char('/');
|
||||
if (sl == -1) {
|
||||
return false;
|
||||
}
|
||||
@ -1708,7 +1708,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
|
||||
String sname = p_name;
|
||||
if (sname.begins_with("surface_")) {
|
||||
int sl = sname.find("/");
|
||||
int sl = sname.find_char('/');
|
||||
if (sl == -1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -822,10 +822,10 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
value = missing_resource_properties[E.name];
|
||||
}
|
||||
} else if (E.type == Variant::ARRAY && E.hint == PROPERTY_HINT_TYPE_STRING) {
|
||||
int hint_subtype_separator = E.hint_string.find(":");
|
||||
int hint_subtype_separator = E.hint_string.find_char(':');
|
||||
if (hint_subtype_separator >= 0) {
|
||||
String subtype_string = E.hint_string.substr(0, hint_subtype_separator);
|
||||
int slash_pos = subtype_string.find("/");
|
||||
int slash_pos = subtype_string.find_char('/');
|
||||
PropertyHint subtype_hint = PropertyHint::PROPERTY_HINT_NONE;
|
||||
if (slash_pos >= 0) {
|
||||
subtype_hint = PropertyHint(subtype_string.get_slice("/", 1).to_int());
|
||||
@ -851,11 +851,11 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
}
|
||||
}
|
||||
} else if (E.type == Variant::DICTIONARY && E.hint == PROPERTY_HINT_TYPE_STRING) {
|
||||
int key_value_separator = E.hint_string.find(";");
|
||||
int key_value_separator = E.hint_string.find_char(';');
|
||||
if (key_value_separator >= 0) {
|
||||
int key_subtype_separator = E.hint_string.find(":");
|
||||
int key_subtype_separator = E.hint_string.find_char(':');
|
||||
String key_subtype_string = E.hint_string.substr(0, key_subtype_separator);
|
||||
int key_slash_pos = key_subtype_string.find("/");
|
||||
int key_slash_pos = key_subtype_string.find_char('/');
|
||||
PropertyHint key_subtype_hint = PropertyHint::PROPERTY_HINT_NONE;
|
||||
if (key_slash_pos >= 0) {
|
||||
key_subtype_hint = PropertyHint(key_subtype_string.get_slice("/", 1).to_int());
|
||||
@ -864,9 +864,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
Variant::Type key_subtype = Variant::Type(key_subtype_string.to_int());
|
||||
bool convert_key = key_subtype == Variant::OBJECT && key_subtype_hint == PROPERTY_HINT_NODE_TYPE;
|
||||
|
||||
int value_subtype_separator = E.hint_string.find(":", key_value_separator) - (key_value_separator + 1);
|
||||
int value_subtype_separator = E.hint_string.find_char(':', key_value_separator) - (key_value_separator + 1);
|
||||
String value_subtype_string = E.hint_string.substr(key_value_separator + 1, value_subtype_separator);
|
||||
int value_slash_pos = value_subtype_string.find("/");
|
||||
int value_slash_pos = value_subtype_string.find_char('/');
|
||||
PropertyHint value_subtype_hint = PropertyHint::PROPERTY_HINT_NONE;
|
||||
if (value_slash_pos >= 0) {
|
||||
value_subtype_hint = PropertyHint(value_subtype_string.get_slice("/", 1).to_int());
|
||||
|
@ -1782,7 +1782,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
|
||||
for (KeyValue<Ref<Resource>, String> &E : external_resources) {
|
||||
String cached_id = E.key->get_id_for_path(local_path);
|
||||
if (cached_id.is_empty() || cached_ids_found.has(cached_id)) {
|
||||
int sep_pos = E.value.find("_");
|
||||
int sep_pos = E.value.find_char('_');
|
||||
if (sep_pos != -1) {
|
||||
E.value = E.value.substr(0, sep_pos + 1); // Keep the order found, for improved thread loading performance.
|
||||
} else {
|
||||
|
@ -205,7 +205,7 @@ Dictionary CodeHighlighter::_get_line_syntax_highlighting_impl(int p_line) {
|
||||
if (end_key_length == 0 || color_regions[c].line_only || from + end_key_length > line_length) {
|
||||
if (from + end_key_length > line_length && (color_regions[in_region].start_key == "\"" || color_regions[in_region].start_key == "\'")) {
|
||||
// If it's key length and there is a '\', dont skip to highlight esc chars.
|
||||
if (str.find("\\", from) >= 0) {
|
||||
if (str.find_char('\\', from) >= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ Dictionary CodeHighlighter::_get_line_syntax_highlighting_impl(int p_line) {
|
||||
for (; from < line_length; from++) {
|
||||
if (line_length - from < end_key_length) {
|
||||
// Don't break if '\' to highlight esc chars.
|
||||
if (!is_string || str.find("\\", from) < 0) {
|
||||
if (!is_string || str.find_char('\\', from) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user