11 #include <unordered_map>
12 #include "GDCore/Project/MemoryTrackedRegistry.h"
13 #include "GDCore/String.h"
14 #include "GDCore/Project/ObjectGroupsContainer.h"
15 #include "GDCore/Project/ObjectFolderOrObject.h"
19 class SerializerElement;
58 SourceType GetSourceType()
const {
return sourceType; }
68 bool HasObjectNamed(
const gd::String& name)
const;
90 const gd::Object& GetObject(std::size_t index)
const;
100 std::size_t GetObjectPosition(
const gd::String& name)
const;
105 std::size_t GetObjectsCount()
const;
117 std::size_t position);
130 std::size_t position);
155 void MoveObject(std::size_t oldIndex, std::size_t newIndex);
165 void MoveObjectFolderOrObjectToAnotherContainerInFolder(
169 std::size_t newPosition);
182 const std::vector<std::unique_ptr<gd::Object> >&
GetObjects()
const {
183 return initialObjects;
186 std::set<gd::String> GetAllObjectNames()
const;
194 std::vector<const ObjectFolderOrObject*> GetAllObjectFolderOrObjects()
const;
200 void AddMissingObjectsInRootFolder();
209 void SerializeObjectsTo(SerializerElement& element)
const;
215 const SerializerElement& element);
219 void SerializeFoldersTo(SerializerElement& element)
const;
225 const SerializerElement& element);
246 std::vector<std::unique_ptr<gd::Object> >
251 SourceType sourceType = Unknown;
252 std::unique_ptr<gd::ObjectFolderOrObject> rootFolder;
260 mutable std::unordered_map<gd::String, gd::Object*> objectsByName;
261 mutable std::size_t objectsByNameGeneration = 0;
262 mutable bool objectsByNameUpToDate =
false;
272 void InvalidateObjectsByName() { objectsByNameUpToDate =
false; }
278 void Init(
const ObjectsContainer& other);
Represent a layout ( also called a scene ) of a project.
Definition: Layout.h:41
A non-copyable, non-movable member object that registers/unregisters its owner with MemoryTrackedRegi...
Definition: MemoryTrackedRegistry.h:238
Class representing a folder structure in order to organize objects in folders (to be used with an Obj...
Definition: ObjectFolderOrObject.h:31
A container for objects groups.
Definition: ObjectGroupsContainer.h:30
Represent an object of a platform.
Definition: Object.h:39
Used as a base class for classes that will own objects (see gd::Object).
Definition: ObjectsContainer.h:39
const ObjectGroupsContainer & GetObjectGroups() const
Return a const reference to the project's objects groups.
Definition: ObjectsContainer.h:241
const std::vector< std::unique_ptr< gd::Object > > & GetObjects() const
Definition: ObjectsContainer.h:182
std::vector< std::unique_ptr< gd::Object > > initialObjects
Objects contained.
Definition: ObjectsContainer.h:247
ObjectGroupsContainer & GetObjectGroups()
Return a reference to the project's objects groups.
Definition: ObjectsContainer.h:236
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:52
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24