]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
BufferList::getBuffer(): migrate to FileName.
[lyx.git] / src / BufferList.cpp
index 4512cae4abdd8e5fc521f3089f217b90425f8f12..edb7885a12e90671a55e5c1dcd595c36ddd9239e 100644 (file)
@@ -25,6 +25,7 @@
 #include "support/ExceptionMessage.h"
 #include "support/debug.h"
 #include "support/filetools.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Package.h"
@@ -273,13 +274,9 @@ docstring BufferList::emergencyWrite(Buffer * buf)
 }
 
 
-bool BufferList::exists(string const & s) const
+bool BufferList::exists(FileName const & fname) const
 {
-       return find_if(bstore.begin(), bstore.end(),
-                      bind(equal_to<string>(),
-                           bind(&Buffer::absFileName, _1),
-                           s))
-               != bstore.end();
+       return getBuffer(fname) != 0;
 }
 
 
@@ -292,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;
 }