1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Introduce std::string_view into wider use (#14368)

This commit is contained in:
sfan5 2024-02-17 15:35:33 +01:00 committed by GitHub
parent fa47af737f
commit 6ca214fefc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 501 additions and 456 deletions

View file

@ -755,7 +755,7 @@ void GUIFormSpecMenu::parseScrollBarOptions(parserData* data, const std::string
data->scrollbar_options.thumb_size = value <= 0 ? 1 : value;
continue;
} else if (options[0] == "arrows") {
std::string value = trim(options[1]);
auto value = trim(options[1]);
if (value == "hide")
data->scrollbar_options.arrow_visiblity = GUIScrollBar::HIDE;
else if (value == "show")
@ -2449,8 +2449,8 @@ bool GUIFormSpecMenu::parseSizeDirect(parserData* data, const std::string &eleme
if (parts.size() < 2)
return false;
std::string type = trim(parts[0]);
std::string description = trim(parts[1]);
auto type = trim(parts[0]);
std::string description(trim(parts[1]));
if (type != "size" && type != "invsize")
return false;
@ -2473,8 +2473,8 @@ bool GUIFormSpecMenu::parsePositionDirect(parserData *data, const std::string &e
if (parts.size() != 2)
return false;
std::string type = trim(parts[0]);
std::string description = trim(parts[1]);
auto type = trim(parts[0]);
std::string description(trim(parts[1]));
if (type != "position")
return false;
@ -2512,8 +2512,8 @@ bool GUIFormSpecMenu::parseAnchorDirect(parserData *data, const std::string &ele
if (parts.size() != 2)
return false;
std::string type = trim(parts[0]);
std::string description = trim(parts[1]);
auto type = trim(parts[0]);
std::string description(trim(parts[1]));
if (type != "anchor")
return false;
@ -2552,8 +2552,8 @@ bool GUIFormSpecMenu::parsePaddingDirect(parserData *data, const std::string &el
if (parts.size() != 2)
return false;
std::string type = trim(parts[0]);
std::string description = trim(parts[1]);
auto type = trim(parts[0]);
std::string description(trim(parts[1]));
if (type != "padding")
return false;
@ -2624,7 +2624,7 @@ bool GUIFormSpecMenu::parseStyle(parserData *data, const std::string &element, b
std::vector<std::string> selectors = split(parts[0], ',');
for (size_t sel = 0; sel < selectors.size(); sel++) {
std::string selector = trim(selectors[sel]);
std::string selector(trim(selectors[sel]));
// Copy the style properties to a new StyleSpec
// This allows a separate state mask per-selector
@ -3216,7 +3216,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
mydata.real_coordinates = m_formspec_version >= 2;
for (; i < elements.size(); i++) {
std::vector<std::string> parts = split(elements[i], '[');
std::string name = trim(parts[0]);
auto name = trim(parts[0]);
if (name != "real_coordinates" || parts.size() != 2)
break; // Invalid format