mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Clean up pointer use:
* Use unique_ptr for Actions instead of manual memory management * Use unique_ptr in KeywordDatabase * Use unique_ptr instead of shared_ptr for file formats * Don't pass shared_ptr to Reader/Writer, use references instead Also * Switch to C++17 so we can use map::try_emplace
This commit is contained in:
@@ -28,21 +28,20 @@ DECLARE_POINTER_TYPE(Style);
|
||||
|
||||
/// Manager of the script context for a set
|
||||
class SetScriptContext {
|
||||
public:
|
||||
public:
|
||||
SetScriptContext(Set& set);
|
||||
virtual ~SetScriptContext();
|
||||
|
||||
/// Get a context to use for the set, for a given stylesheet
|
||||
Context& getContext(const StyleSheetP&);
|
||||
/// Get a context to use for the set, for a given card
|
||||
Context& getContext(const CardP&);
|
||||
|
||||
protected:
|
||||
Set& set; ///< Set for which we are managing scripts
|
||||
map<const StyleSheet*,Context*> contexts; ///< Context for evaluating scripts that use a given stylesheet
|
||||
protected:
|
||||
Set& set; ///< Set for which we are managing scripts
|
||||
map<const StyleSheet*,Context> contexts; ///< Context for evaluating scripts that use a given stylesheet
|
||||
|
||||
/// Called when a new context for a stylesheet is initialized
|
||||
virtual void onInit(const StyleSheetP& stylesheet, Context* ctx) {}
|
||||
virtual void onInit(const StyleSheetP& stylesheet, Context& ctx) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -73,7 +72,7 @@ class SetScriptManager : public SetScriptContext, public ActionListener {
|
||||
void updateAll();
|
||||
|
||||
private:
|
||||
virtual void onInit(const StyleSheetP& stylesheet, Context* ctx);
|
||||
void onInit(const StyleSheetP& stylesheet, Context& ctx) override;
|
||||
|
||||
void initDependencies(Context&, Game&);
|
||||
void initDependencies(Context&, StyleSheet&);
|
||||
|
||||
Reference in New Issue
Block a user