std::unordered_map<
    std::string,
    inclusion_directives_settings_factory::field_definitions
    >
inclusion_directives_settings_factory::
make_field_definitions(const dynamic::repository& rp,
    const formatters::container& fc) const {
    std::unordered_map<std::string, field_definitions> r;

    for (const auto f : fc.all_external_formatters()) {
        const auto& oh(f->ownership_hierarchy());
        const auto fn(oh.formatter_name());

        if (fn.empty()) {
            BOOST_LOG_SEV(lg, error) << empty_formatter_name;
            BOOST_THROW_EXCEPTION(building_error(empty_formatter_name));
        }

        if (f->file_type() != formatters::file_types::cpp_header) {
            BOOST_LOG_SEV(lg, debug) << "Skipping formatter: " << fn;
            continue;
        }

        r[oh.formatter_name()] = make_field_definitions(rp, fn);
    }
    return r;
}
Ejemplo n.º 2
0
std::forward_list<std::shared_ptr<formattables::formattable> >
workflow::from_factory_activity(const config::cpp_options& opts,
    const dynamic::object& root_object,
    const dogen::formatters::general_settings_factory& gsf,
    settings::bundle_repository& brp,
    const std::unordered_map<std::string, settings::path_settings>& ps,
    const formattables::path_derivatives_repository& pdrp,
    formatter_properties_repository& fprp,
    const formatters::container& fc,
    const yarn::model& m) const {

    const auto& formatters(fc.all_formatters());
    std::forward_list<std::shared_ptr<formattables::formattable> > r;
    factory f;
    const auto& ro(root_object);
    const auto ri(f.make_registrar_info(opts, brp, ps, fprp, m));
    if (ri)
        r.push_front(ri);

    r.splice_after(r.before_begin(),
        f.make_includers(opts, ro, gsf, brp, ps, pdrp, formatters, fprp, m));
    r.splice_after(r.before_begin(),
        f.make_cmakelists(opts, ro, gsf, ps, fprp, m));

    const auto oi(f.make_odb_options(opts, ro, gsf, ps, fprp, m));
    if (oi)
        r.push_front(oi);

    BOOST_LOG_SEV(lg, debug) << "Factory formattables: " << r;
    return r;
}
Ejemplo n.º 3
0
std::unordered_map<std::string, settings::path_settings>
workflow::create_path_settings_activity(const dynamic::repository& rp,
    const dynamic::object& root_object,
    const formatters::container& fc) const {

    BOOST_LOG_SEV(lg, debug) << "Creating path settings for root object.";
    settings::path_settings_factory f(rp, fc.all_external_formatters());
    const auto r(f.make(root_object));
    BOOST_LOG_SEV(lg, debug) << "Created path settings for root object.";
    return r;
}
Ejemplo n.º 4
0
std::unordered_map<std::string, enablement_factory::field_definitions>
enablement_factory::create_field_definitions(
    const dynamic::repository& rp,
    const formatters::container& fc) const {
    const dynamic::repository_selector s(rp);

    std::unordered_map<std::string, field_definitions> r;
    for (const auto& f : fc.all_formatters()) {
        field_definitions fd;
        const auto oh(f->ownership_hierarchy());
        const auto& fn(oh.formatter_name());
        fd.enabled = s.select_field_by_name(fn, traits::enabled());

        const auto& fctn(oh.facet_name());
        fd.supported = s.select_field_by_name(fctn, traits::supported());
        r[fn] = fd;
    }
    return r;
}