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_ATTRIBUTE_H
13 #define LCF_RPG_ATTRIBUTE_H
14 
15 // Headers
16 #include <stdint.h>
17 #include "lcf/dbstring.h"
18 #include "lcf/enum_tags.h"
19 #include "lcf/context.h"
20 #include <ostream>
21 #include <type_traits>
22 
23 /**
24  * rpg::Attribute class.
25  */
26 namespace lcf {
27 namespace rpg {
28 	class Attribute {
29 	public:
30 		enum Type {
31 			Type_physical = 0,
32 			Type_magical = 1
33 		};
34 		static constexpr auto kTypeTags = lcf::makeEnumTags<Type>(
35 			"physical",
36 			"magical"
37 		);
38 
39 		int ID = 0;
40 		DBString name;
41 		int32_t type = 0;
42 		int32_t a_rate = 300;
43 		int32_t b_rate = 200;
44 		int32_t c_rate = 100;
45 		int32_t d_rate = 50;
46 		int32_t e_rate = 0;
47 	};
48 	inline std::ostream& operator<<(std::ostream& os, Attribute::Type code) {
49 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
50 		return os;
51 	}
52 
53 	inline bool operator==(const Attribute& l, const Attribute& r) {
54 		return l.name == r.name
55 		&& l.type == r.type
56 		&& l.a_rate == r.a_rate
57 		&& l.b_rate == r.b_rate
58 		&& l.c_rate == r.c_rate
59 		&& l.d_rate == r.d_rate
60 		&& l.e_rate == r.e_rate;
61 	}
62 
63 	inline bool operator!=(const Attribute& l, const Attribute& r) {
64 		return !(l == r);
65 	}
66 
67 	std::ostream& operator<<(std::ostream& os, const Attribute& obj);
68 
69 	template <typename F, typename ParentCtx = Context<void,void>>
70 	void ForEachString(Attribute& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
71 		const auto ctx1 = Context<Attribute, ParentCtx>{ "name", -1, &obj, parent_ctx };
72 		f(obj.name, ctx1);
73 		(void)obj;
74 		(void)f;
75 		(void)parent_ctx;
76 	}
77 
78 } // namespace rpg
79 } // namespace lcf
80 
81 #endif
82