Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/contexts/IWORKListTextIndentsProperty.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 "IWORKListTextIndentsProperty.h"
11
12
#include "IWORKDictionary.h"
13
#include "IWORKMutableArrayElement.h"
14
#include "IWORKNumberElement.h"
15
#include "IWORKPropertyMap.h"
16
#include "IWORKProperties.h"
17
#include "IWORKPushCollector.h"
18
#include "IWORKToken.h"
19
#include "IWORKXMLParserState.h"
20
21
namespace libetonyek
22
{
23
24
namespace
25
{
26
typedef IWORKMutableArrayElement<double, IWORKNumberElement<double>, IWORKPushCollector, +IWORKToken::NS_URI_SF | IWORKToken::number> MutableArrayElement;
27
}
28
29
IWORKListTextIndentsProperty::IWORKListTextIndentsProperty(IWORKXMLParserState &state, IWORKPropertyMap &propMap)
30
0
  : IWORKXMLElementContextBase(state)
31
0
  , m_propertyMap(propMap)
32
0
  , m_elements()
33
0
  , m_ref()
34
0
{
35
0
}
36
37
IWORKXMLContextPtr_t IWORKListTextIndentsProperty::element(const int name)
38
0
{
39
0
  switch (name)
40
0
  {
41
0
  case +IWORKToken::NS_URI_SF | IWORKToken::array :
42
0
  case +IWORKToken::NS_URI_SF | IWORKToken::mutable_array :
43
0
    return std::make_shared<MutableArrayElement>(getState(), getState().getDictionary().m_doubleArrays, m_elements);
44
0
  case +IWORKToken::NS_URI_SF | IWORKToken::array_ref :
45
0
  case +IWORKToken::NS_URI_SF | IWORKToken::mutable_array_ref :
46
0
    return std::make_shared<IWORKRefContext>(getState(), m_ref);
47
0
  default:
48
0
    break;
49
0
  }
50
0
  ETONYEK_DEBUG_MSG(("IWORKListTextIndentsProperty::element: unknown element %d\n", name));
51
0
  return IWORKXMLContextPtr_t();
52
0
}
53
54
void IWORKListTextIndentsProperty::endOfElement()
55
0
{
56
0
  if (m_ref)
57
0
  {
58
0
    const std::unordered_map<ID_t, std::deque<double> >::const_iterator it = getState().getDictionary().m_doubleArrays.find(get(m_ref));
59
0
    if (it != getState().getDictionary().m_doubleArrays.end())
60
0
      m_propertyMap.put<property::ListTextIndents>(it->second);
61
0
    else
62
0
    {
63
0
      ETONYEK_DEBUG_MSG(("IWORKListTextIndentsProperty::endOfElement: unknown element %s\n", get(m_ref).c_str()));
64
0
    }
65
0
  }
66
0
  else
67
0
    m_propertyMap.put<property::ListTextIndents>(m_elements);
68
0
}
69
70
}
71
72
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */