DataMode: support also negative integers + back to the correct value index v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 23 May 2021 22:39:45 +0200
branchv_0
changeset 8 fc8b94bccfc5
parent 7 b8f130c7998e
child 9 215f62cc655f
DataMode: support also negative integers + back to the correct value index
src/DataMode.h
--- a/src/DataMode.h	Sun May 23 21:32:37 2021 +0200
+++ b/src/DataMode.h	Sun May 23 22:39:45 2021 +0200
@@ -36,7 +36,7 @@
 	std::vector<relpipe::common::type::StringX> values;
 
 	bool matches(int attributeIndex, const std::wregex& pattern) {
-		for (int record = 0, attributeCount = attributes.size(), limit = values.size() / attributeCount; record < limit; record++) if (!std::regex_match(values[record * attributeIndex], pattern)) return false;
+		for (int record = 0, attributeCount = attributes.size(), limit = values.size() / attributeCount; record < limit; record++) if (!std::regex_match(values[record * attributeCount + attributeIndex], pattern)) return false;
 		return true;
 	}
 
@@ -81,7 +81,7 @@
 };
 
 const std::wregex DataMode::BOOLEAN_PATTERN = std::wregex(L"true|false");
-const std::wregex DataMode::INTEGER_PATTERN = std::wregex(L"[0-9]+");
+const std::wregex DataMode::INTEGER_PATTERN = std::wregex(L"-?[0-9]+");
 
 }
 }