MCPcopy Create free account
hub / github.com/columbia/egalito / getNumber

Method getNumber

app/shell2/command.cpp:158–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158long ArgumentValue::getNumber() const {
159 switch(type) {
160 case ArgumentSpec::TYPE_ADDRESS:
161 case ArgumentSpec::TYPE_HEX: {
162 STR_TO_INT(data, std::strtol, 16);
163 throw std::string("Invalid argument, ") + ArgumentSpec::getExpectedMessage(type);
164 }
165 case ArgumentSpec::TYPE_DECIMAL: {
166 STR_TO_INT(data, std::strtol, 10);
167 throw std::string("Invalid argument, ") + ArgumentSpec::getExpectedMessage(type);
168 }
169 case ArgumentSpec::TYPE_NUMBER: {
170 STR_TO_INT(data, std::strtol, 0);
171 throw std::string("Invalid argument, ") + ArgumentSpec::getExpectedMessage(type);
172 }
173 default:
174 throw "Calling ArgumentValue::getNumber() on unexpected argument type";
175 }
176}
177
178unsigned long ArgumentValue::getUnsignedNumber() const {
179 switch(type) {

Callers 1

FullCommandListMethod · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected