summaryrefslogtreecommitdiff
path: root/test/testStructures.h
blob: 696605278bd8d286b9cf89f11b55d6ae802d446a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include <persistence.h>

struct AbsObject : public Persistence::Persistable {
	std::string base;

	bool persist(Persistence::PersistenceStore & store) override;

	virtual void dummy() const = 0;
};

struct SubObject : public AbsObject {
	std::string sub;

	bool persist(Persistence::PersistenceStore & store) override;

	void dummy() const override;

	[[nodiscard]] std::string getId() const override;
};

struct SubObject2 : public AbsObject {
	bool persist(Persistence::PersistenceStore & store) override;
	void dummy() const override;
};

struct TestObject : public Persistence::Persistable {
	TestObject() = default;

	float flt {};
	std::string str {};
	bool bl {};
	glm::vec3 pos {};
	std::vector<float> flts;
	std::vector<glm::vec3> poss;
	std::vector<std::vector<std::vector<std::string>>> nest;
	std::unique_ptr<TestObject> ptr;
	std::unique_ptr<AbsObject> aptr;
	std::vector<std::unique_ptr<TestObject>> vptr;

	unsigned int postLoadCalled {};

	bool persist(Persistence::PersistenceStore & store) override;
	void postLoad() override;
};

struct SharedTestObject : public Persistence::Persistable {
	SharedTestObject() = default;

	std::shared_ptr<AbsObject> sptr;
	std::shared_ptr<SubObject> ssptr;

	bool persist(Persistence::PersistenceStore & store) override;
};