differential code coverage report with master
Current view: top level - source/detail - constants.cpp (source / functions) Coverage Total Hit UBC CBC
Current: coverage.info Lines: 42.6 % 47 20 27 20
Current Date: 2025-12-15 23:01:28 Functions: 38.1 % 21 8 13 8
Baseline: coverage_master.info Branches: 46.7 % 90 42 96 84
Baseline Date: 2025-12-15 23:01:27

             Branch data    TLA  Line data    Source code
       1                 :                : // Copyright (c) 2014-2022 Thomas Fussell
       2                 :                : // Copyright (c) 2024-2025 xlnt-community
       3                 :                : //
       4                 :                : // Permission is hereby granted, free of charge, to any person obtaining a copy
       5                 :                : // of this software and associated documentation files (the "Software"), to deal
       6                 :                : // in the Software without restriction, including without limitation the rights
       7                 :                : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       8                 :                : // copies of the Software, and to permit persons to whom the Software is
       9                 :                : // furnished to do so, subject to the following conditions:
      10                 :                : //
      11                 :                : // The above copyright notice and this permission notice shall be included in
      12                 :                : // all copies or substantial portions of the Software.
      13                 :                : //
      14                 :                : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      15                 :                : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      16                 :                : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      17                 :                : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      18                 :                : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      19                 :                : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      20                 :                : // THE SOFTWARE
      21                 :                : //
      22                 :                : // @license: http://www.opensource.org/licenses/mit-license.php
      23                 :                : // @author: see AUTHORS file
      24                 :                : 
      25                 :                : #include <limits>
      26                 :                : 
      27                 :                : #include <xlnt/xlnt_config.hpp>
      28                 :                : #include <xlnt/utils/exceptions.hpp>
      29                 :                : #include <detail/constants.hpp>
      30                 :                : 
      31                 :                : namespace xlnt {
      32                 :                : 
      33                 :CBC         339 : row_t constants::min_row()
      34                 :                : {
      35                 :            339 :     return 1;
      36                 :                : }
      37                 :                : 
      38                 :          13137 : row_t constants::max_row()
      39                 :                : {
      40                 :          13137 :     return std::numeric_limits<row_t>::max();
      41                 :                : }
      42                 :                : 
      43                 :           1918 : const column_t constants::min_column()
      44                 :                : {
      45            [ + ]:           1918 :     return column_t(1);
      46                 :                : }
      47                 :                : 
      48                 :          14742 : const column_t constants::max_column()
      49                 :                : {
      50            [ + ]:          14742 :     return column_t(std::numeric_limits<column_t::index_t>::max());
      51                 :                : }
      52                 :                : 
      53                 :            529 : size_t constants::max_elements_for_reserve()
      54                 :                : {
      55                 :            529 :     return 10000;
      56                 :                : }
      57                 :                : 
      58                 :                : // constants
      59                 :UBC           0 : const path constants::package_properties()
      60                 :                : {
      61         [ #  # ]:              0 :     return path("docProps");
      62                 :                : }
      63                 :                : 
      64                 :CBC           7 : const path constants::package_xl()
      65                 :                : {
      66         [ +  + ]:             14 :     return path("/xl");
      67                 :                : }
      68                 :                : 
      69                 :UBC           0 : const path constants::package_root_rels()
      70                 :                : {
      71         [ #  # ]:              0 :     return path(std::string("_rels"));
      72                 :                : }
      73                 :                : 
      74                 :              0 : const path constants::package_theme()
      75                 :                : {
      76      [ #  #  # ]:              0 :     return package_xl().append("theme");
      77                 :                : }
      78                 :                : 
      79                 :              0 : const path constants::package_worksheets()
      80                 :                : {
      81      [ #  #  # ]:              0 :     return package_xl().append("worksheets");
      82                 :                : }
      83                 :                : 
      84                 :              0 : const path constants::package_drawings()
      85                 :                : {
      86      [ #  #  # ]:              0 :     return package_xl().append("drawings");
      87                 :                : }
      88                 :                : 
      89                 :              0 : const path constants::part_content_types()
      90                 :                : {
      91         [ #  # ]:              0 :     return path("[Content_Types].xml");
      92                 :                : }
      93                 :                : 
      94                 :              0 : const path constants::part_root_relationships()
      95                 :                : {
      96      [ #  #  # ]:              0 :     return package_root_rels().append(".rels");
      97                 :                : }
      98                 :                : 
      99                 :              0 : const path constants::part_core()
     100                 :                : {
     101      [ #  #  # ]:              0 :     return package_properties().append("core.xml");
     102                 :                : }
     103                 :                : 
     104                 :              0 : const path constants::part_app()
     105                 :                : {
     106      [ #  #  # ]:              0 :     return package_properties().append("app.xml");
     107                 :                : }
     108                 :                : 
     109                 :              0 : const path constants::part_workbook()
     110                 :                : {
     111      [ #  #  # ]:              0 :     return package_xl().append("workbook.xml");
     112                 :                : }
     113                 :                : 
     114                 :              0 : const path constants::part_styles()
     115                 :                : {
     116      [ #  #  # ]:              0 :     return package_xl().append("styles.xml");
     117                 :                : }
     118                 :                : 
     119                 :              0 : const path constants::part_theme()
     120                 :                : {
     121      [ #  #  # ]:              0 :     return package_theme().append("theme1.xml");
     122                 :                : }
     123                 :                : 
     124                 :              0 : const path constants::part_shared_strings()
     125                 :                : {
     126      [ #  #  # ]:              0 :     return package_xl().append("sharedStrings.xml");
     127                 :                : }
     128                 :                : 
     129                 :CBC        4854 : const std::unordered_map<std::string, std::string> &constants::namespaces()
     130                 :                : {
     131                 :                :     static const std::unordered_map<std::string, std::string> namespaces =
     132                 :                :         std::unordered_map<std::string, std::string>{
     133                 :                :             {"spreadsheetml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"},
     134                 :                :             {"content-types", "http://schemas.openxmlformats.org/package/2006/content-types"},
     135                 :                :             {"relationships", "http://schemas.openxmlformats.org/package/2006/relationships"},
     136                 :                :             {"drawingml", "http://schemas.openxmlformats.org/drawingml/2006/main"},
     137                 :                :             {"workbook", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"},
     138                 :                :             {"core-properties", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"},
     139                 :                :             {"extended-properties", "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},
     140                 :                :             {"custom-properties", "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"},
     141                 :                : 
     142                 :                :             {"encryption", "http://schemas.microsoft.com/office/2006/encryption"},
     143                 :                :             {"encryption-password", "http://schemas.microsoft.com/office/2006/keyEncryptor/password"},
     144                 :                :             {"encryption-certificate", "http://schemas.microsoft.com/office/2006/keyEncryptor/certificate"},
     145                 :                : 
     146                 :                :             {"dc", "http://purl.org/dc/elements/1.1/"},
     147                 :                :             {"dcterms", "http://purl.org/dc/terms/"},
     148                 :                :             {"dcmitype", "http://purl.org/dc/dcmitype/"},
     149                 :                :             {"mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"},
     150                 :                :             {"mx", "http://schemas.microsoft.com/office/mac/excel/2008/main"},
     151                 :                :             {"r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"},
     152                 :                :             {"thm15", "http://schemas.microsoft.com/office/thememl/2012/main"},
     153                 :                :             {"vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},
     154                 :                :             {"x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"},
     155                 :                :             {"x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},
     156                 :                :             {"x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"},
     157                 :                :             {"x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"},
     158                 :                :             {"xml", "http://www.w3.org/XML/1998/namespace"},
     159                 :                :             {"xsi", "http://www.w3.org/2001/XMLSchema-instance"},
     160                 :                : 
     161                 :                :             {"a", "http://schemas.openxmlformats.org/drawingml/2006/main"},
     162                 :                :             {"xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"},
     163                 :                : 
     164   [ +  +  +  -  :           4884 :             {"loext", "http://schemas.libreoffice.org/"}};
          +  +  +  -  -  
                   -  - ]
     165                 :                : 
     166                 :           4854 :     return namespaces;
     167   [ +  +  +  +  :              1 : }
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  -  
                -  -  - ]
     168                 :                : 
     169                 :           2427 : const std::string &constants::ns(const std::string &id)
     170                 :                : {
     171         [ +  + ]:           2427 :     auto match = namespaces().find(id);
     172                 :                : 
     173      [ +  -  + ]:           2427 :     if (match == namespaces().end())
     174                 :                :     {
     175         [ #  # ]:UBC           0 :         throw xlnt::exception("bad namespace");
     176                 :                :     }
     177                 :                : 
     178                 :CBC        4854 :     return match->second;
     179                 :                : }
     180                 :                : 
     181                 :                : } // namespace xlnt
        

Generated by: LCOV version 2.3.1-beta