Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/ftw/qlazilyallocated_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | template<typename T> | - | ||||||
6 | class QLazilyAllocated { | - | ||||||
7 | public: | - | ||||||
8 | inline QLazilyAllocated(); | - | ||||||
9 | inline ~QLazilyAllocated(); | - | ||||||
10 | - | |||||||
11 | inline bool isAllocated() const; | - | ||||||
12 | - | |||||||
13 | inline T *operator->() const; | - | ||||||
14 | - | |||||||
15 | inline T &value(); | - | ||||||
16 | inline const T &value() const; | - | ||||||
17 | - | |||||||
18 | inline bool flag() const; | - | ||||||
19 | inline void setFlag(); | - | ||||||
20 | inline void clearFlag(); | - | ||||||
21 | inline void setFlagValue(bool); | - | ||||||
22 | private: | - | ||||||
23 | mutable QFlagPointer<T> d; | - | ||||||
24 | }; | - | ||||||
25 | - | |||||||
26 | template<typename T> | - | ||||||
27 | QLazilyAllocated<T>::QLazilyAllocated() | - | ||||||
28 | { | - | ||||||
29 | } | - | ||||||
30 | - | |||||||
31 | template<typename T> | - | ||||||
32 | QLazilyAllocated<T>::~QLazilyAllocated() | - | ||||||
33 | { | - | ||||||
34 | delete *d; | - | ||||||
35 | } executed 695234 times by 124 tests: end of block Executed by:
| 695234 | ||||||
36 | - | |||||||
37 | template<typename T> | - | ||||||
38 | bool QLazilyAllocated<T>::isAllocated() const | - | ||||||
39 | { | - | ||||||
40 | return executed 43176982 times by 128 tests: !d.isNull();return !d.isNull(); Executed by:
executed 43176982 times by 128 tests: return !d.isNull(); Executed by:
| 43176982 | ||||||
41 | } | - | ||||||
42 | - | |||||||
43 | template<typename T> | - | ||||||
44 | T &QLazilyAllocated<T>::value() | - | ||||||
45 | { | - | ||||||
46 | if (d.isNull()
executed 136357 times by 121 tests: d = new T; Executed by:
| 136357-1072582 | ||||||
47 | return executed 1208939 times by 121 tests: *(*d);return *(*d); Executed by:
executed 1208939 times by 121 tests: return *(*d); Executed by:
| 1208939 | ||||||
48 | } | - | ||||||
49 | - | |||||||
50 | template<typename T> | - | ||||||
51 | const T &QLazilyAllocated<T>::value() const | - | ||||||
52 | { | - | ||||||
53 | if (d.isNull()
executed 14 times by 2 tests: d = new T; Executed by:
| 14-11398 | ||||||
54 | return executed 11412 times by 25 tests: *(*d);return *(*d); Executed by:
executed 11412 times by 25 tests: return *(*d); Executed by:
| 11412 | ||||||
55 | } | - | ||||||
56 | - | |||||||
57 | template<typename T> | - | ||||||
58 | T *QLazilyAllocated<T>::operator->() const | - | ||||||
59 | { | - | ||||||
60 | return executed 8028725 times by 121 tests: *d;return *d; Executed by:
executed 8028725 times by 121 tests: return *d; Executed by:
| 8028725 | ||||||
61 | } | - | ||||||
62 | - | |||||||
63 | template<typename T> | - | ||||||
64 | bool QLazilyAllocated<T>::flag() const | - | ||||||
65 | { | - | ||||||
66 | return executed 19879 times by 20 tests: d.flag();return d.flag(); Executed by:
executed 19879 times by 20 tests: return d.flag(); Executed by:
| 19879 | ||||||
67 | } | - | ||||||
68 | - | |||||||
69 | template<typename T> | - | ||||||
70 | void QLazilyAllocated<T>::setFlag() | - | ||||||
71 | { | - | ||||||
72 | d.setFlag(); | - | ||||||
73 | } executed 274664 times by 54 tests: end of block Executed by:
| 274664 | ||||||
74 | - | |||||||
75 | template<typename T> | - | ||||||
76 | void QLazilyAllocated<T>::clearFlag() | - | ||||||
77 | { | - | ||||||
78 | d.clearFlag(); | - | ||||||
79 | } executed 74 times by 3 tests: end of block Executed by:
| 74 | ||||||
80 | - | |||||||
81 | template<typename T> | - | ||||||
82 | void QLazilyAllocated<T>::setFlagValue(bool v) | - | ||||||
83 | { | - | ||||||
84 | d.setFlagValue(v); | - | ||||||
85 | } never executed: end of block | 0 | ||||||
86 | - | |||||||
87 | - | |||||||
Switch to Source code | Preprocessed file |