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

Method toString

lib/vfvalue.cpp:46–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 std::string Value::toString() const {
47 std::stringstream ss;
48 if (this->isImpossible())
49 ss << "!";
50 if (this->bound == Bound::Lower)
51 ss << ">=";
52 if (this->bound == Bound::Upper)
53 ss << "<=";
54 switch (this->valueType) {
55 case ValueType::INT:
56 ss << this->intvalue;
57 break;
58 case ValueType::TOK:
59 ss << this->tokvalue->str();
60 break;
61 case ValueType::FLOAT:
62 ss << MathLib::toString(this->floatValue);
63 break;
64 case ValueType::MOVED:
65 ss << toString(this->moveKind);
66 break;
67 case ValueType::UNINIT:
68 ss << "Uninit";
69 break;
70 case ValueType::BUFFER_SIZE:
71 case ValueType::CONTAINER_SIZE:
72 ss << "size=" << this->intvalue;
73 break;
74 case ValueType::ITERATOR_START:
75 ss << "start=" << this->intvalue;
76 break;
77 case ValueType::ITERATOR_END:
78 ss << "end=" << this->intvalue;
79 break;
80 case ValueType::LIFETIME:
81 ss << "lifetime[" << toString(this->lifetimeKind) << "]=("
82 << this->tokvalue->expressionString() << ")";
83 break;
84 case ValueType::SYMBOLIC:
85 ss << "symbolic=(" << this->tokvalue->expressionString();
86 if (this->intvalue > 0)
87 ss << "+" << this->intvalue;
88 else if (this->intvalue < 0)
89 ss << "-" << -this->intvalue;
90 ss << ")";
91 break;
92 }
93 if (this->indirect > 0)
94 for (int i = 0; i < this->indirect; i++)
95 ss << "*";
96 if (this->path > 0)
97 ss << "@" << this->path;
98 return ss.str();
99 }
100
101 std::string Value::infoString() const {
102 switch (valueType) {

Callers

nothing calls this directly

Calls 4

isImpossibleMethod · 0.95
toStringFunction · 0.70
strMethod · 0.45
expressionStringMethod · 0.45

Tested by

no test coverage detected