#define __COMMAND_MULTIVALUE_H
#include <iostream>
+#include <vector>
#include "parameter.h"
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: "="
+ }
do {
pos = value.find(separator, start);
- values.push_back(value.substr(start, pos-start));
+ 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;
}
virtual bool isUsed() {
return parameter->isUsed();
};
+
+ /**
+ * Wrapper method around passed Parameter::valuePosition().
+ *
+ * \inheritdoc
+ */
+ virtual unsigned int valuePosition(const std::string & value) {
+ return parameter->valuePosition(value);
+ }
};
}
-#endif /* __COMMAND_PARAMETER_H */
+#endif /* __COMMAND_MULTIVALUE_H */