#define __COMMAND_MULTIVALUE_H
#include <iostream>
+#include <vector>
#include "parameter.h"
* \inheritdoc
*/
virtual bool understand(const std::string & value) {
- size_t start = parameter->valuePosition(value);
+ size_t start = 0;
size_t pos = 0;
bool _understand = true;
std::string prefix = "";
+ start = parameter->valuePosition(value);
+
+ if (start > value.size()) {
+ return false;
+ }
+
if (start > 0) {
prefix = value.substr(0, ++start);// always count: "="
}
values.push_back(prefix + value.substr(start, pos-start));
_understand &= parameter->understand(values.back());
start = pos + 1;
- } while ((pos != std::string::npos) && (start < value.size()));
+ if (!_understand) {
+ values.clear();
+ break;
+ }
+ } while ((pos != std::string::npos) && (start < value.size()));
return _understand;
}
};
}
-#endif /* __COMMAND_PARAMETER_H */
+#endif /* __COMMAND_MULTIVALUE_H */