-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patha00020_source.html
274 lines (272 loc) · 37.6 KB
/
a00020_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tesseract: /tesseract/include/tesseract/ocrclass.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">tesseract
 <span id="projectnumber">5.0.0-alpha-619-ge9db</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00020_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ocrclass.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="a00020.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/**********************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * File: ocrclass.h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Description: Class definitions and constants for the OCR API.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Author: Hewlett-Packard Co</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * (C) Copyright 1996, Hewlett-Packard Co.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> ** Licensed under the Apache License, Version 2.0 (the "License");</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> ** you may not use this file except in compliance with the License.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> ** You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> ** http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> ** Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> ** distributed under the License is distributed on an "AS IS" BASIS,</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> ** See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> ** limitations under the License.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> **********************************************************************/</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">/**********************************************************************</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * This file contains typedefs for all the structures used by</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * the HP OCR interface.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * The structures are designed to allow them to be used with any</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> * structure alignment up to 8.</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> **********************************************************************/</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  </div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#ifndef CCUTIL_OCRCLASS_H_</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#define CCUTIL_OCRCLASS_H_</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  </div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <chrono></span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include <ctime></span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="comment">/**********************************************************************</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="comment"> * EANYCODE_CHAR</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="comment"> * Description of a single character. The character code is defined by</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="comment"> * the character set of the current font.</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="comment"> * Output text is sent as an array of these structures.</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment"> * Spaces and line endings in the output are represented in the</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="comment"> * structures of the surrounding characters. They are not directly</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment"> * represented as characters.</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="comment"> * The first character in a word has a positive value of blanks.</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="comment"> * Missing information should be set to the defaults in the comments.</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="comment"> * If word bounds are known, but not character bounds, then the top and</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="comment"> * bottom of each character should be those of the word. The left of the</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="comment"> * first and right of the last char in each word should be set. All other</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="comment"> * lefts and rights should be set to -1.</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment"> * If set, the values of right and bottom are left+width and top+height.</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="comment"> * Most of the members come directly from the parameters to ocr_append_char.</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment"> * The formatting member uses the enhancement parameter and combines the</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="comment"> * line direction stuff into the top 3 bits.</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="comment"> * The coding is 0=RL char, 1=LR char, 2=DR NL, 3=UL NL, 4=DR Para,</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment"> * 5=UL Para, 6=TB char, 7=BT char. API users do not need to know what</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="comment"> * the coding is, only that it is backwards compatible with the previous</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="a02462.html"> 53</a></span> <span class="comment"> * version.</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="comment"> **********************************************************************/</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  </div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <span class="comment">/*single character */</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="comment">// It should be noted that the format for char_code for version 2.0 and beyond</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="comment">// is UTF8 which means that ASCII characters will come out as one structure</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="comment">// but other characters will be returned in two or more instances of this</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="comment">// structure with a single byte of the UTF8 code in each, but each will have</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">// the same bounding box. Programs which want to handle languagues with</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="comment">// different characters sets will need to handle extended characters</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="comment">// appropriately, but *all* code needs to be prepared to receive UTF8 coded</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">// characters for characters such as bullet and fancy quotes.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  uint16_t char_code; <span class="comment">/*character itself */</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  int16_t left; <span class="comment">/*of char (-1) */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  int16_t right; <span class="comment">/*of char (-1) */</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  int16_t top; <span class="comment">/*of char (-1) */</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  int16_t bottom; <span class="comment">/*of char (-1) */</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  int16_t font_index; <span class="comment">/*what font (0) */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  uint8_t confidence; <span class="comment">/*0=perfect, 100=reject (0/100) */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  uint8_t point_size; <span class="comment">/*of char, 72=i inch, (10) */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  int8_t blanks; <span class="comment">/*no of spaces before this char (1) */</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  uint8_t formatting; <span class="comment">/*char formatting (0) */</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> } <a class="code" href="a02462.html">EANYCODE_CHAR</a>; <span class="comment">/*single character */</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  </div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="comment">/**********************************************************************</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment"> * ETEXT_DESC</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="comment"> * Description of the output of the OCR engine.</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"> * This structure is used as both a progress monitor and the final</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment"> * output header, since it needs to be a valid progress monitor while</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment"> * the OCR engine is storing its output to shared memory.</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment"> * During progress, all the buffer info is -1.</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"> * Progress starts at 0 and increases to 100 during OCR. No other constraint.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment"> * Additionally the progress callback contains the bounding box of the word that</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"> * is currently being processed.</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="comment"> * Every progress callback, the OCR engine must set ocr_alive to 1.</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="comment"> * The HP side will set ocr_alive to 0. Repeated failure to reset</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment"> * to 1 indicates that the OCR engine is dead.</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment"> * If the cancel function is not null then it is called with the number of</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="a00020.html#afe614946c68a00ef135b77c9bc35a733"> 91</a></span> <span class="comment"> * user words found. If it returns true then operation is cancelled.</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="a00020.html#abdf580822b76f8ba2a94f53f98e43d0b"> 92</a></span> <span class="comment"> **********************************************************************/</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="a00020.html#a6e69e176da91d97ee781af68be2cf0fa"> 93</a></span> <span class="keyword">class </span><a class="code" href="a02466.html">ETEXT_DESC</a>;</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  </div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="a02466.html"> 95</a></span> <span class="keyword">using</span> <a class="code" href="a00020.html#afe614946c68a00ef135b77c9bc35a733">CANCEL_FUNC</a> = bool (*)(<span class="keywordtype">void</span>*, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>);</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="keyword">using</span> <a class="code" href="a00020.html#abdf580822b76f8ba2a94f53f98e43d0b">PROGRESS_FUNC</a> = bool (*)(<a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>);</div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="a02466.html#ab28f4b5c17e3296e7a5b4a8dfe01a77a"> 97</a></span> <span class="keyword">using</span> <a class="code" href="a00020.html#a6e69e176da91d97ee781af68be2cf0fa">PROGRESS_FUNC2</a> = bool (*)(<a class="code" href="a02466.html">ETEXT_DESC</a>*, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>, <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>);</div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="a02466.html#a469c1ab091847e37969871bd89cf1005"> 98</a></span>  </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">class </span><a class="code" href="a02466.html">ETEXT_DESC</a> { <span class="comment">// output header</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  int16_t <a class="code" href="a02466.html#ab28f4b5c17e3296e7a5b4a8dfe01a77a">count</a>{0}; </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="a02466.html#ac2d71d4f24a22697145e788e76e99082"> 102</a></span>  int16_t <a class="code" href="a02466.html#a469c1ab091847e37969871bd89cf1005">progress</a>{0}; </div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="a02466.html#a3b103545a36543dd4f16c496838d99eb"> 103</a></span>  </div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="a02466.html#a4e76cdcca81c40cb7871e56f23d316b0"> 106</a></span>  int8_t <a class="code" href="a02466.html#ac2d71d4f24a22697145e788e76e99082">more_to_come</a>{0}; </div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="a02462.html#a26b17c4f5acf92a44e47c29247413930"> 107</a></span>  <span class="keyword">volatile</span> int8_t <a class="code" href="a02466.html#a3b103545a36543dd4f16c496838d99eb">ocr_alive</a>{0}; </div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="a02466.html#a51ef2705184520ed0b44e218aa2b1706"> 108</a></span>  int8_t <a class="code" href="a02466.html#a96a63d55535dd16e065877c363b48b2c">err_code</a>{0}; </div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="a02462.html#a41a59a3cd37211860534e730bec36883"> 109</a></span>  <a class="code" href="a00020.html#afe614946c68a00ef135b77c9bc35a733">CANCEL_FUNC</a> <a class="code" href="a02466.html#afcea4319ceed9b37f3c43eec9ec5d55a">cancel</a>{<span class="keyword">nullptr</span>}; </div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189"> 110</a></span>  <a class="code" href="a00020.html#abdf580822b76f8ba2a94f53f98e43d0b">PROGRESS_FUNC</a> <a class="code" href="a02466.html#a4e76cdcca81c40cb7871e56f23d316b0">progress_callback</a>{</div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="a02462.html#a2384b28dd65468b0cbc9eb35a5434bc0"> 111</a></span>  <span class="keyword">nullptr</span>}; </div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <a class="code" href="a00020.html#a6e69e176da91d97ee781af68be2cf0fa">PROGRESS_FUNC2</a> <a class="code" href="a02466.html#a51ef2705184520ed0b44e218aa2b1706">progress_callback2</a>; </div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="a02466.html#ac71732cab3f860ad991da9f91fb6f915"> 113</a></span>  <span class="keywordtype">void</span>* <a class="code" href="a02466.html#a4844a3e9868a0fde7ad2fcaa37f5c5f1">cancel_this</a>{<span class="keyword">nullptr</span>}; </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  std::chrono::steady_clock::time_point <a class="code" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">end_time</a>;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="a02462.html">EANYCODE_CHAR</a> <a class="code" href="a02466.html#ac71732cab3f860ad991da9f91fb6f915">text</a>[1]{}; </div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <a class="code" href="a02466.html#a07eb91ebcbcf0ad1d22a302a12710728">ETEXT_DESC</a>() : <a class="code" href="a02466.html#a51ef2705184520ed0b44e218aa2b1706">progress_callback2</a>(&default_progress_func) {</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <a class="code" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">end_time</a> = std::chrono::time_point<std::chrono::steady_clock,</div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="a02466.html#a16abfdff240ef121844b07bfa3afd4b5"> 121</a></span>  std::chrono::milliseconds>();</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  }</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  </div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="comment">// Sets the end time to be deadline_msecs milliseconds from now.</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordtype">void</span> <a class="code" href="a02466.html#a16abfdff240ef121844b07bfa3afd4b5">set_deadline_msecs</a>(int32_t deadline_msecs) {</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">if</span> (deadline_msecs > 0) {</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <a class="code" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">end_time</a> = std::chrono::steady_clock::now() +</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  std::chrono::milliseconds(deadline_msecs);</div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="a02466.html#a84e8d7c830a6b08ad1ebdbdf872c887a"> 129</a></span>  }</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  }</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  </div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="comment">// Returns false if we've not passed the end_time, or have not set a deadline.</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordtype">bool</span> <a class="code" href="a02466.html#a84e8d7c830a6b08ad1ebdbdf872c887a">deadline_exceeded</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">if</span> (<a class="code" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">end_time</a>.time_since_epoch() ==</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  std::chrono::steady_clock::duration::zero()) {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  }</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keyword">auto</span> now = std::chrono::steady_clock::now();</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordflow">return</span> (now > <a class="code" href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">end_time</a>);</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  }</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  </div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keyword">static</span> <span class="keywordtype">bool</span> default_progress_func(<a class="code" href="a02466.html">ETEXT_DESC</a>* ths, <span class="keywordtype">int</span> left, <span class="keywordtype">int</span> right,</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordtype">int</span> top, <span class="keywordtype">int</span> bottom) {</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">if</span> (ths-><a class="code" href="a02466.html#a4e76cdcca81c40cb7871e56f23d316b0">progress_callback</a> != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keywordflow">return</span> (*(ths-><a class="code" href="a02466.html#a4e76cdcca81c40cb7871e56f23d316b0">progress_callback</a>))(ths-><a class="code" href="a02466.html#a469c1ab091847e37969871bd89cf1005">progress</a>, left, right, top,</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  bottom);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  }</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  }</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span> };</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  </div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="preprocessor">#endif // CCUTIL_OCRCLASS_H_</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aa02466_html_a16abfdff240ef121844b07bfa3afd4b5"><div class="ttname"><a href="a02466.html#a16abfdff240ef121844b07bfa3afd4b5">ETEXT_DESC::set_deadline_msecs</a></div><div class="ttdeci">void set_deadline_msecs(int32_t deadline_msecs)</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00121">ocrclass.h:121</a></div></div>
<div class="ttc" id="aa02466_html_a51ef2705184520ed0b44e218aa2b1706"><div class="ttname"><a href="a02466.html#a51ef2705184520ed0b44e218aa2b1706">ETEXT_DESC::progress_callback2</a></div><div class="ttdeci">PROGRESS_FUNC2 progress_callback2</div><div class="ttdoc">called whenever progress increases</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00108">ocrclass.h:108</a></div></div>
<div class="ttc" id="aa00020_html_abdf580822b76f8ba2a94f53f98e43d0b"><div class="ttname"><a href="a00020.html#abdf580822b76f8ba2a94f53f98e43d0b">PROGRESS_FUNC</a></div><div class="ttdeci">bool(*)(int, int, int, int, int) PROGRESS_FUNC</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00092">ocrclass.h:92</a></div></div>
<div class="ttc" id="aa02466_html_ac2d71d4f24a22697145e788e76e99082"><div class="ttname"><a href="a02466.html#ac2d71d4f24a22697145e788e76e99082">ETEXT_DESC::more_to_come</a></div><div class="ttdeci">int8_t more_to_come</div><div class="ttdoc">percent complete increasing (0-100)</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00102">ocrclass.h:102</a></div></div>
<div class="ttc" id="aa02466_html"><div class="ttname"><a href="a02466.html">ETEXT_DESC</a></div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00095">ocrclass.h:95</a></div></div>
<div class="ttc" id="aa02466_html_ab28f4b5c17e3296e7a5b4a8dfe01a77a"><div class="ttname"><a href="a02466.html#ab28f4b5c17e3296e7a5b4a8dfe01a77a">ETEXT_DESC::count</a></div><div class="ttdeci">int16_t count</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00097">ocrclass.h:97</a></div></div>
<div class="ttc" id="aa02466_html_a3b103545a36543dd4f16c496838d99eb"><div class="ttname"><a href="a02466.html#a3b103545a36543dd4f16c496838d99eb">ETEXT_DESC::ocr_alive</a></div><div class="ttdeci">volatile int8_t ocr_alive</div><div class="ttdoc">true if not last</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00103">ocrclass.h:103</a></div></div>
<div class="ttc" id="aa02466_html_a4844a3e9868a0fde7ad2fcaa37f5c5f1"><div class="ttname"><a href="a02466.html#a4844a3e9868a0fde7ad2fcaa37f5c5f1">ETEXT_DESC::cancel_this</a></div><div class="ttdeci">void * cancel_this</div><div class="ttdoc">monitor-aware progress callback</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00109">ocrclass.h:109</a></div></div>
<div class="ttc" id="aa02466_html_a469c1ab091847e37969871bd89cf1005"><div class="ttname"><a href="a02466.html#a469c1ab091847e37969871bd89cf1005">ETEXT_DESC::progress</a></div><div class="ttdeci">int16_t progress</div><div class="ttdoc">chars in this buffer(0)</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00098">ocrclass.h:98</a></div></div>
<div class="ttc" id="aa01827_html_a09a009a90bfc702287cb52f5b818acda"><div class="ttname"><a href="a01827.html#a09a009a90bfc702287cb52f5b818acda">tesstrain_utils.int</a></div><div class="ttdeci">int</div><div class="ttdef"><b>Definition:</b> <a href="a01397_source.html#l00154">tesstrain_utils.py:154</a></div></div>
<div class="ttc" id="aa02466_html_a96a63d55535dd16e065877c363b48b2c"><div class="ttname"><a href="a02466.html#a96a63d55535dd16e065877c363b48b2c">ETEXT_DESC::err_code</a></div><div class="ttdeci">int8_t err_code</div><div class="ttdoc">ocr sets to 1, HP 0</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00104">ocrclass.h:104</a></div></div>
<div class="ttc" id="aa02466_html_a84e8d7c830a6b08ad1ebdbdf872c887a"><div class="ttname"><a href="a02466.html#a84e8d7c830a6b08ad1ebdbdf872c887a">ETEXT_DESC::deadline_exceeded</a></div><div class="ttdeci">bool deadline_exceeded() const</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00129">ocrclass.h:129</a></div></div>
<div class="ttc" id="aa02466_html_a07eb91ebcbcf0ad1d22a302a12710728"><div class="ttname"><a href="a02466.html#a07eb91ebcbcf0ad1d22a302a12710728">ETEXT_DESC::ETEXT_DESC</a></div><div class="ttdeci">ETEXT_DESC()</div><div class="ttdoc">character data</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00115">ocrclass.h:115</a></div></div>
<div class="ttc" id="aa02466_html_a4e76cdcca81c40cb7871e56f23d316b0"><div class="ttname"><a href="a02466.html#a4e76cdcca81c40cb7871e56f23d316b0">ETEXT_DESC::progress_callback</a></div><div class="ttdeci">PROGRESS_FUNC progress_callback</div><div class="ttdoc">returns true to cancel</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00106">ocrclass.h:106</a></div></div>
<div class="ttc" id="aa00020_html_afe614946c68a00ef135b77c9bc35a733"><div class="ttname"><a href="a00020.html#afe614946c68a00ef135b77c9bc35a733">CANCEL_FUNC</a></div><div class="ttdeci">bool(*)(void *, int) CANCEL_FUNC</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00091">ocrclass.h:91</a></div></div>
<div class="ttc" id="aa02466_html_a9ef584149ea84ad3945ecf1b9c09d189"><div class="ttname"><a href="a02466.html#a9ef584149ea84ad3945ecf1b9c09d189">ETEXT_DESC::end_time</a></div><div class="ttdeci">std::chrono::steady_clock::time_point end_time</div><div class="ttdoc">this or other data for cancel</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00110">ocrclass.h:110</a></div></div>
<div class="ttc" id="aa02466_html_afcea4319ceed9b37f3c43eec9ec5d55a"><div class="ttname"><a href="a02466.html#afcea4319ceed9b37f3c43eec9ec5d55a">ETEXT_DESC::cancel</a></div><div class="ttdeci">CANCEL_FUNC cancel</div><div class="ttdoc">for errcode use</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00105">ocrclass.h:105</a></div></div>
<div class="ttc" id="aa02466_html_ac71732cab3f860ad991da9f91fb6f915"><div class="ttname"><a href="a02466.html#ac71732cab3f860ad991da9f91fb6f915">ETEXT_DESC::text</a></div><div class="ttdeci">EANYCODE_CHAR text[1]</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00113">ocrclass.h:113</a></div></div>
<div class="ttc" id="aa02462_html"><div class="ttname"><a href="a02462.html">EANYCODE_CHAR</a></div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00053">ocrclass.h:53</a></div></div>
<div class="ttc" id="aa00020_html_a6e69e176da91d97ee781af68be2cf0fa"><div class="ttname"><a href="a00020.html#a6e69e176da91d97ee781af68be2cf0fa">PROGRESS_FUNC2</a></div><div class="ttdeci">bool(*)(ETEXT_DESC *, int, int, int, int) PROGRESS_FUNC2</div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00093">ocrclass.h:93</a></div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_00200a555532e7ec3afbcddd6091e65a.html">tesseract</a></li><li class="navelem"><a class="el" href="a00020.html">ocrclass.h</a></li>
<li class="footer">Generated on Thu Jan 30 2020 14:22:19 for tesseract by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li>
</ul>
</div>
</body>
</html>