Coverage Report

Created: 2025-03-04 07:22

/src/serenity/AK/Utf32View.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <AK/StringBuilder.h>
8
#include <AK/Utf32View.h>
9
10
namespace AK {
11
12
Optional<u32> Utf32CodePointIterator::peek(size_t offset) const
13
0
{
14
0
    if (offset == 0) {
15
0
        if (this->done())
16
0
            return {};
17
0
        return this->operator*();
18
0
    }
19
20
0
    auto new_iterator = *this;
21
0
    for (size_t index = 0; index < offset; ++index) {
22
0
        ++new_iterator;
23
0
        if (new_iterator.done())
24
0
            return {};
25
0
    }
26
27
0
    return *new_iterator;
28
0
}
29
30
bool Utf32View::operator==(Utf32View const& other) const
31
0
{
32
0
    ReadonlySpan<u32> code_points { m_code_points, m_length };
33
0
    ReadonlySpan<u32> other_code_points { other.m_code_points, other.m_length };
34
35
0
    return code_points == other_code_points;
36
0
}
37
38
ErrorOr<void> Formatter<Utf32View>::format(FormatBuilder& builder, Utf32View const& string)
39
0
{
40
0
    return builder.builder().try_append(string);
41
0
}
42
43
}