MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / FromStringBase

Method FromStringBase

extern/ttmath/ttmathint.h:1376–1426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1374 */
1375 template<class char_type>
1376 uint FromStringBase(const char_type * s, uint b = 10, const char_type ** after_source = 0, bool * value_read = 0)
1377 {
1378 bool is_sign = false;
1379
1380 Misc::SkipWhiteCharacters(s);
1381
1382 if( *s == '-' )
1383 {
1384 is_sign = true;
1385 Misc::SkipWhiteCharacters(++s);
1386 }
1387 else
1388 if( *s == '+' )
1389 {
1390 Misc::SkipWhiteCharacters(++s);
1391 }
1392
1393 if( UInt<value_size>::FromString(s,b,after_source,value_read) )
1394 return 1;
1395
1396 if( is_sign )
1397 {
1398 Int<value_size> mmin;
1399
1400 mmin.SetMin();
1401
1402 /*
1403 the reference to mmin will be automatically converted to the reference
1404 to UInt type
1405 (this value can be equal mmin -- look at a description in ChangeSign())
1406 */
1407 if( UInt<value_size>::operator>( mmin ) )
1408 return 1;
1409
1410 /*
1411 if the value is equal mmin the method ChangeSign() does nothing (only returns 1 but we ignore it)
1412 */
1413 ChangeSign();
1414 }
1415 else
1416 {
1417 Int<value_size> mmax;
1418
1419 mmax.SetMax();
1420
1421 if( UInt<value_size>::operator>( mmax ) )
1422 return 1;
1423 }
1424
1425 return 0;
1426 }
1427
1428
1429public:

Callers

nothing calls this directly

Calls 3

operator>Function · 0.50
SetMinMethod · 0.45
SetMaxMethod · 0.45

Tested by

no test coverage detected