Buffer * BufferList::createNewBuffer(string const & s)
{
- auto_ptr<Buffer> tmpbuf;
+ unique_ptr<Buffer> tmpbuf;
try {
- tmpbuf.reset(new Buffer(s));
+ tmpbuf = make_unique<Buffer>(s);
} catch (ExceptionMessage const & message) {
if (message.type_ == ErrorException) {
Alert::error(message.title_, message.details_);
}
+bool BufferList::isOthersChild(Buffer * parent, Buffer * child)
+{
+ LASSERT(parent, return false);
+ LASSERT(child, return false);
+ LASSERT(parent->isChild(child), return false);
+
+ // Does child document have a different parent?
+ Buffer const * parent_ = child->parent();
+ if (parent_ && parent_ != parent)
+ return true;
+
+ BufferStorage::iterator it = bstore.begin();
+ BufferStorage::iterator end = bstore.end();
+ for (; it != end; ++it) {
+ Buffer * buf = *it;
+ if (buf != parent && buf->isChild(child))
+ return true;
+ }
+ return false;
+}
+
+
namespace {
struct equivalent_to : public binary_function<FileName, FileName, bool>
}
+void BufferList::updatePreviews()
+{
+ BufferStorage::iterator it = bstore.begin();
+ BufferStorage::iterator end = bstore.end();
+ for (; it != end; ++it)
+ (*it)->updatePreviews();
+}
+
+
int BufferList::bufferNum(FileName const & fname) const
{
FileNameList const buffers(fileNames());
}
-bool BufferList::releaseChild(Buffer * parent, Buffer * child)
-{
- LASSERT(parent, return false);
- LASSERT(child, return false);
- LASSERT(parent->isChild(child), return false);
-
- // Child document has a different parent, don't close it.
- Buffer const * parent_ = child->parent();
- if (parent_ && parent_ != parent)
- return false;
-
- BufferStorage::iterator it = bstore.begin();
- BufferStorage::iterator end = bstore.end();
- for (; it != end; ++it) {
- Buffer * buf = *it;
- if (buf != parent && buf->isChild(child)) {
- child->setParent(0);
- return false;
- }
- }
- release(child);
- return true;
-}
-
-
void BufferList::changed(bool update_metrics) const
{
BufferStorage::const_iterator it = bstore.begin();