diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
commit | 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch) | |
tree | fd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/windowing | |
parent | 14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff) |
The Formatting String Catastrophe
Diffstat (limited to 'source/windowing')
-rw-r--r-- | source/windowing/StarFuelWidget.cpp | 2 | ||||
-rw-r--r-- | source/windowing/StarGuiReader.cpp | 6 | ||||
-rw-r--r-- | source/windowing/StarGuiTypes.cpp | 2 | ||||
-rw-r--r-- | source/windowing/StarItemGridWidget.cpp | 2 | ||||
-rw-r--r-- | source/windowing/StarItemSlotWidget.cpp | 6 | ||||
-rw-r--r-- | source/windowing/StarKeyBindings.cpp | 8 | ||||
-rw-r--r-- | source/windowing/StarListWidget.cpp | 8 | ||||
-rw-r--r-- | source/windowing/StarRegisteredPaneManager.hpp | 8 | ||||
-rw-r--r-- | source/windowing/StarSliderBar.cpp | 18 | ||||
-rw-r--r-- | source/windowing/StarWidget.cpp | 18 | ||||
-rw-r--r-- | source/windowing/StarWidgetParsing.cpp | 54 |
11 files changed, 66 insertions, 66 deletions
diff --git a/source/windowing/StarFuelWidget.cpp b/source/windowing/StarFuelWidget.cpp index 43ea3d5..af51cb2 100644 --- a/source/windowing/StarFuelWidget.cpp +++ b/source/windowing/StarFuelWidget.cpp @@ -86,7 +86,7 @@ void FuelWidget::renderImpl() { guiContext.setFontColor(Color::White.toRgba()); } - guiContext.renderInterfaceText(strf("Fuel %s/%s", std::min(m_fuelLevel + m_potential, m_maxLevel), (int)m_maxLevel), + guiContext.renderInterfaceText(strf("Fuel {}/{}", std::min(m_fuelLevel + m_potential, m_maxLevel), (int)m_maxLevel), {textPosition, HorizontalAnchor::HMidAnchor, VerticalAnchor::VMidAnchor}); } diff --git a/source/windowing/StarGuiReader.cpp b/source/windowing/StarGuiReader.cpp index 4e02529..f44706a 100644 --- a/source/windowing/StarGuiReader.cpp +++ b/source/windowing/StarGuiReader.cpp @@ -38,10 +38,10 @@ WidgetConstructResult GuiReader::titleHandler(String const&, Json const& config) String type = iconConfig.getString("type"); auto icon = m_constructors.get(type)("icon", iconConfig); if (!icon.obj) - throw WidgetParserException(strf("Title specified incompatible icon type: %s", type)); + throw WidgetParserException(strf("Title specified incompatible icon type: {}", type)); m_pane->setTitle(icon.obj, title, subtitle); } catch (JsonException const& e) { - throw WidgetParserException(strf("Malformed icon configuration data in title. %s", outputException(e, false))); + throw WidgetParserException(strf("Malformed icon configuration data in title. {}", outputException(e, false))); } } } else { @@ -74,7 +74,7 @@ WidgetConstructResult GuiReader::backgroundHandler(String const&, Json const& co footer = config.getString("fileFooter", ""); } catch (MapException const& e) { throw WidgetParserException( - strf("Malformed gui json, missing a required value in the map. %s", outputException(e, false))); + strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false))); } m_pane->setBG(header, body, footer); diff --git a/source/windowing/StarGuiTypes.cpp b/source/windowing/StarGuiTypes.cpp index 2085426..80ac5fd 100644 --- a/source/windowing/StarGuiTypes.cpp +++ b/source/windowing/StarGuiTypes.cpp @@ -23,7 +23,7 @@ EnumMap<GuiDirection> const GuiDirectionNames{ }; String rarityBorder(Rarity rarity) { - return strf("/interface/inventory/itemborder%s.png", RarityNames.getRight(rarity).toLower()); + return strf("/interface/inventory/itemborder{}.png", RarityNames.getRight(rarity).toLower()); } } diff --git a/source/windowing/StarItemGridWidget.cpp b/source/windowing/StarItemGridWidget.cpp index 624385b..ad02c32 100644 --- a/source/windowing/StarItemGridWidget.cpp +++ b/source/windowing/StarItemGridWidget.cpp @@ -155,7 +155,7 @@ void ItemGridWidget::setItemBag(ItemBagConstPtr bag) { m_slots.clear(); for (size_t i = 0; i < m_bag->size() - m_bagOffset && i < (unsigned)m_dimensions[0] * m_dimensions[1]; ++i) { auto itemSlot = make_shared<ItemSlotWidget>(m_bag->at(i), m_backingImage); - addChild(strf("%d", i), itemSlot); + addChild(strf("{}", i), itemSlot); m_slots.append(itemSlot); itemSlot->setBackingImageAffinity(m_drawBackingImageWhenFull, m_drawBackingImageWhenEmpty); itemSlot->setProgress(m_progress); diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index a828838..cf12a8d 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -178,20 +178,20 @@ void ItemSlotWidget::renderImpl() { } int frame = (int)roundf(m_progress * 18); // TODO: Hardcoded lol - context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:%d", frame)), Vec2F(screenPosition())); + context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:{}", frame)), Vec2F(screenPosition())); if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something context()->setFont(m_font); context()->setFontSize(m_fontSize); context()->setFontColor(m_fontColor.toRgba()); context()->setFontMode(m_countFontMode); - context()->renderInterfaceText(strf("%d", m_item->count()), m_countPosition.translated(Vec2F(screenPosition()))); + context()->renderInterfaceText(strf("{}", m_item->count()), m_countPosition.translated(Vec2F(screenPosition()))); } } else if (m_drawBackingImageWhenEmpty && m_backingImage != "") { context()->drawInterfaceQuad(m_backingImage, Vec2F(screenPosition())); int frame = (int)roundf(m_progress * 18); // TODO: Hardcoded lol - context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:%d", frame)), Vec2F(screenPosition())); + context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:{}", frame)), Vec2F(screenPosition())); } if (m_highlightEnabled) { diff --git a/source/windowing/StarKeyBindings.cpp b/source/windowing/StarKeyBindings.cpp index e93a1af..969a766 100644 --- a/source/windowing/StarKeyBindings.cpp +++ b/source/windowing/StarKeyBindings.cpp @@ -107,10 +107,10 @@ KeyChord inputDescriptorFromJson(Json const& json) { } else if (value.canConvert(Json::Type::Int)) { key = (Key)value.toUInt(); } else { - throw StarException::format("Improper key value '%s'", value); + throw StarException::format("Improper key value '{}'", value); } } else { - throw StarException::format("Improper bindings type '%s'", type); + throw StarException::format("Improper bindings type '{}'", type); } KeyMod mods = KeyMod::NoMod; @@ -156,7 +156,7 @@ KeyBindings::KeyBindings(Json const& json) { auto chord = inputDescriptorFromJson(input); actions[chord.key].append({chord.mods, action}); } catch (StarException const& e) { - Logger::warn("Could not load keybinding for %s: %s\n", + Logger::warn("Could not load keybinding for {}: {}\n", InterfaceActionNames.getRight(action), outputException(e, false)); } @@ -165,7 +165,7 @@ KeyBindings::KeyBindings(Json const& json) { m_actions = move(actions); } catch (StarException const& e) { - throw StarException(strf("Could not set keybindings from configuration. %s", outputException(e, false))); + throw StarException(strf("Could not set keybindings from configuration. {}", outputException(e, false))); } } diff --git a/source/windowing/StarListWidget.cpp b/source/windowing/StarListWidget.cpp index cda7f92..993fb73 100644 --- a/source/windowing/StarListWidget.cpp +++ b/source/windowing/StarListWidget.cpp @@ -63,14 +63,14 @@ void ListWidget::setSchema(Json const& schema) { m_spacing = jsonToVec2I(schema.get("spacing")); m_memberSize = jsonToVec2I(schema.get("memberSize")); } catch (JsonException const& e) { - throw GuiException(strf("Missing required value in map: %s", outputException(e, false))); + throw GuiException(strf("Missing required value in map: {}", outputException(e, false))); } updateSizeAndPosition(); } WidgetPtr ListWidget::addItem() { auto newItem = constructWidget(); - addChild(strf("%d", Random::randu64()), newItem); + addChild(strf("{}", Random::randu64()), newItem); updateSizeAndPosition(); return newItem; @@ -78,7 +78,7 @@ WidgetPtr ListWidget::addItem() { WidgetPtr ListWidget::addItem(size_t at) { auto newItem = constructWidget(); - addChildAt(strf("%d", Random::randu64()), newItem, at); + addChildAt(strf("{}", Random::randu64()), newItem, at); updateSizeAndPosition(); if (m_selectedItem != NPos && at <= m_selectedItem) @@ -88,7 +88,7 @@ WidgetPtr ListWidget::addItem(size_t at) { } WidgetPtr ListWidget::addItem(WidgetPtr existingItem) { - addChild(strf("%d", Random::randu64()), existingItem); + addChild(strf("{}", Random::randu64()), existingItem); updateSizeAndPosition(); return existingItem; diff --git a/source/windowing/StarRegisteredPaneManager.hpp b/source/windowing/StarRegisteredPaneManager.hpp index fb17ee5..4038525 100644 --- a/source/windowing/StarRegisteredPaneManager.hpp +++ b/source/windowing/StarRegisteredPaneManager.hpp @@ -50,7 +50,7 @@ template <typename T> shared_ptr<T> RegisteredPaneManager<KeyT>::registeredPane(KeyT const& paneId) const { if (auto v = m_registeredPanes.ptr(paneId)) return convert<T>(v->pane); - throw GuiException(strf("No pane named '%s' found in RegisteredPaneManager", outputAny(paneId))); + throw GuiException(strf("No pane named '{}' found in RegisteredPaneManager", outputAny(paneId))); } template <typename KeyT> @@ -58,7 +58,7 @@ void RegisteredPaneManager<KeyT>::registerPane( KeyT paneId, PaneLayer paneLayer, PanePtr pane, DismissCallback onDismiss) { if (!m_registeredPanes.insert(move(paneId), {move(paneLayer), move(pane), move(onDismiss)}).second) throw GuiException( - strf("Registered pane with name '%s' registered a second time in RegisteredPaneManager::registerPane", + strf("Registered pane with name '{}' registered a second time in RegisteredPaneManager::registerPane", outputAny(paneId))); } @@ -69,7 +69,7 @@ PanePtr RegisteredPaneManager<KeyT>::deregisterPane(KeyT const& paneId) { dismissPane(v->pane); return v->pane; } - throw GuiException(strf("No pane named '%s' found in RegisteredPaneManager::deregisterPane", outputAny(paneId))); + throw GuiException(strf("No pane named '{}' found in RegisteredPaneManager::deregisterPane", outputAny(paneId))); } template <typename KeyT> @@ -119,7 +119,7 @@ typename RegisteredPaneManager<KeyT>::PaneInfo const& RegisteredPaneManager<KeyT KeyT const& paneId) const { if (auto p = m_registeredPanes.ptr(paneId)) return *p; - throw GuiException(strf("No registered pane with name '%s' found in RegisteredPaneManager", outputAny(paneId))); + throw GuiException(strf("No registered pane with name '{}' found in RegisteredPaneManager", outputAny(paneId))); } } diff --git a/source/windowing/StarSliderBar.cpp b/source/windowing/StarSliderBar.cpp index 12fb749..e25ed4f 100644 --- a/source/windowing/StarSliderBar.cpp +++ b/source/windowing/StarSliderBar.cpp @@ -39,17 +39,17 @@ SliderBarWidget::SliderBarWidget(String const& grid, bool showSpinner) // TODO: Make spinners a thing already Json config = Json::parse(strf( R"SPINNER( - { - "spinner" : { + {{ + "spinner" : {{ "type" : "spinner", - "leftBase" : "%s", - "leftHover" : "%s", - "rightBase" : "%s", - "rightHover" : "%s", + "leftBase" : "{}", + "leftHover" : "{}", + "rightBase" : "{}", + "rightHover" : "{}", "position" : [0, 0], - "upOffset" : %s - } - } + "upOffset" : {} + }} + }} )SPINNER", assets->json("/interface.config:slider.leftBase").toString(), assets->json("/interface.config:slider.leftHover").toString(), diff --git a/source/windowing/StarWidget.cpp b/source/windowing/StarWidget.cpp index 3189f8a..518b922 100644 --- a/source/windowing/StarWidget.cpp +++ b/source/windowing/StarWidget.cpp @@ -427,15 +427,15 @@ String Widget::toStringImpl(int indentLevel) const { for (auto child : m_members) { childrenString.append(child->toStringImpl(indentLevel + 4)); } - String output = strf(R"OUTPUT(%s%s : { -%s address : %p, -%s visible : %s, -%s position : %s, -%s size : %s, -%s children : { -%s -%s } -%s} + String output = strf(R"OUTPUT({}{} : { +{} address : %p, +{} visible : {}, +{} position : {}, +{} size : {}, +{} children : { +{} +{} } +{}} )OUTPUT", leader, m_name, diff --git a/source/windowing/StarWidgetParsing.cpp b/source/windowing/StarWidgetParsing.cpp index 4ffc921..c7bc69e 100644 --- a/source/windowing/StarWidgetParsing.cpp +++ b/source/windowing/StarWidgetParsing.cpp @@ -75,7 +75,7 @@ void WidgetParser::constructImpl(Json const& config, Widget* widget) { WidgetPtr WidgetParser::makeSingle(String const& name, Json const& config) { if (!m_constructors.contains(config.getString("type"))) { - throw WidgetParserException(strf("Unknown type in gui json. %s", config.getString("type"))); + throw WidgetParserException(strf("Unknown type in gui json. {}", config.getString("type"))); } auto constructResult = m_constructors.get(config.getString("type"))(name, config); @@ -94,7 +94,7 @@ List<WidgetConstructResult> WidgetParser::constructor(Json const& config) { widgets.appendAll(constructor(Root::singleton().assets()->json(memberConfig.getString("file")))); } else { if (!m_constructors.contains(type)) { - throw WidgetParserException(strf("Unknown type in gui json. %s", type)); + throw WidgetParserException(strf("Unknown type in gui json. {}", type)); } auto constructResult = m_constructors.get(memberConfig.getString("type"))(memberConfig.getString("name"), memberConfig); @@ -110,7 +110,7 @@ List<WidgetConstructResult> WidgetParser::constructor(Json const& config) { for (auto const& elem : config.iterateArray()) addWidget(elem); } else { - throw WidgetParserException(strf("Malformed gui json, expected a Map or a List. Instead got %s", config)); + throw WidgetParserException(strf("Malformed gui json, expected a Map or a List. Instead got {}", config)); } return widgets; @@ -129,7 +129,7 @@ WidgetConstructResult WidgetParser::buttonHandler(String const& name, Json const baseImage = config.getString("base"); } catch (MapException const& e) { throw WidgetParserException( - strf("Malformed gui json, missing a required value in the map. %s", outputException(e, false))); + strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false))); } String hoverImage = config.getString("hover", ""); @@ -144,7 +144,7 @@ WidgetConstructResult WidgetParser::buttonHandler(String const& name, Json const String callback = config.getString("callback", name); if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find callback named: %s", callback); + throw WidgetParserException::format("Failed to find callback named: {}", callback); WidgetCallbackFunc callbackFunc = m_callbacks.get(callback); auto button = make_shared<ButtonWidget>(callbackFunc, baseImage, hoverImage, pressedImage, disabledImage); @@ -177,7 +177,7 @@ WidgetConstructResult WidgetParser::buttonHandler(String const& name, Json const button->setTextAlign(HorizontalAnchor::LeftAnchor); } else { throw WidgetParserException(strf( - "Malformed gui json, expected textAlign to be one of \"left\", \"right\", or \"center\", got %s", hAnchor)); + "Malformed gui json, expected textAlign to be one of \"left\", \"right\", or \"center\", got {}", hAnchor)); } if (config.contains("fontSize")) @@ -251,9 +251,9 @@ WidgetConstructResult WidgetParser::spinnerHandler(String const& name, Json cons String callback = config.getString("callback", name); if (!m_callbacks.contains(callback + ".up")) - throw WidgetParserException::format("Failed to find spinner callback named: '%s.up'", name); + throw WidgetParserException::format("Failed to find spinner callback named: '{}.up'", name); if (!m_callbacks.contains(callback + ".down")) - throw WidgetParserException::format("Failed to find spinner callback named: '%s.down'", name); + throw WidgetParserException::format("Failed to find spinner callback named: '{}.down'", name); WidgetCallbackFunc callbackDown = m_callbacks.get(callback + ".down"); WidgetCallbackFunc callbackUp = m_callbacks.get(callback + ".up"); @@ -301,11 +301,11 @@ WidgetConstructResult WidgetParser::radioGroupHandler(String const& name, Json c buttons = config.getArray("buttons"); } catch (MapException const& e) { throw WidgetParserException( - strf("Malformed gui json, missing a required value in the map. %s", outputException(e, false))); + strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false))); } if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find callback named: '%s'", callback); + throw WidgetParserException::format("Failed to find callback named: '{}'", callback); String baseImage = config.getString("baseImage", ""); String hoverImage = config.getString("hoverImage", ""); @@ -360,10 +360,10 @@ WidgetConstructResult WidgetParser::radioGroupHandler(String const& name, Json c common(button, btnConfig); - buttonGroup->addChild(strf("%d", button->buttonGroupId()), button); + buttonGroup->addChild(strf("{}", button->buttonGroupId()), button); } catch (MapException const& e) { throw WidgetParserException( - strf("Malformed gui json, missing a required value in the map. %s", outputException(e, false))); + strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false))); } } @@ -390,7 +390,7 @@ WidgetConstructResult WidgetParser::textboxHandler(String const& name, Json cons String callback = config.getString("callback", name); if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find textbox callback named: '%s'", name); + throw WidgetParserException::format("Failed to find textbox callback named: '{}'", name); WidgetCallbackFunc callbackFunc = m_callbacks.get(callback); @@ -417,7 +417,7 @@ WidgetConstructResult WidgetParser::textboxHandler(String const& name, Json cons textbox->setTextAlign(HorizontalAnchor::HMidAnchor); } else if (hAnchor != "left") { throw WidgetParserException(strf( - "Malformed gui json, expected textAlign to be one of \"left\", \"right\", or \"center\", got %s", hAnchor)); + "Malformed gui json, expected textAlign to be one of \"left\", \"right\", or \"center\", got {}", hAnchor)); } if (config.contains("fontSize")) @@ -477,11 +477,11 @@ WidgetConstructResult WidgetParser::itemSlotHandler(String const& name, Json con auto itemSlot = make_shared<ItemSlotWidget>(ItemPtr(), backingImage); if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find itemSlot callback named: '%s'", callback); + throw WidgetParserException::format("Failed to find itemSlot callback named: '{}'", callback); itemSlot->setCallback(m_callbacks.get(callback)); if (!m_callbacks.contains(rightClickCallback)) - throw WidgetParserException::format("Failed to find itemslot rightClickCallback named: '%s'", rightClickCallback); + throw WidgetParserException::format("Failed to find itemslot rightClickCallback named: '{}'", rightClickCallback); itemSlot->setRightClickCallback(m_callbacks.get(rightClickCallback)); itemSlot->setBackingImageAffinity(config.getBool("showBackingImageWhenFull", false), config.getBool("showBackingImageWhenEmpty", true)); @@ -509,7 +509,7 @@ WidgetConstructResult WidgetParser::itemGridHandler(String const& name, Json con columnSpacing = jsonToVec2I(config.get("columnSpacing")); } } catch (MapException const& e) { - throw WidgetParserException::format("Malformed gui json, missing a required value in the map. %s", outputException(e, false)); + throw WidgetParserException::format("Malformed gui json, missing a required value in the map. {}", outputException(e, false)); } String backingImage = config.getString("backingImage", ""); @@ -526,7 +526,7 @@ WidgetConstructResult WidgetParser::itemGridHandler(String const& name, Json con auto itemGrid = make_shared<ItemGridWidget>(ItemBagConstPtr(), dimensions, rowSpacing, columnSpacing, backingImage, slotOffset); if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find itemgrid callback named: '%s'", callback); + throw WidgetParserException::format("Failed to find itemgrid callback named: '{}'", callback); itemGrid->setCallback(m_callbacks.get(callback)); @@ -535,7 +535,7 @@ WidgetConstructResult WidgetParser::itemGridHandler(String const& name, Json con itemGrid->showDurability(config.getBool("showDurability", false)); if (!m_callbacks.contains(rightClickCallback)) - throw WidgetParserException::format("Failed to find itemgrid rightClickCallback named: '%s'", rightClickCallback); + throw WidgetParserException::format("Failed to find itemgrid rightClickCallback named: '{}'", rightClickCallback); itemGrid->setRightClickCallback(m_callbacks.get(rightClickCallback)); @@ -550,7 +550,7 @@ WidgetConstructResult WidgetParser::listHandler(String const& name, Json const& schema = config.get("schema"); } catch (MapException const& e) { throw WidgetParserException( - strf("Malformed gui json, missing a required value in the map. %s", outputException(e, false))); + strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false))); } auto list = make_shared<ListWidget>(schema); @@ -593,7 +593,7 @@ WidgetConstructResult WidgetParser::sliderHandler(String const& name, Json const return WidgetConstructResult(slider, name, config.getFloat("zlevel", 0)); } catch (MapException const& e) { throw WidgetParserException::format( - "Malformed gui json, missing a required value in the map. %s", outputException(e, false)); + "Malformed gui json, missing a required value in the map. {}", outputException(e, false)); } } @@ -601,7 +601,7 @@ WidgetConstructResult WidgetParser::largeCharPlateHandler(String const& name, Js String callback = config.getString("callback", name); if (!m_callbacks.contains(callback)) - throw WidgetParserException::format("Failed to find callback named: '%s'", name); + throw WidgetParserException::format("Failed to find callback named: '{}'", name); auto charPlate = make_shared<LargeCharPlateWidget>(m_callbacks.get(callback)); common(charPlate, config); @@ -639,7 +639,7 @@ WidgetConstructResult WidgetParser::tabSetHandler(String const& name, Json const tabSet->addTab(entry.getString("tabName"), widget, entry.getString("tabTitle")); } } catch (JsonException const& e) { - throw WidgetParserException(strf("Malformed gui json. %s", outputException(e, false))); + throw WidgetParserException(strf("Malformed gui json. {}", outputException(e, false))); } return WidgetConstructResult(tabSet, name, config.getFloat("zlevel", 0)); @@ -673,7 +673,7 @@ WidgetConstructResult WidgetParser::layoutHandler(String const& name, Json const try { flow->setSpacing(jsonToVec2I(config.get("spacing"))); } catch (JsonException const& e) { - throw WidgetParserException(strf("Parameter \"spacing\" in FlowLayout specification is invalid: %s.", outputException(e, false))); + throw WidgetParserException(strf("Parameter \"spacing\" in FlowLayout specification is invalid: {}.", outputException(e, false))); } } else if (type == "vertical") { widget = make_shared<VerticalLayout>(); @@ -685,7 +685,7 @@ WidgetConstructResult WidgetParser::layoutHandler(String const& name, Json const } else if (type == "basic") { widget = make_shared<Layout>(); } else { - throw WidgetParserException(strf("Invalid layout type \"%s\". Options are \"basic\", \"flow\", \"vertical\".", type)); + throw WidgetParserException(strf("Invalid layout type \"{}\". Options are \"basic\", \"flow\", \"vertical\".", type)); } common(widget, config); if (config.contains("children")) @@ -745,7 +745,7 @@ WidgetConstructResult WidgetParser::stackHandler(String const& name, Json const& auto widget = make_shared<Widget>(); constructImpl(widgetCfg, widget.get()); widget->determineSizeFromChildren(); - stack->addChild(strf("%d", stack->numChildren()), widget); + stack->addChild(strf("{}", stack->numChildren()), widget); } } @@ -811,7 +811,7 @@ ImageStretchSet WidgetParser::parseImageStretchSet(Json const& config) { } else if (type == "stretch") { res.type = ImageStretchSet::ImageStretchType::Stretch; } else { - throw WidgetParserException(strf("Could not parse Image Stretch Set, unknown type: %s")); + throw WidgetParserException(strf("Could not parse Image Stretch Set, unknown type: {}")); } return res; |