}
-bool LyXModule::isAvailable() {
+bool LyXModule::isAvailable() const {
#ifdef TEX2LYX
return true;
#else
}
-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
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_; }
///
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;
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 &);
///
bool isModuleAvailable(string const & modName)
{
- LyXModule * mod = theModuleList[modName];
+ LyXModule const * const mod = theModuleList[modName];
if (!mod)
return false;
return mod->isAvailable();
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())));