LibreOffice Module sc (master)  1
sharedformulagroups.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #include <memory>
11 #include <sharedformulagroups.hxx>
12 #include <tokenarray.hxx>
13 
14 namespace sc {
15 
16 void SharedFormulaGroups::set( size_t nSharedId, std::unique_ptr<ScTokenArray> pArray )
17 {
18  m_Store.try_emplace(nSharedId, std::move(pArray), ScAddress(ScAddress::INITIALIZE_INVALID));
19 }
20 
21 void SharedFormulaGroups::set( size_t nSharedId, std::unique_ptr<ScTokenArray> pArray, const ScAddress& rOrigin )
22 {
23  m_Store.try_emplace(nSharedId, std::move(pArray), rOrigin);
24 }
25 
26 const ScTokenArray* SharedFormulaGroups::get( size_t nSharedId ) const
27 {
28  StoreType::const_iterator const it = m_Store.find(nSharedId);
29  return it == m_Store.end() ? nullptr : it->second.getTokenArray();
30 }
31 
33 {
34  StoreType::const_iterator const it = m_Store.find(nSharedId);
35  return it == m_Store.end() ? nullptr : &(it->second);
36 }
37 
38 }
39 
40 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SharedFormulaGroupEntry * getEntry(size_t nSharedId) const
const ScTokenArray * get(size_t nSharedId) const
void set(size_t nSharedId, std::unique_ptr< ScTokenArray > pArray)