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/PAG1AnnotationElement.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 "PAG1AnnotationElement.h"
11
12
#include "libetonyek_xml.h"
13
#include "IWORKToken.h"
14
#include "PAGCollector.h"
15
#include "PAG1ParserState.h"
16
17
namespace libetonyek
18
{
19
20
PAG1AnnotationElement::PAG1AnnotationElement(PAG1ParserState &state, IWORKXMLContext &container, bool isRef)
21
0
  : PAG1XMLElementContextBase(state)
22
0
  , m_container(container)
23
0
  , m_isRef(isRef)
24
0
  , m_id()
25
0
{
26
0
}
27
28
void PAG1AnnotationElement::attribute(const int name, const char *const value)
29
0
{
30
0
  switch (name)
31
0
  {
32
0
  case +IWORKToken::NS_URI_SFA | IWORKToken::ID : // annotation
33
0
    m_id = value;
34
0
    break;
35
0
  default:
36
0
    break;
37
0
  }
38
39
0
}
40
41
IWORKXMLContextPtr_t PAG1AnnotationElement::element(const int name)
42
0
{
43
0
  return m_container.element(name);
44
0
}
45
46
void PAG1AnnotationElement::text(const char *const value)
47
0
{
48
0
  return m_container.text(value);
49
0
}
50
51
void PAG1AnnotationElement::endOfElement()
52
0
{
53
0
  if (m_isRef || !bool(getState().m_currentText))
54
0
    return;
55
0
  if (!m_id)
56
0
  {
57
0
    ETONYEK_DEBUG_MSG(("PAG1AnnotationElement::endOfElement: oops call without id\n"));
58
0
  }
59
0
  else if (isCollector())
60
0
  {
61
0
    getCollector().collectText(getState().m_currentText);
62
0
    getCollector().sendAnnotation(get(m_id));
63
0
  }
64
0
}
65
66
}
67
68
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */