mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Replace boost::scoped_ptr with unique_ptr
This commit is contained in:
parent
a73f2e6eb6
commit
ca8709aaf5
1
3rdparty/boost/extract.sh
vendored
1
3rdparty/boost/extract.sh
vendored
@ -26,7 +26,6 @@ bcp --boost=$1 \
|
||||
boost/cstdint.hpp \
|
||||
boost/lexical_cast.hpp \
|
||||
boost/regex.hpp \
|
||||
boost/scoped_ptr.hpp \
|
||||
boost/signal.hpp \
|
||||
boost/signals/connection.hpp \
|
||||
boost/signals/trackable.hpp \
|
||||
|
@ -1397,9 +1397,8 @@ bool Buffer::save() const
|
||||
// proper location once that has been done successfully. that
|
||||
// way we preserve the original file if something goes wrong.
|
||||
string const justname = fileName().onlyFileNameWithoutExt();
|
||||
boost::scoped_ptr<TempFile>
|
||||
tempfile(new TempFile(fileName().onlyPath(),
|
||||
justname + "-XXXXXX.lyx"));
|
||||
auto tempfile = make_unique<TempFile>(fileName().onlyPath(),
|
||||
justname + "-XXXXXX.lyx");
|
||||
bool const symlink = fileName().isSymLink();
|
||||
if (!symlink)
|
||||
tempfile->setAutoRemove(false);
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/TempFile.h"
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
#include "frontends/Clipboard.h"
|
||||
@ -1055,7 +1056,8 @@ docstring selection(size_t sel_index, DocumentClassConstPtr docclass)
|
||||
if (sel_index >= theCuts.size())
|
||||
return docstring();
|
||||
|
||||
boost::scoped_ptr<Buffer> buffer(copyToTempBuffer(theCuts[sel_index].first, docclass));
|
||||
unique_ptr<Buffer> buffer(copyToTempBuffer(theCuts[sel_index].first,
|
||||
docclass));
|
||||
if (!buffer)
|
||||
return docstring();
|
||||
|
||||
|
17
src/LyX.cpp
17
src/LyX.cpp
@ -50,6 +50,7 @@
|
||||
#include "frontends/alert.h"
|
||||
#include "frontends/Application.h"
|
||||
|
||||
#include "support/bind.h"
|
||||
#include "support/ConsoleApplication.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/debug.h"
|
||||
@ -61,9 +62,7 @@
|
||||
#include "support/Messages.h"
|
||||
#include "support/os.h"
|
||||
#include "support/Package.h"
|
||||
|
||||
#include "support/bind.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@ -150,13 +149,13 @@ struct LyX::Impl {
|
||||
///
|
||||
CmdDef toplevel_cmddef_;
|
||||
///
|
||||
boost::scoped_ptr<Server> lyx_server_;
|
||||
unique_ptr<Server> lyx_server_;
|
||||
///
|
||||
boost::scoped_ptr<ServerSocket> lyx_socket_;
|
||||
unique_ptr<ServerSocket> lyx_socket_;
|
||||
///
|
||||
boost::scoped_ptr<frontend::Application> application_;
|
||||
unique_ptr<frontend::Application> application_;
|
||||
/// lyx session, containing lastfiles, lastfilepos, and lastopened
|
||||
boost::scoped_ptr<Session> session_;
|
||||
unique_ptr<Session> session_;
|
||||
|
||||
/// Files to load at start.
|
||||
vector<string> files_to_load_;
|
||||
@ -1415,7 +1414,7 @@ Server & theServer()
|
||||
// FIXME: this should not be use_gui dependent
|
||||
LWARNIF(use_gui);
|
||||
LAPPERR(singleton_);
|
||||
return *singleton_->pimpl_->lyx_server_.get();
|
||||
return *singleton_->pimpl_->lyx_server_;
|
||||
}
|
||||
|
||||
|
||||
@ -1424,7 +1423,7 @@ ServerSocket & theServerSocket()
|
||||
// FIXME: this should not be use_gui dependent
|
||||
LWARNIF(use_gui);
|
||||
LAPPERR(singleton_);
|
||||
return *singleton_->pimpl_->lyx_socket_.get();
|
||||
return *singleton_->pimpl_->lyx_socket_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,11 +41,6 @@ LyXVC::LyXVC()
|
||||
}
|
||||
|
||||
|
||||
// for the sake of boost::scoped_ptr
|
||||
LyXVC::~LyXVC()
|
||||
{}
|
||||
|
||||
|
||||
bool LyXVC::fileInVC(FileName const & fn)
|
||||
{
|
||||
if (!RCS::findFile(fn).empty())
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef LYX_VC_H
|
||||
#define LYX_VC_H
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -48,8 +48,6 @@ public:
|
||||
};
|
||||
///
|
||||
LyXVC();
|
||||
///
|
||||
~LyXVC();
|
||||
/// Is \p fn under version control?
|
||||
static bool fileInVC(support::FileName const & fn);
|
||||
/** Not a good name perhaps. This function should be called whenever
|
||||
@ -190,7 +188,7 @@ private:
|
||||
Buffer * owner_;
|
||||
|
||||
///
|
||||
boost::scoped_ptr<VCS> vcs;
|
||||
unique_ptr<VCS> vcs;
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,8 +19,7 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "support/Messages.h"
|
||||
#include "support/unicode.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
// getpid(), getppid()
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
@ -61,11 +60,10 @@
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
using ::boost::scoped_ptr;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
// Dummy LyXRC support
|
||||
@ -618,7 +616,7 @@ int LyXClientApp::run()
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
scoped_ptr<LyXDataSocket> server;
|
||||
unique_ptr<LyXDataSocket> server;
|
||||
|
||||
if (!cmdline::serverAddress.empty()) {
|
||||
server.reset(new LyXDataSocket(FileName(to_utf8(cmdline::serverAddress))));
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
boost::signals::connection cc_;
|
||||
|
||||
///
|
||||
boost::scoped_ptr<Converter> converter_;
|
||||
unique_ptr<Converter> converter_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include "ExternalTemplate.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/signals/trackable.hpp>
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ private:
|
||||
/// The current params
|
||||
InsetExternalParams params_;
|
||||
/// The thing that actually draws the image on LyX's screen.
|
||||
boost::scoped_ptr<RenderBase> renderer_;
|
||||
unique_ptr<RenderBase> renderer_;
|
||||
/// changes color of the button when mouse enters/leaves this inset
|
||||
mutable std::map<BufferView const *, bool> mouse_hover_;
|
||||
};
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
#include "Dimension.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -93,7 +94,7 @@ protected:
|
||||
void preparePreview(DocIterator const & pos) const;
|
||||
|
||||
///
|
||||
boost::scoped_ptr<RenderPreview> preview_;
|
||||
unique_ptr<RenderPreview> preview_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ void InsetInclude::fileChanged() const
|
||||
return;
|
||||
|
||||
preview_->removePreview(*buffer);
|
||||
add_preview(*preview_.get(), *this, *buffer);
|
||||
add_preview(*preview_, *this, *buffer);
|
||||
preview_->startLoading(*buffer);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
#include "RenderButton.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -164,7 +165,7 @@ private:
|
||||
docstring const include_label;
|
||||
|
||||
/// The pointer never changes although *preview_'s contents may.
|
||||
boost::scoped_ptr<RenderMonitoredPreview> const preview_;
|
||||
unique_ptr<RenderMonitoredPreview> const preview_;
|
||||
|
||||
///
|
||||
mutable bool failedtoload_;
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
#include "Dimension.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -80,7 +81,7 @@ protected:
|
||||
void preparePreview(DocIterator const & pos) const;
|
||||
|
||||
///
|
||||
boost::scoped_ptr<RenderPreview> preview_;
|
||||
unique_ptr<RenderPreview> preview_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -61,8 +61,7 @@
|
||||
#include "support/gettext.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@ -96,7 +95,7 @@ int const WIDTH_OF_LINE = 5; // space between double lines
|
||||
|
||||
|
||||
///
|
||||
boost::scoped_ptr<Tabular> paste_tabular;
|
||||
unique_ptr<Tabular> paste_tabular;
|
||||
|
||||
|
||||
struct TabularFeature {
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "DocIterator.h"
|
||||
#include "OutputEnums.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -258,7 +258,7 @@ private:
|
||||
///
|
||||
std::vector<InsetLabel *> label_;
|
||||
///
|
||||
boost::scoped_ptr<RenderPreview> preview_;
|
||||
unique_ptr<RenderPreview> preview_;
|
||||
///
|
||||
DocIterator docit_;
|
||||
///
|
||||
|
@ -22,8 +22,7 @@
|
||||
#include "support/debug.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/textutils.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "support/unique_ptr.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -255,9 +254,9 @@ void InsetMathSymbol::octave(OctaveStream & os) const
|
||||
|
||||
void InsetMathSymbol::write(WriteStream & os) const
|
||||
{
|
||||
boost::scoped_ptr<MathEnsurer> ensurer;
|
||||
unique_ptr<MathEnsurer> ensurer;
|
||||
if (currentMode() != TEXT_MODE)
|
||||
ensurer.reset(new MathEnsurer(os));
|
||||
ensurer = make_unique<MathEnsurer>(os);
|
||||
os << '\\' << name();
|
||||
|
||||
// $,#, etc. In theory the restriction based on catcodes, but then
|
||||
|
Loading…
Reference in New Issue
Block a user