Ejemplo n.º 1
0
cell worksheet::get_cell(const cell_reference &reference)
{
    if (d_->cell_map_.find(reference.get_row()) == d_->cell_map_.end())
    {
        d_->cell_map_[reference.get_row()] = std::unordered_map<column_t, detail::cell_impl>();
    }

    auto &row = d_->cell_map_[reference.get_row()];

    if (row.find(reference.get_column_index()) == row.end())
    {
        row[reference.get_column_index()] = detail::cell_impl(d_, reference.get_column_index(), reference.get_row());
    }

    return cell(&row[reference.get_column_index()]);
}
Ejemplo n.º 2
0
bool worksheet::has_cell(const cell_reference &reference) const
{
    const auto row = d_->cell_map_.find(reference.get_row());
    if(row == d_->cell_map_.cend())
        return false;
    
    const auto col = row->second.find(reference.get_column_index());
    if(col == row->second.cend())
        return false;
    
    return true;
}
Ejemplo n.º 3
0
const cell worksheet::get_cell(const cell_reference &reference) const
{
    return cell(&d_->cell_map_.at(reference.get_row()).at(reference.get_column_index()));
}
Ejemplo n.º 4
0
std::size_t cell_reference_hash::operator()(const cell_reference &k) const
{
    return k.get_row() * constants::MaxColumn().index + k.get_column_index().index;
}