@@ -161,13 +161,13 @@ bool AlignedBlob::WithinTestRegion(int detail_level, int x, int y) {
161
161
ScrollView* AlignedBlob::DisplayTabs (const char * window_name,
162
162
ScrollView* tab_win) {
163
163
#ifndef GRAPHICS_DISABLED
164
- if (tab_win == NULL )
164
+ if (tab_win == nullptr )
165
165
tab_win = MakeWindow (0 , 50 , window_name);
166
166
// For every tab in the grid, display it.
167
167
GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> gsearch (this );
168
168
gsearch.StartFullSearch ();
169
169
BLOBNBOX* bbox;
170
- while ((bbox = gsearch.NextFullSearch ()) != NULL ) {
170
+ while ((bbox = gsearch.NextFullSearch ()) != nullptr ) {
171
171
const TBOX& box = bbox->bounding_box ();
172
172
int left_x = box.left ();
173
173
int right_x = box.right ();
@@ -219,7 +219,7 @@ static bool AtLeast2LineCrossings(BLOBNBOX_CLIST* blobs) {
219
219
// search parameters are determined by the AlignedBlobParams.
220
220
// vertical_x and y are updated with an estimate of the real
221
221
// vertical direction. (skew finding.)
222
- // Returns NULL if no decent vector can be found.
222
+ // Returns nullptr if no decent vector can be found.
223
223
TabVector* AlignedBlob::FindVerticalAlignment (AlignedBlobParams align_params,
224
224
BLOBNBOX* bbox,
225
225
int * vertical_x,
@@ -305,7 +305,7 @@ TabVector* AlignedBlob::FindVerticalAlignment(AlignedBlobParams align_params,
305
305
pt_count, align_params.min_points , end_y - start_y,
306
306
align_params.min_length , abs (end_x - start_x) * kMinTabGradient );
307
307
}
308
- return NULL ;
308
+ return nullptr ;
309
309
}
310
310
311
311
// Find a set of blobs that are aligned in the given vertical
@@ -325,7 +325,7 @@ int AlignedBlob::AlignTabs(const AlignedBlobParams& params,
325
325
box.print ();
326
326
}
327
327
int x_start = params.right_tab ? box.right () : box.left ();
328
- while (bbox != NULL ) {
328
+ while (bbox != nullptr ) {
329
329
// Add the blob to the list if the appropriate side is a tab candidate,
330
330
// or if we are working on a ragged tab.
331
331
TabType type = params.right_tab ? bbox->right_tab_type ()
@@ -340,10 +340,10 @@ int AlignedBlob::AlignTabs(const AlignedBlobParams& params,
340
340
}
341
341
// Find the next blob that is aligned with the current one.
342
342
// FindAlignedBlob guarantees that forward progress will be made in the
343
- // top_to_bottom direction, and therefore eventually it will return NULL ,
344
- // making this while (bbox != NULL ) loop safe.
343
+ // top_to_bottom direction, and therefore eventually it will return nullptr ,
344
+ // making this while (bbox != nullptr ) loop safe.
345
345
bbox = FindAlignedBlob (params, top_to_bottom, bbox, x_start, end_y);
346
- if (bbox != NULL ) {
346
+ if (bbox != nullptr ) {
347
347
box = bbox->bounding_box ();
348
348
if (!params.ragged )
349
349
x_start = params.right_tab ? box.right () : box.left ();
@@ -359,8 +359,8 @@ int AlignedBlob::AlignTabs(const AlignedBlobParams& params,
359
359
// Search vertically for a blob that is aligned with the input bbox.
360
360
// The search parameters are determined by AlignedBlobParams.
361
361
// top_to_bottom tells whether to search down or up.
362
- // The return value is NULL if nothing was found in the search box
363
- // or if a blob was found in the gutter. On a NULL return, end_y
362
+ // The return value is nullptr if nothing was found in the search box
363
+ // or if a blob was found in the gutter. On a nullptr return, end_y
364
364
// is set to the edge of the search box or the leading edge of the
365
365
// gutter blob if one was found.
366
366
BLOBNBOX* AlignedBlob::FindAlignedBlob (const AlignedBlobParams& p,
@@ -412,13 +412,13 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
412
412
xmin, xmax, start_y, p.max_v_gap , p.min_gutter );
413
413
vsearch.StartVerticalSearch (xmin, xmax, start_y);
414
414
// result stores the best real return value.
415
- BLOBNBOX* result = NULL ;
415
+ BLOBNBOX* result = nullptr ;
416
416
// The backup_result is not a tab candidate and can be used if no
417
417
// real tab candidate result is found.
418
- BLOBNBOX* backup_result = NULL ;
418
+ BLOBNBOX* backup_result = nullptr ;
419
419
// neighbour is the blob that is currently being investigated.
420
- BLOBNBOX* neighbour = NULL ;
421
- while ((neighbour = vsearch.NextVerticalSearch (top_to_bottom)) != NULL ) {
420
+ BLOBNBOX* neighbour = nullptr ;
421
+ while ((neighbour = vsearch.NextVerticalSearch (top_to_bottom)) != nullptr ) {
422
422
if (neighbour == bbox)
423
423
continue ;
424
424
TBOX nbox = neighbour->bounding_box ();
@@ -437,9 +437,9 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
437
437
// more than one blob in a grid cell. See comment in AlignTabs.
438
438
if ((n_y < start_y) != top_to_bottom || nbox.y_overlap (box))
439
439
continue ; // Only look in the required direction.
440
- if (result != NULL && result->bounding_box ().y_gap (nbox) > gridsize ())
440
+ if (result != nullptr && result->bounding_box ().y_gap (nbox) > gridsize ())
441
441
return result; // This result is clear.
442
- if (backup_result != NULL && p.ragged && result == NULL &&
442
+ if (backup_result != nullptr && p.ragged && result == nullptr &&
443
443
backup_result->bounding_box ().y_gap (nbox) > gridsize ())
444
444
return backup_result; // This result is clear.
445
445
@@ -466,7 +466,7 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
466
466
*end_y = top_to_bottom ? nbox.top () : nbox.bottom ();
467
467
if (WithinTestRegion (2 , x_start, start_y))
468
468
tprintf (" gutter\n " );
469
- return NULL ;
469
+ return nullptr ;
470
470
}
471
471
if (!p.right_tab &&
472
472
n_left < x_at_n_y - p.l_align_tolerance &&
@@ -478,7 +478,7 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
478
478
*end_y = top_to_bottom ? nbox.top () : nbox.bottom ();
479
479
if (WithinTestRegion (2 , x_start, start_y))
480
480
tprintf (" gutter\n " );
481
- return NULL ;
481
+ return nullptr ;
482
482
}
483
483
if ((p.right_tab && neighbour->leader_on_right ()) ||
484
484
(!p.right_tab && neighbour->leader_on_left ()))
@@ -494,7 +494,7 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
494
494
TabType n_type = p.right_tab ? neighbour->right_tab_type ()
495
495
: neighbour->left_tab_type ();
496
496
if (n_type != TT_NONE && (p.ragged || n_type != TT_MAYBE_RAGGED)) {
497
- if (result == NULL ) {
497
+ if (result == nullptr ) {
498
498
result = neighbour;
499
499
} else {
500
500
// Keep the closest neighbour by Euclidean distance.
@@ -510,7 +510,7 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
510
510
if (new_dist < old_dist)
511
511
result = neighbour;
512
512
}
513
- } else if (backup_result == NULL ) {
513
+ } else if (backup_result == nullptr ) {
514
514
if (WithinTestRegion (2 , x_start, start_y))
515
515
tprintf (" Backup\n " );
516
516
backup_result = neighbour;
@@ -525,7 +525,7 @@ BLOBNBOX* AlignedBlob::FindAlignedBlob(const AlignedBlobParams& p,
525
525
}
526
526
}
527
527
}
528
- return result != NULL ? result : backup_result;
528
+ return result != nullptr ? result : backup_result;
529
529
}
530
530
531
531
} // namespace tesseract.
0 commit comments