本文整理汇总了C++中paragraphlist::const_iterator::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::layout方法的具体用法?C++ const_iterator::layout怎么用?C++ const_iterator::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paragraphlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::layout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeParagraph
ParagraphList::const_iterator makeParagraph(
Buffer const & buf,
odocstream & os,
OutputParams const & runparams,
Text const & text,
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
ParagraphList const & paragraphs = text.paragraphs();
for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
if (par != pbegin)
os << '\n';
bool const default_or_plain =
(buf.params().documentClass().isDefaultLayout(par->layout())
|| buf.params().documentClass().isPlainLayout(par->layout()));
if (default_or_plain && par->emptyTag()) {
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
} else {
sgml::openTag(buf, os, runparams, *par);
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
sgml::closeTag(os, *par);
}
}
return pend;
}
示例2: searchEnvironment
ParagraphList::const_iterator searchEnvironment(
ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend)
{
Layout const & bstyle = p->layout();
size_t const depth = p->params().depth();
for (++p; p != pend; ++p) {
Layout const & style = p->layout();
if (style.latextype == LATEX_COMMAND)
return p;
if (style.latextype == LATEX_PARAGRAPH) {
if (p->params().depth() > depth)
continue;
return p;
}
if (p->params().depth() < depth)
return p;
if (style.latexname() != bstyle.latexname()
&& p->params().depth() == depth)
return p;
}
return pend;
}
示例3: makeCommand
ParagraphList::const_iterator makeCommand(Buffer const & buf,
odocstream & os,
OutputParams const & runparams,
Text const & text,
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
ParagraphList const & paragraphs = text.paragraphs();
ParagraphList::const_iterator par = pbegin;
Layout const & bstyle = par->layout();
//Open outter tag
sgml::openTag(buf, os, runparams, *pbegin);
os << '\n';
// Label around sectioning number:
if (!bstyle.labeltag().empty()) {
sgml::openTag(os, bstyle.labeltag());
// We don't care about appendix in DOCBOOK.
os << par->expandDocBookLabel(bstyle, buf.params());
sgml::closeTag(os, bstyle.labeltag());
}
// Opend inner tag and close inner tags
sgml::openTag(os, bstyle.innertag());
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
sgml::closeTag(os, bstyle.innertag());
os << '\n';
++par;
while (par != pend) {
Layout const & style = par->layout();
ParagraphList::const_iterator send;
switch (style.latextype) {
case LATEX_COMMAND: {
send = searchCommand(par, pend);
par = makeCommand(buf, os, runparams, text, par,send);
break;
}
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: {
send = searchEnvironment(par, pend);
par = makeEnvironment(buf, os, runparams, text, par,send);
break;
}
case LATEX_PARAGRAPH:
send = searchParagraph(par, pend);
par = makeParagraph(buf, os, runparams, text, par,send);
break;
default:
break;
}
}
// Close outter tag
sgml::closeTag(os, *pbegin);
return pend;
}
示例4: makeEnvironment
ParagraphList::const_iterator makeEnvironment(
Buffer const & buf,
odocstream & os,
OutputParams const & runparams,
Text const & text,
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
ParagraphList const & paragraphs = text.paragraphs();
ParagraphList::const_iterator par = pbegin;
Layout const & defaultstyle = buf.params().documentClass().defaultLayout();
Layout const & bstyle = par->layout();
string item_tag;
// Opening outter tag
sgml::openTag(buf, os, runparams, *pbegin);
os << '\n';
if (bstyle.latextype == LATEX_ENVIRONMENT && bstyle.pass_thru)
os << "<![CDATA[";
while (par != pend) {
Layout const & style = par->layout();
ParagraphList::const_iterator send;
string id = par->getID(buf, runparams);
string wrapper = "";
pos_type sep = 0;
// Opening inner tag
switch (bstyle.latextype) {
case LATEX_ENVIRONMENT:
if (!bstyle.innertag().empty()) {
sgml::openTag(os, bstyle.innertag(), id);
}
break;
case LATEX_ITEM_ENVIRONMENT:
if (!bstyle.labeltag().empty()) {
sgml::openTag(os, bstyle.innertag(), id);
sgml::openTag(os, bstyle.labeltag());
sep = par->firstWordDocBook(os, runparams) + 1;
sgml::closeTag(os, bstyle.labeltag());
}
wrapper = defaultstyle.latexname();
// If a sub list (embedded list) appears next with a
// different depth, then there is no need to open
// another tag at the current depth.
if(par->params().depth() == pbegin->params().depth()) {
sgml::openTag(os, bstyle.itemtag());
}
break;
default:
break;
}
switch (style.latextype) {
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: {
if (par->params().depth() == pbegin->params().depth()) {
sgml::openTag(os, wrapper);
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)), sep);
sgml::closeTag(os, wrapper);
++par;
}
else {
send = searchEnvironment(par, pend);
par = makeEnvironment(buf, os, runparams, text, par,send);
}
break;
}
case LATEX_PARAGRAPH:
send = searchParagraph(par, pend);
par = makeParagraph(buf, os, runparams, text, par,send);
break;
case LATEX_LIST_ENVIRONMENT:
case LATEX_BIB_ENVIRONMENT:
case LATEX_COMMAND:
// FIXME This means that we are just skipping any paragraph that
// isn't implemented above, and this includes lists.
++par;
break;
}
// Closing inner tag
switch (bstyle.latextype) {
case LATEX_ENVIRONMENT:
if (!bstyle.innertag().empty()) {
sgml::closeTag(os, bstyle.innertag());
os << '\n';
}
break;
case LATEX_ITEM_ENVIRONMENT:
// If a sub list (embedded list) appears next, then
// there is no need to close the current tag.
// par should have already been incremented to the next
// element. So we can compare the depth of the next
// element with pbegin.
// We need to be careful, that we don't dereference par
// when par == pend but at the same time that the
//.........这里部分代码省略.........
示例5: TeXEnvironment
void TeXEnvironment(Buffer const & buf, Text const & text,
OutputParams const & runparams,
pit_type & pit, otexstream & os)
{
ParagraphList const & paragraphs = text.paragraphs();
ParagraphList::const_iterator par = paragraphs.constIterator(pit);
LYXERR(Debug::LATEX, "TeXEnvironment for paragraph " << pit);
Layout const & current_layout = par->layout();
depth_type const current_depth = par->params().depth();
Length const & current_left_indent = par->params().leftIndent();
// This is for debugging purpose at the end.
pit_type const par_begin = pit;
for (; pit < runparams.par_end; ++pit) {
ParagraphList::const_iterator par = paragraphs.constIterator(pit);
// check first if this is an higher depth paragraph.
bool go_out = (par->params().depth() < current_depth);
if (par->params().depth() == current_depth) {
// This environment is finished.
go_out |= (par->layout() != current_layout);
go_out |= (par->params().leftIndent() != current_left_indent);
}
if (go_out) {
// nothing to do here, restore pit and go out.
pit--;
break;
}
if (par->layout() == current_layout
&& par->params().depth() == current_depth
&& par->params().leftIndent() == current_left_indent) {
// We are still in the same environment so TeXOnePar and continue;
TeXOnePar(buf, text, pit, os, runparams);
continue;
}
// We are now in a deeper environment.
// Either par->layout() != current_layout
// Or par->params().depth() > current_depth
// Or par->params().leftIndent() != current_left_indent)
if (par->layout().isParagraph()) {
// FIXME (Lgb): How to handle this?
//&& !suffixIs(os, "\n\n")
// (ARRae) There should be at least one '\n' already but we need there to
// be two for Standard paragraphs that are depth-increment'ed to be
// output correctly. However, tables can also be paragraphs so
// don't adjust them.
// FIXME (Lgb): Will it ever harm to have one '\n' too
// many? i.e. that we sometimes will have
// three in a row.
os << '\n';
}
// FIXME This test should not be necessary.
// We should perhaps issue an error if it is.
bool const force_plain_layout = text.inset().forcePlainLayout();
Layout const & style = force_plain_layout
? buf.params().documentClass().plainLayout()
: par->layout();
if (!style.isEnvironment()) {
// This is a standard paragraph, no need to call TeXEnvironment.
TeXOnePar(buf, text, pit, os, runparams);
continue;
}
// This is a new environment.
TeXEnvironmentData const data =
prepareEnvironment(buf, text, par, os, runparams);
// Recursive call to TeXEnvironment!
TeXEnvironment(buf, text, runparams, pit, os);
finishEnvironment(os, runparams, data);
}
if (pit != runparams.par_end)
LYXERR(Debug::LATEX, "TeXEnvironment for paragraph " << par_begin << " done.");
}