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/IWORKSizeElement.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 "IWORKSizeElement.h"
11
12
#include "libetonyek_xml.h"
13
#include "IWORKCollector.h"
14
#include "IWORKDictionary.h"
15
#include "IWORKToken.h"
16
#include "IWORKXMLParserState.h"
17
18
namespace libetonyek
19
{
20
21
IWORKSizeElement::IWORKSizeElement(IWORKXMLParserState &state, boost::optional<IWORKSize> &size)
22
0
  : IWORKXMLEmptyContextBase(state)
23
0
  , m_size(size)
24
0
  , m_width()
25
0
  , m_height()
26
0
{
27
0
}
28
29
void IWORKSizeElement::attribute(const int name, const char *const value)
30
0
{
31
0
  switch (name)
32
0
  {
33
0
  case +IWORKToken::NS_URI_SFA | IWORKToken::w :
34
0
    m_width = try_double_cast(value);
35
0
    break;
36
0
  case +IWORKToken::NS_URI_SFA | IWORKToken::h :
37
0
    m_height = try_double_cast(value);
38
0
    break;
39
0
  default:
40
0
    ETONYEK_DEBUG_MSG(("IWORKSizeElement::attribute: find some unknown attribute\n"));
41
0
  }
42
0
}
43
44
void IWORKSizeElement::endOfElement()
45
0
{
46
0
  if (m_width && m_height)
47
0
    m_size = IWORKSize(get(m_width), get(m_height));
48
0
}
49
50
}
51
52
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */