less code and the DUUOB award for output_docbook.cpp

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21811 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-26 23:59:51 +00:00
parent 089c21ba76
commit bb21756817

View File

@ -47,12 +47,10 @@ using std::string;
namespace { namespace {
ParagraphList::const_iterator searchParagraph( ParagraphList::const_iterator searchParagraph(
ParagraphList::const_iterator const & par, ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend) ParagraphList::const_iterator const & pend)
{ {
ParagraphList::const_iterator p = boost::next(par); for (++p; p != pend && p->layout()->latextype == LATEX_PARAGRAPH; ++p)
for (; p != pend && p->layout()->latextype == LATEX_PARAGRAPH; ++p)
; ;
return p; return p;
@ -60,13 +58,12 @@ ParagraphList::const_iterator searchParagraph(
ParagraphList::const_iterator searchCommand( ParagraphList::const_iterator searchCommand(
ParagraphList::const_iterator const & par, ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend) ParagraphList::const_iterator const & pend)
{ {
LayoutPtr const & bstyle = par->layout(); LayoutPtr const & bstyle = p->layout();
ParagraphList::const_iterator p = boost::next(par);
for ( ; p != pend; ++p) { for (++p; p != pend; ++p) {
LayoutPtr const & style = p->layout(); LayoutPtr const & style = p->layout();
if (style->latextype == LATEX_COMMAND if (style->latextype == LATEX_COMMAND
&& style->commanddepth <= bstyle->commanddepth) && style->commanddepth <= bstyle->commanddepth)
@ -77,27 +74,27 @@ ParagraphList::const_iterator searchCommand(
ParagraphList::const_iterator searchEnvironment( ParagraphList::const_iterator searchEnvironment(
ParagraphList::const_iterator const & par, ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend) ParagraphList::const_iterator const & pend)
{ {
LayoutPtr const & bstyle = par->layout(); LayoutPtr const & bstyle = p->layout();
ParagraphList::const_iterator p = boost::next(par); size_t const depth = p->params().depth();
for (; p != pend; ++p) { for (++p; p != pend; ++p) {
LayoutPtr const & style = p->layout(); LayoutPtr const & style = p->layout();
if (style->latextype == LATEX_COMMAND) if (style->latextype == LATEX_COMMAND)
return p; return p;
if (style->latextype == LATEX_PARAGRAPH) { if (style->latextype == LATEX_PARAGRAPH) {
if (p->params().depth() > par->params().depth()) if (p->params().depth() > depth)
continue; continue;
return p; return p;
} }
if (p->params().depth() < par->params().depth()) if (p->params().depth() < depth)
return p; return p;
if (style->latexname() != bstyle->latexname() if (style->latexname() != bstyle->latexname()
&& p->params().depth() == par->params().depth() ) && p->params().depth() == depth)
return p; return p;
} }
return pend; return pend;