Coverage Report

Created: 2025-11-07 06:50

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
32.3k
    UVector(status)
18
32.3k
{
19
32.3k
}
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
22.8k
    UVector(d, c, status)
28
22.8k
{
29
22.8k
}
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
55.1k
UStack::~UStack() {}
37
38
464k
void* UStack::pop() {
39
464k
    int32_t n = size() - 1;
40
464k
    void* result = nullptr;
41
464k
    if (n >= 0) {
42
464k
        result = orphanElementAt(n);
43
464k
    }
44
464k
    return result;
45
464k
}
46
47
934k
int32_t UStack::popi() {
48
934k
    int32_t n = size() - 1;
49
934k
    int32_t result = 0;
50
934k
    if (n >= 0) {
51
934k
        result = elementAti(n);
52
934k
        removeElementAt(n);
53
934k
    }
54
934k
    return result;
55
934k
}
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