GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Effect.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #ifndef GDCORE_EFFECT_H
7 #define GDCORE_EFFECT_H
8 #include <map>
9 namespace gd {
10 class SerializerElement;
11 }
12 #include "GDCore/String.h"
13 
14 namespace gd {
15 
22 class GD_CORE_API Effect {
23  public:
24  Effect() : folded(false) {};
25  virtual ~Effect() {};
26 
27  void SetName(const gd::String& name_) { name = name_; }
28  const gd::String& GetName() const { return name; }
29 
30  void SetEffectType(const gd::String& effectType_) {
31  effectType = effectType_;
32  }
33  const gd::String& GetEffectType() const { return effectType; }
34 
35  void SetFolded(bool fold = true) { folded = fold; }
36  bool IsFolded() const { return folded; }
37 
38  void SetDoubleParameter(const gd::String& name, double value) {
39  doubleParameters[name] = value;
40  }
41 
42  double GetDoubleParameter(const gd::String& name) {
43  return doubleParameters[name];
44  }
45 
46  void SetStringParameter(const gd::String& name, const gd::String& value) {
47  stringParameters[name] = value;
48  }
49 
50  const gd::String& GetStringParameter(const gd::String& name) {
51  return stringParameters[name];
52  }
53 
54  void SetBooleanParameter(const gd::String& name, bool value) {
55  booleanParameters[name] = value;
56  }
57 
58  bool GetBooleanParameter(const gd::String& name) {
59  return booleanParameters[name];
60  }
61 
62  const std::map<gd::String, double>& GetAllDoubleParameters() const {
63  return doubleParameters;
64  }
65 
66  const std::map<gd::String, gd::String>& GetAllStringParameters() const {
67  return stringParameters;
68  }
69 
70  const std::map<gd::String, bool>& GetAllBooleanParameters() const {
71  return booleanParameters;
72  }
73 
74  void ClearParameters() {
75  doubleParameters.clear();
76  stringParameters.clear();
77  booleanParameters.clear();
78  }
79 
83  void SerializeTo(SerializerElement& element) const;
84 
88  void UnserializeFrom(const SerializerElement& element);
89 
90  private:
91  bool folded;
92  gd::String name;
93  gd::String effectType;
94  std::map<gd::String, double> doubleParameters;
95  std::map<gd::String, gd::String> stringParameters;
96  std::map<gd::String, bool> booleanParameters;
97 };
98 
99 } // namespace gd
100 #endif
Represents an effect that can be applied on a layer.
Definition: Effect.h:22
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24