Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed regex, due to build issues on suse server #160

Merged
merged 3 commits into from
Jun 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/librmb/rados-save-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#define SRC_LIBRMB_RADOS_SAVE_LOG_H_

#include <fstream> // std::ofstream
#include <regex>
//#include <regex>
#include <cstdio>
#include <vector>
#include <sstream>

namespace librmb {

Expand All @@ -31,13 +33,18 @@ class RadosSaveLogEntry {
}

friend std::istream &operator>>(std::istream &is, RadosSaveLogEntry &obj) {
std::string line;
std::string item;
const std::regex re{"((?:[^\\\\,]|\\\\.)*?)(?:,|$)"};
std::getline(is, item);
std::vector<std::string> csv_items{std::sregex_token_iterator(item.begin(), item.end(), re, 1),
std::sregex_token_iterator()};
std::vector<std::string> csv_items;
std::getline(is, line);

std::stringstream line_to_parse(line);
while (std::getline(line_to_parse, item, ',')) {
csv_items.push_back(item);
}

// read obj from stream
if (csv_items.size() == 5) {
if (csv_items.size() == 4) {
obj.op = csv_items[0];
obj.pool = csv_items[1];
obj.ns = csv_items[2];
Expand Down