Exemple #1
0
void RelationData::save(QTextStream & st, bool ref, QString & warning) const
{
    if (ref)
        st << "relation_ref " << get_ident() << " // " << (name);
    else {
        nl_indent(st);
        st << "relation " << get_ident() << " " << stringify(type);

        if (name != default_name(type)) {
            st << " name ";
            save_string(name, st);
        }

        indent(+1);

        BasicData::save(st, warning);

        if (original_id != 0) {
            nl_indent(st);
            st << "oid " << original_id;
        }

        bool assoc = isa_association(type);

        nl_indent(st);
        indent(+1);
        st << "a ";
        save_role(a, assoc, st, warning);
        start->save(st, TRUE, warning);
        indent(-1);

        nl_indent(st);
        indent(+1);
        st << "b";

        if (!RelationData::uni_directional(type)) {
            st << " ";
            save_role(b, assoc, st, warning);
            end->save(st, TRUE, warning);
        }
        else {
            if (!b.multiplicity.isEmpty()) {
                st << " multiplicity ";
                save_string(b.multiplicity, st);
            }

            st << " parent ";
            end_removed_from->save(st, TRUE, warning);
        }

        indent(-1);

        if ((association.type != 0) || !association.explicit_type.isEmpty()) {
            nl_indent(st);
            association.save(st, warning, "association_type ", "association_explicit_type ");
        }

        indent(-1);
    }
}
Exemple #2
0
void save_data()
{
    uint8_t *p = START_EEPROM;
    p = save_id(p);
    p = save_role(p);
    p = save_neighs(p);
    p = save_seeders(p);
    if(get_role() == SEEDER)
        p = save_refs(p);

    uint8_t *cp = START_EEPROM;
    cp = check_id(cp);
    cp = check_role(cp);
    cp = check_neighs(cp);
    cp = check_seeders(cp);
    if(get_role() == SEEDER)
        cp = check_refs(cp);
}