Replace scoped_ptr by unique_ptr

This commit is contained in:
Twan van Laarhoven
2020-04-25 22:28:32 +02:00
parent b7ed93cd02
commit 37c8641641
6 changed files with 7 additions and 13 deletions
+2 -3
View File
@@ -15,7 +15,6 @@
#include <util/io/package.hpp>
#include <data/field.hpp> // for Set::value
#include <data/keyword.hpp>
#include <boost/scoped_ptr.hpp>
DECLARE_POINTER_TYPE(Card);
DECLARE_POINTER_TYPE(Set);
@@ -132,9 +131,9 @@ class Set : public Packaged {
void reflect_cards (Tag& tag);
/// Object for managing and executing scripts
scoped_ptr<SetScriptManager> script_manager;
unique_ptr<SetScriptManager> script_manager;
/// Object for executing scripts from the thumbnail thread
scoped_ptr<SetScriptContext> thumbnail_script_context;
unique_ptr<SetScriptContext> thumbnail_script_context;
/// Cache of cards ordered by some criterion
map<pair<ScriptValueP,ScriptValueP>,OrderCacheP> order_cache;
map<ScriptValueP,int> filter_cache;
+1 -2
View File
@@ -11,7 +11,6 @@
#include <gui/thumbnail_thread.hpp>
#include <gui/util.hpp>
#include <gfx/gfx.hpp>
#include <boost/scoped_ptr.hpp>
#include <wx/url.h>
DECLARE_TYPEOF_COLLECTION(InstallablePackageP);
@@ -172,7 +171,7 @@ class PackageIconRequest : public ThumbnailRequest {
virtual Image generate() {
wxURL url(ti->package->description->icon_url);
scoped_ptr<wxInputStream> isP(url.GetInputStream());
unique_ptr<wxInputStream> isP(url.GetInputStream());
if (!isP) return wxImage();
SeekAtStartInputStream is2(*isP);
Image result(is2);
+1 -1
View File
@@ -51,7 +51,7 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
// Evaluate the current instruction
Instruction i = *instr++;
// If a scope is created, destroy it at end of block.
scoped_ptr<LocalScope> new_scope;
unique_ptr<LocalScope> new_scope;
switch (i.instr) {
case I_NOP: break;
+1 -1
View File
@@ -511,7 +511,7 @@ ScriptValueP ScriptClosure::simplify() {
}
ScriptValueP ScriptClosure::do_eval(Context& ctx, bool openScope) const {
scoped_ptr<LocalScope> scope(openScope ? new LocalScope(ctx) : nullptr);
unique_ptr<LocalScope> scope = openScope ? make_unique<LocalScope>(ctx) : nullptr;
applyBindings(ctx);
return fun->eval(ctx, openScope);
}
+2 -3
View File
@@ -15,7 +15,6 @@
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
#include <wx/dir.h>
#include <boost/scoped_ptr.hpp>
DECLARE_TYPEOF(Package::FileInfos);
DECLARE_TYPEOF_COLLECTION(PackageDependencyP);
@@ -401,9 +400,9 @@ void Package::saveToZipfile(const String& saveAs, bool remove_unused, bool is_co
wxRemoveFile(tempFile);
// open zip file
try {
scoped_ptr<wxFileOutputStream> newFile(new wxFileOutputStream(tempFile));
unique_ptr<wxFileOutputStream> newFile(new wxFileOutputStream(tempFile));
if (!newFile->IsOk()) throw PackageError(_ERROR_("unable to open output file"));
scoped_ptr<wxZipOutputStream> newZip(new wxZipOutputStream(*newFile));
unique_ptr<wxZipOutputStream> newZip(new wxZipOutputStream(*newFile));
if (!newZip->IsOk()) throw PackageError(_ERROR_("unable to open output file"));
// copy everything to a new zip file, unless it's updated or removed
if (zipStream) newZip->CopyArchiveMetaData(*zipStream);
-3
View File
@@ -23,9 +23,6 @@ using std::dynamic_pointer_cast;
using std::make_shared;
using std::make_unique;
// TODO: remove scoped_ptr
template <typename T> using scoped_ptr = unique_ptr<T>;
// ----------------------------------------------------------------------------- : Declaring
/// Declares the type TypeP as a shared_ptr<Type>