Skip to content

Commit 7768f9b

Browse files
committed
Clean more include files and include statements
The changes are based on an analysis done with include-what-you-use. Signed-off-by: Stefan Weil <[email protected]>
1 parent a32d24f commit 7768f9b

33 files changed

+371
-275
lines changed

src/ccmain/control.h

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: control.h (Formerly control.h)
33
* Description: Module-independent matcher controller.
4-
* Author: Ray Smith
5-
* Created: Thu Apr 23 11:09:58 BST 1992
4+
* Author: Ray Smith
5+
* Created: Thu Apr 23 11:09:58 BST 1992
66
*
77
* (C) Copyright 1992, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,14 +22,8 @@
2222
* Module-independent matcher controller.
2323
*/
2424

25-
#ifndef CONTROL_H
26-
#define CONTROL_H
27-
28-
#include "params.h"
29-
#include "ocrblock.h"
30-
#include "ratngs.h"
31-
#include "statistc.h"
32-
#include "pageres.h"
25+
#ifndef CONTROL_H
26+
#define CONTROL_H
3327

3428
enum ACCEPTABLE_WERD_TYPE
3529
{

src/ccmain/docqual.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/******************************************************************
22
* File: docqual.h (Formerly docqual.h)
33
* Description: Document Quality Metrics
4-
* Author: Phil Cheatle
5-
* Created: Mon May 9 11:27:28 BST 1994
4+
* Author: Phil Cheatle
5+
* Created: Mon May 9 11:27:28 BST 1994
66
*
77
* (C) Copyright 1994, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,10 +17,14 @@
1717
*
1818
**********************************************************************/
1919

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

23-
#include "control.h"
23+
#include <cstdint> // for int16_t
24+
25+
class PAGE_RES_IT;
26+
class ROW;
27+
class WERD_RES;
2428

2529
enum GARBAGE_LEVEL
2630
{
@@ -32,4 +36,5 @@ enum GARBAGE_LEVEL
3236

3337
int16_t word_blob_quality(WERD_RES *word, ROW *row);
3438
void reject_whole_page(PAGE_RES_IT &page_res_it);
39+
3540
#endif

src/ccmain/equationdetect.h

+6-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,12 @@
2020
#ifndef TESSERACT_CCMAIN_EQUATIONDETECT_H_
2121
#define TESSERACT_CCMAIN_EQUATIONDETECT_H_
2222

23-
#include "blobbox.h"
24-
#include "equationdetectbase.h"
25-
#include "genericvector.h"
26-
#include "tesseractclass.h"
27-
#include "unichar.h"
28-
29-
class BLOBNBOX;
30-
class BLOB_CHOICE;
31-
class BLOB_CHOICE_LIST;
32-
class TO_BLOCK_LIST;
23+
#include "blobbox.h" // for BLOBNBOX (ptr only), BlobSpecialText...
24+
#include "equationdetectbase.h" // for EquationDetectBase
25+
#include "genericvector.h" // for GenericVector
26+
#include "tesseractclass.h" // for Tesseract
27+
#include "unichar.h" // for UNICHAR_ID
28+
3329
class TBOX;
3430
class UNICHARSET;
3531

src/ccmain/fixspace.h

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
/******************************************************************
22
* File: fixspace.h (Formerly fixspace.h)
33
* Description: Implements a pass over the page res, exploring the alternative
4-
* spacing possibilities, trying to use context to improve the
5-
word spacing
6-
* Author: Phil Cheatle
7-
* Created: Thu Oct 21 11:38:43 BST 1993
8-
*
9-
* (C) Copyright 1993, Hewlett-Packard Ltd.
10-
** Licensed under the Apache License, Version 2.0 (the "License");
11-
** you may not use this file except in compliance with the License.
12-
** You may obtain a copy of the License at
13-
** http://www.apache.org/licenses/LICENSE-2.0
14-
** Unless required by applicable law or agreed to in writing, software
15-
** distributed under the License is distributed on an "AS IS" BASIS,
16-
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17-
** See the License for the specific language governing permissions and
18-
** limitations under the License.
19-
*
20-
**********************************************************************/
4+
* spacing possibilities, trying to use context to improve the
5+
* word spacing
6+
* Author: Phil Cheatle
7+
* Created: Thu Oct 21 11:38:43 BST 1993
8+
*
9+
* (C) Copyright 1993, Hewlett-Packard Ltd.
10+
** Licensed under the Apache License, Version 2.0 (the "License");
11+
** you may not use this file except in compliance with the License.
12+
** You may obtain a copy of the License at
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
** Unless required by applicable law or agreed to in writing, software
15+
** distributed under the License is distributed on an "AS IS" BASIS,
16+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
** See the License for the specific language governing permissions and
18+
** limitations under the License.
19+
*
20+
**********************************************************************/
2121

22-
#ifndef FIXSPACE_H
23-
#define FIXSPACE_H
22+
#ifndef FIXSPACE_H
23+
#define FIXSPACE_H
2424

25-
#include "pageres.h"
26-
#include "params.h"
25+
class WERD_RES;
26+
class WERD_RES_LIST;
2727

2828
void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list);
2929
void transform_to_next_perm(WERD_RES_LIST &words);
3030
void fixspace_dbg(WERD_RES *word);
31+
3132
#endif

src/ccmain/osdetect.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
#ifndef TESSERACT_CCMAIN_OSDETECT_H_
2121
#define TESSERACT_CCMAIN_OSDETECT_H_
2222

23-
#include "strngs.h"
24-
#include "unicharset.h"
23+
#include "platform.h" // for TESS_API
2524

26-
class TO_BLOCK_LIST;
2725
class BLOBNBOX;
28-
class BLOB_CHOICE_LIST;
2926
class BLOBNBOX_CLIST;
27+
class BLOB_CHOICE_LIST;
28+
class STRING;
29+
class TO_BLOCK_LIST;
30+
class UNICHARSET;
31+
template <typename T> class GenericVector;
3032

3133
namespace tesseract {
3234
class Tesseract;

src/ccmain/output.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/******************************************************************
22
* File: output.h (Formerly output.h)
33
* Description: Output pass
4-
* Author: Phil Cheatle
5-
* Created: Thu Aug 4 10:56:08 BST 1994
4+
* Author: Phil Cheatle
5+
* Created: Thu Aug 4 10:56:08 BST 1994
66
*
77
* (C) Copyright 1994, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,17 +17,17 @@
1717
*
1818
**********************************************************************/
1919

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

23-
#include "params.h"
24-
//#include "epapconv.h"
25-
#include "pageres.h"
23+
class BLOCK;
24+
class WERD;
2625

2726
/** test line ends */
2827
char determine_newline_type(WERD *word, ///< word to do
2928
BLOCK *block, ///< current block
3029
WERD *next_word, ///< next word
3130
BLOCK *next_block ///< block of next word
3231
);
32+
3333
#endif

src/ccmain/paragraphs.cpp

+29-18
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,36 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <algorithm>
21-
#include <ctype.h>
22-
#include <memory> // std::unique_ptr
23-
24-
#include "genericvector.h"
25-
#include "helpers.h"
26-
#include "mutableiterator.h"
27-
#include "ocrpara.h"
28-
#include "pageres.h"
2920
#include "paragraphs.h"
30-
#include "paragraphs_internal.h"
31-
#include "publictypes.h"
32-
#include "ratngs.h"
33-
#include "rect.h"
34-
#include "statistc.h"
35-
#include "strngs.h"
36-
#include "tprintf.h"
37-
#include "unicharset.h"
38-
#include "unicodes.h"
21+
#include <ctype.h> // for isspace
22+
#include <math.h> // for abs
23+
#include <stdio.h> // for snprintf
24+
#include <stdlib.h> // for abs
25+
#include <string.h> // for strchr, strlen
26+
#include <algorithm> // for max
27+
#include <memory> // for unique_ptr
28+
#include "genericvector.h" // for GenericVector, GenericVectorEqEq
29+
#include "helpers.h" // for UpdateRange, ClipToRange
30+
#include "host.h" // for NearlyEqual
31+
#include "mutableiterator.h" // for MutableIterator
32+
#include "ocrblock.h" // for BLOCK
33+
#include "ocrpara.h" // for ParagraphModel, PARA, PARA_IT, PARA...
34+
#include "ocrrow.h" // for ROW
35+
#include "pageiterator.h" // for PageIterator
36+
#include "pageres.h" // for PAGE_RES_IT, WERD_RES, ROW_RES, BLO...
37+
#include "paragraphs_internal.h" // for RowScratchRegisters, SetOfModels
38+
#include "pdblock.h" // for PDBLK
39+
#include "polyblk.h" // for POLY_BLOCK
40+
#include "publictypes.h" // for JUSTIFICATION_LEFT, JUSTIFICATION_R...
41+
#include "ratngs.h" // for WERD_CHOICE
42+
#include "rect.h" // for TBOX
43+
#include "statistc.h" // for STATS
44+
#include "strngs.h" // for STRING
45+
#include "tprintf.h" // for tprintf
46+
#include "unichar.h" // for UNICHAR, UNICHAR_ID
47+
#include "unicharset.h" // for UNICHARSET
48+
#include "unicodes.h" // for kPDF, kRLE
49+
#include "werd.h" // for WERD, W_REP_CHAR
3950

4051
namespace tesseract {
4152

src/ccmain/paragraphs.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
#ifndef TESSERACT_CCMAIN_PARAGRAPHS_H_
2121
#define TESSERACT_CCMAIN_PARAGRAPHS_H_
2222

23-
#include "rect.h"
24-
#include "ocrpara.h"
25-
#include "genericvector.h"
26-
#include "strngs.h"
23+
#include "rect.h" // for TBOX
24+
#include "strngs.h" // for STRING
2725

26+
class PARA_LIST;
27+
class ParagraphModel;
2828

29-
class WERD;
30-
class UNICHARSET;
29+
struct PARA;
30+
31+
template <typename T> class GenericVector;
3132

3233
namespace tesseract {
3334

src/ccmain/paramsd.cpp

+13-15
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,26 @@
1919
//
2020
// The parameters editor is used to edit all the parameters used within
2121
// tesseract from the ui.
22-
#ifdef _WIN32
23-
#else
24-
#include <cstdlib>
25-
#include <cstdio>
26-
#endif
27-
28-
#include <map>
29-
#include <memory>
3022

3123
// Include automatically generated configuration file if running autoconf.
3224
#ifdef HAVE_CONFIG_H
3325
#include "config_auto.h"
3426
#endif
3527

3628
#ifndef GRAPHICS_DISABLED
37-
#include "paramsd.h"
38-
39-
40-
#include "params.h"
41-
#include "scrollview.h"
42-
#include "svmnode.h"
4329

30+
#include "paramsd.h"
31+
#include <cstdio> // for fclose, fopen, fprintf, sprintf, FILE
32+
#include <cstdlib> // for atoi, strtod
33+
#include <cstring> // for strcmp, strcspn, strlen, strncpy
34+
#include <map> // for map, _Rb_tree_iterator, map<>::iterator
35+
#include <memory> // for unique_ptr
36+
#include <utility> // for pair
37+
#include "genericvector.h" // for GenericVector
38+
#include "params.h" // for ParamsVectors, StringParam, BoolParam
39+
#include "scrollview.h" // for SVEvent, ScrollView, SVET_POPUP
40+
#include "svmnode.h" // for SVMenuNode
41+
#include "tesseractclass.h" // for Tesseract
4442

4543
#define VARDIR "configs/" /*parameters files */
4644
#define MAX_ITEMS_IN_SUBMENU 30
@@ -354,4 +352,4 @@ void ParamsEditor::WriteParams(char *filename,
354352
}
355353
fclose(fp);
356354
}
357-
#endif
355+
#endif // GRAPHICS_DISABLED

src/ccmain/paramsd.h

+11-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@
2424

2525
#ifndef GRAPHICS_DISABLED
2626

27-
#include "elst.h"
28-
#include "params.h"
29-
#include "tesseractclass.h"
27+
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
28+
#include "scrollview.h" // for ScrollView (ptr only), SVEvent (ptr only)
29+
#include "strngs.h" // for STRING
3030

3131
class SVMenuNode;
3232

33+
namespace tesseract {
34+
class BoolParam;
35+
class DoubleParam;
36+
class IntParam;
37+
class StringParam;
38+
class Tesseract;
39+
}
40+
3341
// A list of all possible parameter types used.
3442
enum ParamType {
3543
VT_INTEGER,

src/ccmain/pgedit.h

+10-11
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717
//
1818
///////////////////////////////////////////////////////////////////////
1919

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

23-
#include "ocrblock.h"
24-
#include "ocrrow.h"
25-
#include "werd.h"
26-
#include "rect.h"
27-
#include "params.h"
28-
#include "tesseractclass.h"
23+
#include "params.h" // for INT_VAR_H, IntParam, STRING_VAR_H, StringParam
24+
#include "scrollview.h" // for SVEvent (ptr only), SVEventHandler, ScrollView
2925

30-
class ScrollView;
31-
class SVMenuNode;
32-
struct SVEvent;
26+
class BLOCK_LIST;
27+
class PAGE_RES;
28+
29+
namespace tesseract {
30+
class Tesseract;
31+
}
3332

3433
// A small event handler class to process incoming events to
3534
// this window.

0 commit comments

Comments
 (0)