]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
BufferList::getBuffer(): migrate to FileName.
[lyx.git] / src / BufferList.cpp
index 187eaa5f072bdc53ef77d1cbc5d24aab37dba897..edb7885a12e90671a55e5c1dcd595c36ddd9239e 100644 (file)
@@ -276,11 +276,7 @@ docstring BufferList::emergencyWrite(Buffer * buf)
 
 bool BufferList::exists(FileName const & fname) const
 {
-       return find_if(bstore.begin(), bstore.end(),
-                      bind(equal_to<FileName>(),
-                           bind(&Buffer::fileName, _1),
-                           fname))
-               != bstore.end();
+       return getBuffer(fname) != 0;
 }
 
 
@@ -293,14 +289,10 @@ bool BufferList::isLoaded(Buffer const * b) const
 }
 
 
-Buffer * BufferList::getBuffer(string const & s)
+Buffer * BufferList::getBuffer(support::FileName const & fname) const
 {
-       BufferStorage::iterator it =
-               find_if(bstore.begin(), bstore.end(),
-                       bind(equal_to<string>(),
-                            bind(&Buffer::absFileName, _1),
-                            s));
-
+       BufferStorage::const_iterator it = find_if(bstore.begin(), bstore.end(),
+               bind(equal_to<FileName>(), bind(&Buffer::fileName, _1), fname));
        return it != bstore.end() ? (*it) : 0;
 }