Merge branch 'master' into fix_smart_pointers

This commit is contained in:
Alexander 2018-05-26 00:37:07 +03:00 committed by GitHub
commit 69fbb52930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 1362 additions and 1509 deletions

View File

@ -37,9 +37,9 @@
#endif
namespace tesseract {
BOOL8 Tesseract::word_adaptable( //should we adapt?
WERD_RES *word,
uint16_t mode) {
bool Tesseract::word_adaptable( //should we adapt?
WERD_RES* word,
uint16_t mode) {
if (tessedit_adaption_debug) {
tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n",
word->best_choice == nullptr ? "" :
@ -65,7 +65,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
*/
if (mode == 0) {
if (tessedit_adaption_debug) tprintf("adaption disabled\n");
return FALSE;
return false;
}
if (flags.bit (ADAPTABLE_WERD)) {
@ -83,7 +83,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
}
if (!status) { // If not set then
return FALSE; // ignore other checks
return false; // ignore other checks
}
if (flags.bit (CHECK_DAWGS) &&
@ -92,24 +92,24 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
(word->best_choice->permuter () != USER_DAWG_PERM) &&
(word->best_choice->permuter () != NUMBER_PERM)) {
if (tessedit_adaption_debug) tprintf("word not in dawgs\n");
return FALSE;
return false;
}
if (flags.bit (CHECK_ONE_ELL_CONFLICT) && one_ell_conflict (word, FALSE)) {
if (flags.bit (CHECK_ONE_ELL_CONFLICT) && one_ell_conflict (word, false)) {
if (tessedit_adaption_debug) tprintf("word has ell conflict\n");
return FALSE;
return false;
}
if (flags.bit (CHECK_SPACES) &&
(strchr(word->best_choice->unichar_string().string(), ' ') != nullptr)) {
if (tessedit_adaption_debug) tprintf("word contains spaces\n");
return FALSE;
return false;
}
if (flags.bit (CHECK_AMBIG_WERD) &&
word->best_choice->dangerous_ambig_found()) {
if (tessedit_adaption_debug) tprintf("word is ambiguous\n");
return FALSE;
return false;
}
if (tessedit_adaption_debug) {

View File

@ -80,7 +80,7 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
*
* @param pr_it the page results iterator
*/
BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
int16_t char_qual;
int16_t good_char_qual;
@ -101,7 +101,7 @@ BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
word_blob_quality(word_res, pr_it->row()->row),
word_outline_errs(word_res), char_qual, good_char_qual);
}
return TRUE;
return true;
}
// Helper function to check for a target word and handle it appropriately.
@ -674,7 +674,7 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
(stats_.doc_good_char_quality /
static_cast<float>(stats_.good_char_count)) : 0.0);
}
BOOL8 good_quality_doc =
bool good_quality_doc =
((page_res->rej_count / static_cast<float>(page_res->char_count)) <=
quality_rej_pc) &&
(stats_.doc_blob_quality / static_cast<float>(page_res->char_count) >=
@ -1792,20 +1792,20 @@ ACCEPTABLE_WERD_TYPE Tesseract::acceptable_word_string(
return word_type;
}
BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
BOOL8 show_map_detail = FALSE;
bool Tesseract::check_debug_pt(WERD_RES* word, int location) {
bool show_map_detail = false;
int16_t i;
if (!test_pt)
return FALSE;
return false;
tessedit_rejection_debug.set_value (FALSE);
debug_x_ht_level.set_value(0);
if (word->word->bounding_box ().contains (FCOORD (test_pt_x, test_pt_y))) {
if (word->word->bounding_box().contains(FCOORD (test_pt_x, test_pt_y))) {
if (location < 0)
return TRUE; // For breakpoint use
tessedit_rejection_debug.set_value (TRUE);
return true; // For breakpoint use
tessedit_rejection_debug.set_value(TRUE);
debug_x_ht_level.set_value(2);
tprintf ("\n\nTESTWD::");
switch (location) {
@ -1827,7 +1827,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
break;
case 50:
tprintf ("classify_word_pass2 - END");
show_map_detail = TRUE;
show_map_detail = true;
break;
case 60:
tprintf ("fixspace");
@ -1849,7 +1849,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
break;
case 120:
tprintf ("Write results pass");
show_map_detail = TRUE;
show_map_detail = true;
break;
}
if (word->best_choice != nullptr) {
@ -1868,9 +1868,9 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
}
tprintf ("Tess Accepted: %s\n", word->tess_accepted ? "TRUE" : "FALSE");
tprintf ("Done flag: %s\n\n", word->done ? "TRUE" : "FALSE");
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}

View File

@ -137,7 +137,7 @@ int16_t Tesseract::count_outline_errs(char c, int16_t outline_count) {
}
void Tesseract::quality_based_rejection(PAGE_RES_IT &page_res_it,
BOOL8 good_quality_doc) {
bool good_quality_doc) {
if ((tessedit_good_quality_unrej && good_quality_doc))
unrej_good_quality_words(page_res_it);
doc_and_block_rejection(page_res_it, good_quality_doc);
@ -232,14 +232,14 @@ void Tesseract::unrej_good_quality_words( //unreject potential
void Tesseract::doc_and_block_rejection( //reject big chunks
PAGE_RES_IT &page_res_it,
BOOL8 good_quality_doc) {
bool good_quality_doc) {
int16_t block_no = 0;
int16_t row_no = 0;
BLOCK_RES *current_block;
ROW_RES *current_row;
BOOL8 rej_word;
BOOL8 prev_word_rejected;
bool rej_word;
bool prev_word_rejected;
int16_t char_quality = 0;
int16_t accepted_char_quality;
@ -273,7 +273,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
block_no, current_block->char_count,
current_block->rej_count);
}
prev_word_rejected = FALSE;
prev_word_rejected = false;
while ((word = page_res_it.word()) != nullptr &&
(page_res_it.block() == current_block)) {
if (tessedit_preserve_blk_rej_perfect_wds) {
@ -292,7 +292,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
rej_word = char_quality != word->reject_map.length();
}
} else {
rej_word = TRUE;
rej_word = true;
}
if (rej_word) {
/*
@ -304,7 +304,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() &&
word->word->space() == 1)
word->reject_spaces = TRUE;
word->reject_spaces = true;
word->reject_map.rej_word_block_rej();
}
prev_word_rejected = rej_word;
@ -339,7 +339,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
row_no, current_row->char_count,
current_row->rej_count);
}
prev_word_rejected = FALSE;
prev_word_rejected = false;
while ((word = page_res_it.word()) != nullptr &&
page_res_it.row () == current_row) {
/* Preserve words on good docs unless they are mostly rejected*/
@ -363,7 +363,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
rej_word = char_quality != word->reject_map.length();
}
} else {
rej_word = TRUE;
rej_word = true;
}
if (rej_word) {
/*
@ -375,7 +375,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() &&
word->word->space () == 1)
word->reject_spaces = TRUE;
word->reject_spaces = true;
word->reject_map.rej_word_row_rej();
}
prev_word_rejected = rej_word;
@ -411,7 +411,7 @@ void reject_whole_page(PAGE_RES_IT &page_res_it) {
page_res_it.forward ();
}
//whole page is rejected
page_res_it.page_res->rejected = TRUE;
page_res_it.page_res->rejected = true;
}
namespace tesseract {
@ -419,8 +419,8 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
WERD_RES *word;
GARBAGE_LEVEL garbage_level;
PAGE_RES_IT copy_it;
BOOL8 prev_potential_marked = FALSE;
BOOL8 found_terrible_word = FALSE;
bool prev_potential_marked = false;
bool found_terrible_word = false;
BOOL8 ok_dict_word;
page_res_it.restart_page();
@ -439,13 +439,13 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
word->merge_tess_fails();
if (word->reject_map.accept_count () != 0) {
found_terrible_word = FALSE;
found_terrible_word = false;
//Forget earlier potential crunches
prev_potential_marked = FALSE;
prev_potential_marked = false;
}
else {
ok_dict_word = safe_dict_word(word);
garbage_level = garbage_word (word, ok_dict_word);
garbage_level = garbage_word(word, ok_dict_word);
if ((garbage_level != G_NEVER_CRUNCH) &&
(terrible_word_crunch (word, garbage_level))) {
@ -463,9 +463,9 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
copy_it.word ()->unlv_crunch_mode = CR_KEEP_SPACE;
copy_it.forward ();
}
prev_potential_marked = FALSE;
prev_potential_marked = false;
}
found_terrible_word = TRUE;
found_terrible_word = true;
}
else if ((garbage_level != G_NEVER_CRUNCH) &&
(potential_word_crunch (word,
@ -479,7 +479,7 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
}
else if (!prev_potential_marked) {
copy_it = page_res_it;
prev_potential_marked = TRUE;
prev_potential_marked = true;
if (crunch_debug > 1) {
tprintf ("P3 CRUNCHING: \"%s\"\n",
word->best_choice->unichar_string().string());
@ -487,9 +487,9 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
}
}
else {
found_terrible_word = FALSE;
found_terrible_word = false;
//Forget earlier potential crunches
prev_potential_marked = FALSE;
prev_potential_marked = false;
if (crunch_debug > 2) {
tprintf ("NO CRUNCH: \"%s\"\n",
word->best_choice->unichar_string().string());
@ -501,8 +501,8 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
}
BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
GARBAGE_LEVEL garbage_level) {
bool Tesseract::terrible_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level) {
float rating_per_ch;
int adjusted_len;
int crunch_mode = 0;
@ -533,20 +533,20 @@ BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
tprintf ("Terrible_word_crunch (%d) on \"%s\"\n",
crunch_mode, word->best_choice->unichar_string().string());
}
return TRUE;
return true;
}
else
return FALSE;
return false;
}
BOOL8 Tesseract::potential_word_crunch(WERD_RES *word,
GARBAGE_LEVEL garbage_level,
BOOL8 ok_dict_word) {
bool Tesseract::potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level,
bool ok_dict_word) {
float rating_per_ch;
int adjusted_len;
const char *str = word->best_choice->unichar_string().string();
const char *lengths = word->best_choice->unichar_lengths().string();
BOOL8 word_crunchable;
bool word_crunchable;
int poor_indicator_count = 0;
word_crunchable = !crunch_leave_accept_strings ||
@ -590,8 +590,8 @@ BOOL8 Tesseract::potential_word_crunch(WERD_RES *word,
void Tesseract::tilde_delete(PAGE_RES_IT &page_res_it) {
WERD_RES *word;
PAGE_RES_IT copy_it;
BOOL8 deleting_from_bol = FALSE;
BOOL8 marked_delete_point = FALSE;
bool deleting_from_bol = false;
bool marked_delete_point = false;
int16_t debug_delete_mode;
CRUNCH_MODE delete_mode;
int16_t x_debug_delete_mode;
@ -610,7 +610,7 @@ void Tesseract::tilde_delete(PAGE_RES_IT &page_res_it) {
word->best_choice->unichar_string().string());
}
word->unlv_crunch_mode = delete_mode;
deleting_from_bol = TRUE;
deleting_from_bol = true;
} else if (word->word->flag(W_EOL)) {
if (marked_delete_point) {
while (copy_it.word() != word) {
@ -631,20 +631,20 @@ void Tesseract::tilde_delete(PAGE_RES_IT &page_res_it) {
word->best_choice->unichar_string().string());
}
word->unlv_crunch_mode = delete_mode;
deleting_from_bol = FALSE;
marked_delete_point = FALSE;
deleting_from_bol = false;
marked_delete_point = false;
}
else {
if (!marked_delete_point) {
copy_it = page_res_it;
marked_delete_point = TRUE;
marked_delete_point = true;
}
}
}
else {
deleting_from_bol = FALSE;
deleting_from_bol = false;
//Forget earlier potential crunches
marked_delete_point = FALSE;
marked_delete_point = false;
}
/*
The following step has been left till now as the tess fails are used to
@ -975,7 +975,7 @@ int16_t Tesseract::failure_count(WERD_RES *word) {
}
BOOL8 Tesseract::noise_outlines(TWERD *word) {
bool Tesseract::noise_outlines(TWERD* word) {
TBOX box; // BB of outline
int16_t outline_count = 0;
int16_t small_outline_count = 0;

View File

@ -55,7 +55,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
WERD_RES *word_res;
WERD_RES_LIST fuzzy_space_words;
int16_t new_length;
BOOL8 prevent_null_wd_fixsp; // DON'T process blobless wds
bool prevent_null_wd_fixsp; // DON'T process blobless wds
int32_t word_index; // current word
block_res_it.set_to_list(&page_res->block_res_list);
@ -108,13 +108,13 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
if (check_debug_pt(word_res, 60))
debug_fix_space_level.set_value(10);
if (word_res->word->cblob_list()->empty())
prevent_null_wd_fixsp = TRUE;
prevent_null_wd_fixsp = true;
word_res = word_res_it_to.forward();
}
if (check_debug_pt(word_res, 60))
debug_fix_space_level.set_value(10);
if (word_res->word->cblob_list()->empty())
prevent_null_wd_fixsp = TRUE;
prevent_null_wd_fixsp = true;
if (prevent_null_wd_fixsp) {
word_res_it_from = word_res_it_to;
} else {
@ -148,7 +148,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
int16_t best_score;
WERD_RES_LIST current_perm;
int16_t current_score;
BOOL8 improved = FALSE;
bool improved = false;
best_score = eval_word_spacing(best_perm); // default score
dump_words(best_perm, best_score, 1, improved);
@ -164,7 +164,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
best_perm.clear();
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
best_score = current_score;
improved = TRUE;
improved = true;
}
if (current_score < PERFECT_WERDS)
transform_to_next_perm(current_perm);
@ -184,8 +184,8 @@ void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
src_wd = src_it.data();
if (!src_wd->combination) {
new_wd = WERD_RES::deep_copy(src_wd);
new_wd->combination = FALSE;
new_wd->part_of_combo = FALSE;
new_wd->combination = false;
new_wd->part_of_combo = false;
new_it.add_after_then_move(new_wd);
}
}
@ -246,15 +246,15 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
int16_t offset;
WERD_RES *word; // current word
int16_t prev_word_score = 0;
BOOL8 prev_word_done = FALSE;
BOOL8 prev_char_1 = FALSE; // prev ch a "1/I/l"?
BOOL8 prev_char_digit = FALSE; // prev ch 2..9 or 0
BOOL8 current_char_1 = FALSE;
BOOL8 current_word_ok_so_far;
bool prev_word_done = false;
bool prev_char_1 = false; // prev ch a "1/I/l"?
bool prev_char_digit = false; // prev ch 2..9 or 0
bool current_char_1 = false;
bool current_word_ok_so_far;
STRING punct_chars = "!\"`',.:;";
BOOL8 prev_char_punct = FALSE;
BOOL8 current_char_punct = FALSE;
BOOL8 word_done = FALSE;
bool prev_char_punct = false;
bool current_char_punct = false;
bool word_done = false;
do {
word = word_res_it.data();
@ -265,9 +265,9 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
if (prev_word_done)
done_word_count++;
prev_word_score = 0;
prev_char_1 = FALSE;
prev_char_digit = FALSE;
prev_word_done = FALSE;
prev_char_1 = false;
prev_char_digit = false;
prev_word_done = false;
} else {
/*
Can we add the prev word score and potentially count this word?
@ -275,7 +275,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
AND it didn't end in a digit when the first char of this word is a 1
*/
word_len = word->reject_map.length();
current_word_ok_so_far = FALSE;
current_word_ok_so_far = false;
if (!((prev_char_1 && digit_or_numeric_punct(word, 0)) ||
(prev_char_digit && (
(word_done &&
@ -290,16 +290,16 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
}
if (current_word_ok_so_far) {
prev_word_done = TRUE;
prev_word_done = true;
prev_word_score = word_len;
} else {
prev_word_done = FALSE;
prev_word_done = false;
prev_word_score = 0;
}
/* Add 1 to total score for every joined 1 regardless of context and
rejtn */
for (i = 0, prev_char_1 = FALSE; i < word_len; i++) {
for (i = 0, prev_char_1 = false; i < word_len; i++) {
current_char_1 = word->best_choice->unichar_string()[i] == '1';
if (prev_char_1 || (current_char_1 && (i > 0)))
total_score++;
@ -309,7 +309,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
/* Add 1 to total score for every joined punctuation regardless of context
and rejtn */
if (tessedit_prefer_joined_punct) {
for (i = 0, offset = 0, prev_char_punct = FALSE; i < word_len;
for (i = 0, offset = 0, prev_char_punct = false; i < word_len;
offset += word->best_choice->unichar_lengths()[i++]) {
current_char_punct =
punct_chars.contains(word->best_choice->unichar_string()[offset]);
@ -340,7 +340,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
return total_score;
}
BOOL8 Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
bool Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
int i;
int offset;
@ -417,7 +417,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
combo = new WERD_RES(copy_word);
combo->combination = TRUE;
combo->x_height = prev_word->x_height;
prev_word->part_of_combo = TRUE;
prev_word->part_of_combo = true;
prev_word_it.add_before_then_move(combo);
}
combo->word->set_flag(W_EOL, word->word->flag(W_EOL));
@ -429,7 +429,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
} else {
// Copy current wd to combo
combo->copy_on(word);
word->part_of_combo = TRUE;
word->part_of_combo = true;
}
combo->done = FALSE;
combo->ClearResults();
@ -447,7 +447,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
namespace tesseract {
void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
int16_t mode, BOOL8 improved) {
int16_t mode, bool improved) {
WERD_RES_IT word_res_it(&perm);
if (debug_fix_space_level > 0) {
@ -500,9 +500,9 @@ void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
}
}
BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
bool Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
if (word->done)
return TRUE;
return true;
/*
Use all the standard pass 2 conditions for mode 5 in set_done() in
@ -518,9 +518,9 @@ BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
(word->best_choice->permuter() == FREQ_DAWG_PERM) ||
(word->best_choice->permuter() == USER_DAWG_PERM) ||
(word->best_choice->permuter() == NUMBER_PERM))) {
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}
@ -574,7 +574,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
WERD_RES_IT current_perm_it(&current_perm);
WERD_RES *old_word_res;
int16_t current_score;
BOOL8 improved = FALSE;
bool improved = false;
best_score = fp_eval_word_spacing(best_perm); // default score
@ -583,9 +583,9 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
old_word_res = best_perm_it.data();
// Even deep_copy doesn't copy the underlying WERD unless its combination
// flag is true!.
old_word_res->combination = TRUE; // Kludge to force deep copy
old_word_res->combination = true; // Kludge to force deep copy
current_perm_it.add_to_end(WERD_RES::deep_copy(old_word_res));
old_word_res->combination = FALSE; // Undo kludge
old_word_res->combination = false; // Undo kludge
break_noisiest_blob_word(current_perm);
@ -597,7 +597,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
best_perm.clear();
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
best_score = current_score;
improved = TRUE;
improved = true;
}
if (current_score < PERFECT_WERDS) {
break_noisiest_blob_word(current_perm);
@ -671,7 +671,7 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
}
WERD_RES* new_word_res = new WERD_RES(new_word);
new_word_res->combination = TRUE;
new_word_res->combination = true;
worst_word_it.add_before_then_move(new_word_res);
word_res->ClearResults();
@ -794,7 +794,7 @@ float Tesseract::blob_noise_score(TBLOB *blob) {
void fixspace_dbg(WERD_RES *word) {
TBOX box = word->word->bounding_box();
BOOL8 show_map_detail = FALSE;
bool show_map_detail = false;
int16_t i;
box.print();

View File

@ -37,9 +37,6 @@ LTRResultIterator::LTRResultIterator(PAGE_RES* page_res, Tesseract* tesseract,
paragraph_separator_("\n") {
}
LTRResultIterator::~LTRResultIterator() {
}
// Returns the null terminated UTF-8 encoded text string for the current
// object at the given level. Use delete [] to free after use.
char* LTRResultIterator::GetUTF8Text(PageIteratorLevel level) const {

View File

@ -62,7 +62,8 @@ class TESS_API LTRResultIterator : public PageIterator {
int scale, int scaled_yres,
int rect_left, int rect_top,
int rect_width, int rect_height);
virtual ~LTRResultIterator();
virtual ~LTRResultIterator() = default;
// LTRResultIterators may be copied! This makes it possible to iterate over
// all the objects at a lower level, while maintaining an iterator to

View File

@ -51,7 +51,7 @@ class MutableIterator : public ResultIterator {
: ResultIterator(
LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
rect_top, rect_width, rect_height)) {}
virtual ~MutableIterator() {}
virtual ~MutableIterator() = default;
// See PageIterator and ResultIterator for most calls.

View File

@ -65,7 +65,7 @@ void Tesseract::output_pass( //Tess output pass //send to api
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box) {
BLOCK_RES *block_of_last_word;
BOOL8 force_eol; //During output
bool force_eol; //During output
BLOCK *nextblock; //block of next word
WERD *nextword; //next word
@ -123,13 +123,13 @@ void Tesseract::output_pass( //Tess output pass //send to api
* inset list - a list of bounding boxes of reject insets - indexed by the
* reject strings in the epchoice text.
*************************************************************************/
void Tesseract::write_results(PAGE_RES_IT &page_res_it,
void Tesseract::write_results(PAGE_RES_IT& page_res_it,
char newline_type, // type of newline
BOOL8 force_eol) { // override tilde crunch?
bool force_eol) { // override tilde crunch?
WERD_RES *word = page_res_it.word();
const UNICHARSET &uchset = *word->uch_set;
int i;
BOOL8 need_reject = FALSE;
bool need_reject = false;
UNICHAR_ID space = uchset.unichar_to_id(" ");
if ((word->unlv_crunch_mode != CR_NONE ||
@ -147,7 +147,7 @@ void Tesseract::write_results(PAGE_RES_IT &page_res_it,
!word->word->flag (W_FUZZY_SP)) {
stats_.last_char_was_tilde = false;
}
need_reject = TRUE;
need_reject = true;
}
if ((need_reject && !stats_.last_char_was_tilde) ||
(force_eol && stats_.write_results_empty_block)) {
@ -412,9 +412,9 @@ int16_t Tesseract::count_alphanums(const WERD_CHOICE &word) {
}
BOOL8 Tesseract::acceptable_number_string(const char *s,
const char *lengths) {
BOOL8 prev_digit = FALSE;
bool Tesseract::acceptable_number_string(const char* s,
const char* lengths) {
bool prev_digit = false;
if (*lengths == 1 && *s == '(')
s++;
@ -425,21 +425,21 @@ BOOL8 Tesseract::acceptable_number_string(const char *s,
for (; *s != '\0'; s += *(lengths++)) {
if (unicharset.get_isdigit(s, *lengths))
prev_digit = TRUE;
prev_digit = true;
else if (prev_digit &&
(*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-'))))
prev_digit = FALSE;
prev_digit = false;
else if (prev_digit && *lengths == 1 &&
(*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')')))
return TRUE;
return true;
else if (prev_digit &&
*lengths == 1 && (*s == '%') &&
(*(lengths + 1) == 1 && *(s + *lengths) == ')') &&
(*(s + *lengths + *(lengths + 1)) == '\0'))
return TRUE;
return true;
else
return FALSE;
return false;
}
return TRUE;
return true;
}
} // namespace tesseract

View File

@ -28,9 +28,9 @@ namespace tesseract {
* to each word that overlaps the selection_box.
*/
void Tesseract::process_selected_words(
PAGE_RES* page_res, // blocks to check
TBOX & selection_box,
BOOL8(tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it)) {
PAGE_RES* page_res, // blocks to check
TBOX& selection_box,
bool (tesseract::Tesseract::* word_processor)(PAGE_RES_IT* pr_it)) {
for (PAGE_RES_IT page_res_it(page_res); page_res_it.word() != nullptr;
page_res_it.forward()) {
WERD* word = page_res_it.word()->word;

View File

@ -155,7 +155,7 @@ STRING ParamContent::GetValue() const {
void ParamContent::SetValue(const char* val) {
// TODO (wanke) Test if the values actually are properly converted.
// (Quickly visible impacts?)
changed_ = TRUE;
changed_ = true;
if (param_type_ == VT_INTEGER) {
iIt->set_value(atoi(val));
} else if (param_type_ == VT_BOOLEAN) {

View File

@ -52,8 +52,7 @@ class ParamContent : public ELIST_LINK {
static ParamContent* GetParamContentById(int id);
// Constructors for the various ParamTypes.
ParamContent() {
}
ParamContent() = default;
explicit ParamContent(tesseract::StringParam* it);
explicit ParamContent(tesseract::IntParam* it);
explicit ParamContent(tesseract::BoolParam* it);

View File

@ -302,7 +302,7 @@ SVMenuNode *Tesseract::build_menu_new() {
* Redisplay page
*/
void Tesseract::do_re_display(
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it)) {
bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it)) {
int block_count = 1;
image_win->Clear();
@ -390,12 +390,12 @@ void pgeditor_show_point( // display coords
*/
namespace tesseract {
BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char *new_value // any prompt data
) {
bool Tesseract::process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char* new_value // any prompt data
) {
char msg[160];
BOOL8 exit = FALSE;
bool exit = false;
color_mode = CM_RAINBOW;
@ -535,7 +535,7 @@ BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
do_re_display(&tesseract::Tesseract::word_display);
break;
case QUIT_CMD_EVENT:
exit = TRUE;
exit = true;
ScrollView::Exit();
break;
@ -710,7 +710,7 @@ void show_point(PAGE_RES* page_res, float x, float y) {
#endif // GRAPHICS_DISABLED
namespace tesseract {
#ifndef GRAPHICS_DISABLED
BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_blank_and_set_display(PAGE_RES_IT* pr_it) {
pr_it->word()->word->bounding_box().plot(image_win, ScrollView::BLACK,
ScrollView::BLACK);
return word_set_display(pr_it);
@ -722,7 +722,7 @@ BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
*
* Normalize word and display in word window
*/
BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word();
if (word_res->chopped_word == nullptr) {
// Setup word normalization parameters.
@ -744,7 +744,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
color = WERD::NextColor(color);
}
bln_word_window_handle()->Update();
return TRUE;
return true;
}
@ -754,12 +754,12 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
*
* Display a word according to its display modes
*/
BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word();
WERD* word = word_res->word;
TBOX word_bb; // word bounding box
int word_height; // ht of word BB
BOOL8 displayed_something = FALSE;
bool displayed_something = false;
float shift; // from bot left
C_BLOB_IT c_it; // cblob iterator
@ -833,13 +833,13 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
c_it.set_to_list(word->cblob_list());
for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
c_it.data()->bounding_box().plot(image_win);
displayed_something = TRUE;
displayed_something = true;
}
// display edge steps
if (word->display_flag(DF_EDGE_STEP)) { // edgesteps available
word->plot(image_win); // rainbow colors
displayed_something = TRUE;
displayed_something = true;
}
// display poly approx
@ -848,7 +848,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
TWERD* tword = TWERD::PolygonalCopy(poly_allow_detailed_fx, word);
tword->plot(image_win);
delete tword;
displayed_something = TRUE;
displayed_something = true;
}
// Display correct text and blamer information.
@ -898,7 +898,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
blame.string());
}
displayed_something = TRUE;
displayed_something = true;
}
if (!displayed_something) // display BBox anyway
@ -906,7 +906,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
(ScrollView::Color)((int32_t) editor_image_word_bb_color),
(ScrollView::Color)((int32_t)
editor_image_word_bb_color));
return TRUE;
return true;
}
#endif // GRAPHICS_DISABLED
@ -915,10 +915,10 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
*
* Dump members to the debug window
*/
BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
bool Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
if (pr_it->block()->block != nullptr) {
tprintf("\nBlock data...\n");
pr_it->block()->block->print(nullptr, FALSE);
pr_it->block()->block->print(nullptr, false);
}
tprintf("\nRow data...\n");
pr_it->row()->row->print(nullptr);
@ -930,7 +930,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
tprintf("Current blamer debug: %s\n",
word_res->blamer_bundle->debug().string());
}
return TRUE;
return true;
}
#ifndef GRAPHICS_DISABLED
@ -939,7 +939,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
*
* Display word according to current display mode settings
*/
BOOL8 Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
bool Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
WERD* word = pr_it->word()->word;
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));

View File

@ -57,7 +57,7 @@ void Tesseract::set_done(WERD_RES *word, int16_t pass) {
word->best_choice->permuter() == FREQ_DAWG_PERM ||
word->best_choice->permuter() == USER_DAWG_PERM;
if (word->done && (pass == 1) && (!word_from_dict || word_is_ambig) &&
one_ell_conflict(word, FALSE)) {
one_ell_conflict(word, false)) {
if (tessedit_rejection_debug) tprintf("one_ell_conflict detected\n");
word->done = FALSE;
}
@ -104,7 +104,7 @@ void Tesseract::make_reject_map(WERD_RES *word, ROW *row, int16_t pass) {
if (kBlnXHeight / word->denorm.y_scale() <= min_sane_x_ht_pixels) {
word->reject_map.rej_word_small_xht();
} else {
one_ell_conflict(word, TRUE);
one_ell_conflict(word, true);
/*
Originally the code here just used the done flag. Now I have duplicated
and unpacked the conditions for setting the done flag so that each
@ -284,7 +284,7 @@ void Tesseract::reject_edge_blobs(WERD_RES *word) {
* Identify words where there is a potential I/l/1 error.
* - A bundle of contextual heuristics!
**********************************************************************/
BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
bool Tesseract::one_ell_conflict(WERD_RES* word_res, bool update_map) {
const char *word;
const char *lengths;
int16_t word_len; //its length
@ -292,30 +292,30 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
int16_t first_alphanum_offset_;
int16_t i;
int16_t offset;
BOOL8 non_conflict_set_char; //non conf set a/n?
BOOL8 conflict = FALSE;
BOOL8 allow_1s;
bool non_conflict_set_char; //non conf set a/n?
bool conflict = false;
bool allow_1s;
ACCEPTABLE_WERD_TYPE word_type;
BOOL8 dict_perm_type;
BOOL8 dict_word_ok;
bool dict_perm_type;
bool dict_word_ok;
int dict_word_type;
word = word_res->best_choice->unichar_string().string ();
lengths = word_res->best_choice->unichar_lengths().string();
word_len = strlen (lengths);
word_len = strlen(lengths);
/*
If there are no occurrences of the conflict set characters then the word
is OK.
*/
if (strpbrk (word, conflict_set_I_l_1.string ()) == nullptr)
return FALSE;
if (strpbrk(word, conflict_set_I_l_1.string ()) == nullptr)
return false;
/*
There is a conflict if there are NO other (confirmed) alphanumerics apart
from those in the conflict set.
*/
for (i = 0, offset = 0, non_conflict_set_char = FALSE;
for (i = 0, offset = 0, non_conflict_set_char = false;
(i < word_len) && !non_conflict_set_char; offset += lengths[i++])
non_conflict_set_char =
(word_res->uch_set->get_isalpha(word + offset, lengths[i]) ||
@ -324,7 +324,7 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
if (!non_conflict_set_char) {
if (update_map)
reject_I_1_L(word_res);
return TRUE;
return true;
}
/*
@ -355,11 +355,11 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
if (update_map)
word_res->reject_map[first_alphanum_index_].
setrej_1Il_conflict();
return TRUE;
return true;
}
else {
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'I';
return FALSE;
return false;
}
}
@ -371,14 +371,14 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
if (update_map)
word_res->reject_map[first_alphanum_index_].
setrej_1Il_conflict();
return TRUE;
return true;
}
else {
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'l';
return FALSE;
return false;
}
}
return FALSE;
return false;
}
/*
@ -398,7 +398,7 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
word[first_alphanum_offset_] == 'l') {
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'I';
if (safe_dict_word(word_res) > 0)
return FALSE;
return false;
else
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'l';
}
@ -406,7 +406,7 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
word[first_alphanum_offset_] == 'I') {
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'l';
if (safe_dict_word(word_res) > 0)
return FALSE;
return false;
else
word_res->best_choice->unichar_string()[first_alphanum_offset_] = 'I';
}
@ -421,14 +421,14 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
(word_res->best_choice->permuter () == NUMBER_PERM);
int16_t offset;
conflict = FALSE;
conflict = false;
for (i = 0, offset = 0; word[offset] != '\0';
offset += word_res->best_choice->unichar_lengths()[i++]) {
if ((!allow_1s || (word[offset] != '1')) &&
STRING (conflict_set_I_l_1).contains (word[offset])) {
if (update_map)
word_res->reject_map[i].setrej_1Il_conflict ();
conflict = TRUE;
conflict = true;
}
}
return conflict;
@ -445,18 +445,18 @@ BOOL8 Tesseract::one_ell_conflict(WERD_RES *word_res, BOOL8 update_map) {
if (update_map)
word_res->reject_map[first_alphanum_index_].
setrej_1Il_conflict ();
return TRUE;
return true;
}
else
return FALSE;
return false;
}
else if (word_type == AC_UPPER_CASE) {
return FALSE;
return false;
}
else {
if (update_map)
reject_I_1_L(word_res);
return TRUE;
return true;
}
}
@ -501,17 +501,17 @@ int16_t Tesseract::alpha_count(const char *word,
}
BOOL8 Tesseract::word_contains_non_1_digit(const char *word,
const char *word_lengths) {
bool Tesseract::word_contains_non_1_digit(const char* word,
const char* word_lengths) {
int16_t i;
int16_t offset;
for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) {
if (unicharset.get_isdigit (word + offset, word_lengths[i]) &&
(word_lengths[i] != 1 || word[offset] != '1'))
return TRUE;
return true;
}
return FALSE;
return false;
}
/*************************************************************************
@ -524,13 +524,13 @@ void Tesseract::dont_allow_1Il(WERD_RES *word) {
int word_len = word->reject_map.length();
const char *s = word->best_choice->unichar_string().string();
const char *lengths = word->best_choice->unichar_lengths().string();
BOOL8 accepted_1Il = FALSE;
bool accepted_1Il = false;
for (i = 0, offset = 0; i < word_len;
offset += word->best_choice->unichar_lengths()[i++]) {
if (word->reject_map[i].accepted()) {
if (STRING(conflict_set_I_l_1).contains(s[offset])) {
accepted_1Il = TRUE;
accepted_1Il = true;
} else {
if (word->uch_set->get_isalpha(s + offset, lengths[i]) ||
word->uch_set->get_isdigit(s + offset, lengths[i]))
@ -574,29 +574,29 @@ void Tesseract::reject_mostly_rejects(WERD_RES *word) {
}
BOOL8 Tesseract::repeated_nonalphanum_wd(WERD_RES *word, ROW *row) {
bool Tesseract::repeated_nonalphanum_wd(WERD_RES* word, ROW* row) {
int16_t char_quality;
int16_t accepted_char_quality;
if (word->best_choice->unichar_lengths().length() <= 1)
return FALSE;
return false;
if (!STRING(ok_repeated_ch_non_alphanum_wds).
contains(word->best_choice->unichar_string()[0]))
return FALSE;
return false;
UNICHAR_ID uch_id = word->best_choice->unichar_id(0);
for (int i = 1; i < word->best_choice->length(); ++i) {
if (word->best_choice->unichar_id(i) != uch_id) return FALSE;
if (word->best_choice->unichar_id(i) != uch_id) return false;
}
word_char_quality(word, row, &char_quality, &accepted_char_quality);
if ((word->best_choice->unichar_lengths().length () == char_quality) &&
(char_quality == accepted_char_quality))
return TRUE;
return true;
else
return FALSE;
return false;
}
int16_t Tesseract::safe_dict_word(const WERD_RES *werd_res) {
@ -777,11 +777,11 @@ void Tesseract::flip_0O(WERD_RES *word_res) {
}
}
BOOL8 Tesseract::non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id) {
bool Tesseract::non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id) {
return ch_set.get_isupper(unichar_id) && !ch_set.eq(unichar_id, "O");
}
BOOL8 Tesseract::non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id) {
bool Tesseract::non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id) {
return ch_set.get_isdigit(unichar_id) && !ch_set.eq(unichar_id, "0");
}
} // namespace tesseract

View File

@ -26,9 +26,9 @@
void reject_blanks(WERD_RES *word);
void reject_poor_matches(WERD_RES *word);
float compute_reject_threshold(WERD_CHOICE* word);
BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths);
bool word_contains_non_1_digit(const char* word, const char* word_lengths);
void dont_allow_1Il(WERD_RES *word);
void flip_hyphens(WERD_RES *word);
void flip_0O(WERD_RES *word);
BOOL8 non_0_digit(const char* str, int length);
bool non_0_digit(const char* str, int length);
#endif

View File

@ -43,7 +43,7 @@ class TESS_API ResultIterator : public LTRResultIterator {
* ResultIterator is copy constructible!
* The default copy constructor works just fine for us.
*/
virtual ~ResultIterator() {}
virtual ~ResultIterator() = default;
// ============= Moving around within the page ============.
/**

View File

@ -453,13 +453,13 @@ class Tesseract : public Wordrec {
bool TestNewNormalization(int original_misfits, float baseline_shift,
float new_x_ht, WERD_RES *word, BLOCK* block,
ROW *row);
BOOL8 recog_interactive(PAGE_RES_IT* pr_it);
bool recog_interactive(PAGE_RES_IT* pr_it);
// Set fonts of this word.
void set_word_fonts(WERD_RES *word);
void font_recognition_pass(PAGE_RES* page_res);
void dictionary_correction_pass(PAGE_RES* page_res);
BOOL8 check_debug_pt(WERD_RES *word, int location);
bool check_debug_pt(WERD_RES* word, int location);
//// superscript.cpp ////////////////////////////////////////////////////
bool SubAndSuperscriptFix(WERD_RES *word_res);
@ -491,14 +491,14 @@ class Tesseract : public Wordrec {
//// output.h //////////////////////////////////////////////////////////
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box);
void write_results(PAGE_RES_IT &page_res_it, // full info
void write_results(PAGE_RES_IT& page_res_it, // full info
char newline_type, // type of newline
BOOL8 force_eol // override tilde crunch?
);
bool force_eol // override tilde crunch?
);
void set_unlv_suspects(WERD_RES *word);
UNICHAR_ID get_rep_char(WERD_RES *word); // what char is repeated?
BOOL8 acceptable_number_string(const char *s,
const char *lengths);
bool acceptable_number_string(const char* s,
const char* lengths);
int16_t count_alphanums(const WERD_CHOICE &word);
int16_t count_alphas(const WERD_CHOICE &word);
//// tessedit.h ////////////////////////////////////////////////////////
@ -571,40 +571,40 @@ class Tesseract : public Wordrec {
#endif // GRAPHICS_DISABLED
void process_image_event( // action in image win
const SVEvent &event);
BOOL8 process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char *new_value // any prompt data
);
bool process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char* new_value // any prompt data
);
void debug_word(PAGE_RES* page_res, const TBOX &selection_box);
void do_re_display(
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it));
BOOL8 word_display(PAGE_RES_IT* pr_it);
BOOL8 word_bln_display(PAGE_RES_IT* pr_it);
BOOL8 word_blank_and_set_display(PAGE_RES_IT* pr_its);
BOOL8 word_set_display(PAGE_RES_IT* pr_it);
bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it));
bool word_display(PAGE_RES_IT* pr_it);
bool word_bln_display(PAGE_RES_IT* pr_it);
bool word_blank_and_set_display(PAGE_RES_IT* pr_its);
bool word_set_display(PAGE_RES_IT* pr_it);
// #ifndef GRAPHICS_DISABLED
BOOL8 word_dumper(PAGE_RES_IT* pr_it);
bool word_dumper(PAGE_RES_IT* pr_it);
// #endif // GRAPHICS_DISABLED
void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box);
//// reject.h //////////////////////////////////////////////////////////
// make rej map for word
void make_reject_map(WERD_RES *word, ROW *row, int16_t pass);
BOOL8 one_ell_conflict(WERD_RES *word_res, BOOL8 update_map);
bool one_ell_conflict(WERD_RES* word_res, bool update_map);
int16_t first_alphanum_index(const char *word,
const char *word_lengths);
int16_t first_alphanum_offset(const char *word,
const char *word_lengths);
int16_t alpha_count(const char *word,
const char *word_lengths);
BOOL8 word_contains_non_1_digit(const char *word,
const char *word_lengths);
bool word_contains_non_1_digit(const char* word,
const char* word_lengths);
void dont_allow_1Il(WERD_RES *word);
int16_t count_alphanums( //how many alphanums
WERD_RES *word);
void flip_0O(WERD_RES *word);
BOOL8 non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
BOOL8 non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
BOOL8 repeated_nonalphanum_wd(WERD_RES *word, ROW *row);
bool non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
bool non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
bool repeated_nonalphanum_wd(WERD_RES* word, ROW* row);
void nn_match_word( //Match a word
WERD_RES *word,
ROW *row);
@ -618,9 +618,9 @@ class Tesseract : public Wordrec {
void reject_edge_blobs(WERD_RES *word);
void reject_mostly_rejects(WERD_RES *word);
//// adaptions.h ///////////////////////////////////////////////////////
BOOL8 word_adaptable( //should we adapt?
WERD_RES *word,
uint16_t mode);
bool word_adaptable( //should we adapt?
WERD_RES* word,
uint16_t mode);
//// tfacepp.cpp ///////////////////////////////////////////////////////
void recog_word_recursive(WERD_RES* word);
@ -634,7 +634,7 @@ class Tesseract : public Wordrec {
WERD_RES *word2,
BlamerBundle *orig_bb) const;
//// fixspace.cpp ///////////////////////////////////////////////////////
BOOL8 digit_or_numeric_punct(WERD_RES *word, int char_position);
bool digit_or_numeric_punct(WERD_RES *word, int char_position);
int16_t eval_word_spacing(WERD_RES_LIST &word_res_list);
void match_current_words(WERD_RES_LIST &words, ROW *row, BLOCK* block);
int16_t fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
@ -646,24 +646,24 @@ class Tesseract : public Wordrec {
int32_t word_count, //count of words in doc
PAGE_RES *page_res);
void dump_words(WERD_RES_LIST &perm, int16_t score,
int16_t mode, BOOL8 improved);
BOOL8 fixspace_thinks_word_done(WERD_RES *word);
int16_t mode, bool improved);
bool fixspace_thinks_word_done(WERD_RES *word);
int16_t worst_noise_blob(WERD_RES *word_res, float *worst_noise_score);
float blob_noise_score(TBLOB *blob);
void break_noisiest_blob_word(WERD_RES_LIST &words);
//// docqual.cpp ////////////////////////////////////////////////////////
GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
BOOL8 potential_word_crunch(WERD_RES *word,
GARBAGE_LEVEL garbage_level,
BOOL8 ok_dict_word);
bool potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level,
bool ok_dict_word);
void tilde_crunch(PAGE_RES_IT &page_res_it);
void unrej_good_quality_words( //unreject potential
PAGE_RES_IT &page_res_it);
void doc_and_block_rejection( //reject big chunks
PAGE_RES_IT &page_res_it,
BOOL8 good_quality_doc);
bool good_quality_doc);
void quality_based_rejection(PAGE_RES_IT &page_res_it,
BOOL8 good_quality_doc);
bool good_quality_doc);
void convert_bad_unlv_chs(WERD_RES *word_res);
void tilde_delete(PAGE_RES_IT &page_res_it);
int16_t word_blob_quality(WERD_RES *word, ROW *row);
@ -672,17 +672,17 @@ class Tesseract : public Wordrec {
void unrej_good_chs(WERD_RES *word, ROW *row);
int16_t count_outline_errs(char c, int16_t outline_count);
int16_t word_outline_errs(WERD_RES *word);
BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level);
bool terrible_word_crunch(WERD_RES* word, GARBAGE_LEVEL garbage_level);
CRUNCH_MODE word_deletable(WERD_RES *word, int16_t &delete_mode);
int16_t failure_count(WERD_RES *word);
BOOL8 noise_outlines(TWERD *word);
bool noise_outlines(TWERD* word);
//// pagewalk.cpp ///////////////////////////////////////////////////////
void
process_selected_words (
PAGE_RES* page_res, // blocks to check
//function to call
TBOX & selection_box,
BOOL8 (tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it));
process_selected_words(
PAGE_RES* page_res, // blocks to check
//function to call
TBOX& selection_box,
bool (tesseract::Tesseract::* word_processor)(PAGE_RES_IT* pr_it));
//// tessbox.cpp ///////////////////////////////////////////////////////
void tess_add_doc_word( //test acceptability
WERD_CHOICE *word_choice //after context

View File

@ -820,8 +820,8 @@ void TO_ROW::compute_vertical_projection() { //project whole row
* Zero out all scalar members.
**********************************************************************/
void TO_ROW::clear() {
all_caps = 0;
used_dm_model = 0;
all_caps = false;
used_dm_model = false;
projection_left = 0;
projection_right = 0;
pitch_decision = PITCH_DUNNO;

View File

@ -639,9 +639,9 @@ class TO_ROW: public ELIST2_LINK
}
// true when dead
BOOL8 merged;
BOOL8 all_caps; // had no ascenders
BOOL8 used_dm_model; // in guessing pitch
bool merged;
bool all_caps; // had no ascenders
bool used_dm_model; // in guessing pitch
int16_t projection_left; // start of projection
int16_t projection_right; // start of projection
PITCH_TYPE pitch_decision; // how strong is decision

View File

@ -37,9 +37,6 @@ BoxWord::BoxWord(const BoxWord& src) {
CopyFrom(src);
}
BoxWord::~BoxWord() {
}
BoxWord& BoxWord::operator=(const BoxWord& src) {
CopyFrom(src);
return *this;

View File

@ -40,7 +40,7 @@ class BoxWord {
public:
BoxWord();
explicit BoxWord(const BoxWord& src);
~BoxWord();
~BoxWord() = default;
BoxWord& operator=(const BoxWord& src);

View File

@ -28,9 +28,4 @@ const double CCStruct::kAscenderFraction = 0.25;
const double CCStruct::kXHeightCapRatio = CCStruct::kXHeightFraction /
(CCStruct::kXHeightFraction + CCStruct::kAscenderFraction);
CCStruct::CCStruct() {}
CCStruct::~CCStruct() {
}
}

View File

@ -24,8 +24,8 @@
namespace tesseract {
class CCStruct : public CUtil {
public:
CCStruct();
~CCStruct();
CCStruct() = default;
~CCStruct() = default;
// Globally accessible constants.
// APPROXIMATIONS of the fractions of the character cell taken by

View File

@ -339,12 +339,12 @@ int32_t C_OUTLINE::outer_area() const {
*/
int32_t C_OUTLINE::count_transitions(int32_t threshold) {
BOOL8 first_was_max_x; //what was first
BOOL8 first_was_max_y;
BOOL8 looking_for_max_x; //what is next
BOOL8 looking_for_min_x;
BOOL8 looking_for_max_y; //what is next
BOOL8 looking_for_min_y;
bool first_was_max_x; //what was first
bool first_was_max_y;
bool looking_for_max_x; //what is next
bool looking_for_min_x;
bool looking_for_max_y; //what is next
bool looking_for_min_y;
int stepindex; //current step
int32_t total_steps; //steps to do
//current limits
@ -354,77 +354,77 @@ int32_t C_OUTLINE::count_transitions(int32_t threshold) {
ICOORD pos; //position of point
ICOORD next_step; //step to next pix
pos = start_pos ();
total_steps = pathlength ();
pos = start_pos();
total_steps = pathlength();
total = 0;
max_x = min_x = pos.x ();
max_y = min_y = pos.y ();
looking_for_max_x = TRUE;
looking_for_min_x = TRUE;
looking_for_max_y = TRUE;
looking_for_min_y = TRUE;
first_was_max_x = FALSE;
first_was_max_y = FALSE;
initial_x = pos.x ();
initial_y = pos.y (); //stop uninit warning
max_x = min_x = pos.x();
max_y = min_y = pos.y();
looking_for_max_x = true;
looking_for_min_x = true;
looking_for_max_y = true;
looking_for_min_y = true;
first_was_max_x = false;
first_was_max_y = false;
initial_x = pos.x();
initial_y = pos.y(); //stop uninit warning
for (stepindex = 0; stepindex < total_steps; stepindex++) {
//all intersected
next_step = step (stepindex);
next_step = step(stepindex);
pos += next_step;
if (next_step.x () < 0) {
if (looking_for_max_x && pos.x () < min_x)
min_x = pos.x ();
if (looking_for_min_x && max_x - pos.x () > threshold) {
if (next_step.x() < 0) {
if (looking_for_max_x && pos.x() < min_x)
min_x = pos.x();
if (looking_for_min_x && max_x - pos.x() > threshold) {
if (looking_for_max_x) {
initial_x = max_x;
first_was_max_x = FALSE;
first_was_max_x = false;
}
total++;
looking_for_max_x = TRUE;
looking_for_min_x = FALSE;
min_x = pos.x (); //reset min
looking_for_max_x = true;
looking_for_min_x = false;
min_x = pos.x(); //reset min
}
}
else if (next_step.x () > 0) {
if (looking_for_min_x && pos.x () > max_x)
max_x = pos.x ();
if (looking_for_max_x && pos.x () - min_x > threshold) {
else if (next_step.x() > 0) {
if (looking_for_min_x && pos.x() > max_x)
max_x = pos.x();
if (looking_for_max_x && pos.x() - min_x > threshold) {
if (looking_for_min_x) {
initial_x = min_x; //remember first min
first_was_max_x = TRUE;
first_was_max_x = true;
}
total++;
looking_for_max_x = FALSE;
looking_for_min_x = TRUE;
max_x = pos.x ();
looking_for_max_x = false;
looking_for_min_x = true;
max_x = pos.x();
}
}
else if (next_step.y () < 0) {
if (looking_for_max_y && pos.y () < min_y)
min_y = pos.y ();
if (looking_for_min_y && max_y - pos.y () > threshold) {
else if (next_step.y() < 0) {
if (looking_for_max_y && pos.y() < min_y)
min_y = pos.y();
if (looking_for_min_y && max_y - pos.y() > threshold) {
if (looking_for_max_y) {
initial_y = max_y; //remember first max
first_was_max_y = FALSE;
first_was_max_y = false;
}
total++;
looking_for_max_y = TRUE;
looking_for_min_y = FALSE;
min_y = pos.y (); //reset min
looking_for_max_y = true;
looking_for_min_y = false;
min_y = pos.y(); //reset min
}
}
else {
if (looking_for_min_y && pos.y () > max_y)
max_y = pos.y ();
if (looking_for_max_y && pos.y () - min_y > threshold) {
if (looking_for_min_y && pos.y() > max_y)
max_y = pos.y();
if (looking_for_max_y && pos.y() - min_y > threshold) {
if (looking_for_min_y) {
initial_y = min_y; //remember first min
first_was_max_y = TRUE;
first_was_max_y = true;
}
total++;
looking_for_max_y = FALSE;
looking_for_min_y = TRUE;
max_y = pos.y ();
looking_for_max_y = false;
looking_for_min_y = true;
max_y = pos.y();
}
}
@ -464,14 +464,14 @@ int32_t C_OUTLINE::count_transitions(int32_t threshold) {
* @param other other outline
*/
BOOL8
bool
C_OUTLINE::operator<(const C_OUTLINE& other) const {
int16_t count = 0; //winding count
ICOORD pos; //position of point
int32_t stepindex; //index to cstep
if (!box.overlap (other.box))
return FALSE; //can't be contained
return false; //can't be contained
if (stepcount == 0)
return other.box.contains(this->box);

View File

@ -93,14 +93,14 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
delete [] offsets;
}
BOOL8 flag( //test flag
bool flag( //test flag
C_OUTLINE_FLAGS mask) const { //flag to test
return flags.bit (mask);
return flags.bit(mask);
}
void set_flag( //set flag value
C_OUTLINE_FLAGS mask, //flag to test
BOOL8 value) { //value to set
flags.set_bit (mask, value);
C_OUTLINE_FLAGS mask, //flag to test
bool value) { //value to set
flags.set_bit(mask, value);
}
C_OUTLINE_LIST *child() { //get child list
@ -200,9 +200,9 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
int32_t count_transitions( //count maxima
int32_t threshold); //size threshold
BOOL8 operator< ( //containment test
bool operator< ( //containment test
const C_OUTLINE & other) const;
BOOL8 operator> ( //containment test
bool operator> ( //containment test
C_OUTLINE & other) const
{
return other < *this; //use the < to do it

View File

@ -25,7 +25,7 @@
class CRACKEDGE {
public:
CRACKEDGE() {}
CRACKEDGE() = default;
ICOORD pos; /*position of crack */
int8_t stepx; //edge step

View File

@ -41,9 +41,6 @@ const int kMaxRealDistance = 2.0;
DetLineFit::DetLineFit() : square_length_(0.0) {
}
DetLineFit::~DetLineFit() {
}
// Delete all Added points.
void DetLineFit::Clear() {
pts_.clear();

View File

@ -56,7 +56,7 @@ namespace tesseract {
class DetLineFit {
public:
DetLineFit();
~DetLineFit();
~DetLineFit() = default;
// Delete all Added points.
void Clear();

View File

@ -61,7 +61,7 @@ struct FontSpacingInfo {
*/
struct FontInfo {
FontInfo() : name(nullptr), properties(0), universal_id(0), spacing_vec(nullptr) {}
~FontInfo() {}
~FontInfo() = default;
// Writes to the given file. Returns false in case of error.
bool Serialize(FILE* fp) const;

View File

@ -29,8 +29,7 @@
class DLLSYM DIR128
{
public:
DIR128() {
} //empty constructor
DIR128() = default;
DIR128( //constructor
int16_t value) { //value to assign

View File

@ -195,9 +195,9 @@ void BLOCK::compress( // squash it up
*/
void BLOCK::print( //print list of sides
FILE *, //< file to print on
BOOL8 dump //< print full detail
) {
FILE*, //< file to print on
bool dump //< print full detail
) {
ICOORDELT_IT it = &pdblk.leftside; //iterator
pdblk.box.print ();

View File

@ -48,8 +48,7 @@ class BLOCK:public ELIST_LINK
int16_t xmax, //< top right
int16_t ymax);
~BLOCK () {
}
~BLOCK () = default;
/**
* set space size etc.
@ -187,7 +186,7 @@ class BLOCK:public ELIST_LINK
void compress(const ICOORD vec);
/// dump whole table
void print(FILE *fp, BOOL8 dump);
void print(FILE* fp, bool dump);
BLOCK& operator=(const BLOCK & source);
PDBLK pdblk; //< Page Description Block

View File

@ -33,8 +33,7 @@ class ROW:public ELIST_LINK
{
friend void tweak_row_baseline(ROW *, double, double);
public:
ROW() {
} //empty constructor
ROW() = default;
ROW( //constructor
int32_t spline_size, //no of segments
int32_t *xstarts, //segment boundaries

View File

@ -89,9 +89,9 @@ BLOCK_RES::BLOCK_RES(bool merge_similar_words, BLOCK *the_block) {
rej_count = 0;
font_class = -1; //not assigned
x_height = -1.0;
font_assigned = FALSE;
bold = FALSE;
italic = FALSE;
font_assigned = false;
bold = false;
italic = false;
row_count = 0;
block = the_block;
@ -1084,10 +1084,10 @@ WERD_RES::~WERD_RES () {
}
void WERD_RES::InitNonPointers() {
tess_failed = FALSE;
tess_accepted = FALSE;
tess_would_adapt = FALSE;
done = FALSE;
tess_failed = false;
tess_accepted = false;
tess_would_adapt = false;
done = false;
unlv_crunch_mode = CR_NONE;
small_caps = false;
odd_size = false;
@ -1104,11 +1104,11 @@ void WERD_RES::InitNonPointers() {
caps_height = 0.0;
baseline_shift = 0.0f;
space_certainty = 0.0f;
guessed_x_ht = TRUE;
guessed_caps_ht = TRUE;
combination = FALSE;
part_of_combo = FALSE;
reject_spaces = FALSE;
guessed_x_ht = true;
guessed_caps_ht = true;
combination = false;
part_of_combo = false;
reject_spaces = false;
}
void WERD_RES::InitPointers() {

View File

@ -60,7 +60,7 @@ class PAGE_RES { // page result
int32_t char_count;
int32_t rej_count;
BLOCK_RES_LIST block_res_list;
BOOL8 rejected;
bool rejected;
// Updated every time PAGE_RES_IT iterating on this PAGE_RES moves to
// the next word. This pointer is not owned by PAGE_RES class.
WERD_CHOICE **prev_word_best_choice;
@ -75,7 +75,7 @@ class PAGE_RES { // page result
inline void Init() {
char_count = 0;
rej_count = 0;
rejected = FALSE;
rejected = false;
prev_word_best_choice = nullptr;
blame_reasons.init_to_size(IRR_NUM_REASONS, 0);
}
@ -86,8 +86,7 @@ class PAGE_RES { // page result
BLOCK_LIST *block_list, // real blocks
WERD_CHOICE **prev_word_best_choice_ptr);
~PAGE_RES () { // destructor
}
~PAGE_RES () = default;
};
/*************************************************************************
@ -102,20 +101,18 @@ class BLOCK_RES:public ELIST_LINK {
int16_t font_class; //
int16_t row_count;
float x_height;
BOOL8 font_assigned; // block already
bool font_assigned; // block already
// processed
BOOL8 bold; // all bold
BOOL8 italic; // all italic
bool bold; // all bold
bool italic; // all italic
ROW_RES_LIST row_res_list;
BLOCK_RES() {
} // empty constructor
BLOCK_RES() = default;
BLOCK_RES(bool merge_similar_words, BLOCK *the_block); // real block
~BLOCK_RES () { // destructor
}
~BLOCK_RES () = default;
};
/*************************************************************************
@ -130,13 +127,11 @@ class ROW_RES:public ELIST_LINK {
int32_t whole_word_rej_count; // rejs in total rej wds
WERD_RES_LIST word_res_list;
ROW_RES() {
} // empty constructor
ROW_RES() = default;
ROW_RES(bool merge_similar_words, ROW *the_row); // real row
~ROW_RES() { // destructor
}
~ROW_RES() = default;
};
/*************************************************************************
@ -269,7 +264,7 @@ class WERD_RES : public ELIST_LINK {
// TODO(rays) Add more documentation here.
WERD_CHOICE *ep_choice; // ep text TODO(rays) delete this.
REJMAP reject_map; // best_choice rejects
BOOL8 tess_failed;
bool tess_failed;
/*
If tess_failed is TRUE, one of the following tests failed when Tess
returned:
@ -277,9 +272,9 @@ class WERD_RES : public ELIST_LINK {
- The best_choice string contained ALL blanks;
- The best_choice string was zero length
*/
BOOL8 tess_accepted; // Tess thinks its ok?
BOOL8 tess_would_adapt; // Tess would adapt?
BOOL8 done; // ready for output?
bool tess_accepted; // Tess thinks its ok?
bool tess_would_adapt; // Tess would adapt?
bool done; // ready for output?
bool small_caps; // word appears to be small caps
bool odd_size; // word is bigger than line or leader dots.
int8_t italic;
@ -289,8 +284,8 @@ class WERD_RES : public ELIST_LINK {
const FontInfo* fontinfo2;
int8_t fontinfo_id_count; // number of votes
int8_t fontinfo_id2_count; // number of votes
BOOL8 guessed_x_ht;
BOOL8 guessed_caps_ht;
bool guessed_x_ht;
bool guessed_caps_ht;
CRUNCH_MODE unlv_crunch_mode;
float x_height; // post match estimate
float caps_height; // post match estimate
@ -315,9 +310,9 @@ class WERD_RES : public ELIST_LINK {
Combination words are FOLLOWED by the sequence of part_of_combo words
which they combine.
*/
BOOL8 combination; //of two fuzzy gap wds
BOOL8 part_of_combo; //part of a combo
BOOL8 reject_spaces; //Reject spacing?
bool combination; //of two fuzzy gap wds
bool part_of_combo; //part of a combo
bool reject_spaces; //Reject spacing?
WERD_RES() {
InitNonPointers();
@ -660,8 +655,7 @@ class PAGE_RES_IT {
public:
PAGE_RES * page_res; // page being iterated
PAGE_RES_IT() {
} // empty contructor
PAGE_RES_IT() = default;
PAGE_RES_IT(PAGE_RES *the_page_res) { // page result
page_res = the_page_res;

View File

@ -126,7 +126,7 @@ using ParamsTrainingHypothesisList = GenericVector<ParamsTrainingHypothesis>;
// explored on PASS1, PASS2, fix xheight pass, etc).
class ParamsTrainingBundle {
public:
ParamsTrainingBundle() {}
ParamsTrainingBundle() = default;
// Starts a new hypothesis list.
// Should be called at the beginning of a new run of the segmentation search.
void StartHypothesisList() {

View File

@ -70,12 +70,12 @@ void PDBLK::set_sides( //set vertex lists
ICOORDELT_IT left_it = &leftside;
ICOORDELT_IT right_it = &rightside;
leftside.clear ();
left_it.move_to_first ();
left_it.add_list_before (left);
rightside.clear ();
right_it.move_to_first ();
right_it.add_list_before (right);
leftside.clear();
left_it.move_to_first();
left_it.add_list_before(left);
rightside.clear();
right_it.move_to_first();
right_it.add_list_before(right);
}
/**********************************************************************
@ -84,21 +84,21 @@ void PDBLK::set_sides( //set vertex lists
* Return TRUE if the given point is within the block.
**********************************************************************/
BOOL8 PDBLK::contains( //test containment
ICOORD pt //point to test
) {
bool PDBLK::contains( //test containment
ICOORD pt //point to test
) {
BLOCK_RECT_IT it = this; //rectangle iterator
ICOORD bleft, tright; //corners of rectangle
for (it.start_block (); !it.cycled_rects (); it.forward ()) {
for (it.start_block(); !it.cycled_rects(); it.forward()) {
//get rectangle
it.bounding_box (bleft, tright);
//inside rect
if (pt.x () >= bleft.x () && pt.x () <= tright.x ()
&& pt.y () >= bleft.y () && pt.y () <= tright.y ())
return TRUE; //is inside
if (pt.x() >= bleft.x() && pt.x() <= tright.x()
&& pt.y() >= bleft.y() && pt.y() <= tright.y())
return true; //is inside
}
return FALSE; //not inside
return false; //not inside
}

View File

@ -69,7 +69,7 @@ class PDBLK {
void set_index(int value) { index_ = value; }
/// is pt inside block
BOOL8 contains(ICOORD pt);
bool contains(ICOORD pt);
/// reposition block
void move(const ICOORD vec); // by vector
@ -118,8 +118,8 @@ class DLLSYM BLOCK_RECT_IT //rectangle iterator
void forward();
///test end
BOOL8 cycled_rects() {
return left_it.cycled_list () && right_it.cycled_list ();
bool cycled_rects() {
return left_it.cycled_list() && right_it.cycled_list();
}
///current rectangle

View File

@ -45,8 +45,7 @@ class ICOORD
ycoord = yin;
}
///destructor
~ICOORD () {
}
~ICOORD () = default;
///access function
int16_t x() const {
@ -99,11 +98,11 @@ class ICOORD
}
///test equality
BOOL8 operator== (const ICOORD & other) const {
bool operator== (const ICOORD & other) const {
return xcoord == other.xcoord && ycoord == other.ycoord;
}
///test inequality
BOOL8 operator!= (const ICOORD & other) const {
bool operator!= (const ICOORD & other) const {
return xcoord != other.xcoord || ycoord != other.ycoord;
}
///rotate 90 deg anti
@ -163,8 +162,7 @@ class DLLSYM ICOORDELT:public ELIST_LINK, public ICOORD
{
public:
///empty constructor
ICOORDELT() {
}
ICOORDELT() = default;
///constructor from ICOORD
ICOORDELT (ICOORD icoord):ICOORD (icoord) {
}
@ -190,8 +188,7 @@ class DLLSYM FCOORD
{
public:
///empty constructor
FCOORD() {
}
FCOORD() = default;
///constructor
///@param xvalue x value
///@param yvalue y value
@ -273,11 +270,11 @@ class DLLSYM FCOORD
bool normalise();
///test equality
BOOL8 operator== (const FCOORD & other) {
bool operator== (const FCOORD & other) {
return xcoord == other.xcoord && ycoord == other.ycoord;
}
///test inequality
BOOL8 operator!= (const FCOORD & other) {
bool operator!= (const FCOORD & other) {
return xcoord != other.xcoord || ycoord != other.ycoord;
}
///rotate 90 deg anti

View File

@ -27,13 +27,11 @@
class DLLSYM POLY_BLOCK {
public:
POLY_BLOCK() {
}
POLY_BLOCK() = default;
// Initialize from box coordinates.
POLY_BLOCK(const TBOX& box, PolyBlockType type);
POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType type);
~POLY_BLOCK () {
}
~POLY_BLOCK () = default;
TBOX *bounding_box() { // access function
return &box;

View File

@ -25,8 +25,7 @@
class QUAD_COEFFS
{
public:
QUAD_COEFFS() {
} //empty constructor
QUAD_COEFFS() = default;
QUAD_COEFFS( //constructor
double xsq, //coefficients
float x,

View File

@ -277,22 +277,15 @@ void QSPLINE::move( // reposition spline
* than the bounds of this.
**********************************************************************/
BOOL8 QSPLINE::overlap( //test overlap
QSPLINE *spline2, //2 cannot be smaller
double fraction //by more than this
) {
int leftlimit; /*common left limit */
int rightlimit; /*common right limit */
leftlimit = xcoords[1];
rightlimit = xcoords[segments - 1];
bool QSPLINE::overlap( //test overlap
QSPLINE* spline2, //2 cannot be smaller
double fraction //by more than this
) {
int leftlimit = xcoords[1]; /*common left limit */
int rightlimit = xcoords[segments - 1]; /*common right limit */
/*or too non-overlap */
if (spline2->segments < 3 || spline2->xcoords[1] > leftlimit + fraction * (rightlimit - leftlimit)
|| spline2->xcoords[spline2->segments - 1] < rightlimit
- fraction * (rightlimit - leftlimit))
return FALSE;
else
return TRUE;
return !(spline2->segments < 3 || spline2->xcoords[1] > leftlimit + fraction * (rightlimit - leftlimit) ||
spline2->xcoords[spline2->segments - 1] < rightlimit - fraction * (rightlimit - leftlimit));
}

View File

@ -67,9 +67,9 @@ class QSPLINE
void move( // reposition spline
ICOORD vec); // by vector
BOOL8 overlap( //test overlap
QSPLINE *spline2, //2 cannot be smaller
double fraction); //by more than this
bool overlap( //test overlap
QSPLINE* spline2, //2 cannot be smaller
double fraction); //by more than this
void extrapolate( //linear extrapolation
double gradient, //gradient to use
int left, //new left edge

View File

@ -71,7 +71,7 @@ class BLOB_CHOICE: public ELIST_LINK
float yshift, // the larger of y shift (top or bottom)
BlobChoiceClassifier c); // adapted match or other
BLOB_CHOICE(const BLOB_CHOICE &other);
~BLOB_CHOICE() {}
~BLOB_CHOICE() = default;
UNICHAR_ID unichar_id() const {
return unichar_id_;

View File

@ -21,7 +21,7 @@
#include "rejctmap.h"
#include "params.h"
BOOL8 REJ::perm_rejected() { //Is char perm reject?
bool REJ::perm_rejected() { //Is char perm reject?
return (flag (R_TESS_FAILURE) ||
flag (R_SMALL_XHT) ||
flag (R_EDGE_CHAR) ||
@ -32,47 +32,47 @@ BOOL8 REJ::perm_rejected() { //Is char perm reject?
}
BOOL8 REJ::rej_before_nn_accept() {
bool REJ::rej_before_nn_accept() {
return flag (R_POOR_MATCH) ||
flag (R_NOT_TESS_ACCEPTED) ||
flag (R_CONTAINS_BLANKS) || flag (R_BAD_PERMUTER);
}
BOOL8 REJ::rej_between_nn_and_mm() {
bool REJ::rej_between_nn_and_mm() {
return flag (R_HYPHEN) ||
flag (R_DUBIOUS) ||
flag (R_NO_ALPHANUMS) || flag (R_MOSTLY_REJ) || flag (R_XHT_FIXUP);
}
BOOL8 REJ::rej_between_mm_and_quality_accept() {
bool REJ::rej_between_mm_and_quality_accept() {
return flag (R_BAD_QUALITY);
}
BOOL8 REJ::rej_between_quality_and_minimal_rej_accept() {
bool REJ::rej_between_quality_and_minimal_rej_accept() {
return flag (R_DOC_REJ) ||
flag (R_BLOCK_REJ) || flag (R_ROW_REJ) || flag (R_UNLV_REJ);
}
BOOL8 REJ::rej_before_mm_accept() {
bool REJ::rej_before_mm_accept() {
return rej_between_nn_and_mm () ||
(rej_before_nn_accept () &&
!flag (R_NN_ACCEPT) && !flag (R_HYPHEN_ACCEPT));
}
BOOL8 REJ::rej_before_quality_accept() {
bool REJ::rej_before_quality_accept() {
return rej_between_mm_and_quality_accept () ||
(!flag (R_MM_ACCEPT) && rej_before_mm_accept ());
}
BOOL8 REJ::rejected() { //Is char rejected?
bool REJ::rejected() { //Is char rejected?
if (flag (R_MINIMAL_REJ_ACCEPT))
return FALSE;
return false;
else
return (perm_rejected () ||
rej_between_quality_and_minimal_rej_accept () ||
@ -80,7 +80,7 @@ BOOL8 REJ::rejected() { //Is char rejected?
}
BOOL8 REJ::accept_if_good_quality() { //potential rej?
bool REJ::accept_if_good_quality() { //potential rej?
return (rejected () &&
!perm_rejected () &&
flag (R_BAD_PERMUTER) &&
@ -290,25 +290,21 @@ int16_t REJMAP::accept_count() { //How many accepted?
}
BOOL8 REJMAP::recoverable_rejects() { //Any non perm rejs?
int i;
for (i = 0; i < len; i++) {
bool REJMAP::recoverable_rejects() { //Any non perm rejs?
for (int i = 0; i < len; i++) {
if (ptr[i].recoverable ())
return TRUE;
return true;
}
return FALSE;
return false;
}
BOOL8 REJMAP::quality_recoverable_rejects() { //Any potential rejs?
int i;
for (i = 0; i < len; i++) {
bool REJMAP::quality_recoverable_rejects() { //Any potential rejs?
for (int i = 0; i < len; i++) {
if (ptr[i].accept_if_good_quality ())
return TRUE;
return true;
}
return FALSE;
return false;
}

View File

@ -108,16 +108,15 @@ class REJ
flags2.turn_on_bit (rej_flag - 16);
}
BOOL8 rej_before_nn_accept();
BOOL8 rej_between_nn_and_mm();
BOOL8 rej_between_mm_and_quality_accept();
BOOL8 rej_between_quality_and_minimal_rej_accept();
BOOL8 rej_before_mm_accept();
BOOL8 rej_before_quality_accept();
bool rej_before_nn_accept();
bool rej_between_nn_and_mm();
bool rej_between_mm_and_quality_accept();
bool rej_between_quality_and_minimal_rej_accept();
bool rej_before_mm_accept();
bool rej_before_quality_accept();
public:
REJ() { //constructor
}
REJ() = default;
REJ( //classwise copy
const REJ &source) {
@ -132,7 +131,7 @@ class REJ
return *this;
}
BOOL8 flag(REJ_FLAGS rej_flag) {
bool flag(REJ_FLAGS rej_flag) {
if (rej_flag < 16)
return flags1.bit (rej_flag);
else
@ -150,18 +149,18 @@ class REJ
return MAP_ACCEPT;
}
BOOL8 perm_rejected(); //Is char perm reject?
bool perm_rejected(); //Is char perm reject?
BOOL8 rejected(); //Is char rejected?
bool rejected(); //Is char rejected?
BOOL8 accepted() { //Is char accepted?
bool accepted() { //Is char accepted?
return !rejected ();
}
//potential rej?
BOOL8 accept_if_good_quality();
bool accept_if_good_quality();
BOOL8 recoverable() {
bool recoverable() {
return (rejected () && !perm_rejected ());
}
@ -240,9 +239,9 @@ class REJMAP
void full_print(FILE *fp);
BOOL8 recoverable_rejects(); //Any non perm rejs?
bool recoverable_rejects(); //Any non perm rejs?
BOOL8 quality_recoverable_rejects();
bool quality_recoverable_rejects();
//Any potential rejs?
void rej_word_small_xht(); //Reject whole word

View File

@ -320,7 +320,7 @@ int32_t STATS::cluster(float lower, // thresholds
float multiple, // distance threshold
int32_t max_clusters, // max no to make
STATS *clusters) { // array of clusters
BOOL8 new_cluster; // added one
bool new_cluster; // added one
float *centres; // cluster centres
int32_t entry; // bucket index
int32_t cluster; // cluster index
@ -369,7 +369,7 @@ int32_t STATS::cluster(float lower, // thresholds
clusters[0].set_range(rangemin_, rangemax_);
}
do {
new_cluster = FALSE;
new_cluster = false;
new_mode = 0;
for (entry = 0; entry < rangemax_ - rangemin_; entry++) {
count = buckets_[entry] - clusters[0].buckets_[entry];
@ -401,7 +401,7 @@ int32_t STATS::cluster(float lower, // thresholds
// need new and room
if (new_mode > 0 && cluster_count < max_clusters) {
cluster_count++;
new_cluster = TRUE;
new_cluster = true;
if (!clusters[cluster_count].set_range(rangemin_, rangemax_)) {
delete [] centres;
return 0;

View File

@ -30,8 +30,7 @@ ELISTIZEH(C_BLOB)
class C_BLOB:public ELIST_LINK
{
public:
C_BLOB() {
}
C_BLOB() = default;
explicit C_BLOB(C_OUTLINE_LIST *outline_list);
// Simpler constructor to build a blob from a single outline that has
// already been fully initialized.

View File

@ -76,8 +76,8 @@ WERD::WERD(C_BLOB_LIST *blob_list, uint8_t blank_count, const char *text)
if (start_it.empty())
return;
for (start_it.mark_cycle_pt(); !start_it.cycled_list(); start_it.forward()) {
BOOL8 reject_blob = FALSE;
BOOL8 blob_inverted;
bool reject_blob = false;
bool blob_inverted;
c_outline_it.set_to_list(start_it.data()->out_list());
blob_inverted = c_outline_it.data()->flag(COUT_INVERSE);

View File

@ -59,7 +59,7 @@ class ROW; //forward decl
class WERD : public ELIST2_LINK {
public:
WERD() {}
WERD() = default;
// WERD constructed with:
// blob_list - blobs of the word (we take this list's contents)
// blanks - number of blanks before the word
@ -75,8 +75,7 @@ class WERD : public ELIST2_LINK {
// W_BOL and W_EOL flags are set according to the given values.
WERD* ConstructFromSingleBlob(bool bol, bool eol, C_BLOB* blob);
~WERD() {
}
~WERD() = default;
// assignment
WERD & operator= (const WERD &source);
@ -125,11 +124,11 @@ class WERD : public ELIST2_LINK {
const char *text() const { return correct.string(); }
void set_text(const char *new_text) { correct = new_text; }
BOOL8 flag(WERD_FLAGS mask) const { return flags.bit(mask); }
void set_flag(WERD_FLAGS mask, BOOL8 value) { flags.set_bit(mask, value); }
bool flag(WERD_FLAGS mask) const { return flags.bit(mask); }
void set_flag(WERD_FLAGS mask, bool value) { flags.set_bit(mask, value); }
BOOL8 display_flag(uint8_t flag) const { return disp_flags.bit(flag); }
void set_display_flag(uint8_t flag, BOOL8 value) {
bool display_flag(uint8_t flag) const { return disp_flags.bit(flag); }
void set_display_flag(uint8_t flag, bool value) {
disp_flags.set_bit(flag, value);
}

View File

@ -114,7 +114,7 @@ class UnicharIdArrayUtils {
class AmbigSpec : public ELIST_LINK {
public:
AmbigSpec();
~AmbigSpec() {}
~AmbigSpec() = default;
// Comparator function for sorting AmbigSpec_LISTs. The lists will
// be sorted by their wrong_ngram arrays. Example of wrong_ngram vectors
@ -142,7 +142,7 @@ using UnicharAmbigsVector = GenericVector<AmbigSpec_LIST *>;
class UnicharAmbigs {
public:
UnicharAmbigs() {}
UnicharAmbigs() = default;
~UnicharAmbigs() {
replace_ambigs_.delete_data_pointers();
dang_ambigs_.delete_data_pointers();

View File

@ -46,15 +46,15 @@ class DLLSYM BITS16
}
void set_bit( // flip specified bit
uint8_t bit_num, // bit to flip 0..7
BOOL8 value) { // value to flip to
uint8_t bit_num, // bit to flip 0..7
bool value) { // value to flip to
if (value)
val = val | 01 << bit_num;
else
val = val & ~(01 << bit_num);
}
BOOL8 bit( // access bit
bool bit( // access bit
uint8_t bit_num) const { // bit to access
return (val >> bit_num) & 01;
}

View File

@ -27,10 +27,6 @@ CCUtil::CCUtil() :
" whether to adapt to a character", &params_) {
}
CCUtil::~CCUtil() {
}
CCUtilMutex::CCUtilMutex() {
#ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0);

View File

@ -51,7 +51,7 @@ class CCUtilMutex {
class CCUtil {
public:
CCUtil();
virtual ~CCUtil();
virtual ~CCUtil() = default;
public:
// Read the arguments and set up the data path.

View File

@ -466,9 +466,9 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
nullptr);
#endif
ex_current_was_last = other_it->ex_current_was_last = FALSE;
ex_current_was_cycle_pt = FALSE;
other_it->ex_current_was_cycle_pt = FALSE;
ex_current_was_last = other_it->ex_current_was_last = false;
ex_current_was_cycle_pt = false;
other_it->ex_current_was_cycle_pt = false;
temp_it.mark_cycle_pt ();
do { //walk sublist
@ -477,14 +477,14 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
if (temp_it.at_last ()) {
list->last = prev;
ex_current_was_last = other_it->ex_current_was_last = TRUE;
ex_current_was_last = other_it->ex_current_was_last = true;
}
if (temp_it.current == cycle_pt)
ex_current_was_cycle_pt = TRUE;
ex_current_was_cycle_pt = true;
if (temp_it.current == other_it->cycle_pt)
other_it->ex_current_was_cycle_pt = TRUE;
other_it->ex_current_was_cycle_pt = true;
temp_it.forward ();
}

View File

@ -150,13 +150,13 @@ class DLLSYM CLIST_ITERATOR
CLIST_LINK *prev; //prev element
CLIST_LINK *current; //current element
CLIST_LINK *next; //next element
BOOL8 ex_current_was_last; //current extracted
bool ex_current_was_last; //current extracted
//was end of list
BOOL8 ex_current_was_cycle_pt; //current extracted
bool ex_current_was_cycle_pt; //current extracted
//was cycle point
CLIST_LINK *cycle_pt; //point we are cycling
//the list to.
BOOL8 started_cycling; //Have we moved off
bool started_cycling; //Have we moved off
//the start?
CLIST_LINK *extract_sublist( //from this current...
@ -214,7 +214,7 @@ class DLLSYM CLIST_ITERATOR
void mark_cycle_pt(); //remember current
BOOL8 empty() { //is list empty?
bool empty() { //is list empty?
#ifndef NDEBUG
if (!list)
NO_LIST.error ("CLIST_ITERATOR::empty", ABORT, nullptr);
@ -222,15 +222,15 @@ class DLLSYM CLIST_ITERATOR
return list->empty ();
}
BOOL8 current_extracted() { //current extracted?
bool current_extracted() { //current extracted?
return !current;
}
BOOL8 at_first(); //Current is first?
bool at_first(); //Current is first?
BOOL8 at_last(); //Current is last?
bool at_last(); //Current is last?
BOOL8 cycled_list(); //Completed a cycle?
bool cycled_list(); //Completed a cycle?
void add_to_end( // add at end &
void *new_data); // don't move
@ -266,9 +266,9 @@ inline void CLIST_ITERATOR::set_to_list( //change list
current = list->First ();
next = current != nullptr ? current->next : nullptr;
cycle_pt = nullptr; //await explicit set
started_cycling = FALSE;
ex_current_was_last = FALSE;
ex_current_was_cycle_pt = FALSE;
started_cycling = false;
ex_current_was_last = false;
ex_current_was_cycle_pt = false;
}
/***********************************************************************
@ -354,7 +354,7 @@ inline void CLIST_ITERATOR::add_after_stay_put( // element to add
new_element->next = new_element;
list->last = new_element;
prev = next = new_element;
ex_current_was_last = FALSE;
ex_current_was_last = false;
current = nullptr;
}
else {
@ -371,7 +371,7 @@ inline void CLIST_ITERATOR::add_after_stay_put( // element to add
prev->next = new_element;
if (ex_current_was_last) {
list->last = new_element;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
}
next = new_element;
@ -448,7 +448,7 @@ inline void CLIST_ITERATOR::add_before_stay_put( // element to add
new_element->next = new_element;
list->last = new_element;
prev = next = new_element;
ex_current_was_last = TRUE;
ex_current_was_last = true;
current = nullptr;
}
else {
@ -489,7 +489,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
list->last = list_to_add->last;
prev = list->last;
next = list->First ();
ex_current_was_last = TRUE;
ex_current_was_last = true;
current = nullptr;
}
else {
@ -504,7 +504,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
prev->next = list_to_add->First ();
if (ex_current_was_last) {
list->last = list_to_add->last;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
list_to_add->last->next = next;
next = prev->next;
@ -537,7 +537,7 @@ inline void CLIST_ITERATOR::add_list_before(CLIST *list_to_add) {
prev = list->last;
current = list->First ();
next = current->next;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
else {
prev->next = list_to_add->First ();
@ -587,13 +587,13 @@ inline void *CLIST_ITERATOR::extract() {
if (current == list->last) {
list->last = prev;
ex_current_was_last = TRUE;
ex_current_was_last = true;
} else {
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
}
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
ex_current_was_cycle_pt = (current == cycle_pt);
extracted_data = current->data;
delete(current); //destroy CONS cell
current = nullptr;
@ -650,7 +650,7 @@ inline void CLIST_ITERATOR::mark_cycle_pt() {
*
**********************************************************************/
inline BOOL8 CLIST_ITERATOR::at_first() {
inline bool CLIST_ITERATOR::at_first() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("CLIST_ITERATOR::at_first", ABORT, nullptr);
@ -669,7 +669,7 @@ inline BOOL8 CLIST_ITERATOR::at_first() {
*
**********************************************************************/
inline BOOL8 CLIST_ITERATOR::at_last() {
inline bool CLIST_ITERATOR::at_last() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("CLIST_ITERATOR::at_last", ABORT, nullptr);
@ -688,7 +688,7 @@ inline BOOL8 CLIST_ITERATOR::at_last() {
*
**********************************************************************/
inline BOOL8 CLIST_ITERATOR::cycled_list() {
inline bool CLIST_ITERATOR::cycled_list() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("CLIST_ITERATOR::cycled_list", ABORT, nullptr);

View File

@ -439,9 +439,9 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
nullptr);
#endif
ex_current_was_last = other_it->ex_current_was_last = FALSE;
ex_current_was_cycle_pt = FALSE;
other_it->ex_current_was_cycle_pt = FALSE;
ex_current_was_last = other_it->ex_current_was_last = false;
ex_current_was_cycle_pt = false;
other_it->ex_current_was_cycle_pt = false;
temp_it.mark_cycle_pt ();
do { //walk sublist
@ -450,14 +450,14 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
if (temp_it.at_last ()) {
list->last = prev;
ex_current_was_last = other_it->ex_current_was_last = TRUE;
ex_current_was_last = other_it->ex_current_was_last = true;
}
if (temp_it.current == cycle_pt)
ex_current_was_cycle_pt = TRUE;
ex_current_was_cycle_pt = true;
if (temp_it.current == other_it->cycle_pt)
other_it->ex_current_was_cycle_pt = TRUE;
other_it->ex_current_was_cycle_pt = true;
temp_it.forward ();
}

View File

@ -156,13 +156,13 @@ class DLLSYM ELIST2_ITERATOR
ELIST2_LINK *prev; //prev element
ELIST2_LINK *current; //current element
ELIST2_LINK *next; //next element
BOOL8 ex_current_was_last; //current extracted
bool ex_current_was_last; //current extracted
//was end of list
BOOL8 ex_current_was_cycle_pt; //current extracted
bool ex_current_was_cycle_pt; //current extracted
//was cycle point
ELIST2_LINK *cycle_pt; //point we are cycling
//the list to.
BOOL8 started_cycling; //Have we moved off
bool started_cycling; //Have we moved off
//the start?
ELIST2_LINK *extract_sublist( //from this current...
@ -219,7 +219,7 @@ class DLLSYM ELIST2_ITERATOR
void mark_cycle_pt(); //remember current
BOOL8 empty() { //is list empty?
bool empty() { //is list empty?
#ifndef NDEBUG
if (!list)
NO_LIST.error ("ELIST2_ITERATOR::empty", ABORT, nullptr);
@ -227,15 +227,15 @@ class DLLSYM ELIST2_ITERATOR
return list->empty ();
}
BOOL8 current_extracted() { //current extracted?
bool current_extracted() { //current extracted?
return !current;
}
BOOL8 at_first(); //Current is first?
bool at_first(); //Current is first?
BOOL8 at_last(); //Current is last?
bool at_last(); //Current is last?
BOOL8 cycled_list(); //Completed a cycle?
bool cycled_list(); //Completed a cycle?
void add_to_end( // add at end &
ELIST2_LINK *new_link); // don't move
@ -274,9 +274,9 @@ inline void ELIST2_ITERATOR::set_to_list( //change list
current = list->First ();
next = current ? current->next : nullptr;
cycle_pt = nullptr; //await explicit set
started_cycling = FALSE;
ex_current_was_last = FALSE;
ex_current_was_cycle_pt = FALSE;
started_cycling = false;
ex_current_was_last = false;
ex_current_was_cycle_pt = false;
}
/***********************************************************************
@ -361,7 +361,7 @@ inline void ELIST2_ITERATOR::add_after_stay_put( // element to add
new_element->prev = new_element;
list->last = new_element;
prev = next = new_element;
ex_current_was_last = FALSE;
ex_current_was_last = false;
current = nullptr;
}
else {
@ -381,7 +381,7 @@ inline void ELIST2_ITERATOR::add_after_stay_put( // element to add
prev->next = new_element;
if (ex_current_was_last) {
list->last = new_element;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
}
next = new_element;
@ -458,7 +458,7 @@ inline void ELIST2_ITERATOR::add_before_stay_put( // element to add
new_element->prev = new_element;
list->last = new_element;
prev = next = new_element;
ex_current_was_last = TRUE;
ex_current_was_last = true;
current = nullptr;
}
else {
@ -503,7 +503,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
list->last = list_to_add->last;
prev = list->last;
next = list->First ();
ex_current_was_last = TRUE;
ex_current_was_last = true;
current = nullptr;
}
else {
@ -521,7 +521,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
prev->next->prev = prev;
if (ex_current_was_last) {
list->last = list_to_add->last;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
list_to_add->last->next = next;
next->prev = list_to_add->last;
@ -555,7 +555,7 @@ inline void ELIST2_ITERATOR::add_list_before(ELIST2 *list_to_add) {
prev = list->last;
current = list->First ();
next = current->next;
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
else {
prev->next = list_to_add->First ();
@ -610,13 +610,13 @@ inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
if (current == list->last) {
list->last = prev;
ex_current_was_last = TRUE;
ex_current_was_last = true;
} else {
ex_current_was_last = FALSE;
ex_current_was_last = false;
}
}
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
ex_current_was_cycle_pt = (current == cycle_pt) ? true : false;
extracted_link = current;
extracted_link->next = nullptr; //for safety
extracted_link->prev = nullptr; //for safety
@ -693,7 +693,7 @@ inline void ELIST2_ITERATOR::mark_cycle_pt() {
*
**********************************************************************/
inline BOOL8 ELIST2_ITERATOR::at_first() {
inline bool ELIST2_ITERATOR::at_first() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("ELIST2_ITERATOR::at_first", ABORT, nullptr);
@ -712,7 +712,7 @@ inline BOOL8 ELIST2_ITERATOR::at_first() {
*
**********************************************************************/
inline BOOL8 ELIST2_ITERATOR::at_last() {
inline bool ELIST2_ITERATOR::at_last() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("ELIST2_ITERATOR::at_last", ABORT, nullptr);
@ -731,7 +731,7 @@ inline BOOL8 ELIST2_ITERATOR::at_last() {
*
**********************************************************************/
inline BOOL8 ELIST2_ITERATOR::cycled_list() {
inline bool ELIST2_ITERATOR::cycled_list() {
#ifndef NDEBUG
if (!list)
NO_LIST.error ("ELIST2_ITERATOR::cycled_list", ABORT, nullptr);

View File

@ -57,7 +57,7 @@ namespace tesseract {
template <typename Pair>
class GenericHeap {
public:
GenericHeap() {}
GenericHeap() = default;
// The initial size is only a GenericVector::reserve. It is not enforced as
// the size limit of the heap. Caller must implement their own enforcement.
explicit GenericHeap(int initial_size) {

View File

@ -41,7 +41,7 @@ class IndexMapBiDi;
// It must be initialized by copying from an IndexMapBiDi or by DeSerialize.
class IndexMap {
public:
virtual ~IndexMap() {}
virtual ~IndexMap() = default;
// SparseToCompact takes a sparse index to an index in the compact space.
// Uses a binary search to find the result. For faster speed use

View File

@ -32,7 +32,7 @@ namespace tesseract {
// of simple or smart-pointer data using a separate key. Similar to STL pair.
template <typename Key, typename Data>
struct KDPair {
KDPair() {}
KDPair() = default;
KDPair(Key k, Data d) : data(d), key(k) {}
int operator==(const KDPair<Key, Data>& other) const {
@ -49,7 +49,7 @@ struct KDPair {
// and recasting of data pointers for use with DoublePtr.
template <typename Key, typename Data>
struct KDPairInc : public KDPair<Key, Data> {
KDPairInc() {}
KDPairInc() = default;
KDPairInc(Key k, Data d) : KDPair<Key, Data>(k, d) {}
// Operator< facilitates sorting in increasing order.
int operator<(const KDPairInc<Key, Data>& other) const {
@ -65,7 +65,7 @@ struct KDPairInc : public KDPair<Key, Data> {
// and recasting of data pointers for use with DoublePtr.
template <typename Key, typename Data>
struct KDPairDec : public KDPair<Key, Data> {
KDPairDec() {}
KDPairDec() = default;
KDPairDec(Key k, Data d) : KDPair<Key, Data>(k, d) {}
// Operator< facilitates sorting in decreasing order by using operator> on
// the key values.

View File

@ -34,7 +34,7 @@ namespace tesseract {
template<typename T>
class ObjectCache {
public:
ObjectCache() {}
ObjectCache() = default;
~ObjectCache() {
mu_.Lock();
for (int i = 0; i < cache_.size(); i++) {

View File

@ -34,7 +34,7 @@
#else
#include <sys/time.h>
#endif
#include <time.h>
#include <ctime>
#include "host.h"
/*Maximum lengths of various strings*/

View File

@ -111,7 +111,7 @@ class ParamUtils {
// Definition of various parameter types.
class Param {
public:
~Param() {}
~Param() = default;
const char *name_str() const { return name_; }
const char *info_str() const { return info_; }

View File

@ -186,7 +186,7 @@ bool STRING::SkipDeSerialize(tesseract::TFile* fp) {
return fp->FRead(nullptr, 1, len) == len;
}
BOOL8 STRING::contains(const char c) const {
bool STRING::contains(const char c) const {
return (c != '\0') && (strchr (GetCStr(), c) != nullptr);
}
@ -302,7 +302,7 @@ void STRING::split(const char c, GenericVector<STRING> *splited) {
}
}
BOOL8 STRING::operator==(const STRING& str) const {
bool STRING::operator==(const STRING& str) const {
FixHeader();
str.FixHeader();
const STRING_HEADER* str_header = str.GetHeader();
@ -314,7 +314,7 @@ BOOL8 STRING::operator==(const STRING& str) const {
&& (memcmp(GetCStr(), str.GetCStr(), this_used) == 0);
}
BOOL8 STRING::operator!=(const STRING& str) const {
bool STRING::operator!=(const STRING& str) const {
FixHeader();
str.FixHeader();
const STRING_HEADER* str_header = str.GetHeader();
@ -326,7 +326,7 @@ BOOL8 STRING::operator!=(const STRING& str) const {
|| (memcmp(GetCStr(), str.GetCStr(), this_used) != 0);
}
BOOL8 STRING::operator!=(const char* cstr) const {
bool STRING::operator!=(const char* cstr) const {
FixHeader();
const STRING_HEADER* this_header = GetHeader();

View File

@ -49,7 +49,7 @@ class TESS_API STRING
STRING(const STRING &string);
STRING(const char *string);
STRING(const char *data, int length);
~STRING ();
~STRING();
// Writes to the given file. Returns false in case of error.
bool Serialize(FILE* fp) const;
@ -64,7 +64,7 @@ class TESS_API STRING
// As DeSerialize, but only seeks past the data - hence a static method.
static bool SkipDeSerialize(tesseract::TFile* fp);
BOOL8 contains(const char c) const;
bool contains(const char c) const;
int32_t length() const;
int32_t size() const { return length(); }
// Workaround to avoid g++ -Wsign-compare warnings.
@ -92,9 +92,9 @@ class TESS_API STRING
void split(const char c, GenericVector<STRING> *splited);
void truncate_at(int32_t index);
BOOL8 operator== (const STRING & string) const;
BOOL8 operator!= (const STRING & string) const;
BOOL8 operator!= (const char *string) const;
bool operator== (const STRING & string) const;
bool operator!= (const STRING & string) const;
bool operator!= (const char *string) const;
STRING & operator= (const char *string);
STRING & operator= (const STRING & string);

View File

@ -128,7 +128,7 @@ class TessdataManager {
TessdataManager();
explicit TessdataManager(FileReader reader);
~TessdataManager() {}
~TessdataManager() = default;
bool swap() const { return swap_; }
bool is_loaded() const { return is_loaded_; }

View File

@ -17,7 +17,7 @@
//
///////////////////////////////////////////////////////////////////////
#include <assert.h>
#include <cassert>
#include "unichar.h"
#include "host.h"
#include "unicharmap.h"

View File

@ -109,7 +109,7 @@ class Classify : public CCStruct {
ADAPT_TEMPLATES ReadAdaptedTemplates(TFile* File);
/* normmatch.cpp ************************************************************/
FLOAT32 ComputeNormMatch(CLASS_ID ClassId,
const FEATURE_STRUCT& feature, BOOL8 DebugMatch);
const FEATURE_STRUCT& feature, bool DebugMatch);
void FreeNormProtos();
NORM_PROTOS* ReadNormProtos(TFile* fp);
/* protos.cpp ***************************************************************/

View File

@ -308,8 +308,8 @@ PROTOTYPE *NewMixedProto(int16_t N, CLUSTER *Cluster, STATISTICS *Statistics);
PROTOTYPE *NewSimpleProto(int16_t N, CLUSTER *Cluster);
BOOL8 Independent (PARAM_DESC ParamDesc[],
int16_t N, FLOAT32 * CoVariance, FLOAT32 Independence);
bool Independent(PARAM_DESC* ParamDesc,
int16_t N, FLOAT32* CoVariance, FLOAT32 Independence);
BUCKETS *GetBuckets(CLUSTERER* clusterer,
DISTRIBUTION Distribution,
@ -347,7 +347,7 @@ uint16_t UniformBucket(PARAM_DESC *ParamDesc,
FLOAT32 Mean,
FLOAT32 StdDev);
BOOL8 DistributionOK(BUCKETS *Buckets);
bool DistributionOK(BUCKETS* Buckets);
void FreeStatistics(STATISTICS *Statistics);
@ -378,9 +378,9 @@ FLOAT64 Solve(SOLVEFUNC Function,
FLOAT64 ChiArea(CHISTRUCT *ChiParams, FLOAT64 x);
BOOL8 MultipleCharSamples(CLUSTERER *Clusterer,
CLUSTER *Cluster,
FLOAT32 MaxIllegal);
bool MultipleCharSamples(CLUSTERER* Clusterer,
CLUSTER* Cluster,
FLOAT32 MaxIllegal);
double InvertMatrix(const float* input, int size, float* inv);
@ -1637,9 +1637,9 @@ PROTOTYPE *NewSimpleProto(int16_t N, CLUSTER *Cluster) {
* @note Exceptions: None
* @note History: 6/4/89, DSJ, Created.
*/
BOOL8
Independent (PARAM_DESC ParamDesc[],
int16_t N, FLOAT32 * CoVariance, FLOAT32 Independence) {
bool
Independent(PARAM_DESC* ParamDesc,
int16_t N, FLOAT32* CoVariance, FLOAT32 Independence) {
int i, j;
FLOAT32 *VARii; // points to ith on-diagonal element
FLOAT32 *VARjj; // points to jth on-diagonal element
@ -1662,10 +1662,10 @@ int16_t N, FLOAT32 * CoVariance, FLOAT32 Independence) {
CorrelationCoeff =
sqrt (sqrt (*CoVariance * *CoVariance / (*VARii * *VARjj)));
if (CorrelationCoeff > Independence)
return (FALSE);
return false;
}
}
return (TRUE);
return true;
} // Independent
/**
@ -1746,7 +1746,7 @@ BUCKETS *MakeBuckets(DISTRIBUTION Distribution,
FLOAT64 LastProbDensity;
FLOAT64 ProbDensity;
uint16_t CurrentBucket;
BOOL8 Symmetrical;
bool Symmetrical;
// allocate memory needed for data structure
Buckets = static_cast<BUCKETS *>(Emalloc(sizeof(BUCKETS)));
@ -1766,7 +1766,7 @@ BUCKETS *MakeBuckets(DISTRIBUTION Distribution,
}
// all currently defined distributions are symmetrical
Symmetrical = TRUE;
Symmetrical = true;
Buckets->ChiSquared = ComputeChiSquared(
DegreesOfFreedom(Distribution, Buckets->NumberOfBuckets), Confidence);
@ -2122,7 +2122,7 @@ uint16_t UniformBucket(PARAM_DESC *ParamDesc,
* @note Exceptions: None
* @note History: 6/5/89, DSJ, Created.
*/
BOOL8 DistributionOK(BUCKETS *Buckets) {
bool DistributionOK(BUCKETS* Buckets) {
FLOAT32 FrequencyDifference;
FLOAT32 TotalDifference;
int i;
@ -2137,9 +2137,9 @@ BOOL8 DistributionOK(BUCKETS *Buckets) {
// test to see if the difference is more than expected
if (TotalDifference > Buckets->ChiSquared)
return FALSE;
return false;
else
return TRUE;
return true;
} // DistributionOK
/**
@ -2461,9 +2461,9 @@ FLOAT64 ChiArea(CHISTRUCT *ChiParams, FLOAT64 x) {
* 2/22/90, DSJ, Added MaxIllegal control rather than always
* splitting illegal clusters.
*/
BOOL8
MultipleCharSamples (CLUSTERER * Clusterer,
CLUSTER * Cluster, FLOAT32 MaxIllegal)
bool
MultipleCharSamples(CLUSTERER* Clusterer,
CLUSTER* Cluster, FLOAT32 MaxIllegal)
#define ILLEGAL_CHAR 2
{
static BOOL8 *CharFlags = nullptr;
@ -2505,11 +2505,11 @@ CLUSTER * Cluster, FLOAT32 MaxIllegal)
PercentIllegal = (FLOAT32) NumIllegalInCluster / NumCharInCluster;
if (PercentIllegal > MaxIllegal) {
destroy(SearchState);
return (TRUE);
return true;
}
}
}
return (FALSE);
return false;
} // MultipleCharSamples

View File

@ -375,9 +375,9 @@ void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle) {
* @note History: 6/12/89, DSJ, Created.
*/
void WriteProtoList(FILE *File, uint16_t N, PARAM_DESC ParamDesc[],
LIST ProtoList, BOOL8 WriteSigProtos,
BOOL8 WriteInsigProtos) {
void WriteProtoList(FILE* File, uint16_t N, PARAM_DESC* ParamDesc,
LIST ProtoList, bool WriteSigProtos,
bool WriteInsigProtos) {
PROTOTYPE *Proto;
/* write file header */

View File

@ -44,9 +44,9 @@ void WriteNFloats (FILE * File, uint16_t N, FLOAT32 Array[]);
void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle);
void WriteProtoList(FILE *File, uint16_t N, PARAM_DESC ParamDesc[],
LIST ProtoList, BOOL8 WriteSigProtos,
BOOL8 WriteInsigProtos);
void WriteProtoList(FILE* File, uint16_t N, PARAM_DESC* ParamDesc,
LIST ProtoList, bool WriteSigProtos,
bool WriteInsigProtos);
//--------------Global Data Definitions and Declarations---------------------
// define errors that can be trapped

View File

@ -163,8 +163,6 @@ ErrorCounter::ErrorCounter(const UNICHARSET& unicharset, int fontsize)
font_counts_.init_to_size(fontsize, empty_counts);
multi_unichar_counts_.init_to_size(unicharset.size(), 0);
}
ErrorCounter::~ErrorCounter() {
}
// Accumulates the errors from the classifier results on a single sample.
// Returns true if debug is true and a CT_UNICHAR_TOPN_ERR error occurred.

View File

@ -153,7 +153,7 @@ class ErrorCounter {
// Constructor is private. Only anticipated use of ErrorCounter is via
// the static ComputeErrorRate.
ErrorCounter(const UNICHARSET& unicharset, int fontsize);
~ErrorCounter();
~ErrorCounter() = default;
// Accumulates the errors from the classifier results on a single sample.
// Returns true if debug is true and a CT_UNICHAR_TOPN_ERR error occurred.

View File

@ -216,7 +216,7 @@ bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
for (int i = 0; i < CharDesc->FeatureSets[Type]->NumFeatures; i++) {
FEATURE feat = CharDesc->FeatureSets[Type]->Features[i];
for (int p = 0; p < feat->Type->NumParams; p++) {
if (isnan(feat->Params[p]) || isinf(feat->Params[p]))
if (std::isnan(feat->Params[p]) || std::isinf(feat->Params[p]))
well_formed = false;
else
anything_written = true;

View File

@ -71,7 +71,7 @@ void Classify::ComputeIntCharNormArray(const FEATURE_STRUCT& norm_feature,
for (int i = 0; i < unicharset.size(); i++) {
if (i < PreTrainedTemplates->NumClasses) {
int norm_adjust = static_cast<int>(INT_CHAR_NORM_RANGE *
ComputeNormMatch(i, norm_feature, FALSE));
ComputeNormMatch(i, norm_feature, false));
char_norm_array[i] = ClipToRange(norm_adjust, 0, MAX_INT_CHAR_NORM);
} else {
// Classes with no templates (eg. ambigs & ligatures) default

View File

@ -93,7 +93,7 @@ class IntegerMatcher {
// Center of Similarity Curve.
static const float kSimilarityCenter;
IntegerMatcher() : classify_debug_level_(0) {}
IntegerMatcher() : classify_debug_level_(nullptr) {}
void Init(tesseract::IntParam *classify_debug_level);

View File

@ -136,7 +136,7 @@ void DoFill(FILL_SPEC *FillSpec,
uint32_t ClassCount,
uint32_t WordIndex);
BOOL8 FillerDone(TABLE_FILLER *Filler);
bool FillerDone(TABLE_FILLER* Filler);
void FillPPCircularBits(uint32_t
ParamTable[NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR],
@ -399,7 +399,7 @@ void AddProtoToProtoPruner(PROTO Proto, int ProtoId,
Angle = Proto->Angle;
#ifndef _WIN32
assert(!isnan(Angle));
assert(!std::isnan(Angle));
#endif
FillPPCircularBits (ProtoSet->ProtoPruner[PRUNER_ANGLE], Index,
@ -1221,15 +1221,12 @@ void DoFill(FILL_SPEC *FillSpec,
* @note Exceptions: none
* @note History: Tue Feb 19 10:08:05 1991, DSJ, Created.
*/
BOOL8 FillerDone(TABLE_FILLER *Filler) {
bool FillerDone(TABLE_FILLER* Filler) {
FILL_SWITCH *Next;
Next = &(Filler->Switch[Filler->NextSwitch]);
if (Filler->X > Next->X && Next->Type == LastSwitch)
return (TRUE);
else
return (FALSE);
return Filler->X > Next->X && Next->Type == LastSwitch;
} /* FillerDone */

View File

@ -72,7 +72,7 @@ FEATURE_SET ExtractMicros(TBLOB* Blob, const DENORM& cn_denorm) {
// Assert that feature parameters are well defined.
int i;
for (i = 0; i < Feature->Type->NumParams; i++) {
ASSERT_HOST(!isnan(Feature->Params[i]));
ASSERT_HOST(!std::isnan(Feature->Params[i]));
}
#endif

View File

@ -87,7 +87,7 @@ namespace tesseract {
*/
FLOAT32 Classify::ComputeNormMatch(CLASS_ID ClassId,
const FEATURE_STRUCT& feature,
BOOL8 DebugMatch) {
bool DebugMatch) {
LIST Protos;
FLOAT32 BestMatch;
FLOAT32 Match;

View File

@ -40,14 +40,14 @@
* @return TRUE if feature added to set, FALSE if set is already full.
* @note History: Tue May 22 17:22:23 1990, DSJ, Created.
*/
BOOL8 AddFeature(FEATURE_SET FeatureSet, FEATURE Feature) {
bool AddFeature(FEATURE_SET FeatureSet, FEATURE Feature) {
if (FeatureSet->NumFeatures >= FeatureSet->MaxNumFeatures) {
FreeFeature(Feature);
return FALSE;
return false;
}
FeatureSet->Features[FeatureSet->NumFeatures++] = Feature;
return TRUE;
return true;
} /* AddFeature */
/**
@ -134,7 +134,7 @@ FEATURE ReadFeature(FILE* File, const FEATURE_DESC_STRUCT* FeatureDesc) {
if (tfscanf(File, "%f", &(Feature->Params[i])) != 1)
DoError (ILLEGAL_FEATURE_PARAM, "Illegal feature parameter spec");
#ifndef _WIN32
assert (!isnan(Feature->Params[i]));
assert (!std::isnan(Feature->Params[i]));
#endif
}
return (Feature);
@ -181,7 +181,7 @@ FEATURE_SET ReadFeatureSet(FILE* File, const FEATURE_DESC_STRUCT* FeatureDesc) {
void WriteFeature(FEATURE Feature, STRING* str) {
for (int i = 0; i < Feature->Type->NumParams; i++) {
#ifndef WIN32
assert(!isnan(Feature->Params[i]));
assert(!std::isnan(Feature->Params[i]));
#endif
str->add_str_double(" ", Feature->Params[i]);
}

View File

@ -104,7 +104,7 @@ const FEATURE_DESC_STRUCT Name = { \
/*----------------------------------------------------------------------
Generic routines that work for all feature types
----------------------------------------------------------------------*/
BOOL8 AddFeature(FEATURE_SET FeatureSet, FEATURE Feature);
bool AddFeature(FEATURE_SET FeatureSet, FEATURE Feature);
void FreeFeature(FEATURE Feature);

View File

@ -42,7 +42,7 @@ struct UnicharRating;
// Interface base class for classifiers that produce ShapeRating results.
class ShapeClassifier {
public:
virtual ~ShapeClassifier() {}
virtual ~ShapeClassifier() = default;
// Classifies the given [training] sample, writing to results.
// If page_pix is not nullptr, the overriding function may call

View File

@ -37,7 +37,7 @@ class TessClassifier : public ShapeClassifier {
public:
TessClassifier(bool pruner_only, tesseract::Classify* classify)
: pruner_only_(pruner_only), classify_(classify) {}
virtual ~TessClassifier() {}
virtual ~TessClassifier() = default;
// Classifies the given [training] sample, writing to results.
// See ShapeClassifier for a full description.

View File

@ -20,10 +20,4 @@
namespace tesseract {
CUtil::CUtil() {
}
CUtil::~CUtil() {
}
} // namespace tesseract

View File

@ -27,8 +27,8 @@ namespace tesseract {
class CUtil : public CCUtil {
public:
CUtil();
~CUtil();
CUtil() = default;
~CUtil() = default;
void read_variables(const char *filename, bool global_only);
};

View File

@ -129,7 +129,7 @@ class Dawg {
inline const STRING &lang() const { return lang_; }
inline PermuterType permuter() const { return perm_; }
virtual ~Dawg() {}
virtual ~Dawg() = default;
/// Returns true if the given word is in the Dawg.
bool word_in_dawg(const WERD_CHOICE &word) const;

View File

@ -30,9 +30,6 @@ Convolve::Convolve(const STRING& name, int ni, int half_x, int half_y)
half_x_(half_x), half_y_(half_y) {
}
Convolve::~Convolve() {
}
// Writes to the given file. Returns false in case of error.
bool Convolve::Serialize(TFile* fp) const {
if (!Network::Serialize(fp)) return false;

View File

@ -35,7 +35,7 @@ class Convolve : public Network {
// The area of convolution is 2*half_x + 1 by 2*half_y + 1, forcing it to
// always be odd, so the center is the current pixel.
Convolve(const STRING& name, int ni, int half_x, int half_y);
virtual ~Convolve();
virtual ~Convolve() = default;
STRING spec() const override {
STRING spec;

View File

@ -41,9 +41,6 @@ FullyConnected::FullyConnected(const STRING& name, int ni, int no,
: Network(type, name, ni, no), external_source_(nullptr), int_mode_(false) {
}
FullyConnected::~FullyConnected() {
}
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
StaticShape FullyConnected::OutputShape(const StaticShape& input_shape) const {

View File

@ -28,7 +28,7 @@ namespace tesseract {
class FullyConnected : public Network {
public:
FullyConnected(const STRING& name, int ni, int no, NetworkType type);
virtual ~FullyConnected();
virtual ~FullyConnected() = default;
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).

View File

@ -37,9 +37,6 @@ Input::Input(const STRING& name, const StaticShape& shape)
if (shape.height() == 1) ni_ = shape.depth();
}
Input::~Input() {
}
// Writes to the given file. Returns false in case of error.
bool Input::Serialize(TFile* fp) const {
return Network::Serialize(fp) && shape_.Serialize(fp);

View File

@ -29,7 +29,7 @@ class Input : public Network {
public:
Input(const STRING& name, int ni, int no);
Input(const STRING& name, const StaticShape& shape);
virtual ~Input();
virtual ~Input() = default;
STRING spec() const override {
STRING spec;

View File

@ -27,9 +27,6 @@ Maxpool::Maxpool(const STRING& name, int ni, int x_scale, int y_scale)
no_ = ni;
}
Maxpool::~Maxpool() {
}
// Reads from the given file. Returns false in case of error.
bool Maxpool::DeSerialize(TFile* fp) {
bool result = Reconfig::DeSerialize(fp);

View File

@ -29,7 +29,7 @@ namespace tesseract {
class Maxpool : public Reconfig {
public:
Maxpool(const STRING& name, int ni, int x_scale, int y_scale);
virtual ~Maxpool();
virtual ~Maxpool() = default;
// Accessors.
STRING spec() const override {

View File

@ -97,8 +97,6 @@ Network::Network(NetworkType type, const STRING& name, int ni, int no)
backward_win_(nullptr),
randomizer_(nullptr) {}
Network::~Network() {
}
// Suspends/Enables/Permanently disables training by setting the training_
// flag. Serialize and DeSerialize only operate on the run-time data if state

View File

@ -106,7 +106,7 @@ class Network {
public:
Network();
Network(NetworkType type, const STRING& name, int ni, int no);
virtual ~Network();
virtual ~Network() = default;
// Accessors.
NetworkType type() const {

View File

@ -36,7 +36,7 @@ namespace tesseract {
class NetworkScratch {
public:
NetworkScratch() : int_mode_(false) {}
~NetworkScratch() {}
~NetworkScratch() = default;
// Sets the network representation. If the representation is integer, then
// default (integer) NetworkIOs are separated from the always-float variety.

View File

@ -32,9 +32,6 @@ Parallel::Parallel(const STRING& name, NetworkType type) : Plumbing(name) {
type_ = type;
}
Parallel::~Parallel() {
}
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).
StaticShape Parallel::OutputShape(const StaticShape& input_shape) const {

View File

@ -28,7 +28,7 @@ class Parallel : public Plumbing {
public:
// ni_ and no_ will be set by AddToStack.
Parallel(const STRING& name, NetworkType type);
virtual ~Parallel();
virtual ~Parallel() = default;
// Returns the shape output from the network given an input shape (which may
// be partially unknown ie zero).

View File

@ -26,9 +26,6 @@ Plumbing::Plumbing(const STRING& name)
: Network(NT_PARALLEL, name, 0, 0) {
}
Plumbing::~Plumbing() {
}
// Suspends/Enables training by setting the training_ flag. Serialize and
// DeSerialize only operate on the run-time data if state is false.
void Plumbing::SetEnableTraining(TrainingState state) {

Some files were not shown because too many files have changed in this diff Show More