MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / ToUpper

Method ToUpper

src/Nazara/Core/String.cpp:4208–4238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4206 */
4207
4208 String String::ToUpper(UInt32 flags) const
4209 {
4210 if (m_sharedString->size == 0)
4211 return *this;
4212
4213 if (flags & HandleUtf8)
4214 {
4215 String upper;
4216 upper.Reserve(m_sharedString->size);
4217 utf8::unchecked::iterator<const char*> it(m_sharedString->string.get());
4218 do
4219 utf8::append(Unicode::GetUppercase(*it), std::back_inserter(upper));
4220 while (*++it);
4221
4222 return upper;
4223 }
4224 else
4225 {
4226 auto str = std::make_shared<SharedString>(m_sharedString->size);
4227
4228 char* ptr = m_sharedString->string.get();
4229 char* s = str->string.get();
4230 do
4231 *s++ = Detail::ToUpper(*ptr);
4232 while (*++ptr);
4233
4234 *s = '\0';
4235
4236 return String(std::move(str));
4237 }
4238 }
4239
4240 /*!
4241 * \brief Trims the string

Callers 1

AlgorithmCore.cppFile · 0.80

Calls 3

ToUpperFunction · 0.85
ReserveMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected