Exemple #1
0
void AssignmentNode::getFormat(QSharedPointer<ASTNode>& node, QString& format, QString& fnamespace) const {
    Formatter *fnode = static_cast<Formatter *>(node->child(0).data());
    format = fnode->format();
    fnamespace = fnode->fnamespace();

    if ( format == "" || format == sUNDEF) {
        Formatter *fnode = ScriptNode::activeFormat(itRASTER);
        if ( fnode) {
            format = fnode->format();
            fnamespace = fnode->fnamespace();
        }
    }
}
inline void QodeMagic_Text_Formatter_Test::test_format_1()
{
    Formatter sut;
    sut.setFirstLineLeftIndent(2);
    sut.setFirstLineRightIndent(5);
    sut.setParagraphLeftIndent(4);
    sut.setParagraphRightIndent(10);
    sut.setMaxLineLength(30);

    QString text("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                 "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                 "sdfl skgjskjfghkd f djkfshgkdfskg kdfh kdf kdjfgh dk jfsdkfgh dkjfgh kdjfhgksjdh "
                 "kdsjfghk jhdfgjsdhfkgj hsdkfjgh ksjdhgksdjhg kjdhsgkj ksjd dkfgd,fmgldkfmgl kdmfg"
                 " dlfkgl kdfjlgk jdflgkjdl kfgdslkfg sdfgsdlökjfgl sdlkfgjl sdkfjgl sdkfgjldskfgj "
                 "lfkgjdl kjdflgkdjlgk jdlkfgjld jlfgj fwe.");

    qDebug() << QString("RESULT:\n%1").arg(sut.format(text).join('\n'));
}
Exemple #3
0
    void format_entity(const Formatter& f, const Entity& e,
        const bool empty_out_content = false) {
        const auto fn(f.ownership_hierarchy().formatter_name());
        BOOST_LOG_SEV(lg, debug) << "Formatting: '" << e.name()
                                 << "' with '" << fn << "'";

        const auto ctx(factory_.make(e.id()));
        const auto fp(ctx.formatter_properties());
        const auto i(fp.find(fn));
        if (i == fp.end()) {
            BOOST_LOG_SEV(lg, error) << formatter_properties_not_found << fn;
            BOOST_THROW_EXCEPTION(
                workflow_error(formatter_properties_not_found + fn));
        }

        const auto is_formatter_enabled(i->second.enabled());
        if (!is_formatter_enabled) {
            BOOST_LOG_SEV(lg, debug) << "Formatter not enabled for type.";
            return;
        }

        auto file(f.format(ctx, e));

        if (empty_out_content) {
            BOOST_LOG_SEV(lg, debug) << "Emptying out content.";
            file.content().clear();
        }

        files_.push_front(file);
        if (!file.overwrite()) {
            BOOST_LOG_SEV(lg, debug) << "Filename: "
                                     << file.path().generic_string();
            BOOST_LOG_SEV(lg, debug) << "Content: "
                                     << (file.content().empty() ? "<empty>" :
                                         file.content());
            BOOST_LOG_SEV(lg, debug) << "Finished formatting: '" << e.name()
                                     << "'";
        } else {
            BOOST_LOG_SEV(lg, debug) << "Not dumping file contents to log "
                                     << "(overwrite is false).";
        }
    }
Exemple #4
0
    void format(const Formatter& f, const Formatable& e,
        const bool empty_out_content = false) {
        const auto fn(f.ownership_hierarchy().formatter_name());
        BOOST_LOG_SEV(lg, debug) << "Formatting with: '" << fn << "'";

        auto file(f.format(factory_.make_empty_context(), e));

        if (empty_out_content) {
            BOOST_LOG_SEV(lg, debug) << "Emptying out content.";
            file.content().clear();
        }

        files_.push_front(file);
        if (!file.overwrite()) {
            BOOST_LOG_SEV(lg, debug) << "Filename: "
                                     << file.path().generic_string();
            BOOST_LOG_SEV(lg, debug) << "Content: "
                                     << (file.content().empty() ? "<empty>" :
                                         file.content());
        } else {
            BOOST_LOG_SEV(lg, debug) << "Not dumping file contents to log "
                                     << "(overwrite is false).";
        }
    }
Exemple #5
0
 void format_diagnostics_callback(Func callback, Args... args)
 {
     callback(formatter.format(std::move(args)...));
 }
Exemple #6
0
 std::string format_diagnostics(Args... args)
 {
     return formatter.format(std::move(args)...);
 }
Exemple #7
0
 std::string format()
 {
     return formatter.format();
 }
VCharacter Font::formatVChar(VCharacter vchar, float row_size)
{
	Formatter formatter = Formatter(vchar, row_size);
	return formatter.format();
}