Coverage Report

Created: 2026-10-31 06:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/icu/icu4c/source/common/ustack.cpp
Line
Count
Source
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
**********************************************************************
5
*   Copyright (C) 2003-2011, International Business Machines
6
*   Corporation and others.  All Rights Reserved.
7
**********************************************************************
8
*/
9
10
#include "uvector.h"
11
12
U_NAMESPACE_BEGIN
13
14
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UStack)
15
16
UStack::UStack(UErrorCode &status) :
17
40.1k
    UVector(status)
18
40.1k
{
19
40.1k
}
20
21
UStack::UStack(int32_t initialCapacity, UErrorCode &status) :
22
0
    UVector(initialCapacity, status)
23
0
{
24
0
}
25
26
UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, UErrorCode &status) :
27
21.7k
    UVector(d, c, status)
28
21.7k
{
29
21.7k
}
30
31
UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UErrorCode &status) :
32
0
    UVector(d, c, initialCapacity, status)
33
0
{
34
0
}
35
36
61.8k
UStack::~UStack() {}
37
38
335k
void* UStack::pop() {
39
335k
    int32_t n = size() - 1;
40
335k
    void* result = nullptr;
41
335k
    if (n >= 0) {
42
335k
        result = orphanElementAt(n);
43
335k
    }
44
335k
    return result;
45
335k
}
46
47
8.22M
int32_t UStack::popi() {
48
8.22M
    int32_t n = size() - 1;
49
8.22M
    int32_t result = 0;
50
8.22M
    if (n >= 0) {
51
8.22M
        result = elementAti(n);
52
8.22M
        removeElementAt(n);
53
8.22M
    }
54
8.22M
    return result;
55
8.22M
}
56
57
0
int32_t UStack::search(void* obj) const {
58
0
    int32_t i = indexOf(obj);
59
0
    return (i >= 0) ? size() - i : i;
60
0
}
61
62
U_NAMESPACE_END