Coverage Report

Created: 2025-10-10 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/logging-log4cxx/src/main/cpp/asyncbuffer.cpp
Line
Count
Source
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
#include <log4cxx/helpers/asyncbuffer.h>
19
20
namespace LOG4CXX_NS
21
{
22
23
namespace helpers
24
{
25
26
struct AsyncBuffer::Private
27
{
28
  std::vector<MessageBufferAppender> data;
29
};
30
31
/** An empty buffer.
32
*/
33
AsyncBuffer::AsyncBuffer()
34
3.75k
{}
35
36
/** A new buffer with the content of \c other
37
*/
38
AsyncBuffer::AsyncBuffer(AsyncBuffer&& other)
39
0
  : m_priv(std::move(other.m_priv))
40
0
{
41
0
}
42
43
/** Release resources.
44
*/
45
AsyncBuffer::~AsyncBuffer()
46
3.75k
{
47
3.75k
}
48
49
/**
50
* Has no item been added to this?
51
*/
52
0
bool AsyncBuffer::empty() const { return !m_priv || m_priv->data.empty(); }
53
54
/**
55
* Add text version of buffered values to \c msg
56
*/
57
void AsyncBuffer::renderMessage(LogCharMessageBuffer& msg)
58
0
{
59
0
  if (m_priv)
60
0
    for (auto& renderer : m_priv->data)
61
0
      renderer(msg);
62
0
}
63
64
/**
65
* Remove all message appenders
66
*/
67
void AsyncBuffer::clear()
68
0
{
69
0
  if (m_priv)
70
0
    m_priv->data.clear();
71
0
}
72
73
/**
74
 *   Append \c function to this buffer.
75
 */
76
void AsyncBuffer::append(const MessageBufferAppender& f)
77
0
{
78
0
  if (!m_priv)
79
0
    m_priv = std::make_unique<Private>();
80
0
  m_priv->data.push_back(f);
81
0
}
82
83
} // namespace helpers
84
} // namespace LOG4CXX_NS
85