MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / wcstou32

Function wcstou32

PersistantDataLib/PersistantData.cpp:25–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace
24{
25 uint32_t wcstou32(const wchar_t* str, int length)
26 {
27 uint64_t ret = 0;
28 for (int i = 0; i < length; ++i)
29 {
30 if (str[i] > L'9' || str[i] < L'0')
31 throw std::out_of_range("unexpected character in numeric string");
32 ret *= 10;
33 ret += str[i] - L'0';
34 if (ret > std::numeric_limits<uint32_t>::max())
35 throw std::out_of_range("number too large");
36 }
37 return static_cast<uint32_t>(ret);
38 }
39
40 class SimpleSAXContentHandler : public ISAXContentHandler
41 {

Callers 2

startElementMethod · 0.85
RetrieveAttributeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected