mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Pass parameters as const references when possible
Fixes some cppcheck warnings.
This commit is contained in:
parent
4d9a2c2e59
commit
dd65a97b55
@ -1045,7 +1045,7 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring const BibTeXInfo::getLabel(BibTeXInfoList const xrefs,
|
docstring const BibTeXInfo::getLabel(BibTeXInfoList const & xrefs,
|
||||||
Buffer const & buf, docstring const & format,
|
Buffer const & buf, docstring const & format,
|
||||||
CiteItem const & ci, bool next, bool second) const
|
CiteItem const & ci, bool next, bool second) const
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
Buffer const & buf, CiteItem const & ci,
|
Buffer const & buf, CiteItem const & ci,
|
||||||
docstring const & format = docstring()) const;
|
docstring const & format = docstring()) const;
|
||||||
/// \return formatted BibTeX data for a citation label
|
/// \return formatted BibTeX data for a citation label
|
||||||
docstring const getLabel(BibTeXInfoList const xrefs,
|
docstring const getLabel(BibTeXInfoList const & xrefs,
|
||||||
Buffer const & buf, docstring const & format,
|
Buffer const & buf, docstring const & format,
|
||||||
CiteItem const & ci, bool next = false, bool second = false) const;
|
CiteItem const & ci, bool next = false, bool second = false) const;
|
||||||
///
|
///
|
||||||
|
@ -110,7 +110,7 @@ bool LyXCiteEngine::isDefaultBiblio(string const & bf) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXCiteEngine::required(const string p) const
|
bool LyXCiteEngine::required(string const & p) const
|
||||||
{
|
{
|
||||||
return find(package_list_.begin(), package_list_.end(), p) != package_list_.end();
|
return find(package_list_.begin(), package_list_.end(), p) != package_list_.end();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
std::vector<std::string> const & getPackageList() const
|
std::vector<std::string> const & getPackageList() const
|
||||||
{ return package_list_; }
|
{ return package_list_; }
|
||||||
///
|
///
|
||||||
bool required(std::string const p) const;
|
bool required(std::string const & p) const;
|
||||||
private:
|
private:
|
||||||
/// what appears in the ui
|
/// what appears in the ui
|
||||||
std::string name_;
|
std::string name_;
|
||||||
|
@ -47,7 +47,7 @@ typedef map<std::string, PersonalWordList *> LangPersonalWordList;
|
|||||||
|
|
||||||
typedef vector<WordLangTuple> IgnoreList;
|
typedef vector<WordLangTuple> IgnoreList;
|
||||||
|
|
||||||
docstring remap_result(docstring const s)
|
docstring remap_result(docstring const & s)
|
||||||
{
|
{
|
||||||
// substitute RIGHT SINGLE QUOTATION MARK
|
// substitute RIGHT SINGLE QUOTATION MARK
|
||||||
// by APOSTROPHE
|
// by APOSTROPHE
|
||||||
|
@ -269,7 +269,7 @@ WriteStream & operator<<(WriteStream & ws, unsigned int i)
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MathStream::MathStream(odocstream & os, std::string xmlns, bool xmlMode)
|
MathStream::MathStream(odocstream & os, std::string const & xmlns, bool xmlMode)
|
||||||
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns), xml_mode_(xmlMode)
|
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns), xml_mode_(xmlMode)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ public:
|
|||||||
class CTag {
|
class CTag {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
CTag(char const * const tag, std::string attr = "")
|
CTag(char const * const tag, std::string const & attr = "")
|
||||||
: tag_(tag), attr_(attr) {}
|
: tag_(tag), attr_(attr) {}
|
||||||
///
|
///
|
||||||
char const * const tag_;
|
char const * const tag_;
|
||||||
@ -346,7 +346,7 @@ class MathExportException : public std::exception {};
|
|||||||
class MathStream {
|
class MathStream {
|
||||||
public:
|
public:
|
||||||
/// Builds a stream proxy for os; the MathML namespace is given by xmlns (supposed to be already defined elsewhere in the document).
|
/// Builds a stream proxy for os; the MathML namespace is given by xmlns (supposed to be already defined elsewhere in the document).
|
||||||
explicit MathStream(odocstream & os, std::string xmlns="", bool xmlMode=false);
|
explicit MathStream(odocstream & os, std::string const & xmlns="", bool xmlMode=false);
|
||||||
///
|
///
|
||||||
void cr();
|
void cr();
|
||||||
///
|
///
|
||||||
@ -370,7 +370,9 @@ public:
|
|||||||
///
|
///
|
||||||
bool xmlMode() const { return xml_mode_; }
|
bool xmlMode() const { return xml_mode_; }
|
||||||
/// Returns the tag name prefixed by the name space if needed.
|
/// Returns the tag name prefixed by the name space if needed.
|
||||||
std::string namespacedTag(std::string tag) const { return ((xmlns().empty()) ? "" : xmlns() + ":") + tag; }
|
std::string namespacedTag(std::string const & tag) const {
|
||||||
|
return (xmlns().empty() ? "" : xmlns() + ":") + tag;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void setTextMode(bool t) { in_text_ = t; }
|
void setTextMode(bool t) { in_text_ = t; }
|
||||||
|
@ -453,7 +453,7 @@ bool Parser::good()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Parser::hasOpt(string const l)
|
bool Parser::hasOpt(string const & l)
|
||||||
{
|
{
|
||||||
// An optional argument can occur in any of the following forms:
|
// An optional argument can occur in any of the following forms:
|
||||||
// - \foo[bar]
|
// - \foo[bar]
|
||||||
@ -577,7 +577,7 @@ string Parser::getFullParentheseArg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Parser::hasListPreamble(string const itemcmd)
|
bool Parser::hasListPreamble(string const & itemcmd)
|
||||||
{
|
{
|
||||||
// remember current position
|
// remember current position
|
||||||
unsigned int oldpos = pos_;
|
unsigned int oldpos = pos_;
|
||||||
|
@ -214,7 +214,7 @@ public:
|
|||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
/// Does an optional argument follow after the current token?
|
/// Does an optional argument follow after the current token?
|
||||||
bool hasOpt(std::string const l = "[");
|
bool hasOpt(std::string const & l = "[");
|
||||||
///
|
///
|
||||||
typedef std::pair<bool, std::string> Arg;
|
typedef std::pair<bool, std::string> Arg;
|
||||||
/*!
|
/*!
|
||||||
@ -260,7 +260,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::string getFullParentheseArg();
|
std::string getFullParentheseArg();
|
||||||
/// Check if we have a list preamble
|
/// Check if we have a list preamble
|
||||||
bool hasListPreamble(std::string const itemcmd);
|
bool hasListPreamble(std::string const & itemcmd);
|
||||||
/*!
|
/*!
|
||||||
* \returns the contents of the environment \p name.
|
* \returns the contents of the environment \p name.
|
||||||
* <tt>\begin{name}</tt> must be parsed already, <tt>\end{name}</tt>
|
* <tt>\begin{name}</tt> must be parsed already, <tt>\end{name}</tt>
|
||||||
|
@ -295,7 +295,7 @@ vector<string> split_options(string const & input)
|
|||||||
* \p options and return the value.
|
* \p options and return the value.
|
||||||
* The found option is also removed from \p options.
|
* The found option is also removed from \p options.
|
||||||
*/
|
*/
|
||||||
string process_keyval_opt(vector<string> & options, string name)
|
string process_keyval_opt(vector<string> & options, string const & name)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < options.size(); ++i) {
|
for (size_t i = 0; i < options.size(); ++i) {
|
||||||
vector<string> option;
|
vector<string> option;
|
||||||
@ -469,7 +469,7 @@ void Preamble::add_package(string const & name, vector<string> & options)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preamble::setTextClass(string const tclass, TeX2LyXDocClass & tc)
|
void Preamble::setTextClass(string const & tclass, TeX2LyXDocClass & tc)
|
||||||
{
|
{
|
||||||
h_textclass = tclass;
|
h_textclass = tclass;
|
||||||
tc.setName(h_textclass);
|
tc.setName(h_textclass);
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
/// Get author named \p name (must be registered first)
|
/// Get author named \p name (must be registered first)
|
||||||
Author const & getAuthor(std::string const & name) const;
|
Author const & getAuthor(std::string const & name) const;
|
||||||
/// Set text class
|
/// Set text class
|
||||||
void setTextClass(std::string const tclass, TeX2LyXDocClass & tc);
|
void setTextClass(std::string const & tclass, TeX2LyXDocClass & tc);
|
||||||
/// Get number of arguments of special table column type \c or -1
|
/// Get number of arguments of special table column type \c or -1
|
||||||
/// if no column type \p c exists
|
/// if no column type \p c exists
|
||||||
int getSpecialTableColumnArguments(char c) const;
|
int getSpecialTableColumnArguments(char c) const;
|
||||||
|
@ -48,7 +48,7 @@ extern std::string rgbcolor2code(std::string const & name);
|
|||||||
std::string translate_len(std::string const &);
|
std::string translate_len(std::string const &);
|
||||||
|
|
||||||
void parse_text(Parser & p, std::ostream & os, unsigned flags, bool outer,
|
void parse_text(Parser & p, std::ostream & os, unsigned flags, bool outer,
|
||||||
Context & context, std::string const rdelim = std::string());
|
Context & context, std::string const & rdelim = std::string());
|
||||||
void check_comment_bib(std::ostream & os, Context & context);
|
void check_comment_bib(std::ostream & os, Context & context);
|
||||||
|
|
||||||
void fix_child_filename(std::string & name);
|
void fix_child_filename(std::string & name);
|
||||||
@ -68,7 +68,7 @@ std::string find_file(std::string const & name, std::string const & path,
|
|||||||
void parse_text_in_inset(Parser & p, std::ostream & os, unsigned flags,
|
void parse_text_in_inset(Parser & p, std::ostream & os, unsigned flags,
|
||||||
bool outer, Context const & context,
|
bool outer, Context const & context,
|
||||||
InsetLayout const * layout = 0,
|
InsetLayout const * layout = 0,
|
||||||
std::string const rdelim = std::string());
|
std::string const & rdelim = std::string());
|
||||||
|
|
||||||
/// Guess document language from \p p if CJK is used.
|
/// Guess document language from \p p if CJK is used.
|
||||||
/// \p lang is used for all non-CJK contents.
|
/// \p lang is used for all non-CJK contents.
|
||||||
|
@ -55,7 +55,7 @@ void output_arguments(ostream &, Parser &, bool, bool, string, Context &,
|
|||||||
|
|
||||||
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
Context const & context, InsetLayout const * layout,
|
Context const & context, InsetLayout const * layout,
|
||||||
string const rdelim)
|
string const & rdelim)
|
||||||
{
|
{
|
||||||
bool const forcePlainLayout =
|
bool const forcePlainLayout =
|
||||||
layout ? layout->forcePlainLayout() : false;
|
layout ? layout->forcePlainLayout() : false;
|
||||||
@ -86,7 +86,7 @@ namespace {
|
|||||||
|
|
||||||
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
Context const & context, string const & name,
|
Context const & context, string const & name,
|
||||||
string const rdelim = string())
|
string const & rdelim = string())
|
||||||
{
|
{
|
||||||
InsetLayout const * layout = 0;
|
InsetLayout const * layout = 0;
|
||||||
DocumentClass::InsetLayouts::const_iterator it =
|
DocumentClass::InsetLayouts::const_iterator it =
|
||||||
@ -2867,7 +2867,7 @@ void fix_child_filename(string & name)
|
|||||||
|
|
||||||
|
|
||||||
void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
Context & context, string const rdelim)
|
Context & context, string const & rdelim)
|
||||||
{
|
{
|
||||||
Layout const * newlayout = 0;
|
Layout const * newlayout = 0;
|
||||||
InsetLayout const * newinsetlayout = 0;
|
InsetLayout const * newinsetlayout = 0;
|
||||||
|
@ -219,9 +219,9 @@ struct StartTag
|
|||||||
struct EndTag
|
struct EndTag
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
explicit EndTag(std::string tag) : tag_(from_ascii(tag)) {}
|
explicit EndTag(std::string const & tag) : tag_(from_ascii(tag)) {}
|
||||||
///
|
///
|
||||||
explicit EndTag(docstring tag) : tag_(tag) {}
|
explicit EndTag(docstring const & tag) : tag_(tag) {}
|
||||||
///
|
///
|
||||||
virtual ~EndTag() {}
|
virtual ~EndTag() {}
|
||||||
/// </tag_>
|
/// </tag_>
|
||||||
|
Loading…
Reference in New Issue
Block a user