예제 #1
0
std::size_t decoration_properties_hasher::hash(const decoration_properties& v) {
    std::size_t seed(0);

    combine(seed, v.generate_decoration());
    combine(seed, hash_boost_optional_dogen_formatters_modeline(v.modeline()));
    combine(seed, hash_boost_optional_dogen_formatters_licence(v.licence()));
    combine(seed, v.code_generation_marker());

    return seed;
}
예제 #2
0
void decoration_formatter::format_postamble(std::ostream& s,
    const comment_styles& cs, const decoration_properties& dc) const {
    if (!dc.modeline())
        return;

    const auto m(*dc.modeline());
    if (m.location() == modeline_locations::bottom) {
        std::list<std::string> content;
        add_modeline(content, m);

        comment_formatter cf(
            !start_on_first_line,
            !use_documentation_tool_markup,
            !documenting_previous_identifier,
            cs,
            !last_line_is_blank);

        cf.format(s, content);
    }
}
예제 #3
0
void decoration_formatter::format_preamble(
    std::ostream& s, const comment_styles& single_line_cs,
    const comment_styles& multi_line_cs,
    const decoration_properties& dc) const {

    bool is_top(false);
    const auto top(modeline_locations::top);
    bool has_modeline(dc.modeline());
    std::list<std::string> content;
    if (has_modeline) {
        is_top = dc.modeline()->location() == top;

        if (is_top)
            add_modeline(content, *dc.modeline());
    }

    add_marker(content, dc.code_generation_marker());
    if (dc.licence())
        add_licence(content, *dc.licence());

    if (content.empty())
        return;

    if (has_modeline && is_top && content.size() == 1) {
        comment_formatter cf(
            start_on_first_line,
            !use_documentation_tool_markup,
            !documenting_previous_identifier,
            single_line_cs,
            !last_line_is_blank);

        cf.format(s, content, !line_between_blocks);
    } else {
        comment_formatter cf(
            is_top ? start_on_first_line : !start_on_first_line,
            !use_documentation_tool_markup,
            !documenting_previous_identifier,
            multi_line_cs,
            last_line_is_blank);

        cf.format(s, content, line_between_blocks);
    }
}