mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Added possibility to retrieve internal buffers (by their tmp file-name) from the Model.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37548 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
10bedbd268
commit
edc94a578f
@ -254,17 +254,33 @@ struct equivalent_to : public binary_function<FileName, FileName, bool>
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::getBuffer(support::FileName const & fname) const
|
||||
Buffer * BufferList::getBuffer(support::FileName const & fname, bool internal) const
|
||||
{
|
||||
// 1) cheap test, using string comparison of file names
|
||||
BufferStorage::const_iterator it = find_if(bstore.begin(), bstore.end(),
|
||||
lyx::bind(equal_to<FileName>(), lyx::bind(&Buffer::fileName, _1), fname));
|
||||
if (it != bstore.end())
|
||||
return *it;
|
||||
return *it;
|
||||
// 2) possibly expensive test, using equivalence test of file names
|
||||
it = find_if(bstore.begin(), bstore.end(),
|
||||
lyx::bind(equivalent_to(), lyx::bind(&Buffer::fileName, _1), fname));
|
||||
return it != bstore.end() ? (*it) : 0;
|
||||
if (it != bstore.end())
|
||||
return *it;
|
||||
|
||||
if (internal) {
|
||||
// 1) cheap test, using string comparison of file names
|
||||
BufferStorage::const_iterator it = find_if(binternal.begin(), binternal.end(),
|
||||
lyx::bind(equal_to<FileName>(), lyx::bind(&Buffer::fileName, _1), fname));
|
||||
if (it != binternal.end())
|
||||
return *it;
|
||||
// 2) possibly expensive test, using equivalence test of file names
|
||||
it = find_if(binternal.begin(), binternal.end(),
|
||||
lyx::bind(equivalent_to(), lyx::bind(&Buffer::fileName, _1), fname));
|
||||
if (it != binternal.end())
|
||||
return *it;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,10 +81,17 @@ public:
|
||||
|
||||
/// \return index of named buffer in buffer list
|
||||
int bufferNum(support::FileName const & name) const;
|
||||
/// \return a pointer to the buffer with the given name
|
||||
Buffer * getBuffer(support::FileName const & name) const;
|
||||
|
||||
/** returns a pointer to the buffer with the given name
|
||||
*
|
||||
* \param internal
|
||||
* If true, the buffer is searched also among internal buffers
|
||||
*/
|
||||
Buffer * getBuffer(support::FileName const & name, bool internal = false) const;
|
||||
|
||||
/// \return a pointer to the buffer with the given number
|
||||
Buffer * getBuffer(unsigned int);
|
||||
|
||||
/// \return a pointer to the buffer whose temppath matches the given path
|
||||
Buffer * getBufferFromTmp(std::string const & path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user