Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/contexts/IWORKPtrPropertyContext.h
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
#ifndef IWORKPTRPROPERTYCONTEXT_H_INCLUDED
11
#define IWORKPTRPROPERTYCONTEXT_H_INCLUDED
12
13
#include "IWORKPropertyContextBase.h"
14
#include "IWORKPropertyInfo.h"
15
16
namespace libetonyek
17
{
18
19
template<typename Property, typename Context, int TokenId>
20
class IWORKPtrPropertyContext : public IWORKPropertyContextBase
21
{
22
public:
23
  IWORKPtrPropertyContext(IWORKXMLParserState &state, IWORKPropertyMap &propMap);
24
25
private:
26
  IWORKXMLContextPtr_t element(int name) override;
27
  void endOfElement() override;
28
29
private:
30
  typename IWORKPropertyInfo<Property>::ValueType m_value;
31
};
32
33
template<typename Property, typename Context, int TokenId>
34
IWORKPtrPropertyContext<Property, Context, TokenId>::IWORKPtrPropertyContext(IWORKXMLParserState &state, IWORKPropertyMap &propMap)
35
0
  : IWORKPropertyContextBase(state, propMap)
36
0
  , m_value()
37
0
{
38
0
}
39
40
template<typename Property, typename Context, int TokenId>
41
IWORKXMLContextPtr_t IWORKPtrPropertyContext<Property, Context, TokenId>::element(const int name)
42
0
{
43
0
  m_default = false;
44
0
  if (TokenId == name)
45
0
    return std::make_shared<Context>(getState(), m_value);
46
0
  return IWORKXMLContextPtr_t();
47
0
}
48
49
template<typename Property, typename Context, int TokenId>
50
void IWORKPtrPropertyContext<Property, Context, TokenId>::endOfElement()
51
0
{
52
0
  if (bool(m_value))
53
0
    m_propMap.put<Property>(m_value);
54
0
  else if (m_default)
55
0
    m_propMap.clear<Property>();
56
0
}
57
58
}
59
60
#endif // IWORKPTRPROPERTYCONTEXT_H_INCLUDED
61
62
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */