1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "../ride/Ride.h"
13 #include "../world/Banner.h"
14 #include "../world/Entrance.h"
15 #include "../world/Footpath.h"
16 #include "../world/Scenery.h"
17 #include "../world/Water.h"
18 #include "Object.h"
19 #include "ObjectLimits.h"
20 
21 #include <vector>
22 
23 class ObjectList
24 {
25 private:
26     std::vector<std::vector<ObjectEntryDescriptor>> _subLists;
27 
28 public:
29     void Add(const ObjectEntryDescriptor& entry);
30     std::vector<ObjectEntryDescriptor>& GetList(ObjectType type);
31     std::vector<ObjectEntryDescriptor>& GetList(ObjectType type) const;
32     const ObjectEntryDescriptor& GetObject(ObjectType type, ObjectEntryIndex index) const;
33     void SetObject(ObjectEntryIndex index, const ObjectEntryDescriptor& entry);
34     void SetObject(ObjectType type, ObjectEntryIndex index, std::string_view identifier);
35     ObjectEntryIndex Find(ObjectType type, std::string_view identifier);
36 
37     struct const_iterator
38     {
39     private:
40         const ObjectList* _parent;
41         size_t _subList;
42         size_t _index;
43 
44         void MoveToNextEntry();
45 
46     public:
47         const_iterator(const ObjectList* parent, bool end);
48         const ObjectEntryDescriptor& operator*();
49         bool operator==(const_iterator& rhs);
50         bool operator!=(const_iterator& rhs);
51         const_iterator& operator++();
52         const_iterator operator++(int);
53     };
54 
55     const_iterator begin() const;
56     const_iterator end() const;
57 };
58 
59 void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex);
60