1 /* !!!! GENERATED FILE - DO NOT EDIT !!!!
2  * --------------------------------------
3  *
4  * This file is part of liblcf. Copyright (c) 2021 liblcf authors.
5  * https://github.com/EasyRPG/liblcf - https://easyrpg.org
6  *
7  * liblcf is Free/Libre Open Source Software, released under the MIT License.
8  * For the full copyright and license information, please view the COPYING
9  * file that was distributed with this source code.
10  */
11 
12 #ifndef LCF_RPG_TROOP_H
13 #define LCF_RPG_TROOP_H
14 
15 // Headers
16 #include <vector>
17 #include "lcf/dbbitarray.h"
18 #include "lcf/dbstring.h"
19 #include "lcf/rpg/troopmember.h"
20 #include "lcf/rpg/trooppage.h"
21 #include "lcf/context.h"
22 #include <ostream>
23 #include <type_traits>
24 
25 /**
26  * rpg::Troop class.
27  */
28 namespace lcf {
29 namespace rpg {
30 	class Troop {
31 	public:
32 		int ID = 0;
33 		DBString name;
34 		std::vector<TroopMember> members;
35 		bool auto_alignment = false;
36 		DBBitArray terrain_set;
37 		bool appear_randomly = false;
38 		std::vector<TroopPage> pages;
39 	};
40 
41 	inline bool operator==(const Troop& l, const Troop& r) {
42 		return l.name == r.name
43 		&& l.members == r.members
44 		&& l.auto_alignment == r.auto_alignment
45 		&& l.terrain_set == r.terrain_set
46 		&& l.appear_randomly == r.appear_randomly
47 		&& l.pages == r.pages;
48 	}
49 
50 	inline bool operator!=(const Troop& l, const Troop& r) {
51 		return !(l == r);
52 	}
53 
54 	std::ostream& operator<<(std::ostream& os, const Troop& obj);
55 
56 	template <typename F, typename ParentCtx = Context<void,void>>
57 	void ForEachString(Troop& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
58 		const auto ctx1 = Context<Troop, ParentCtx>{ "name", -1, &obj, parent_ctx };
59 		f(obj.name, ctx1);
60 		for (int i = 0; i < static_cast<int>(obj.members.size()); ++i) {
61 			const auto ctx2 = Context<Troop, ParentCtx>{ "members", i, &obj, parent_ctx };
62 			ForEachString(obj.members[i], f, &ctx2);
63 		}
64 		for (int i = 0; i < static_cast<int>(obj.pages.size()); ++i) {
65 			const auto ctx6 = Context<Troop, ParentCtx>{ "pages", i, &obj, parent_ctx };
66 			ForEachString(obj.pages[i], f, &ctx6);
67 		}
68 		(void)obj;
69 		(void)f;
70 		(void)parent_ctx;
71 	}
72 
73 } // namespace rpg
74 } // namespace lcf
75 
76 #endif
77