src/DataMode.h
branchv_0
changeset 8 fc8b94bccfc5
parent 7 b8f130c7998e
equal deleted inserted replaced
7:b8f130c7998e 8:fc8b94bccfc5
    34 	relpipe::common::type::StringX name;
    34 	relpipe::common::type::StringX name;
    35 	std::vector<relpipe::reader::handlers::AttributeMetadata> attributes;
    35 	std::vector<relpipe::reader::handlers::AttributeMetadata> attributes;
    36 	std::vector<relpipe::common::type::StringX> values;
    36 	std::vector<relpipe::common::type::StringX> values;
    37 
    37 
    38 	bool matches(int attributeIndex, const std::wregex& pattern) {
    38 	bool matches(int attributeIndex, const std::wregex& pattern) {
    39 		for (int record = 0, attributeCount = attributes.size(), limit = values.size() / attributeCount; record < limit; record++) if (!std::regex_match(values[record * attributeIndex], pattern)) return false;
    39 		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;
    40 		return true;
    40 		return true;
    41 	}
    41 	}
    42 
    42 
    43 public:
    43 public:
    44 
    44 
    79 		for (relpipe::common::type::StringX& value : values) relationalWriter->writeAttribute(value);
    79 		for (relpipe::common::type::StringX& value : values) relationalWriter->writeAttribute(value);
    80 	}
    80 	}
    81 };
    81 };
    82 
    82 
    83 const std::wregex DataMode::BOOLEAN_PATTERN = std::wregex(L"true|false");
    83 const std::wregex DataMode::BOOLEAN_PATTERN = std::wregex(L"true|false");
    84 const std::wregex DataMode::INTEGER_PATTERN = std::wregex(L"[0-9]+");
    84 const std::wregex DataMode::INTEGER_PATTERN = std::wregex(L"-?[0-9]+");
    85 
    85 
    86 }
    86 }
    87 }
    87 }
    88 }
    88 }