Skip to content

Commit

Permalink
Merge pull request #734 from CrimeIsDown/better-csv-parsing
Browse files Browse the repository at this point in the history
Improve CSV parsing to allow quoted and escaped fields
  • Loading branch information
robotastic authored Nov 25, 2022
2 parents 49e655d + eb8f001 commit 7e9aefe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ COPY . .

WORKDIR /src/build

RUN cmake .. && make && make install
RUN cmake .. && make -j$(nproc) && make install

#USER nobody

Expand Down
8 changes: 4 additions & 4 deletions trunk-recorder/talkgroups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void Talkgroups::load_talkgroups(std::string filename) {
return;
}

boost::char_separator<char> sep(",\t");
typedef boost::tokenizer<boost::char_separator<char>> t_tokenizer;
boost::escaped_list_separator<char> sep("\\", ",\t", "\"");
typedef boost::tokenizer<boost::escaped_list_separator<char>> t_tokenizer;

std::vector<std::string> vec;
std::string line;
Expand Down Expand Up @@ -123,8 +123,8 @@ void Talkgroups::load_channels(std::string filename) {
return;
}

boost::char_separator<char> sep(",", "\t", boost::keep_empty_tokens);
typedef boost::tokenizer<boost::char_separator<char>> t_tokenizer;
boost::escaped_list_separator<char> sep("\\", ",\t", "\"");
typedef boost::tokenizer<boost::escaped_list_separator<char>> t_tokenizer;

std::vector<std::string> vec;
std::string line;
Expand Down
4 changes: 2 additions & 2 deletions trunk-recorder/unit_tags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void UnitTags::load_unit_tags(std::string filename) {
return;
}

boost::char_separator<char> sep(",\t");
typedef boost::tokenizer<boost::char_separator<char>> t_tokenizer;
boost::escaped_list_separator<char> sep("\\", ",\t", "\"");
typedef boost::tokenizer<boost::escaped_list_separator<char>> t_tokenizer;

std::vector<std::string> vec;
std::string line;
Expand Down

0 comments on commit 7e9aefe

Please sign in to comment.