GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
LayersContainer.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 
7 #pragma once
8 
9 #include <vector>
10 
11 #include "GDCore/Project/Layer.h"
12 #include "GDCore/String.h"
13 
14 namespace gd {
15 
21 class GD_CORE_API LayersContainer {
22  public:
24 
28  bool HasLayerNamed(const gd::String& name) const;
29 
33  Layer& GetLayer(const gd::String& name);
34 
38  const Layer& GetLayer(const gd::String& name) const;
39 
44  Layer& GetLayer(std::size_t index);
45 
50  const Layer& GetLayer(std::size_t index) const;
51 
55  std::size_t GetLayerPosition(const gd::String& name) const;
56 
60  std::size_t GetLayersCount() const;
61 
66  void InsertNewLayer(const gd::String& name, std::size_t position);
67 
74  void InsertLayer(const Layer& theLayer, std::size_t position);
75 
79  void RemoveLayer(const gd::String& name);
80 
84  void SwapLayers(std::size_t firstLayerIndex, std::size_t secondLayerIndex);
85 
89  void MoveLayer(std::size_t oldIndex, std::size_t newIndex);
90 
91  void Reset();
92 
96  void SerializeLayersTo(SerializerElement& element) const;
97 
101  void UnserializeLayersFrom(const SerializerElement& element);
102 
103  private:
104  static gd::Layer badLayer;
106  std::vector<gd::Layer> layers;
107 };
108 
109 } // namespace gd
Represents a layer of a layout.
Definition: Layer.h:91
Contains the layers for a scene or a custom object.
Definition: LayersContainer.h:21
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:31
Definition: CommonTools.h:24