46 std::map<std::string, std::vector<model::class_method>>;
58 for (
const auto &subpackage : p) {
59 if (
dynamic_cast<package *
>(subpackage.get()) !=
nullptr) {
61 const auto &sp =
dynamic_cast<package &
>(*subpackage);
72 subpackage.get(), [&](
auto *el) {
74 generator_.config().get_together_group(
75 el->full_name(false));
77 together_group_stack_.group_together(
78 together_group.value(), el);
81 generator_.generate_alias(*el, ostr);
82 generator_.generate(*el, ostr);
97 for (
const auto &p : generator_.model()) {
98 if (
auto *pkg =
dynamic_cast<package *
>(p.get()); pkg) {
100 generate(*pkg, ostr);
103 generator_.model().dynamic_apply(p.get(), [&](
auto *el) {
104 auto together_group =
105 generator_.config().get_together_group(
106 el->full_name(
false));
107 if (together_group) {
108 together_group_stack_.group_together(
109 together_group.value(), el);
112 generator_.generate_alias(*el, ostr);
113 generator_.generate(*el, ostr);
122 for (
const auto &subpackage : p) {
123 if (
dynamic_cast<package *
>(subpackage.get()) !=
nullptr) {
127 const auto &sp =
dynamic_cast<package &
>(*subpackage);
129 generate_relationships(sp, ostr);
132 generator_.model().dynamic_apply(
133 subpackage.get(), [&](
auto *el) {
134 if (generator_.model().should_include(*el)) {
135 generator_.generate_relationships(*el, ostr);
144 for (
const auto &p : generator_.model()) {
145 if (
auto *pkg =
dynamic_cast<package *
>(p.get()); pkg) {
146 generate_relationships(*pkg, ostr);
149 generator_.model().dynamic_apply(p.get(), [&](
auto *el) {
150 generator_.generate_relationships(*el, ostr);
158 for (
const auto &[group_name, group_elements] :
159 together_group_stack_.get_current_groups()) {
161 generator_.start_together_group(group_name, ostr);
163 for (
auto *e : group_elements) {
164 generator_.model().dynamic_apply(e, [&](
auto *el) {
165 generator_.generate_alias(*el, ostr);
166 generator_.generate(*el, ostr);
170 generator_.end_together_group(group_name, ostr);
174 template <
typename T>
177 if (generator_.config().member_order() ==
179 std::sort(elements.begin(), elements.end(),
180 [](
const auto &m1,
const auto &m2) {
181 return m1.name() < m2.name();
189 bool is_first_non_empty_group{
true};
191 for (
const auto &group : method_groups_) {
192 const auto &group_methods = methods.at(group);
193 if (!group_methods.empty()) {
194 if (!is_first_non_empty_group)
195 generator_.start_method_group(ostr);
196 is_first_non_empty_group =
false;
197 generator_.generate_methods(group_methods, ostr);
210 const std::vector<model::class_method> &methods)
const
212 std::map<std::string, std::vector<model::class_method>> result;
214 for (
const auto &g : method_groups_) {
218 for (
const auto &m : methods) {
219 if (m.is_constructor() || m.is_destructor()) {
220 result[
"constructors"].push_back(m);
222 else if (m.is_copy_assignment() || m.is_move_assignment()) {
223 result[
"assignment"].push_back(m);
225 else if (m.is_operator()) {
226 result[
"operators"].push_back(m);
229 result[
"other"].push_back(m);
237 const std::vector<std::string> method_groups_{
238 "constructors",
"assignment",
"operators",
"other"};