Most of these are about passing const strings parameters as references.
// Copy child authors to the params. We need those pointers.
AuthorList const & child_authors = params().authors();
AuthorList::Authors::const_iterator it = child_authors.begin();
- for (; it != child_authors.end(); it++)
+ for (; it != child_authors.end(); ++it)
mparams.authors().record(*it);
return mparams;
}
}
-void Buffer::getSourceCode(odocstream & os, string const format,
+void Buffer::getSourceCode(odocstream & os, string const & format,
pit_type par_begin, pit_type par_end,
OutputWhat output, bool master) const
{
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
/// including preamble
- void getSourceCode(odocstream & os, std::string const format,
+ void getSourceCode(odocstream & os, std::string const & format,
pit_type par_begin, pit_type par_end, OutputWhat output,
bool master) const;
}
-OutputParams::FLAVOR BufferParams::getOutputFlavor(string const format) const
+OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const
{
string const dformat = (format.empty() || format == "default") ?
getDefaultOutputFormat() : format;
}
-InsetQuotes::QuoteLanguage BufferParams::getQuoteStyle(string const qs) const
+InsetQuotes::QuoteLanguage BufferParams::getQuoteStyle(string const & qs) const
{
return quoteslangtranslator().find(qs);
}
std::string getDefaultOutputFormat() const;
/// return the output flavor of \p format or the default
OutputParams::FLAVOR getOutputFlavor(
- std::string const format = std::string()) const;
+ std::string const & format = std::string()) const;
///
bool isExportable(std::string const & format) const;
///
Font const getFont() const;
/// translate quote style string to enum value
- InsetQuotes::QuoteLanguage getQuoteStyle(std::string const qs) const;
+ InsetQuotes::QuoteLanguage getQuoteStyle(std::string const & qs) const;
/* these are for the PaperLayout */
/// the papersize
CharInfo::CharInfo(
- docstring const textcommand, docstring const mathcommand,
- std::string const textpreamble, std::string const mathpreamble,
- std::string const tipashortcut, unsigned int flags)
+ docstring const & textcommand, docstring const & mathcommand,
+ std::string const & textpreamble, std::string const & mathpreamble,
+ std::string const & tipashortcut, unsigned int flags)
: textcommand_(textcommand), mathcommand_(mathcommand),
textpreamble_(textpreamble), mathpreamble_(mathpreamble),
tipashortcut_(tipashortcut), flags_(flags)
}
-pair<docstring, docstring> Encoding::latexString(docstring const input, bool dryrun) const
+pair<docstring, docstring> Encoding::latexString(docstring const & input, bool dryrun) const
{
docstring result;
docstring uncodable;
public:
CharInfo() : flags_(0) {}
CharInfo(
- docstring const textcommand, docstring const mathcommand,
- std::string const textpreamble, std::string const mathpreamble,
- std::string const tipashortcut, unsigned int flags);
+ docstring const & textcommand, docstring const & mathcommand,
+ std::string const & textpreamble, std::string const & mathpreamble,
+ std::string const & tipashortcut, unsigned int flags);
// we assume that at least one command is nonempty when using unicodesymbols
bool isUnicodeSymbol() const { return !textcommand_.empty() || !mathcommand_.empty(); }
/// LaTeX command (text mode) for this character
* \p dryrun specifies whether the string is used within source
* preview (which yields a special warning).
*/
- std::pair<docstring, docstring> latexString(docstring const input,
+ std::pair<docstring, docstring> latexString(docstring const & input,
bool dryrun = false) const;
/// Which LaTeX package handles this encoding?
Package package() const { return package_; }
}
-int iterateLine(string const token, regex const reg, string const & closing,
+int iterateLine(string const & token, regex const & reg, string const & closing,
int fragment_pos, DepTable & head)
{
smatch what;
/// language code
std::string const & code() const { return code_; }
/// set code (needed for rc.spellchecker_alt_lang)
- void setCode(std::string const c) { code_ = c; }
+ void setCode(std::string const & c) { code_ = c; }
/// language variety (needed by aspell checker)
std::string const & variety() const { return variety_; }
/// set variety (needed for rc.spellchecker_alt_lang)
- void setVariety(std::string const v) { variety_ = v; }
+ void setVariety(std::string const & v) { variety_ = v; }
/// preamble settings after babel was called
std::string const & babel_postsettings() const { return babel_postsettings_; }
/// preamble settings before babel is called
///
typedef std::string base_type;
///
- LayoutFileIndex(base_type t) { data_ = t; }
+ LayoutFileIndex(base_type const & t) : data_(t) { }
///
operator base_type() const { return data_; }
///
// check the string from UI
-string PDFOptions::quoted_options_check(string const str) const
+string PDFOptions::quoted_options_check(string const & str) const
{
return subst(str, "\n", "");
}
* Returns repaired string. For the time being only newlines
* are checked.
*/
- std::string quoted_options_check(std::string const str) const;
+ std::string quoted_options_check(std::string const & str) const;
/**
namespace {
-string const guiErrorType(string const s)
+string const guiErrorType(string const & s)
{
if (s == "docbook")
return N_("DocBook");
namespace {
-string const l10n_shortcut(string const prettyname, string const shortcut)
+string const l10n_shortcut(string const & prettyname, string const & shortcut)
{
if (shortcut.empty())
return string();
\return true if the content has changed since last call.
*/
static bool getContent(BufferView const * view, Buffer::OutputWhat output,
- QString & qstr, string const format, bool force_getcontent,
+ QString & qstr, string const & format, bool force_getcontent,
bool master)
{
// get the *top* level paragraphs that contain the cursor,
}
-lyx::Converter const * setConverter(string const from)
+lyx::Converter const * setConverter(string const & from)
{
typedef vector<string> FmtList;
typedef lyx::graphics::Cache GCache;
LASSERT(false, return);
break;
case PREVIEW_INSTANT: {
+ //FIXME: why is the value below immediately forgotten?
RenderMonitoredPreview * preview_ptr = renderer_->asMonitoredPreview();
renderer_.reset(new RenderMonitoredPreview(this));
preview_ptr = renderer_->asMonitoredPreview();
// I would have liked a fromstr template a lot better. (Lgb)
-bool string2type(string const str, LyXAlignment & num)
+bool string2type(string const & str, LyXAlignment & num)
{
if (str == "none")
num = LYX_ALIGN_NONE;
}
-bool string2type(string const str, Tabular::HAlignment & num)
+bool string2type(string const & str, Tabular::HAlignment & num)
{
if (str == "left")
num = Tabular::LYX_LONGTABULAR_ALIGN_LEFT;
}
-bool string2type(string const str, Tabular::VAlignment & num)
+bool string2type(string const & str, Tabular::VAlignment & num)
{
if (str == "top")
num = Tabular::LYX_VALIGN_TOP;
}
-bool string2type(string const str, Tabular::BoxType & num)
+bool string2type(string const & str, Tabular::BoxType & num)
{
if (str == "none")
num = Tabular::BOX_NONE;
}
-bool string2type(string const str, bool & num)
+bool string2type(string const & str, bool & num)
{
if (str == "true")
num = true;
}
-InsetTableCell splitCell(InsetTableCell & head, docstring const align_d, bool & hassep)
+InsetTableCell splitCell(InsetTableCell & head, docstring const & align_d, bool & hassep)
{
InsetTableCell tail = InsetTableCell(head);
DocIterator const dit = separatorPos(&head, align_d);
}
-void Tabular::TeXTopHLine(otexstream & os, row_type row, string const lang) const
+void Tabular::TeXTopHLine(otexstream & os, row_type row, string const & lang) const
{
// we only output complete row lines and the 1st row here, the rest
// is done in Tabular::TeXBottomHLine(...)
}
-void Tabular::TeXBottomHLine(otexstream & os, row_type row, string const lang) const
+void Tabular::TeXBottomHLine(otexstream & os, row_type row, string const & lang) const
{
// we output bottomlines of row r and the toplines of row r+1
// if the latter do not span the whole tabular
///
// helper function for Latex
///
- void TeXTopHLine(otexstream &, row_type row, std::string const lang) const;
+ void TeXTopHLine(otexstream &, row_type row, std::string const & lang) const;
///
- void TeXBottomHLine(otexstream &, row_type row, std::string const lang) const;
+ void TeXBottomHLine(otexstream &, row_type row, std::string const & lang) const;
///
void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow) const;
///
std::string const featureAsString(Tabular::Feature feature);
/// Split cell on decimal symbol
-InsetTableCell splitCell(InsetTableCell & head, docstring const decimal_sym, bool & hassep);
+InsetTableCell splitCell(InsetTableCell & head, docstring const & decimal_sym, bool & hassep);
} // namespace lyx
istringstream is(out);
string line;
getline(is, line);
- if (line.find("on line") != 0)
+ if (!prefixIs(line, "on line"))
break; // error message not identified
getline(is, line);
size_t pos = line.find('^');
switch (c) {
case ' ':
os << ' ';
- currlinelen++;
+ ++currlinelen;
break;
case '\0':
ParagraphList::const_iterator findEndOfEnvironment(
- ParagraphList::const_iterator const pstart,
+ ParagraphList::const_iterator const & pstart,
ParagraphList::const_iterator const & pend)
{
ParagraphList::const_iterator p = pstart;
}
-docstring const sgml::uniqueID(docstring const label)
+docstring const sgml::uniqueID(docstring const & label)
{
// FIXME THREAD
// It seems unlikely there could be a problem here,
docstring const & orig);
/// returns a unique numeric id
-docstring const uniqueID(docstring const label);
+docstring const uniqueID(docstring const & label);
/// Opens tag
void openTag(odocstream & os, std::string const & name,
ModuleMap modules;
-bool addModule(string const module, LayoutFile const & baseClass, LayoutModuleList & m, vector<string> & visited)
+bool addModule(string const & module, LayoutFile const & baseClass, LayoutModuleList & m, vector<string> & visited)
{
// avoid endless loop for circular dependency
vector<string>::const_iterator const vb = visited.begin();