コード例 #1
0
bool BaseTable::addColumn(const ColumnDefinition& def){
    if ( _columnDefinitionsByName.contains(def.name())) {
        kernel()->issues()->log(TR("Adding duplicate column %1").arg(name()),IssueObject::itWarning);
        return false;
    }
    _columnDefinitionsByName[def.name()] = def;
    _columnDefinitionsByIndex[def.id()] = _columnDefinitionsByName[def.name()];
    _columns = _columnDefinitionsByName.size();

    return true;
}
コード例 #2
0
void AttributeDefinition::columndefinition(const ColumnDefinition &coldef)
{
    if ( coldef.id() >=  _columnDefinitionsByIndex.size())     {
        addColumn({coldef.name(), coldef.datadef().domain<>()});
    } else {
        auto iter1 = _columnDefinitionsByName.find(coldef.name());
        if ( iter1 != _columnDefinitionsByName.end()) {
            ColumnDefinition cdef = coldef;
            cdef.columnindex((*iter1).second);
            _columnDefinitionsByIndex[cdef.columnindex()] = cdef;
            (*iter1).second = cdef.columnindex();

        }else {
            addColumn(coldef);
        }
    }
}