Coverage Report

Created: 2026-07-20 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/contexts/IWORKLineEndElement.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 "IWORKLineEndElement.h"
11
12
#include "libetonyek_xml.h"
13
#include "IWORKCollector.h"
14
#include "IWORKPath.h"
15
#include "IWORKPositionElement.h"
16
#include "IWORKToken.h"
17
#include "IWORKXMLParserState.h"
18
19
namespace libetonyek
20
{
21
22
namespace
23
{
24
class PathElement : public IWORKXMLEmptyContextBase
25
{
26
public:
27
  explicit PathElement(IWORKXMLParserState &state, boost::optional<std::string> &value);
28
29
private:
30
  void attribute(int name, const char *value) override;
31
  IWORKXMLContextPtr_t element(int name) override;
32
33
  boost::optional<std::string> &m_value;
34
  boost::optional<ID_t> m_id;
35
};
36
37
PathElement::PathElement(IWORKXMLParserState &state, boost::optional<std::string> &value)
38
0
  : IWORKXMLEmptyContextBase(state)
39
0
  , m_value(value)
40
0
  , m_id()
41
0
{
42
0
}
43
44
void PathElement::attribute(const int name, const char *const value)
45
0
{
46
0
  switch (name)
47
0
  {
48
0
  case +IWORKToken::ID | IWORKToken::NS_URI_SFA :
49
0
    m_id=value;
50
0
    break;
51
0
  case +IWORKToken::path | IWORKToken::NS_URI_SFA :
52
0
    m_value=value;
53
0
    break;
54
0
  case +IWORKToken::version | IWORKToken::NS_URI_SFA :
55
0
    break;
56
0
  default :
57
0
    ETONYEK_DEBUG_MSG(("PathElement::attribute[IWORKLineEndElement]: find unknown attribute\n"));
58
0
    IWORKXMLEmptyContextBase::attribute(name, value);
59
0
  }
60
0
}
61
62
IWORKXMLContextPtr_t PathElement::element(int /*name*/)
63
0
{
64
0
  ETONYEK_DEBUG_MSG(("PathElement::element[IWORKLineEndElement]: find unknown element\n"));
65
0
  return IWORKXMLContextPtr_t();
66
0
}
67
}
68
69
IWORKLineEndElement::IWORKLineEndElement(IWORKXMLParserState &state, boost::optional<IWORKMarker> &value)
70
0
  : IWORKXMLElementContextBase(state)
71
0
  , m_value(value)
72
0
  , m_id()
73
0
{
74
0
  m_value=IWORKMarker();
75
0
}
76
77
void IWORKLineEndElement::attribute(int name, const char *value)
78
0
{
79
0
  switch (name)
80
0
  {
81
0
  case +IWORKToken::NS_URI_SFA | IWORKToken::ID :
82
    /* checkme: do we need to store this element in the dictionary ?
83
       I never seen sf:line-end-ref so maybe not
84
     */
85
0
    m_id=value;
86
0
    break;
87
0
  case +IWORKToken::NS_URI_SF | IWORKToken::filled :
88
0
    m_value->m_filled = bool_cast(value);
89
0
    break;
90
0
  case +IWORKToken::NS_URI_SF | IWORKToken::identifier : // needed ?
91
0
    break;
92
0
  case +IWORKToken::NS_URI_SF | IWORKToken::scale :
93
0
    m_value->m_scale = double_cast(value);
94
0
    break;
95
0
  case +IWORKToken::NS_URI_SF | IWORKToken::path_join :
96
0
    m_value->m_pathJoin = int_cast(value);
97
0
    break;
98
0
  default:
99
0
    ETONYEK_DEBUG_MSG(("IWORKLineEndElement::attribute: find unknown attribute\n"));
100
0
  }
101
0
}
102
103
IWORKXMLContextPtr_t IWORKLineEndElement::element(const int name)
104
0
{
105
0
  switch (name)
106
0
  {
107
0
  case +IWORKToken::NS_URI_SF | IWORKToken::path :
108
0
    return std::make_shared<PathElement>(getState(), m_value->m_path);
109
0
  case +IWORKToken::NS_URI_SF | IWORKToken::end_point :
110
0
    return std::make_shared<IWORKPositionElement>(getState(), m_value->m_endPoint);
111
0
  default:
112
0
    break;
113
0
  }
114
115
0
  ETONYEK_DEBUG_MSG(("IWORKLineEndElement::element: find unknown element\n"));
116
0
  return IWORKXMLContextPtr_t();
117
0
}
118
119
}
120
121
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */