mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-22 01:30:49 +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>.
|
// possible length of an int (in 64 bits), being -<20 digits>.
|
||||||
const int kMaxIntSize = 22;
|
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.
|
// TODO(rays) Change all callers to use TFile and remove the old functions.
|
||||||
// Writes to the given file. Returns false in case of error.
|
// Writes to the given file. Returns false in case of error.
|
||||||
bool STRING::Serialize(FILE *fp) const {
|
bool STRING::Serialize(FILE *fp) const {
|
||||||
|
@ -32,22 +32,7 @@ namespace tesseract {
|
|||||||
|
|
||||||
class TFile;
|
class TFile;
|
||||||
|
|
||||||
const std::vector<std::string> split(const std::string &s, char c) {
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
class STRING : public std::string {
|
class STRING : public std::string {
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user