MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / parseInt32

Function parseInt32

Libraries/SerializationText/SerializationJson.cpp:186–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186bool parseInt32(StringSpan token, int32_t& value)
187{
188 char buffer[32];
189 SC_TRY(copyTokenToBuffer(token, buffer));
190 errno = 0;
191 char* end = nullptr;
192 long parsed = ::strtol(buffer, &end, 10);
193 if (errno == 0 and buffer < end and parsed >= INT32_MIN and parsed <= INT32_MAX)
194 {
195 value = static_cast<int32_t>(parsed);
196 return true;
197 }
198 return false;
199}
200
201bool parseFloat(StringSpan token, float& value)
202{

Callers 2

parseHostMethod · 0.85
serializeMethod · 0.85

Calls 1

copyTokenToBufferFunction · 0.85

Tested by

no test coverage detected