本文整理汇总了C++中docstring类的典型用法代码示例。如果您正苦于以下问题:C++ docstring类的具体用法?C++ docstring怎么用?C++ docstring使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了docstring类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buffer
int InsetCommand::plaintext(odocstream & os, OutputParams const &) const
{
docstring const str = "[" + buffer().B_("LaTeX Command: ")
+ from_utf8(getCmdName()) + "]";
os << str;
return str.size();
}
示例2: getParam
int InsetRef::plaintext(odocstringstream & os,
OutputParams const &, size_t) const
{
docstring const str = getParam("reference");
os << '[' << str << ']';
return 2 + str.size();
}
示例3: labelFont
void RowPainter::paintTopLevelLabel() const
{
BufferParams const & bparams = pi_.base.bv->buffer().params();
ParagraphParameters const & pparams = par_.params();
Layout const & layout = par_.layout();
FontInfo const font = labelFont(false);
docstring const str = par_.labelString();
if (str.empty())
return;
double spacing_val = 1.0;
if (!pparams.spacing().isDefault())
spacing_val = pparams.spacing().getValue();
else
spacing_val = bparams.spacing().getValue();
FontMetrics const & fm = theFontMetrics(font);
int const labeladdon = int(fm.maxHeight()
* layout.spacing.getValue() * spacing_val);
int maxdesc =
int(fm.maxDescent() * layout.spacing.getValue() * spacing_val
+ (layout.labelbottomsep * defaultRowHeight()));
double x = x_;
if (layout.labeltype == LABEL_CENTERED) {
x += (tm_.width() - row_.left_margin - row_.right_margin) / 2;
x -= fm.width(str) / 2;
} else if (row_.isRTL()) {
x = xo_ + tm_.width() - row_.right_margin - fm.width(str);
}
pi_.pain.text(int(x), yo_ - maxdesc - labeladdon, str, font);
}
示例4: while
bool BranchList::add(docstring const & s)
{
bool added = false;
size_t i = 0;
while (true) {
size_t const j = s.find_first_of(separator_, i);
docstring name;
if (j == docstring::npos)
name = s.substr(i);
else
name = s.substr(i, j - i);
// Is this name already in the list?
bool const already =
find_if(list.begin(), list.end(),
BranchNamesEqual(name)) != list.end();
if (!already) {
added = true;
Branch br;
br.setBranch(name);
br.setSelected(false);
br.setFileNameSuffix(false);
list.push_back(br);
}
if (j == docstring::npos)
break;
i = j + 1;
}
return added;
}
示例5: from_ascii
QValidator::State PathValidator::validate(QString & qtext, int &) const
{
if (!latex_doc_)
return QValidator::Acceptable;
docstring const text = support::trim(qstring_to_ucs4(qtext));
if (text.empty())
return acceptable_if_empty_ ?
QValidator::Acceptable : QValidator::Intermediate;
docstring invalid_chars = from_ascii("#$%{}()[]\"^");
if (!tex_allows_spaces_)
invalid_chars += ' ';
if (text.find_first_of(invalid_chars) != docstring::npos) {
static int counter = 0;
if (counter == 0) {
Alert::error(_("Invalid filename"),
_("LyX does not provide LaTeX support for file names containing any of these characters:\n") +
printable_list(invalid_chars));
}
++counter;
return QValidator::Intermediate;
}
return QValidator::Acceptable;
}
示例6: docstring
docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
{
Buffer const & buf = bv.buffer();
// Only after the buffer is loaded from file...
if (!buf.isFullyLoaded())
return docstring();
BiblioInfo const & bi = buf.masterBibInfo();
if (bi.empty())
return _("No bibliography defined!");
docstring const & key = getParam("key");
if (key.empty())
return _("No citations selected!");
vector<docstring> keys = getVectorFromString(key);
vector<docstring>::const_iterator it = keys.begin();
vector<docstring>::const_iterator en = keys.end();
docstring tip;
for (; it != en; ++it) {
docstring const key_info = bi.getInfo(*it, buffer());
if (key_info.empty())
continue;
if (!tip.empty())
tip += "\n";
tip += wrap(key_info, -4);
}
return tip;
}
示例7: text
// FIXME XHTML
// There are cases where we may need to close open fonts and such
// and then re-open them when we are done. This would be the case, e.g.,
// if we were otherwise about to write:
// <em>word <div class='foot'>footnote text.</div> emph</em>
// The problem isn't so much that the footnote text will get emphasized:
// we can handle that with CSS. The problem is that this is invalid XHTML.
// One solution would be to make the footnote <span>, but the problem is
// completely general, and so we'd have to make absolutely everything into
// span. What I think will work is to check if we're about to write "div" and,
// if so, try to close fonts, etc.
// There are probably limits to how well we can do here, though, and we will
// have to rely upon users not putting footnotes inside noun-type insets.
docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
XHTMLOptions opts) const
{
// we will always want to output all our paragraphs when we are
// called this way.
OutputParams runparams = rp;
runparams.par_begin = 0;
runparams.par_end = text().paragraphs().size();
if (undefined()) {
xs.startDivision(false);
xhtmlParagraphs(text_, buffer(), xs, runparams);
xs.endDivision();
return docstring();
}
InsetLayout const & il = getLayout();
if (opts & WriteOuterTag)
xs << html::StartTag(il.htmltag(), il.htmlattr());
if ((opts & WriteLabel) && !il.counter().empty()) {
BufferParams const & bp = buffer().masterBuffer()->params();
Counters & cntrs = bp.documentClass().counters();
cntrs.step(il.counter(), OutputUpdate);
// FIXME: translate to paragraph language
if (!il.htmllabel().empty()) {
docstring const lbl =
cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
// FIXME is this check necessary?
if (!lbl.empty()) {
xs << html::StartTag(il.htmllabeltag(), il.htmllabelattr());
xs << lbl;
xs << html::EndTag(il.htmllabeltag());
}
}
}
if (opts & WriteInnerTag)
xs << html::StartTag(il.htmlinnertag(), il.htmlinnerattr());
// we will eventually lose information about the containing inset
if (!allowMultiPar() || opts == JustText)
runparams.html_make_pars = false;
if (il.isPassThru())
runparams.pass_thru = true;
xs.startDivision(false);
xhtmlParagraphs(text_, buffer(), xs, runparams);
xs.endDivision();
if (opts & WriteInnerTag)
xs << html::EndTag(il.htmlinnertag());
if (opts & WriteOuterTag)
xs << html::EndTag(il.htmltag());
return docstring();
}
示例8: escapeString
docstring sgml::escapeString(docstring const & raw)
{
docstring bin;
bin.reserve(raw.size() * 2); // crude approximation is sufficient
for (size_t i = 0; i != raw.size(); ++i)
bin += sgml::escapeChar(raw[i]);
return bin;
}
示例9: makeDefaultCSS
void InsetLayout::makeDefaultCSS() const
{
if (!htmldefaultstyle_.empty())
return;
docstring const mainfontCSS = font_.asCSS();
if (!mainfontCSS.empty())
htmldefaultstyle_ =
from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") +
mainfontCSS + from_ascii("\n}\n");
}
示例10: add_known_environment
void add_known_environment(string const & environment, string const & o1,
bool o2, docstring const & beg, docstring const &end)
{
vector<ArgumentType> arguments;
convertArgs(o1, o2, arguments);
known_environments[environment] = arguments;
if (!beg.empty() || ! end.empty())
possible_textclass_environments[environment] =
FullEnvironment(arguments, beg, end);
}
示例11: wi
int InsetFormulaMacro::plaintext(odocstream & os, OutputParams const & runparams) const
{
odocstringstream oss;
WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding);
tmpl()->write(wi);
docstring const str = oss.str();
os << str;
return str.size();
}
示例12: signedWidth
int GuiFontMetrics::signedWidth(docstring const & s) const
{
if (s.empty())
return 0;
if (s[0] == '-')
return -width(s.substr(1, s.size() - 1));
else
return width(s);
}
示例13: paragraphs
pit_type InsetText::openAddToTocForParagraph(pit_type pit,
DocIterator const & dit,
bool output_active,
TocBackend & backend) const
{
Paragraph const & par = paragraphs()[pit];
TocBuilder & b = backend.builder(par.layout().tocType());
docstring const label = par.labelString();
b.pushItem(dit, label + (label.empty() ? "" : " "), output_active);
return text().lastInSequence(pit);
}
示例14: getCmdName
int InsetCitation::plaintext(odocstringstream & os,
OutputParams const &, size_t) const
{
string const & cmd = getCmdName();
if (cmd == "nocite")
return 0;
docstring const label = generateLabel(false);
os << label;
return label.size();
}
示例15: cleanAttr
docstring cleanAttr(docstring const & str)
{
docstring newname;
docstring::const_iterator it = str.begin();
docstring::const_iterator en = str.end();
for (; it != en; ++it) {
char_type const c = *it;
newname += isAlnumASCII(c) ? c : char_type('_');
}
return newname;
}