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/IWORKBinaryElement.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 "IWORKBinaryElement.h"
11
12
#include <memory>
13
14
#include "IWORKDataElement.h"
15
#include "IWORKDictionary.h"
16
#include "IWORKSizeElement.h"
17
#include "IWORKToken.h"
18
#include "IWORKXMLParserState.h"
19
20
namespace libetonyek
21
{
22
23
IWORKBinaryElement::IWORKBinaryElement(IWORKXMLParserState &state, IWORKMediaContentPtr_t &value)
24
0
  : IWORKXMLElementContextBase(state)
25
0
  , m_value(value)
26
0
  , m_size()
27
0
  , m_data()
28
0
  , m_fillColor()
29
0
{
30
0
}
31
32
IWORKXMLContextPtr_t IWORKBinaryElement::element(const int name)
33
0
{
34
0
  switch (name)
35
0
  {
36
0
  case +IWORKToken::NS_URI_SF | IWORKToken::data :
37
0
    return std::make_shared<IWORKDataElement>(getState(), m_data, m_fillColor);
38
0
  case +IWORKToken::NS_URI_SF | IWORKToken::size :
39
0
    return std::make_shared<IWORKSizeElement>(getState(), m_size);
40
0
  default:
41
0
    break;
42
0
  }
43
0
  return IWORKXMLContextPtr_t();
44
0
}
45
46
void IWORKBinaryElement::endOfElement()
47
0
{
48
0
  IWORKMediaContentPtr_t binary;
49
50
0
  if (bool(m_data) || bool(m_fillColor))
51
0
  {
52
0
    binary = std::make_shared<IWORKMediaContent>();
53
0
    binary->m_data = m_data;
54
0
    binary->m_fillColor = m_fillColor;
55
0
    binary->m_size = m_size;
56
0
  }
57
58
0
  m_value = binary;
59
0
  if (getId())
60
0
    getState().getDictionary().m_binaries[get(getId())] = m_value;
61
0
}
62
63
}
64
65
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */