Use std::enable_shared_from_this instead of thisP parameters.

This commit is contained in:
Twan van Laarhoven
2020-05-06 22:59:10 +02:00
parent b4435e5e57
commit e005d47d56
20 changed files with 114 additions and 118 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
ScriptType GeneratedImage::type() const { return SCRIPT_IMAGE; }
String GeneratedImage::typeName() const { return _TYPE_("image"); }
GeneratedImageP GeneratedImage::toImage(const ScriptValueP& thisP) const {
return static_pointer_cast<GeneratedImage>(thisP);
GeneratedImageP GeneratedImage::toImage() const {
return const_cast<GeneratedImage*>(this)->intrusive_from_this();
}
Image GeneratedImage::generateConform(const Options& options) const {
+2 -2
View File
@@ -23,7 +23,7 @@ class Package;
/// An image that is generated from a script.
/** The actual generation is independend of the script execution
*/
class GeneratedImage : public ScriptValue {
class GeneratedImage : public ScriptValue, public IntrusiveFromThis<GeneratedImage> {
public:
/// Options for generating the image
struct Options {
@@ -62,7 +62,7 @@ class GeneratedImage : public ScriptValue {
ScriptType type() const override;
String typeName() const override;
GeneratedImageP toImage(const ScriptValueP& thisP) const override;
GeneratedImageP toImage() const override;
};
/// Resize an image to conform to the options