mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
use a reference instead of a pointer in ParagraphList::iterator
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7037 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
297b40c725
commit
9bf624381d
@ -1,5 +1,13 @@
|
||||
2003-05-24 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* paragraph_funcs.C (breakParagraph): adjust
|
||||
(breakParagraphConservative): adjust
|
||||
|
||||
* buffer.C (readParagraph): adjust
|
||||
|
||||
* ParagraphList.C (insert): take a reference instead of a pointer
|
||||
(insert): adjust
|
||||
|
||||
* paragraph.[Ch] (id): new function
|
||||
|
||||
* bufferlist.C (newFile): adjust
|
||||
|
@ -110,8 +110,10 @@ ParagraphList & ParagraphList::operator=(ParagraphList const & rhs)
|
||||
|
||||
|
||||
ParagraphList::iterator
|
||||
ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
|
||||
ParagraphList::insert(ParagraphList::iterator it, Paragraph const & p)
|
||||
{
|
||||
Paragraph * par = new Paragraph(p, false);
|
||||
|
||||
if (it != end()) {
|
||||
Paragraph * prev = it->prev_par_;
|
||||
par->next_par_ = &*it;
|
||||
@ -136,7 +138,7 @@ ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
|
||||
void ParagraphList::insert(iterator pos, iterator beg, iterator end)
|
||||
{
|
||||
for (; beg != end; ++beg) {
|
||||
insert(pos, new Paragraph(*beg, false));
|
||||
insert(pos, *beg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
///
|
||||
ParagraphList & operator=(ParagraphList const &);
|
||||
///
|
||||
iterator insert(iterator it, Paragraph * par);
|
||||
iterator insert(iterator it, Paragraph const & par);
|
||||
///
|
||||
void insert(iterator pos, iterator beg, iterator end);
|
||||
///
|
||||
|
10
src/buffer.C
10
src/buffer.C
@ -368,16 +368,16 @@ int Buffer::readParagraph(LyXLex & lex, string const & token,
|
||||
if (token == "\\layout") {
|
||||
lex.pushToken(token);
|
||||
|
||||
Paragraph * par = new Paragraph();
|
||||
par->params().depth(depth);
|
||||
Paragraph par;
|
||||
par.params().depth(depth);
|
||||
if (params.tracking_changes)
|
||||
par->trackChanges();
|
||||
par.trackChanges();
|
||||
LyXFont f(LyXFont::ALL_INHERIT, params.language);
|
||||
par->setFont(0, f);
|
||||
par.setFont(0, f);
|
||||
|
||||
// FIXME: goddamn InsetTabular makes us pass a Buffer
|
||||
// not BufferParams
|
||||
unknown += ::readParagraph(*this, *par, lex);
|
||||
unknown += ::readParagraph(*this, par, lex);
|
||||
|
||||
// insert after
|
||||
if (pit != pars.end())
|
||||
|
@ -4,6 +4,7 @@
|
||||
(clear): adjust
|
||||
(setParagraphData): separate same_id cases, adjust
|
||||
(appendParagraphs): adjust
|
||||
(appendParagraphs): adjust
|
||||
|
||||
2003-05-23 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -2649,8 +2649,7 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
|
||||
mergeParagraph(buffer->params, paragraphs, lastbuffer);
|
||||
#else
|
||||
ParagraphList::iterator pit = plist.begin();
|
||||
ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(),
|
||||
new Paragraph(*pit, false));
|
||||
ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit);
|
||||
++pit;
|
||||
mergeParagraph(buffer->params, paragraphs, boost::prior(ins));
|
||||
|
||||
|
@ -51,7 +51,7 @@ void breakParagraph(BufferParams const & bparams,
|
||||
{
|
||||
// create a new paragraph, and insert into the list
|
||||
ParagraphList::iterator tmp = paragraphs.insert(boost::next(par),
|
||||
new Paragraph);
|
||||
Paragraph());
|
||||
|
||||
// without doing that we get a crash when typing <Return> at the
|
||||
// end of a paragraph
|
||||
@ -150,7 +150,7 @@ void breakParagraphConservative(BufferParams const & bparams,
|
||||
{
|
||||
// create a new paragraph
|
||||
ParagraphList::iterator tmp = paragraphs.insert(boost::next(par),
|
||||
new Paragraph);
|
||||
Paragraph());
|
||||
tmp->makeSameLayout(*par);
|
||||
|
||||
// When can pos > size()?
|
||||
|
Loading…
Reference in New Issue
Block a user