summaryrefslogtreecommitdiffstats
path: root/src/libixion/debug.cpp
blob: f790ada5730a5299f2fa054153ca6ebe4d7b1158 (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
/* -*- 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/.
 */

#include "debug.hpp"
#include "ixion/formula_name_resolver.hpp"
#include "ixion/formula_tokens.hpp"
#include "ixion/cell.hpp"
#include "ixion/formula.hpp"

#include <sstream>

namespace ixion { namespace detail {

std::string print_formula_expression(const model_context& cxt, const abs_address_t& pos, const formula_cell& cell)
{
    auto resolver = formula_name_resolver::get(formula_name_resolver_t::excel_a1, &cxt);
    assert(resolver);
    const formula_tokens_t& tokens = cell.get_tokens()->get();
    return print_formula_tokens(cxt, pos, *resolver, tokens);
}

std::string print_formula_token_repr(const formula_token& t)
{
    std::ostringstream os;
    os << t;
    return os.str();
}

}}

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