MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / arg

Method arg

src/Engine/LocalizedText.h:108–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 */
107template <typename T>
108LocalizedText LocalizedText::arg(T val) const
109{
110 std::wostringstream os;
111 os << '{' << _nextArg << '}';
112 std::wstring marker(os.str());
113 size_t pos = _text.find(marker);
114 if (std::string::npos == pos)
115 return *this;
116 std::wstring ntext(_text);
117 os.str(L"");
118 os << val;
119 std::wstring tval(os.str());
120 for (/*empty*/ ; std::wstring::npos != pos; pos = ntext.find(marker, pos + tval.length()))
121 {
122 ntext.replace(pos, marker.length(), tval);
123 }
124 return LocalizedText(ntext, _nextArg);
125}
126
127/**
128 * Replace the next argument placeholder with @a val.

Callers 15

getDayStringMethod · 0.60
getNameMethod · 0.60
getNameMethod · 0.60
getNameMethod · 0.60
getNameMethod · 0.60
getSaveInfoMethod · 0.60
getNameMethod · 0.60
addItemMethod · 0.60
updateStatsMethod · 0.60
invClickMethod · 0.60
BriefingStateMethod · 0.60
NextTurnStateMethod · 0.60

Calls 2

replaceMethod · 0.80
LocalizedTextClass · 0.70

Tested by 1