Skip to content

Commit 1a15178

Browse files
committed
Clean some include statements
The changes are based on an analysis done with include-what-you-use. Replace also some standard header files by the corresponding standard C++ header files. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 15f64e0 commit 1a15178

22 files changed

+143
-100
lines changed

src/arch/dotproductavx.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ double DotProductAVX(const double* u, const double* v, int n) {
3535
#include <immintrin.h>
3636
#include <cstdint>
3737
#include "dotproductavx.h"
38-
#include "host.h"
3938

4039
namespace tesseract {
4140

src/arch/dotproductsse.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n) {
4141
#include <smmintrin.h>
4242
#include <cstdint>
4343
#include "dotproductsse.h"
44-
#include "host.h"
4544

4645
namespace tesseract {
4746

src/arch/dotproductsse.h

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#ifndef TESSERACT_ARCH_DOTPRODUCTSSE_H_
2020
#define TESSERACT_ARCH_DOTPRODUCTSSE_H_
2121

22-
#include "host.h"
23-
2422
namespace tesseract {
2523

2624
// Computes and returns the dot product of the n-vectors u and v.

src/arch/intsimdmatrix.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
///////////////////////////////////////////////////////////////////////
1818

1919
#include "intsimdmatrix.h"
20-
#include "intsimdmatrixavx2.h"
21-
#include "intsimdmatrixsse.h"
22-
#include "simddetect.h"
20+
#include "genericvector.h" // for GenericVector
21+
#include "intsimdmatrixavx2.h" // for IntSimdMatrixAVX2
22+
#include "intsimdmatrixsse.h" // for IntSimdMatrixSSE
23+
#include "matrix.h" // for GENERIC_2D_ARRAY
24+
#include "simddetect.h" // for SIMDDetect
2325

2426
namespace tesseract {
2527

src/arch/intsimdmatrix.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
#include <cstdint>
2323
#include <vector>
24-
#include "genericvector.h"
25-
#include "matrix.h"
24+
25+
template <class T> class GENERIC_2D_ARRAY;
26+
template <typename T> class GenericVector;
2627

2728
namespace tesseract {
2829

src/arch/simddetect.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
///////////////////////////////////////////////////////////////////////
1717

1818
#include "simddetect.h"
19-
#include "tprintf.h"
2019

2120
#undef X86_BUILD
2221
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)

src/ccmain/ltrresultiterator.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
#ifndef TESSERACT_CCMAIN_LTR_RESULT_ITERATOR_H_
2222
#define TESSERACT_CCMAIN_LTR_RESULT_ITERATOR_H_
2323

24-
#include "platform.h"
25-
#include "pageiterator.h"
26-
#include "unichar.h"
24+
#include "pageiterator.h" // for PageIterator
25+
#include "platform.h" // for TESS_API
26+
#include "publictypes.h" // for PageIteratorLevel
27+
#include "unichar.h" // for StrongScriptDirection
2728

2829
class BLOB_CHOICE_IT;
30+
class PAGE_RES;
2931
class WERD_RES;
3032

3133
namespace tesseract {

src/ccstruct/blamer.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@
1919
///////////////////////////////////////////////////////////////////////
2020

2121
#include "blamer.h"
22-
#include "blobs.h"
23-
#include "matrix.h"
24-
#include "normalis.h"
25-
#include "pageres.h"
22+
#include <math.h> // for abs
23+
#include <stdlib.h> // for abs
24+
#include "blobs.h" // for TPOINT, TWERD, TBLOB
25+
#include "errcode.h" // for ASSERT_HOST
26+
#include "matrix.h" // for MATRIX
27+
#include "normalis.h" // for DENORM
28+
#include "pageres.h" // for WERD_RES
29+
#include "tesscallback.h" // for TessResultCallback2
30+
#include "unicharset.h" // for UNICHARSET
2631

2732
// Names for each value of IncorrectResultReason enum. Keep in sync.
2833
const char kBlameCorrect[] = "corr";

src/ccstruct/blobbox.cpp

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: blobbox.cpp (Formerly blobnbox.c)
33
* Description: Code for the textord blob class.
4-
* Author: Ray Smith
5-
* Created: Thu Jul 30 09:08:51 BST 1992
4+
* Author: Ray Smith
5+
* Created: Thu Jul 30 09:08:51 BST 1992
66
*
77
* (C) Copyright 1992, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,12 +23,17 @@
2323
#endif
2424

2525
#include "blobbox.h"
26-
#include "allheaders.h"
27-
#include "blobs.h"
28-
#include "helpers.h"
29-
#include "normalis.h"
30-
31-
#include <algorithm>
26+
#include <stdint.h> // for INT32_MAX, INT16_MAX
27+
#include <algorithm> // for max, min
28+
#include "allheaders.h" // for pixGetHeight, pixGetPixel
29+
#include "blobs.h" // for TPOINT
30+
#include "coutln.h" // for C_OUTLINE_IT, C_OUTLINE, C_OUTLINE_LIST
31+
#include "environ.h" // for l_uint32
32+
#include "helpers.h" // for UpdateRange, IntCastRounded
33+
#include "host.h" // for NearlyEqual, TRUE
34+
#include "ipoints.h" // for operator+=, ICOORD::rotate
35+
36+
struct Pix;
3237

3338
#define PROJECTION_MARGIN 10 //arbitrary
3439
#define EXTERN

src/ccstruct/coutln.cpp

+13-7
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <algorithm>
21-
#include <cstring>
22-
2320
#include "coutln.h"
24-
25-
#include "allheaders.h"
26-
#include "blobs.h"
27-
#include "normalis.h"
21+
#include <algorithm> // for max, min
22+
#include <cmath> // for abs
23+
#include <cstdlib> // for abs
24+
#include <cstring> // for memset, memcpy, memmove
25+
#include "allheaders.h" // for pixSetPixel, pixGetData, pixRasterop, pixGe...
26+
#include "arrayaccess.h" // for GET_DATA_BYTE
27+
#include "blobs.h" // for TPOINT
28+
#include "crakedge.h" // for CRACKEDGE
29+
#include "environ.h" // for l_uint32
30+
#include "errcode.h" // for ASSERT_HOST
31+
#include "helpers.h" // for ClipToRange, IntCastRounded, Modulo
32+
#include "normalis.h" // for DENORM
33+
#include "pix.h" // for Pix (ptr only), PIX_DST, PIX_NOT
2834

2935
// Include automatically generated configuration file if running autoconf.
3036
#ifdef HAVE_CONFIG_H

src/ccstruct/coutln.h

+15-8
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@
1717
*
1818
**********************************************************************/
1919

20-
#ifndef COUTLN_H
21-
#define COUTLN_H
20+
#ifndef COUTLN_H
21+
#define COUTLN_H
2222

23-
#include "crakedge.h"
24-
#include "mod128.h"
25-
#include "bits16.h"
26-
#include "rect.h"
27-
#include "blckerr.h"
28-
#include "scrollview.h"
23+
#include <cstdint> // for int16_t, int32_t
24+
#include "bits16.h" // for BITS16
25+
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
26+
#include "ipoints.h" // for operator+=
27+
#include "memry.h" // for free_mem
28+
#include "mod128.h" // for DIR128, DIRBITS
29+
#include "platform.h" // for DLLSYM
30+
#include "points.h" // for ICOORD, FCOORD
31+
#include "rect.h" // for TBOX
32+
#include "scrollview.h" // for ScrollView, ScrollView::Color
2933

34+
class CRACKEDGE;
35+
class C_OUTLINE;
3036
class DENORM;
37+
struct Pix;
3138

3239
#define INTERSECTING INT16_MAX//no winding number
3340

src/ccstruct/dppoint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef TESSERACT_CCSTRUCT_DPPOINT_H_
2121
#define TESSERACT_CCSTRUCT_DPPOINT_H_
2222

23-
#include "host.h"
23+
#include <cstdint>
2424

2525
namespace tesseract {
2626

src/ccstruct/fontinfo.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
#ifndef TESSERACT_CCSTRUCT_FONTINFO_H_
2222
#define TESSERACT_CCSTRUCT_FONTINFO_H_
2323

24+
#include <cstdint> // for uint16_t, uint32_t
25+
#include <cstdio> // for FILE
2426
#include "errcode.h"
2527
#include "genericvector.h"
26-
#include "host.h"
2728
#include "unichar.h"
2829

2930
template <typename T> class UnicityTable;
3031

3132
namespace tesseract {
3233

33-
class BitVector;
34-
3534
// Simple struct to hold a font and a score. The scores come from the low-level
3635
// integer matcher, so they are in the uint16_t range. Fonts are an index to
3736
// fontinfo_table.

src/ccstruct/imagedata.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030
#include <thread>
3131
#endif
3232

33-
#include "allheaders.h"
34-
#include "boxread.h"
35-
#include "callcpp.h"
36-
#include "helpers.h"
37-
#include "tprintf.h"
33+
#include "allheaders.h" // for pixDestroy, pixGetHeight, pixGetWidth, lept_...
34+
#include "boxread.h" // for ReadMemBoxes
35+
#include "callcpp.h" // for window_wait
36+
#include "helpers.h" // for IntCastRounded, TRand, ClipToRange, Modulo
37+
#include "rect.h" // for TBOX
38+
#include "scrollview.h" // for ScrollView, ScrollView::CYAN, ScrollView::NONE
39+
#include "serialis.h" // for TFile
40+
#include "tprintf.h" // for tprintf
3841

3942
// Number of documents to read ahead while training. Doesn't need to be very
4043
// large.

src/ccstruct/imagedata.h

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@
2020
#ifndef TESSERACT_IMAGE_IMAGEDATA_H_
2121
#define TESSERACT_IMAGE_IMAGEDATA_H_
2222

23+
#include "genericvector.h" // for GenericVector, PointerVector, FileReader
24+
#include "points.h" // for FCOORD
25+
#include "strngs.h" // for STRING
26+
#include "svutil.h" // for SVAutoLock, SVMutex
2327

24-
#include "genericvector.h"
25-
#include "normalis.h"
26-
#include "rect.h"
27-
#include "strngs.h"
28-
#include "svutil.h"
29-
28+
class ScrollView;
29+
class TBOX;
3030
struct Pix;
3131

3232
namespace tesseract {
3333

34+
class TFile;
35+
3436
// Amount of padding to apply in output pixels in feature mode.
3537
const int kFeaturePadding = 2;
3638
// Number of pixels to pad around text boxes.
@@ -118,7 +120,7 @@ class ImageData {
118120
// Reads from the given file. Returns false in case of error.
119121
bool DeSerialize(TFile* fp);
120122
// As DeSerialize, but only seeks past the data - hence a static method.
121-
static bool SkipDeSerialize(tesseract::TFile* fp);
123+
static bool SkipDeSerialize(TFile* fp);
122124

123125
// Other accessors.
124126
const STRING& imagefilename() const {

src/ccstruct/ipoints.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: ipoints.h (Formerly icoords.h)
33
* Description: Inline functions for coords.h.
4-
* Author: Ray Smith
5-
* Created: Fri Jun 21 15:14:21 BST 1991
4+
* Author: Ray Smith
5+
* Created: Fri Jun 21 15:14:21 BST 1991
66
*
77
* (C) Copyright 1991, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,10 +17,11 @@
1717
*
1818
**********************************************************************/
1919

20-
#ifndef IPOINTS_H
21-
#define IPOINTS_H
20+
#ifndef IPOINTS_H
21+
#define IPOINTS_H
2222

23-
#include <math.h>
23+
#include <cmath>
24+
#include "points.h" // ICOORD
2425

2526
/**********************************************************************
2627
* operator!

src/ccstruct/pageres.cpp

+19-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,26 @@
2222
*
2323
**********************************************************************/
2424

25-
#include <stdlib.h>
26-
#include <cassert>
27-
#include "blamer.h"
2825
#include "pageres.h"
29-
#include "blobs.h"
26+
#include <cassert> // for assert
27+
#include <cstdint> // for INT32_MAX
28+
#include <cstring> // for strlen
29+
#include "blamer.h" // for BlamerBundle
30+
#include "blobs.h" // for TWERD, TBLOB
31+
#include "boxword.h" // for BoxWord
32+
#include "errcode.h" // for ASSERT_HOST
33+
#include "host.h" // for TRUE, FALSE
34+
#include "ocrblock.h" // for BLOCK_IT, BLOCK, BLOCK_LIST (ptr only)
35+
#include "ocrrow.h" // for ROW, ROW_IT
36+
#include "pdblock.h" // for PDBLK
37+
#include "polyblk.h" // for POLY_BLOCK
38+
#include "publictypes.h" // for OcrEngineMode, OEM_LSTM_ONLY
39+
#include "seam.h" // for SEAM, start_seam_list
40+
#include "stepblob.h" // for C_BLOB_IT, C_BLOB, C_BLOB_LIST
41+
#include "tesscallback.h" // for NewPermanentTessCallback, TessResultCallback2
42+
#include "tprintf.h" // for tprintf
43+
44+
struct Pix;
3045

3146
ELISTIZE (BLOCK_RES)
3247
CLISTIZE (BLOCK_RES) ELISTIZE (ROW_RES) ELISTIZE (WERD_RES)

src/ccstruct/polyaprx.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <stdio.h>
21-
#define FASTEDGELENGTH 256
2220
#include "polyaprx.h"
23-
#include "params.h"
24-
#include "tprintf.h"
21+
#include <cstdint> // for INT16_MAX, int8_t
22+
#include "blobs.h" // for EDGEPT, TPOINT, VECTOR, TESSLINE
23+
#include "coutln.h" // for C_OUTLINE
24+
#include "errcode.h" // for ASSERT_HOST
25+
#include "host.h" // for FALSE, TRUE
26+
#include "ipoints.h" // for operator+=, operator*=
27+
#include "mod128.h" // for DIR128
28+
#include "params.h" // for BoolParam, BOOL_VAR
29+
#include "points.h" // for ICOORD
30+
#include "rect.h" // for TBOX
31+
#include "tprintf.h" // for tprintf
32+
#include "vecfuncs.h" // for LENGTH, point_diff, CROSS
2533

2634
#define EXTERN
35+
#define FASTEDGELENGTH 256
2736

2837
EXTERN BOOL_VAR(poly_debug, FALSE, "Debug old poly");
2938
EXTERN BOOL_VAR(poly_wide_objects_better, TRUE,

src/ccutil/memry.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
*
1818
**********************************************************************/
1919

20-
#ifndef MEMRY_H
21-
#define MEMRY_H
20+
#ifndef MEMRY_H
21+
#define MEMRY_H
2222

23-
#include <stddef.h>
24-
#include "host.h"
23+
#include <cstdint>
2524

2625
// allocate string
2726
extern char *alloc_string(int32_t count);

src/ccutil/strngs.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
**********************************************************************/
1919

2020
#include "strngs.h"
21-
22-
#include <cassert>
23-
24-
#include "errcode.h"
25-
#include "genericvector.h"
26-
#include "helpers.h"
27-
#include "serialis.h"
28-
#include "tprintf.h"
21+
#include <cassert> // for assert
22+
#include "errcode.h" // for ASSERT_HOST
23+
#include "genericvector.h" // for GenericVector
24+
#include "helpers.h" // for ReverseN
25+
#include "memry.h" // for alloc_string, free_string
26+
#include "serialis.h" // for TFile
2927

3028
using tesseract::TFile;
3129

0 commit comments

Comments
 (0)