Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/IWORKXMLParserState.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libetonyek 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 "IWORKXMLParserState.h"
11
12
#include <memory>
13
14
#include "IWORKCollector.h"
15
#include "IWORKDictionary.h"
16
#include "IWORKParser.h"
17
#include "IWORKTable.h"
18
#include "IWORKText.h"
19
#include "IWORKTypes.h"
20
21
namespace libetonyek
22
{
23
24
IWORKXMLParserState::IWORKXMLParserState(IWORKParser &parser, IWORKCollector &collector, IWORKDictionary &dict)
25
0
  : m_tableData()
26
0
  , m_stylesheet()
27
0
  , m_enableCollector(true)
28
0
  , m_formatNameMap()
29
0
  , m_tableNameMap(std::make_shared<IWORKTableNameMap_t>())
30
0
  , m_langManager()
31
0
  , m_currentTable()
32
0
  , m_currentText()
33
0
  , m_parser(parser)
34
0
  , m_collector(collector)
35
0
  , m_dict(dict)
36
0
{
37
0
}
38
39
IWORKParser &IWORKXMLParserState::getParser()
40
0
{
41
0
  return m_parser;
42
0
}
43
44
IWORKDictionary &IWORKXMLParserState::getDictionary()
45
0
{
46
0
  return m_dict;
47
0
}
48
49
IWORKCollector &IWORKXMLParserState::getCollector() const
50
0
{
51
0
  return m_collector;
52
0
}
53
54
const IWORKTokenizer &IWORKXMLParserState::getTokenizer() const
55
0
{
56
0
  return m_parser.getTokenizer();
57
0
}
58
59
IWORKStylePtr_t IWORKXMLParserState::getStyleByName(const char *const name, const IWORKStyleMap_t &mainMap, bool mustExist) const
60
0
{
61
0
  if (!name)
62
0
  {
63
0
    ETONYEK_DEBUG_MSG(("IWORKXMLParserState::getStyleByName: called without name\n"));
64
0
    return IWORKStylePtr_t();
65
0
  }
66
0
  const IWORKStyleMap_t::const_iterator it = mainMap.find(name);
67
0
  if (mainMap.end() != it)
68
0
    return it->second;
69
0
  if (m_stylesheet && m_stylesheet->m_styles.find(name)!=m_stylesheet->m_styles.end())
70
0
    return m_stylesheet->m_styles.find(name)->second;
71
0
  if (mustExist)
72
0
  {
73
0
    ETONYEK_DEBUG_MSG(("IWORKXMLParserState::getStyleByName: unknown style %s\n", name));
74
0
  }
75
0
  return IWORKStylePtr_t();
76
0
}
77
78
}
79
80
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */