summaryrefslogtreecommitdiffstats
path: root/include/ixion/cell_access.hpp
blob: 63c53231939fd8121700fead790f6d1faabd9e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_IXION_CELL_ACCESS_HPP
#define INCLUDED_IXION_CELL_ACCESS_HPP

#include "types.hpp"

#include <memory>
#include <string>

namespace ixion {

class model_context;
class formula_cell;
class formula_result;
struct abs_address_t;

/**
 * This class provides a read-only access to a single cell.  It's more
 * efficient to use this class if you need to make multiple successive
 * queries to the same cell.
 *
 * Note that an instance of this class will get invalidated when the content
 * of ixion::model_context is modified.
 */
class IXION_DLLPUBLIC cell_access
{
    friend class model_context;

    struct impl;
    std::unique_ptr<impl> mp_impl;

    cell_access(const model_context& cxt, const abs_address_t& addr);
public:
    cell_access(cell_access&& other);
    cell_access& operator= (cell_access&& other);
    ~cell_access();

    celltype_t get_type() const;

    cell_value_t get_value_type() const;

    const formula_cell* get_formula_cell() const;

    formula_result get_formula_result() const;

    double get_numeric_value() const;

    bool get_boolean_value() const;

    std::string_view get_string_value() const;

    string_id_t get_string_identifier() const;

    formula_error_t get_error_value() const;
};

}

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */