Exemple #1
0
void comment_formatter::add_comment_middle_marker(std::ostream& s) const {
    switch(style_) {
    case comment_styles::c_style:
        s << c_style_middle;
        break;
    case comment_styles::cpp_style:
        if (use_documentation_tool_markup_) {
            s << doxygen_cpp_style;
            if (documenting_previous_identifier_)
                s << doxygen_previous_identifier;
        } else
            s << plain_cpp_style;
        break;
    case comment_styles::shell_style:
        s << shell_style;
        break;
    case comment_styles::sql_style:
        s << sql_style;
        break;
    case comment_styles::csharp_style:
        if (use_documentation_tool_markup_) {
            s << doxygen_cpp_style;
        } else
            s << plain_cpp_style;
        break;
    default:
        const auto s(boost::lexical_cast<std::string>(style_));
        BOOST_LOG_SEV(lg, error) << unsupported_style << s;
        BOOST_THROW_EXCEPTION(formatting_error(unsupported_style + s));
    }
}
void helper_methods_formatter::smart_pointer_helper(
    formatters::nested_type_formatting_assistant& fa,
    const formattables::nested_type_info& t) const {
    const auto children(t.children());
    if (children.size() != 1) {
        BOOST_LOG_SEV(lg, error) << invalid_smart_pointer;
        BOOST_THROW_EXCEPTION(formatting_error(invalid_smart_pointer));
    }
    smart_pointer_helper_stitch(fa, t);
}
Exemple #3
0
void utility_formatter::insert_quote(const quote_types qt) const {
    switch(qt) {
    case quote_types::single_quote:
        stream_ << single_quote;
        return;
    case quote_types::double_quote:
        stream_ << double_quote;
        return;
    default:
        BOOST_LOG_SEV(lg, error) << unsupported_quote_type << qt;
        BOOST_THROW_EXCEPTION(formatting_error(
                unsupported_quote_type + boost::lexical_cast<std::string>(qt)));
    }
}
Exemple #4
0
void comment_formatter::validate() const {
    bool is_syle_supported(
        style_ == comment_styles::c_style ||
        style_ == comment_styles::shell_style ||
        style_ == comment_styles::sql_style ||
        style_ == comment_styles::csharp_style ||
        style_ == comment_styles::cpp_style);

    if (!is_syle_supported) {
        const auto s(boost::lexical_cast<std::string>(style_));
        BOOST_LOG_SEV(lg, error) << unsupported_style << s;
        BOOST_THROW_EXCEPTION(formatting_error(unsupported_style + s));
    }
}
Exemple #5
0
std::string utility_formatter::
escape_quote(const std::string& s, const quote_types qt) const {
    auto r(boost::replace_all_copy(s, escape, escape_escaped));
    switch(qt) {
    case quote_types::single_quote:
        boost::replace_all(r, single_quote, single_quote_escaped);
        break;
    case quote_types::double_quote:
        boost::replace_all(r, double_quote, double_quote_escaped);
        break;
    default:
        BOOST_LOG_SEV(lg, error) << unsupported_quote_type << qt;
        BOOST_THROW_EXCEPTION(formatting_error(
                unsupported_quote_type + boost::lexical_cast<std::string>(qt)));
    }
    return r;
}