MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / value

Method value

lib/mathlib.cpp:40–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38const int MathLib::bigint_bits = 64;
39
40MathLib::value::value(const std::string &s)
41{
42 if (MathLib::isFloat(s)) {
43 mType = MathLib::value::Type::FLOAT;
44 mDoubleValue = MathLib::toDoubleNumber(s);
45 return;
46 }
47
48 if (!MathLib::isInt(s))
49 throw InternalError(nullptr, "Invalid value: " + s);
50
51 mType = MathLib::value::Type::INT;
52 mIntValue = MathLib::toBigNumber(s);
53
54 if (isIntHex(s) && mIntValue < 0)
55 mIsUnsigned = true;
56
57 // read suffix
58 if (s.size() >= 2U) {
59 for (std::size_t i = s.size() - 1U; i > 0U; --i) {
60 const char c = s[i];
61 if (c == 'u' || c == 'U')
62 mIsUnsigned = true;
63 else if (c == 'l' || c == 'L') {
64 if (mType == MathLib::value::Type::INT)
65 mType = MathLib::value::Type::LONG;
66 else if (mType == MathLib::value::Type::LONG)
67 mType = MathLib::value::Type::LONGLONG;
68 } else if (i > 2U && c == '4' && s[i-1] == '6' && s[i-2] == 'i')
69 mType = MathLib::value::Type::LONGLONG;
70 }
71 }
72}
73
74std::string MathLib::value::str() const
75{

Callers 15

loadSettingsMethod · 0.45
loadSettingsMethod · 0.45
loadSettingsMethod · 0.45
loadFromProjectFileMethod · 0.45
saveToProjectFileMethod · 0.45
determineVersionMethod · 0.45
getPathFunction · 0.45
toFilterStringFunction · 0.45
getDataDirFunction · 0.45
loadMethod · 0.45
getArgMethod · 0.45
SettingsDialogMethod · 0.45

Calls 2

isFloatFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected