LCOV - code coverage report
Current view: top level - source/ioutils - textTable.cpp (source / functions) Coverage Total Hit
Test: mxlib Lines: 72.7 % 11 8
Test Date: 2026-08-30 22:23:37 Functions: 50.0 % 2 1

            Line data    Source code
       1              : /** \file textTable.cpp
       2              :  * \brief implementation for a simple text table manager
       3              :  *
       4              :  * \author Jared R. Males (jaredmales@gmail.com)
       5              :  *
       6              :  * \ingroup asciiutils
       7              :  *
       8              :  */
       9              : 
      10              : //***********************************************************************//
      11              : // Copyright 2021 Jared R. Males (jaredmales@gmail.com)
      12              : //
      13              : // This file is part of mxlib.
      14              : //
      15              : // mxlib is free software: you can redistribute it and/or modify
      16              : // it under the terms of the GNU General Public License as published by
      17              : // the Free Software Foundation, either version 3 of the License, or
      18              : // (at your option) any later version.
      19              : //
      20              : // mxlib is distributed in the hope that it will be useful,
      21              : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      22              : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      23              : // GNU General Public License for more details.
      24              : //
      25              : // You should have received a copy of the GNU General Public License
      26              : // along with mxlib.  If not, see <http://www.gnu.org/licenses/>.
      27              : //***********************************************************************//
      28              : 
      29              : #include "ioutils/textTable.hpp"
      30              : 
      31              : /// The mxlib c++ namespace
      32              : namespace mx
      33              : {
      34              : namespace ioutils
      35              : {
      36           14 : void textTable::addCell( size_t row, size_t col, const std::string &cell )
      37              : {
      38              :     // Increase size if needed.
      39           14 :     if( row >= m_rows.size() )
      40              :     {
      41            1 :         size_t N = m_rows.size();
      42            4 :         for( size_t i = 0; i < row - N + 1; ++i )
      43              :         {
      44            9 :             m_rows.push_back( std::vector<std::vector<std::string>>( m_colWidths.size() ) );
      45              :         }
      46              :     }
      47              : 
      48           14 :     m_rows[row][col].clear();
      49           14 :     stringWrap( m_rows[row][col], cell, m_colWidths[col] );
      50           14 : }
      51              : 
      52            0 : void textTable::addCell( size_t row, size_t col, const char *cell )
      53              : {
      54            0 :     addCell( row, col, std::string( cell ) );
      55            0 : }
      56              : 
      57              : template void textTable::outPut<std::ostream>( std::ostream &ios );
      58              : 
      59              : } // namespace ioutils
      60              : } // namespace mx
        

Generated by: LCOV version 2.0-1