Coverage Report

Created: 2026-09-14 06:37

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