This commit is contained in:
2025-03-24 02:02:10 +03:00
parent d17695a7fa
commit 1b32774e55
8 changed files with 34 additions and 12 deletions

View File

@@ -6,14 +6,17 @@
#include <utils/utils.h>
#include <boost/regex.hpp>
#include <iostream>
StoreModule::StoreModule() {}
std::vector<std::string> StoreModule::parse(std::wstring str, std::wstring regexp, boost::regex_constants::flag_type_ flag) {
std::vector<std::string> result;
boost::wregex r(regexp, flag);
std::cout << "Handling: " << to_utf8(str) << std::endl;
for (boost::wsregex_iterator it{str.begin(), str.end(), r}, end{}; it != end;
it++) {
std::wcout << "Parsed" << it->str() << std::endl;
result.push_back(to_utf8(it->str()));
}
@@ -34,7 +37,7 @@ StoreModule::StoreModule(std::string path) {
}
std::vector<std::string> StoreModule::parse_name(std::wstring str) {
return parse(str, this->goods_name_regex, boost::regex_constants::extended);
return parse(str, this->goods_name_regex, boost::regex_constants::perl);
}
std::vector<std::string> StoreModule::parse_price(std::wstring str) {
@@ -49,6 +52,7 @@ std::vector<std::string> StoreModule::parse_net_weight(std::vector<std::string>
result.push_back("?");
} else {
result.push_back(parsed[0]);
name.erase(0, name.find(parsed[0]) + parsed[0].length());
}
}
return result;

View File

@@ -68,7 +68,7 @@ std::vector<Goods> Parser::parse(std::wstring check_plaintext) {
std::vector<std::string> goods_quantities = module.parse_quantity(check_plaintext);
if (areAllSizesEqual(goods_names, goods_prices, goods_net_weights, goods_quantities)) {
if (!areAllSizesEqual(goods_names, goods_prices, goods_net_weights, goods_quantities)) {
// dumpVectorsToStderr(goods_names, goods_prices, goods_net_weights, goods_quantities);