Move implementation of tesseract::split from header to cpp file

This fixes duplicate symbols for some builds.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-03-13 23:39:52 +01:00
parent 3b0759940c
commit 36f9131e04
2 changed files with 18 additions and 16 deletions

View File

@ -33,6 +33,23 @@ namespace tesseract {
// possible length of an int (in 64 bits), being -<20 digits>.
const int kMaxIntSize = 22;
const std::vector<std::string> split(const std::string &s, char c) {
std::string buff;
std::vector<std::string> v;
for (auto n : s) {
if (n != c)
buff += n;
else if (n == c && !buff.empty()) {
v.push_back(buff);
buff.clear();
}
}
if (!buff.empty()) {
v.push_back(buff);
}
return v;
}
// TODO(rays) Change all callers to use TFile and remove the old functions.
// Writes to the given file. Returns false in case of error.
bool STRING::Serialize(FILE *fp) const {

View File

@ -32,22 +32,7 @@ namespace tesseract {
class TFile;
const std::vector<std::string> split(const std::string &s, char c) {
std::string buff;
std::vector<std::string> v;
for (auto n : s) {
if (n != c)
buff += n;
else if (n == c && !buff.empty()) {
v.push_back(buff);
buff.clear();
}
}
if (!buff.empty()) {
v.push_back(buff);
}
return v;
}
const std::vector<std::string> split(const std::string &s, char c);
class STRING : public std::string {
public: