(Buffer::errorList): simplify
* src/buffer.h
emptyErrorList_ move to buffer.C and make it static const
* src/lyx_main.C
(LyX::exec2): Use for_each instead of for loop
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14667
a592a061-630c-0410-9148-
cb99ea01b6c8
ErrorList const & Buffer::errorList(string const & type) const
{
+ static ErrorList const emptyErrorList;
std::map<std::string, ErrorList>::const_iterator I = errorLists_.find(type);
if (I == errorLists_.end())
- return emptyErrorList_;
+ return emptyErrorList;
return I->second;
}
ErrorList & Buffer::errorList(string const & type)
{
- std::map<std::string, ErrorList>::iterator I = errorLists_.find(type);
- if (I == errorLists_.end()) {
- errorLists_[type] = emptyErrorList_;
- return errorLists_[type];
- }
-
- return I->second;
+ return errorLists_[type];
}
/// Container for all sort of Buffer dependant errors.
std::map<std::string, ErrorList> errorLists_;
-
- /// Empty Error List
- ErrorList const emptyErrorList_;
};
#endif
using std::endl;
using std::string;
using std::vector;
-using std::mem_fun_ref;
#ifndef CXX_GLOBAL_CSTD
using std::exit;
if (loadLyXFile(buf, s)) {
last_loaded = buf;
ErrorList const & el = buf->errorList("Parse");
- if (!el.empty()) {
- // There should be a way to use the following but I (abdel) don't know
- // how to make it compile on MSVC2005.
- //for_each(el.begin(), el.end(), mem_fun_ref(&LyX::printError));
- for (ErrorList::const_iterator it = el.begin();
- it != el.end(); ++it) {
- printError(*it);
- }
- }
+ if (!el.empty())
+ for_each(el.begin(), el.end(),
+ boost::bind(&LyX::printError, this, _1));
}
else
bufferlist.release(buf);