34 friend class TestMathLib;
40 long long mIntValue{};
41 double mDoubleValue{};
42 enum class Type { INT, LONG, LONGLONG, FLOAT } mType;
45 void promote(
const value &v);
48 explicit value(
const std::string &s);
49 std::string str()
const;
51 return mType != Type::FLOAT;
54 return mType == Type::FLOAT;
58 return isFloat() ? mDoubleValue : (double)mIntValue;
62 int compare(
const value &v)
const;
63 value add(
int v)
const;
73 static bigint toBigNumber(
const std::string & str);
75 static biguint toBigUNumber(
const std::string & str);
79 static double toDoubleNumber(
const std::string & str);
81 static bool isInt(
const std::string & str);
82 static bool isFloat(
const std::string &str);
83 static bool isDecimalFloat(
const std::string &str);
84 static bool isNegative(
const std::string &str);
85 static bool isPositive(
const std::string &str);
86 static bool isDec(
const std::string & str);
87 static bool isFloatHex(
const std::string& str);
88 static bool isIntHex(
const std::string& str);
89 static bool isOct(
const std::string& str);
90 static bool isBin(
const std::string& str);
92 static std::string getSuffix(
const std::string&
value);
100 static bool isValidIntegerSuffix(
const std::string& str,
bool supportMicrosoftExtensions=
true);
102 static std::string add(
const std::string & first,
const std::string & second);
103 static std::string subtract(
const std::string & first,
const std::string & second);
104 static std::string multiply(
const std::string & first,
const std::string & second);
105 static std::string divide(
const std::string & first,
const std::string & second);
106 static std::string mod(
const std::string & first,
const std::string & second);
107 static std::string
calculate(
const std::string & first,
const std::string & second,
char action);
109 static std::string sin(
const std::string & tok);
110 static std::string cos(
const std::string & tok);
111 static std::string tan(
const std::string & tok);
112 static std::string abs(
const std::string & tok);
113 static bool isEqual(
const std::string & first,
const std::string & second);
114 static bool isNotEqual(
const std::string & first,
const std::string & second);
115 static bool isGreater(
const std::string & first,
const std::string & second);
116 static bool isGreaterEqual(
const std::string & first,
const std::string & second);
117 static bool isLess(
const std::string & first,
const std::string & second);
118 static bool isLessEqual(
const std::string & first,
const std::string & second);
119 static bool isNullValue(
const std::string & str);
125 static bool isOctalDigit(
char c);
127 static unsigned int encodeMultiChar(
const std::string& str);
134 static bool isDigitSeparator(
const std::string& iCode, std::string::size_type iPos);
R calculate(const std::string &s, const T &x, const T &y, bool *error=nullptr)
static bool isNegative(const Token *tok, const Settings &settings)
double getDoubleValue() const
simple math functions that uses operands stored in std::string.
static std::string toString(T value)=delete
static const int bigint_bits
unsigned long long biguint
Information about a class type.
MathLib::value operator&(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator%(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator-(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator|(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator<<(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator>>(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator*(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator/(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator^(const MathLib::value &v1, const MathLib::value &v2)
MathLib::value operator+(const MathLib::value &v1, const MathLib::value &v2)
static bool isNotEqual(std::pair< const Token *, const Token * > x, std::pair< const Token *, const Token * > y)