mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* src/buffer.C
(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
This commit is contained in:
parent
63b5b965df
commit
28ef49f2d9
11
src/buffer.C
11
src/buffer.C
@ -1703,9 +1703,10 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
|
||||
|
||||
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;
|
||||
}
|
||||
@ -1713,11 +1714,5 @@ ErrorList const & Buffer::errorList(string const & type) const
|
||||
|
||||
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];
|
||||
}
|
||||
|
@ -387,9 +387,6 @@ private:
|
||||
|
||||
/// Container for all sort of Buffer dependant errors.
|
||||
std::map<std::string, ErrorList> errorLists_;
|
||||
|
||||
/// Empty Error List
|
||||
ErrorList const emptyErrorList_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,6 @@ namespace fs = boost::filesystem;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::mem_fun_ref;
|
||||
|
||||
#ifndef CXX_GLOBAL_CSTD
|
||||
using std::exit;
|
||||
@ -283,15 +282,9 @@ int LyX::exec2(int & argc, char * argv[])
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user