mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
Remove last usage of STRING
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
57920174dc
commit
e51fcb2d31
@ -344,7 +344,6 @@ noinst_HEADERS += src/ccutil/qrsequence.h
|
||||
noinst_HEADERS += src/ccutil/sorthelper.h
|
||||
noinst_HEADERS += src/ccutil/scanutils.h
|
||||
noinst_HEADERS += src/ccutil/serialis.h
|
||||
noinst_HEADERS += src/ccutil/strngs.h
|
||||
noinst_HEADERS += src/ccutil/tessdatamanager.h
|
||||
noinst_HEADERS += src/ccutil/tprintf.h
|
||||
noinst_HEADERS += src/ccutil/unicharcompress.h
|
||||
@ -367,7 +366,6 @@ libtesseract_ccutil_la_SOURCES += src/ccutil/elst.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/errcode.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/mainblk.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/serialis.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/strngs.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/scanutils.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/tessdatamanager.cpp
|
||||
libtesseract_ccutil_la_SOURCES += src/ccutil/tprintf.cpp
|
||||
|
@ -45,7 +45,7 @@ ELIST2IZE(WERD)
|
||||
* text correct text, outlives this WERD
|
||||
*/
|
||||
WERD::WERD(C_BLOB_LIST *blob_list, uint8_t blank_count, const char *text)
|
||||
: blanks(blank_count), flags(0), script_id_(0), correct(text) {
|
||||
: blanks(blank_count), flags(0), script_id_(0), correct(text ? text : "") {
|
||||
C_BLOB_IT start_it = &cblobs;
|
||||
C_BLOB_IT rej_cblob_it = &rej_cblobs;
|
||||
C_OUTLINE_IT c_outline_it;
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include "params.h"
|
||||
#include "stepblob.h"
|
||||
|
||||
#include "strngs.h"
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
enum WERD_FLAGS {
|
||||
@ -193,7 +191,7 @@ private:
|
||||
BITS16 flags; // flags about word
|
||||
BITS16 disp_flags; // display flags
|
||||
int16_t script_id_ = 0; // From unicharset.
|
||||
STRING correct; // correct text
|
||||
std::string correct; // correct text
|
||||
C_BLOB_LIST cblobs; // compacted blobs
|
||||
C_BLOB_LIST rej_cblobs; // DUFF blobs
|
||||
};
|
||||
|
@ -27,13 +27,26 @@
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
#include <tesseract/export.h> // for TESS_API
|
||||
#include <vector>
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
TESS_API
|
||||
const std::vector<std::string> split(const std::string &s, char c);
|
||||
inline 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;
|
||||
}
|
||||
|
||||
// A simple linear congruential random number generator.
|
||||
class TRand {
|
||||
|
@ -1,43 +0,0 @@
|
||||
/**********************************************************************
|
||||
* File: strngs.cpp (Formerly strings.c)
|
||||
* Description: STRING class functions.
|
||||
* Author: Ray Smith
|
||||
*
|
||||
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "strngs.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
} // namespace tesseract
|
@ -1,39 +0,0 @@
|
||||
/**********************************************************************
|
||||
* File: strngs.h (Formerly strings.h)
|
||||
* Description: STRING class definition.
|
||||
* Author: Ray Smith
|
||||
*
|
||||
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef STRNGS_H
|
||||
#define STRNGS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
class STRING : public std::string {
|
||||
public:
|
||||
STRING() {
|
||||
}
|
||||
STRING(const std::string &s) : std::string(s) {
|
||||
}
|
||||
STRING(const char *s) : std::string(s ? s : "") {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace tesseract.
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user