dogen::formatters::file class_header_formatter_stitch( assistant& a, const formattables::class_info& c) { { auto sbf(a.make_scoped_boilerplate_formatter()); const auto odbs(a.get_odb_settings()); if (!odbs || odbs->pragmas().empty()) { a.stream() << "// class has no ODB pragmas defined." << std::endl; a.stream() << std::endl; } else { { auto snf(a.make_scoped_namespace_formatter(c.namespaces())); a.stream() << std::endl; a.stream() << "#ifdef ODB_COMPILER" << std::endl; a.stream() << std::endl; const std::string odb_key("odb_pragma"); for (const auto& pg : odbs->pragmas()) a.stream() << "#pragma db object(" << c.name() << ") " << pg << std::endl; bool is_first(true); for (const auto p : c.properties()) { const auto podbs(a.get_odb_settings(p.id())); if (podbs) { for (const auto pg : podbs->pragmas()) { if (is_first) a.stream() << std::endl; is_first = false; a.stream() << "#pragma db member(" << c.name() << "::" << a.make_member_variable_name(p) << ") " << pg << std::endl; } } } a.stream() << std::endl; a.stream() << "#endif" << std::endl; a.stream() << std::endl; } a.stream() << std::endl; } } // sbf return a.make_file(); }
dogen::formatters::file class_implementation_formatter_stitch( assistant& a, const formattables::class_info& c) { { auto sbf(a.make_scoped_boilerplate_formatter()); a.add_helper_methods(c); { auto snf(a.make_scoped_namespace_formatter(c.namespaces())); const bool no_arg(!c.is_parent() && c.parents().empty() && c.properties().empty()); a.stream() << std::endl; a.stream() << "std::ostream& operator<<(std::ostream& s, const " << c.name() << "&" << (no_arg ? "" : " v") << ") {" << std::endl; if (c.is_parent() || !c.parents().empty()) { a.stream() << " v.to_stream(s);" << std::endl; a.stream() << " return(s);" << std::endl; } else io::inserter_implementation_helper_stitch(a, c, false/*inside_class*/); a.stream() << "}" << std::endl; a.stream() << std::endl; } // snf } // sbf return a.make_file(); }