Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/ArrayView.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 * This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef MOZILLA_GFX_ARRAY_VIEW_H_
7
#define MOZILLA_GFX_ARRAY_VIEW_H_
8
9
#include "nsTArray.h"
10
11
/* This is similar to mfbt/Range.h but has implicit conversion
12
 * from nsTArray and less bounds checking.
13
 * For now, prefer Range over ArrayView */
14
15
namespace mozilla {
16
namespace gfx {
17
18
template<typename T>
19
class ArrayView
20
{
21
    public:
22
        MOZ_IMPLICIT ArrayView(const nsTArray<T>& aData) :
23
            mData(aData.Elements()), mLength(aData.Length())
24
0
        {
25
0
        }
Unexecuted instantiation: mozilla::gfx::ArrayView<pixman_box32>::ArrayView(nsTArray<pixman_box32> const&)
Unexecuted instantiation: mozilla::gfx::ArrayView<int>::ArrayView(nsTArray<int> const&)
26
        ArrayView(const T* aData, const size_t aLength) :
27
            mData(aData), mLength(aLength)
28
        {
29
        }
30
        const T& operator[](const size_t aIdx) const
31
0
        {
32
0
            return mData[aIdx];
33
0
        }
Unexecuted instantiation: mozilla::gfx::ArrayView<pixman_box32>::operator[](unsigned long) const
Unexecuted instantiation: mozilla::gfx::ArrayView<int>::operator[](unsigned long) const
34
        size_t Length() const
35
0
        {
36
0
            return mLength;
37
0
        }
38
        const T* Data() const
39
0
        {
40
0
            return mData;
41
0
        }
42
    private:
43
        const T* mData;
44
        const size_t mLength;
45
};
46
47
} // namespace gfx
48
} // namespace mozilla
49
50
#endif /* MOZILLA_GFX_ARRAY_VIEW_H_ */