mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-21 17:13:09 +08:00
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:
parent
3b0759940c
commit
36f9131e04
@ -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 {
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user