当前位置: 首页>>代码示例>>C++>>正文


C++ docstring::empty方法代码示例

本文整理汇总了C++中docstring::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ docstring::empty方法的具体用法?C++ docstring::empty怎么用?C++ docstring::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docstring的用法示例。


在下文中一共展示了docstring::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:rpavlik,项目名称:lyx-lucid-backport,代码行数:10,代码来源:tex2lyx.cpp

示例2: validate

void BufferEncodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed)
{
	CharInfo const & ci = Encodings::unicodeCharInfo(c);
	if (ci.isUnicodeSymbol()) {
		// In mathed, c could be used both in textmode and mathmode
		docstring const textcommand = ci.textcommand();
		bool const math_mode = for_mathed && isMathCmd(c);
		bool const use_math = math_mode ||
		                      (!for_mathed && textcommand.empty());
		bool const use_text = (for_mathed && isTextCmd(c)) ||
		                      (!for_mathed && !textcommand.empty());
		bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain");
		bool const unicode_math = (features.isRequired("unicode-math")
			&& features.isAvailable("unicode-math"));
		// with utf8-plain, we only load packages when in mathed (see #7766)
		// and if we do not use unicode-math
		if ((math_mode && !unicode_math)
		     || (use_math && !plain_utf8)) {
			string const mathpreamble = ci.mathpreamble();
			if (!mathpreamble.empty()) {
				if (ci.mathfeature()) {
					string feats = mathpreamble;
					while (!feats.empty()) {
						string feat;
						feats = split(feats, feat, ',');
						features.require(feat);
					}
				} else
					features.addPreambleSnippet(mathpreamble);
			}
		}
		// with utf8-plain, we do not load packages (see #7766)
		if (use_text && !plain_utf8) {
			string const textpreamble = ci.textpreamble();
			if (!textpreamble.empty()) {
				if (ci.textfeature()) {
					string feats = textpreamble;
					while (!feats.empty()) {
						string feat;
						feats = split(feats, feat, ',');
						features.require(feat);
					}
				} else
					features.addPreambleSnippet(textpreamble);
			}
		}
	}
	if (for_mathed && isMathSym(c)) {
		features.require("amstext");
		features.require("lyxmathsym");
	}
}
开发者ID:315234,项目名称:lyx-retina,代码行数:52,代码来源:BufferEncodings.cpp

示例3: toolTip

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;
}
开发者ID:315234,项目名称:lyx-retina,代码行数:29,代码来源:InsetCitation.cpp

示例4: validate

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;
}
开发者ID:bsjung,项目名称:Lyx,代码行数:28,代码来源:Validator.cpp

示例5: paintTopLevelLabel

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);
}
开发者ID:cburschka,项目名称:lyx,代码行数:34,代码来源:RowPainter.cpp

示例6: string

FileFilterList::FileFilterList(docstring const & qt_style_filter)
{
	// FIXME UNICODE
	string const filter = to_utf8(qt_style_filter)
		+ (qt_style_filter.empty() ? string() : ";;")
		+ to_utf8(_("All Files "))
#if defined(_WIN32)		
		+ ("(*.*)");
#else
		+ ("(*)");
#endif

	// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
	// into individual filters.
	static lyx::regex const separator_re(";;");

	string::const_iterator it = filter.begin();
	string::const_iterator const end = filter.end();
	while (true) {
		match_results<string::const_iterator> what;

		if (!lyx::regex_search(it, end, what, separator_re)) {
			parse_filter(string(it, end));
			break;
		}

		// Everything from the start of the input to
		// the start of the match.
		parse_filter(string(what[-1].first, what[-1].second));

		// Increment the iterator to the end of the match.
		it += distance(it, what[0].second);
	}
}
开发者ID:hashinisenaratne,项目名称:HSTML,代码行数:34,代码来源:qt_helpers.cpp

示例7: hasLayout

bool TextClass::hasLayout(docstring const & n) const
{
	docstring const name = n.empty() ? defaultLayoutName() : n;

	return find_if(layoutlist_.begin(), layoutlist_.end(),
		       LayoutNamesEqual(name))
		!= layoutlist_.end();
}
开发者ID:bsjung,项目名称:Lyx,代码行数:8,代码来源:TextClass.cpp

示例8: insetAsXHTML

// 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();
}
开发者ID:cburschka,项目名称:lyx,代码行数:71,代码来源:InsetText.cpp

示例9: setCustomLabel

void InsetCaption::setCustomLabel(docstring const & label)
{
	if (!isAscii(label) || label.empty())
		// This must be a user defined layout. We cannot translate
		// this, since gettext accepts only ascii keys.
		custom_label_ = label;
	else
		custom_label_ = _(to_ascii(label));
}
开发者ID:ronenabr,项目名称:lyx,代码行数:9,代码来源:InsetCaption.cpp

示例10: if

vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
	vector<docstring> const & keys_to_search, bool only_keys,
 	docstring const & search_expression, docstring field,
	bool case_sensitive, bool regex)
{
	vector<docstring> foundKeys;

	docstring expr = trim(search_expression);
	if (expr.empty())
		return foundKeys;

	if (!regex)
		// We must escape special chars in the search_expr so that
		// it is treated as a simple string by lyx::regex.
		expr = escape_special_chars(expr);

	lyx::regex reg_exp;
	try {
		reg_exp.assign(to_utf8(expr), case_sensitive ?
			lyx::regex_constants::ECMAScript : lyx::regex_constants::icase);
	} catch (lyx::regex_error const & e) {
		// lyx::regex throws an exception if the regular expression is not
		// valid.
		LYXERR(Debug::GUI, e.what());
		return vector<docstring>();
	}

	vector<docstring>::const_iterator it = keys_to_search.begin();
	vector<docstring>::const_iterator end = keys_to_search.end();
	for (; it != end; ++it ) {
		BiblioInfo::const_iterator info = bi.find(*it);
		if (info == bi.end())
			continue;

		BibTeXInfo const & kvm = info->second;
		string data;
		if (only_keys)
			data = to_utf8(*it);
		else if (field.empty())
			data = to_utf8(*it) + ' ' + to_utf8(kvm.allData());
		else
			data = to_utf8(kvm[field]);

		if (data.empty())
			continue;

		try {
			if (lyx::regex_search(data, reg_exp))
				foundKeys.push_back(*it);
		}
		catch (lyx::regex_error const & e) {
			LYXERR(Debug::GUI, e.what());
			return vector<docstring>();
		}
	}
	return foundKeys;
}
开发者ID:315234,项目名称:lyx-retina,代码行数:57,代码来源:GuiCitation.cpp

示例11: add_known_command

void add_known_command(string const & command, string const & o1,
                       bool o2, docstring const & definition)
{
	vector<ArgumentType> arguments;
	convertArgs(o1, o2, arguments);
	known_commands[command] = arguments;
	if (!definition.empty())
		possible_textclass_commands[command] =
			FullCommand(arguments, definition);
}
开发者ID:rpavlik,项目名称:lyx-lucid-backport,代码行数:10,代码来源:tex2lyx.cpp

示例12: 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");
}
开发者ID:yiran06,项目名称:lyx,代码行数:10,代码来源:InsetLayout.cpp

示例13: 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);
}
开发者ID:bsjung,项目名称:Lyx,代码行数:10,代码来源:GuiFontMetrics.cpp

示例14: string

string const to_local8bit(docstring const & s)
{
	// This conversion can fail, depending on input.
	if (s.empty())
		return string();
	QByteArray const local = toqstr(s).toLocal8Bit();
	if (local.isEmpty())
		throw to_local8bit_failure();
	return string(local.begin(), local.end());
}
开发者ID:djmitche,项目名称:lyx,代码行数:10,代码来源:docstring.cpp

示例15: hasInsetLayout

bool TextClass::hasInsetLayout(docstring const & n) const
{
	if (n.empty()) 
		return false;
	InsetLayouts::const_iterator it = insetlayoutlist_.begin();
	InsetLayouts::const_iterator en = insetlayoutlist_.end();
	for (; it != en; ++it)
		if (n == it->first)
			return true;
	return false;
}
开发者ID:bsjung,项目名称:Lyx,代码行数:11,代码来源:TextClass.cpp


注:本文中的docstring::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。