本文整理汇总了C++中WERD::set_flag方法的典型用法代码示例。如果您正苦于以下问题:C++ WERD::set_flag方法的具体用法?C++ WERD::set_flag怎么用?C++ WERD::set_flag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WERD
的用法示例。
在下文中一共展示了WERD::set_flag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_single_word
void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows) {
TO_ROW_IT to_row_it(rows);
ROW_IT row_it(real_rows);
for (to_row_it.mark_cycle_pt(); !to_row_it.cycled_list();
to_row_it.forward()) {
TO_ROW* row = to_row_it.data();
// The blobs have to come out of the BLOBNBOX into the C_BLOB_LIST ready
// to create the word.
C_BLOB_LIST cblobs;
C_BLOB_IT cblob_it(&cblobs);
BLOBNBOX_IT box_it(row->blob_list());
for (;!box_it.empty(); box_it.forward()) {
BLOBNBOX* bblob= box_it.extract();
if (bblob->joined_to_prev() || (one_blob && !cblob_it.empty())) {
if (bblob->cblob() != NULL) {
C_OUTLINE_IT cout_it(cblob_it.data()->out_list());
cout_it.move_to_last();
cout_it.add_list_after(bblob->cblob()->out_list());
delete bblob->cblob();
}
} else {
if (bblob->cblob() != NULL)
cblob_it.add_after_then_move(bblob->cblob());
}
delete bblob;
}
// Convert the TO_ROW to a ROW.
ROW* real_row = new ROW(row, static_cast<inT16>(row->kern_size),
static_cast<inT16>(row->space_size));
WERD_IT word_it(real_row->word_list());
WERD* word = new WERD(&cblobs, 0, NULL);
word->set_flag(W_BOL, TRUE);
word->set_flag(W_EOL, TRUE);
word->set_flag(W_DONT_CHOP, one_blob);
word_it.add_after_then_move(word);
row_it.add_after_then_move(real_row);
}
}
示例2: tprintf
//.........这里部分代码省略.........
tprintf ("Leftmost blob is at (%d,%d)\n",
box_it.data ()->bounding_box ().left (),
box_it.data ()->bounding_box ().bottom ());
return nullptr;
}
ASSERT_HOST (!cell_it.empty () && !row->char_cells.singleton ());
prev_chop_coord = cell_it.data ()->x ();
word = nullptr;
while (rep_left < cell_it.data ()->x ()) {
word = add_repeated_word (&rep_it, rep_left, prev_chop_coord,
blanks, row->fixed_pitch, &word_it);
}
cell_it.mark_cycle_pt ();
if (prev_chop_coord >= cell_it.data ()->x ())
cell_it.forward ();
for (; !cell_it.cycled_list (); cell_it.forward ()) {
chop_coord = cell_it.data ()->x ();
while (!box_it.empty ()
&& box_it.data ()->bounding_box ().left () <= chop_coord) {
if (box_it.data ()->bounding_box ().right () > prev_x)
prev_x = box_it.data ()->bounding_box ().right ();
split_to_blob (box_it.extract (), chop_coord,
textord_fp_chop_error + 0.5f,
&left_coutlines,
&right_coutlines);
box_it.forward ();
while (!box_it.empty() && box_it.data()->cblob() == nullptr) {
delete box_it.extract();
box_it.forward();
}
}
if (!right_coutlines.empty() && left_coutlines.empty())
split_to_blob (nullptr, chop_coord,
textord_fp_chop_error + 0.5f,
&left_coutlines,
&right_coutlines);
if (!left_coutlines.empty()) {
cblob_it.add_after_then_move(new C_BLOB(&left_coutlines));
} else {
if (rep_left < chop_coord) {
if (rep_left > prev_chop_coord)
new_blanks = (uint8_t) floor ((rep_left - prev_chop_coord)
/ row->fixed_pitch + 0.5);
else
new_blanks = 0;
}
else {
if (chop_coord > prev_chop_coord)
new_blanks = (uint8_t) floor ((chop_coord - prev_chop_coord)
/ row->fixed_pitch + 0.5);
else
new_blanks = 0;
}
if (!cblob_it.empty()) {
if (blanks < 1 && word != nullptr && !word->flag (W_REP_CHAR))
blanks = 1;
word = new WERD (&cblobs, blanks, nullptr);
cblob_it.set_to_list (&cblobs);
word->set_flag (W_DONT_CHOP, TRUE);
word_it.add_after_then_move (word);
if (bol) {
word->set_flag (W_BOL, TRUE);
bol = false;
}
blanks = new_blanks;
}
else
blanks += new_blanks;
while (rep_left < chop_coord) {
word = add_repeated_word (&rep_it, rep_left, prev_chop_coord,
blanks, row->fixed_pitch, &word_it);
}
}
if (prev_chop_coord < chop_coord)
prev_chop_coord = chop_coord;
}
if (!cblob_it.empty()) {
word = new WERD(&cblobs, blanks, nullptr);
word->set_flag (W_DONT_CHOP, TRUE);
word_it.add_after_then_move (word);
if (bol)
word->set_flag (W_BOL, TRUE);
}
ASSERT_HOST (word != nullptr);
while (!rep_it.empty ()) {
add_repeated_word (&rep_it, rep_left, prev_chop_coord,
blanks, row->fixed_pitch, &word_it);
}
//at end of line
word_it.data ()->set_flag (W_EOL, TRUE);
if (prev_chop_coord > prev_x)
prev_x = prev_chop_coord;
xstarts[1] = prev_x + 1;
real_row = new ROW (row, (int16_t) row->kern_size, (int16_t) row->space_size);
word_it.set_to_list (real_row->word_list ());
//put words in row
word_it.add_list_after (&words);
real_row->recalc_bounding_box ();
return real_row;
}
示例3: if
WERD *make_real_word( //make a WERD
BLOBNBOX_IT *box_it, //iterator
inT32 blobcount, //no of blobs to use
BOOL8 bol, //start of line
BOOL8 fuzzy_sp, //fuzzy space
BOOL8 fuzzy_non, //fuzzy non-space
uinT8 blanks //no of blanks
) {
OUTLINE_IT out_it; //outlines
C_OUTLINE_IT cout_it;
PBLOB_LIST blobs; //blobs in word
C_BLOB_LIST cblobs;
PBLOB_IT blob_it = &blobs; //iterator
C_BLOB_IT cblob_it = &cblobs;
WERD *word; //new word
BLOBNBOX *bblob; //current blob
inT32 blobindex; //in row
for (blobindex = 0; blobindex < blobcount; blobindex++) {
bblob = box_it->extract ();
if (bblob->joined_to_prev ()) {
if (bblob->blob () != NULL) {
out_it.set_to_list (blob_it.data ()->out_list ());
out_it.move_to_last ();
out_it.add_list_after (bblob->blob ()->out_list ());
delete bblob->blob ();
}
else if (bblob->cblob () != NULL) {
cout_it.set_to_list (cblob_it.data ()->out_list ());
cout_it.move_to_last ();
cout_it.add_list_after (bblob->cblob ()->out_list ());
delete bblob->cblob ();
}
}
else {
if (bblob->blob () != NULL)
blob_it.add_after_then_move (bblob->blob ());
else if (bblob->cblob () != NULL)
cblob_it.add_after_then_move (bblob->cblob ());
}
delete bblob;
box_it->forward (); //next one
}
if (blanks < 1)
blanks = 1;
if (!blob_it.empty ()) {
//make real word
word = new WERD (&blobs, blanks, NULL);
}
else {
word = new WERD (&cblobs, blanks, NULL);
}
if (bol) {
word->set_flag (W_BOL, TRUE);
}
if (fuzzy_sp)
//probably space
word->set_flag (W_FUZZY_SP, TRUE);
else if (fuzzy_non)
//probably not
word->set_flag (W_FUZZY_NON, TRUE);
if (box_it->at_first ()) {
word->set_flag (W_EOL, TRUE);//at end of line
}
return word;
}