本文整理汇总了C++中DocIterator::text方法的典型用法代码示例。如果您正苦于以下问题:C++ DocIterator::text方法的具体用法?C++ DocIterator::text怎么用?C++ DocIterator::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocIterator
的用法示例。
在下文中一共展示了DocIterator::text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equal
static bool equal(DocIterator & o, DocIterator & n)
{
// Explicitly check for this, so we won't call
// Paragraph::getChar for the last pos.
bool const o_lastpos = o.pos() == o.lastpos();
bool const n_lastpos = n.pos() == n.lastpos();
if (o_lastpos || n_lastpos)
return o_lastpos && n_lastpos;
Paragraph const & old_par = o.text()->getPar(o.pit());
Paragraph const & new_par = n.text()->getPar(n.pit());
char_type const c_o = old_par.getChar(o.pos());
char_type const c_n = new_par.getChar(n.pos());
if (c_o != c_n)
return false;
if (old_par.isInset(o.pos())) {
Inset const * i_o = old_par.getInset(o.pos());
Inset const * i_n = new_par.getInset(n.pos());
if (i_o && i_n)
return equal(i_o, i_n);
}
Font fo = old_par.getFontSettings(o.buffer()->params(), o.pos());
Font fn = new_par.getFontSettings(n.buffer()->params(), n.pos());
return fo == fn;
}
示例2: undo
void Undo::Private::doRecordUndo(UndoKind kind,
DocIterator const & cell,
pit_type first_pit, pit_type last_pit,
CursorData const & cur_before,
bool isFullBuffer,
UndoElementStack & stack)
{
if (!group_level) {
LYXERR0("There is no group open (creating one)");
++group_id;
}
if (first_pit > last_pit)
swap(first_pit, last_pit);
// Undo::ATOMIC are always recorded (no overlapping there).
// As nobody wants all removed character appear one by one when undoing,
// we want combine 'similar' non-ATOMIC undo recordings to one.
pit_type from = first_pit;
pit_type end = cell.lastpit() - last_pit;
if (!undo_finished_
&& kind != ATOMIC_UNDO
&& !stack.empty()
&& samePar(stack.top().cell, cell)
&& stack.top().kind == kind
&& stack.top().from == from
&& stack.top().end == end) {
// reset cur_after; it will be filled correctly by endUndoGroup.
stack.top().cur_after = CursorData();
return;
}
if (isFullBuffer)
LYXERR(Debug::UNDO, "Create full buffer undo element of group " << group_id);
else
LYXERR(Debug::UNDO, "Create undo element of group " << group_id);
// create the position information of the Undo entry
UndoElement undo(kind, cur_before, cell, from, end, 0, 0,
buffer_.params(), isFullBuffer, buffer_.isClean(), group_id);
// fill in the real data to be saved
if (cell.inMathed()) {
// simply use the whole cell
MathData & ar = cell.cell();
undo.array = new MathData(ar.buffer(), ar.begin(), ar.end());
} else {
// some more effort needed here as 'the whole cell' of the
// main Text _is_ the whole document.
// record the relevant paragraphs
Text const * text = cell.text();
LBUFERR(text);
ParagraphList const & plist = text->paragraphs();
ParagraphList::const_iterator first = plist.begin();
advance(first, first_pit);
ParagraphList::const_iterator last = plist.begin();
advance(last, last_pit + 1);
undo.pars = new ParagraphList(first, last);
}
// push the undo entry to undo stack
stack.push(undo);
//lyxerr << "undo record: " << stack.top() << endl;
}