dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
command.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix formatting.
[command.git]
/
include
/
multiValue.h
diff --git
a/include/multiValue.h
b/include/multiValue.h
index e84b855628f035a0e89ea47b0f6223d2975063ec..26738b5c54e6a7c2461d9a8e88edb4355365aee9 100644
(file)
--- a/
include/multiValue.h
+++ b/
include/multiValue.h
@@
-2,6
+2,7
@@
#define __COMMAND_MULTIVALUE_H
#include <iostream>
#define __COMMAND_MULTIVALUE_H
#include <iostream>
+#include <vector>
#include "parameter.h"
#include "parameter.h"
@@
-70,14
+71,29
@@
namespace command {
size_t start = 0;
size_t pos = 0;
bool _understand = true;
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);
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;
_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;
}
return _understand;
}
@@
-99,7
+115,16
@@
namespace command {
virtual bool isUsed() {
return parameter->isUsed();
};
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 */