LCOV - code coverage report
Current view: top level - sc/source/core/data - columnset.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 21 0.0 %
Date: 2014-04-14 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "columnset.hxx"
      11             : 
      12             : namespace sc {
      13             : 
      14           0 : void ColumnSet::set(SCTAB nTab, SCCOL nCol)
      15             : {
      16           0 :     TabsType::iterator itTab = maTabs.find(nTab);
      17           0 :     if (itTab == maTabs.end())
      18             :     {
      19             :         std::pair<TabsType::iterator,bool> r =
      20           0 :             maTabs.insert(TabsType::value_type(nTab, ColsType()));
      21             : 
      22           0 :         if (!r.second)
      23             :             // insertion failed.
      24           0 :             return;
      25             : 
      26           0 :         itTab = r.first;
      27             :     }
      28             : 
      29           0 :     ColsType& rCols = itTab->second;
      30           0 :     rCols.insert(nCol);
      31             : }
      32             : 
      33           0 : void ColumnSet::getColumns(SCTAB nTab, std::vector<SCCOL>& rCols) const
      34             : {
      35           0 :     std::vector<SCCOL> aCols;
      36           0 :     TabsType::const_iterator itTab = maTabs.find(nTab);
      37           0 :     if (itTab == maTabs.end())
      38             :     {
      39           0 :         rCols.swap(aCols); // empty it.
      40           0 :         return;
      41             :     }
      42             : 
      43           0 :     const ColsType& rTabCols = itTab->second;
      44           0 :     aCols.assign(rTabCols.begin(), rTabCols.end());
      45             : 
      46             :     // Sort and remove duplicates.
      47           0 :     std::sort(aCols.begin(), aCols.end());
      48           0 :     std::vector<SCCOL>::iterator itCol = std::unique(aCols.begin(), aCols.end());
      49           0 :     aCols.erase(itCol, aCols.end());
      50             : 
      51           0 :     rCols.swap(aCols);
      52             : }
      53             : 
      54             : }
      55             : 
      56             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10