-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFamily.hpp
80 lines (64 loc) · 1.98 KB
/
Family.hpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// AmigaOS MUI C++ wrapper
//
// (c) 2022-2024 TDolphin
//
#pragma once
#include "Notify.hpp"
#undef Insert
#undef Remove
namespace MUI
{
class Family : public Notify
{
public:
explicit Family(Object *pMuiObject)
: Notify(pMuiObject)
{
}
Family(const Root &root)
: Notify(root.muiObject())
{
}
// instanceOf
const static std::string className;
static inline bool instanceOf(Object *pMuiObject)
{
return MUI::instanceOf(pMuiObject, className.c_str());
}
// is/get/set (attributes), all setters return object reference
// methods, some returns object reference
/// @brief [ @b MUIM_Family_Insert ]
Family &Insert(const MUI::Root &obj, const MUI::Root &pred);
/// @brief [ @b MUIM_Family_Remove ]
Family &Remove(const MUI::Root &obj);
};
template <typename T, typename U> class FamilyBuilderTemplate : public NotifyBuilderTemplate<T, U>
{
public:
FamilyBuilderTemplate(const std::string &uniqueId = MUI::EmptyUniqueId, const std::string &muiClassName = MUIC_Family)
: NotifyBuilderTemplate<T, U>(uniqueId, muiClassName)
{
}
/// @brief [ @b MUIA_Family_Child ]
T &tagChild(const MUI::Root &child);
/// @brief [ @b MUIA_Family_Child ]
T &tagChild(const Object *child);
};
class FamilyBuilder : public FamilyBuilderTemplate<FamilyBuilder, Family>
{
public:
FamilyBuilder();
};
template <typename T, typename U> inline T &FamilyBuilderTemplate<T, U>::tagChild(const MUI::Root &child)
{
this->PushTag(MUIA_Family_Child, child.muiObject(), false);
return (T &)*this;
}
template <typename T, typename U> inline T &FamilyBuilderTemplate<T, U>::tagChild(const Object *child)
{
if (child)
this->PushTag(MUIA_Family_Child, child, false);
return (T &)*this;
}
}