mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
api: Replace BOOL8, TRUE, FALSE by bool, true, false and modernize code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
4e0c726d6c
commit
146079f31d
@ -59,12 +59,11 @@
|
||||
#include "dict.h" // for Dict
|
||||
#include "edgblob.h" // for extract_edges
|
||||
#include "elst.h" // for ELIST_ITERATOR, ELISTIZE, ELISTIZEH
|
||||
#include "environ.h" // for l_uint8, FALSE, TRUE
|
||||
#include "environ.h" // for l_uint8
|
||||
#include "equationdetect.h" // for EquationDetect
|
||||
#include "errcode.h" // for ASSERT_HOST
|
||||
#include "globaloc.h" // for SavePixForCrash, signal_exit
|
||||
#include "helpers.h" // for IntCastRounded, chomp_string
|
||||
#include "host.h" // for BOOL8
|
||||
#include "imageio.h" // for IFF_TIFF_G4, IFF_TIFF, IFF_TIFF_G3
|
||||
#include "intfx.h" // for INT_FX_RESULT_STRUCT
|
||||
#include "mutableiterator.h" // for MutableIterator
|
||||
@ -91,7 +90,7 @@
|
||||
#include "tprintf.h" // for tprintf
|
||||
#include "werd.h" // for WERD, WERD_IT, W_FUZZY_NON, W_FUZZY_SP
|
||||
|
||||
BOOL_VAR(stream_filelist, FALSE, "Stream a filelist from stdin");
|
||||
BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
@ -309,7 +308,7 @@ bool TessBaseAPI::GetBoolVariable(const char *name, bool *value) const {
|
||||
auto *p = ParamUtils::FindParam<BoolParam>(
|
||||
name, GlobalParams()->bool_params, tesseract_->params()->bool_params);
|
||||
if (p == nullptr) return false;
|
||||
*value = (BOOL8)(*p);
|
||||
*value = bool(*p);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2325,7 +2324,7 @@ ROW *TessBaseAPI::MakeTessOCRRow(float baseline,
|
||||
TBLOB *TessBaseAPI::MakeTBLOB(Pix *pix) {
|
||||
int width = pixGetWidth(pix);
|
||||
int height = pixGetHeight(pix);
|
||||
BLOCK block("a character", TRUE, 0, 0, 0, 0, width, height);
|
||||
BLOCK block("a character", true, 0, 0, 0, 0, width, height);
|
||||
|
||||
// Create C_BLOBs from the page
|
||||
extract_edges(pix, &block);
|
||||
|
@ -23,13 +23,13 @@
|
||||
// To avoid collision with other typenames include the ABSOLUTE MINIMUM
|
||||
// complexity of includes here. Use forward declarations wherever possible
|
||||
// and hide includes of complex types in baseapi.cpp.
|
||||
#include "tess_version.h"
|
||||
#include "apitypes.h"
|
||||
#include "pageiterator.h"
|
||||
#include "platform.h"
|
||||
#include "publictypes.h"
|
||||
#include "resultiterator.h"
|
||||
#include "serialis.h"
|
||||
#include "tess_version.h"
|
||||
#include "tesscallback.h"
|
||||
#include "thresholder.h"
|
||||
#include "unichar.h"
|
||||
@ -56,7 +56,7 @@ class UNICHARSET;
|
||||
class WERD_CHOICE_LIST;
|
||||
|
||||
struct INT_FEATURE_STRUCT;
|
||||
typedef INT_FEATURE_STRUCT *INT_FEATURE;
|
||||
using INT_FEATURE = INT_FEATURE_STRUCT *;
|
||||
struct TBLOB;
|
||||
|
||||
namespace tesseract {
|
||||
@ -73,20 +73,10 @@ class Tesseract;
|
||||
class Trie;
|
||||
class Wordrec;
|
||||
|
||||
typedef int (Dict::*DictFunc)(void* void_dawg_args,
|
||||
const UNICHARSET& unicharset,
|
||||
UNICHAR_ID unichar_id, bool word_end) const;
|
||||
typedef double (Dict::*ProbabilityInContextFunc)(const char* lang,
|
||||
const char* context,
|
||||
int context_bytes,
|
||||
const char* character,
|
||||
int character_bytes);
|
||||
typedef float (Dict::*ParamsModelClassifyFunc)(
|
||||
const char *lang, void *path);
|
||||
typedef void (Wordrec::*FillLatticeFunc)(const MATRIX &ratings,
|
||||
const WERD_CHOICE_LIST &best_choices,
|
||||
const UNICHARSET &unicharset,
|
||||
BlamerBundle *blamer_bundle);
|
||||
using DictFunc = int (Dict::*)(void *, const UNICHARSET &, UNICHAR_ID, bool) const;
|
||||
using ProbabilityInContextFunc = double (Dict::*)(const char *, const char *, int, const char *, int);
|
||||
using ParamsModelClassifyFunc = float (Dict::*)(const char *, void *);
|
||||
using FillLatticeFunc = void (Wordrec::*)(const MATRIX &, const WERD_CHOICE_LIST &, const UNICHARSET &, BlamerBundle *);
|
||||
typedef TessCallback4<const UNICHARSET &, int, PageIterator *, Pix *>
|
||||
TruthCallback;
|
||||
|
||||
@ -404,7 +394,7 @@ class TESS_API TessBaseAPI {
|
||||
* If paraids is not nullptr, the paragraph-id of each line within its block is
|
||||
* also returned as an array of one element per line. delete [] after use.
|
||||
*/
|
||||
Boxa* GetTextlines(const bool raw_image, const int raw_padding,
|
||||
Boxa* GetTextlines(bool raw_image, int raw_padding,
|
||||
Pixa** pixa, int** blockids, int** paraids);
|
||||
/*
|
||||
Helper method to extract from the thresholded image. (most common usage)
|
||||
@ -453,9 +443,9 @@ class TESS_API TessBaseAPI {
|
||||
* instead of the thresholded image and padded with raw_padding.
|
||||
* If text_only is true, then only text components are returned.
|
||||
*/
|
||||
Boxa* GetComponentImages(const PageIteratorLevel level,
|
||||
const bool text_only, const bool raw_image,
|
||||
const int raw_padding,
|
||||
Boxa* GetComponentImages(PageIteratorLevel level,
|
||||
bool text_only, bool raw_image,
|
||||
int raw_padding,
|
||||
Pixa** pixa, int** blockids, int** paraids);
|
||||
// Helper function to get binary images with no padding (most common usage).
|
||||
Boxa* GetComponentImages(const PageIteratorLevel level,
|
||||
|
Loading…
Reference in New Issue
Block a user