mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Constify a bunch of stuff that can be const.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31037 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ea0501025e
commit
56146a9346
@ -45,7 +45,7 @@ LyXModule::LyXModule(string const & n, string const & i,
|
||||
}
|
||||
|
||||
|
||||
bool LyXModule::isAvailable() {
|
||||
bool LyXModule::isAvailable() const {
|
||||
#ifdef TEX2LYX
|
||||
return true;
|
||||
#else
|
||||
@ -242,15 +242,26 @@ LyXModuleList::iterator ModuleList::end()
|
||||
}
|
||||
|
||||
|
||||
LyXModule * ModuleList::operator[](string const & str)
|
||||
LyXModule const * ModuleList::operator[](string const & str) const
|
||||
{
|
||||
LyXModuleList::iterator it = modlist_.begin();
|
||||
LyXModuleList::const_iterator it = modlist_.begin();
|
||||
for (; it != modlist_.end(); ++it)
|
||||
if (it->getID() == str) {
|
||||
LyXModule & mod = *it;
|
||||
LyXModule const & mod = *it;
|
||||
return &mod;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LyXModule * ModuleList::operator[](string const & str)
|
||||
{
|
||||
LyXModuleList::iterator it = modlist_.begin();
|
||||
for (; it != modlist_.end(); ++it)
|
||||
if (it->getID() == str) {
|
||||
LyXModule & mod = *it;
|
||||
return &mod;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
std::vector<std::string> const & excludes,
|
||||
std::string const & catgy);
|
||||
/// whether the required packages are available
|
||||
bool isAvailable();
|
||||
bool isAvailable() const;
|
||||
///
|
||||
std::string const & getName() const { return name_; }
|
||||
///
|
||||
@ -102,10 +102,12 @@ private:
|
||||
std::vector<std::string> excluded_modules_;
|
||||
/// Category, also used in the UI
|
||||
std::string category_;
|
||||
// these are mutable because they are used to cache the results
|
||||
// or an otherwise const operation.
|
||||
///
|
||||
bool checked_;
|
||||
mutable bool checked_;
|
||||
///
|
||||
bool available_;
|
||||
mutable bool available_;
|
||||
};
|
||||
|
||||
typedef std::vector<LyXModule> LyXModuleList;
|
||||
@ -132,8 +134,10 @@ public:
|
||||
bool empty() const { return modlist_.empty(); }
|
||||
/// Returns a pointer to the LyXModule with filename str.
|
||||
/// Returns a null pointer if no such module is found.
|
||||
LyXModule const * operator[](std::string const & str) const;
|
||||
///
|
||||
LyXModule * operator[](std::string const & str);
|
||||
private:
|
||||
private:
|
||||
/// noncopyable
|
||||
ModuleList(ModuleList const &);
|
||||
///
|
||||
|
@ -243,7 +243,7 @@ vector<string> getPackageList(string const & modName)
|
||||
|
||||
bool isModuleAvailable(string const & modName)
|
||||
{
|
||||
LyXModule * mod = theModuleList[modName];
|
||||
LyXModule const * const mod = theModuleList[modName];
|
||||
if (!mod)
|
||||
return false;
|
||||
return mod->isAvailable();
|
||||
@ -2694,7 +2694,7 @@ list<GuiDocument::modInfoStruct> const
|
||||
for (; it != end; ++it) {
|
||||
modInfoStruct m;
|
||||
m.id = *it;
|
||||
LyXModule * mod = theModuleList[*it];
|
||||
LyXModule const * const mod = theModuleList[*it];
|
||||
if (mod)
|
||||
// FIXME Unicode
|
||||
m.name = toqstr(translateIfPossible(from_utf8(mod->getName())));
|
||||
|
Loading…
Reference in New Issue
Block a user