This file is indexed.

/usr/include/unitizeddouble.h is in libdewalls-dev 1.0.0+ds1-4ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#ifndef DEWALLS_UNITIZEDDOUBLE_H
#define DEWALLS_UNITIZEDDOUBLE_H

#include <iostream>
#include <cmath>
#include <QString>
#include "dewallsexport.h"
#include "length.h"
#include "angle.h"

namespace dewalls {

template<class T>
class UnitizedDouble
{
public:
    typedef typename T::Unit Unit;

    UnitizedDouble();
    UnitizedDouble(double quantity, Unit unit);
    UnitizedDouble(UnitizedDouble&& other);
    UnitizedDouble(const UnitizedDouble& other) = default;

    Unit unit() const;
    double get(Unit toUnit) const;
    UnitizedDouble<T> in(Unit unit) const;
    inline bool isValid() const { return _unit != T::Invalid; }
    inline void clear() { _unit = T::Invalid; }

    inline bool isZero() const { return _unit && _quantity == 0.0; }
    inline bool isNonzero() const { return _unit && _quantity != 0.0; }
    inline bool isNegative() const { return _unit && _quantity < 0.0; }
    inline bool isPositive() const { return _unit && _quantity > 0.0; }
    double signum() const;

    friend void swap(UnitizedDouble<T>& first, UnitizedDouble<T>& second)
    {
        using std::swap;

        swap(first._quantity, second._quantity);
        swap(first._unit, second._unit);
    }

    UnitizedDouble<T>& operator =(UnitizedDouble<T> other);
    UnitizedDouble<T>& operator +=(const UnitizedDouble<T>& rhs);
    UnitizedDouble<T>  operator -();
    UnitizedDouble<T>& operator -=(const UnitizedDouble<T>& rhs);
    UnitizedDouble<T>& operator *=(const double& rhs);
    UnitizedDouble<T>& operator /=(const double& rhs);
    UnitizedDouble<T>& operator %=(const UnitizedDouble<T>& rhs);

    QString toString() const;

    friend std::ostream& operator<<(std::ostream& os, const UnitizedDouble<T>& obj)
    {
        return os << obj.toString().toStdString();
    }

private:
    Unit _unit;
    double _quantity;
};

template class DEWALLS_LIB_EXPORT UnitizedDouble<Length>;
template class DEWALLS_LIB_EXPORT UnitizedDouble<Angle>;

template<class T>
inline UnitizedDouble<T>::UnitizedDouble()
    : _unit(T::Invalid)
{

}

template<class T>
inline UnitizedDouble<T>::UnitizedDouble(UnitizedDouble&& other)
    : UnitizedDouble()
{
    swap(*this, other);
}

template<class T>
inline double UnitizedDouble<T>::signum() const
{
    if (_unit) {
        return _quantity > 0.0 ? 1.0 : _quantity == 0.0 ? 0.0 : -1.0;
    }
    return NAN;
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator =(UnitizedDouble<T> other)
{
    swap(*this, other);
    return *this;
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator +=(const UnitizedDouble<T>& rhs)
{
    if (!rhs._unit) _unit = T::Invalid;
    else if (_unit) _quantity += rhs.get(_unit);
    return *this;
}

template<class T>
inline UnitizedDouble<T> UnitizedDouble<T>::operator -()
{
    return UnitizedDouble<T>(-_quantity, _unit);
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator -=(const UnitizedDouble<T>& rhs)
{
    if (!rhs._unit) _unit = T::Invalid;
    else if (_unit) _quantity -= rhs.get(_unit);
    return *this;
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator *=(const double& rhs)
{
    _quantity *= rhs;
    return *this;
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator /=(const double& rhs)
{
    _quantity /= rhs;
    return *this;
}

template<class T>
inline UnitizedDouble<T>& UnitizedDouble<T>::operator %=(const UnitizedDouble<T>& rhs)
{
    if (!rhs._unit) _unit = T::Invalid;
    else if (_unit) _quantity = fmod(_quantity, rhs.get(_unit));
    return *this;
}

template<class T>
inline bool operator ==(const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return lhs.unit() ? rhs.unit() && lhs.get(lhs.unit()) == rhs.get(lhs.unit())
                      : !rhs.unit();
}

template<class T>
inline bool operator !=(const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return !operator ==(lhs, rhs);
}

template<class T>
inline bool operator < (const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return lhs.unit() && lhs.get(lhs.unit()) < rhs.get(lhs.unit());
}

template<class T>
inline bool operator > (const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return operator < (rhs, lhs);
}

template<class T>
inline bool operator <=(const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return !operator > (rhs, lhs);
}

template<class T>
inline bool operator >=(const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return !operator < (rhs, lhs);
}

template<class T>
inline UnitizedDouble<T> operator +(UnitizedDouble<T> lhs, const UnitizedDouble<T>& rhs)
{
    lhs += rhs;
    return lhs;
}

template<class T>
inline UnitizedDouble<T> operator -(UnitizedDouble<T> lhs, const UnitizedDouble<T>& rhs)
{
    lhs -= rhs;
    return lhs;
}

template<class T>
inline UnitizedDouble<T> operator *(UnitizedDouble<T> lhs, const double& rhs)
{
    lhs *= rhs;
    return lhs;
}

template<class T>
inline UnitizedDouble<T> operator *(double lhs, const UnitizedDouble<T>& rhs)
{
    return rhs * lhs;
}

template<class T>
inline UnitizedDouble<T> operator /(UnitizedDouble<T> lhs, const double& rhs)
{
    lhs /= rhs;
    return lhs;
}

template<class T>
inline UnitizedDouble<T> operator /(double lhs, const UnitizedDouble<T>& rhs)
{
    return rhs.unit() ? UnitizedDouble<T>(lhs / rhs.get(rhs.unit()), rhs.unit())
                      : UnitizedDouble<T>();
}

template<class T>
inline double operator / (const UnitizedDouble<T>& lhs, const UnitizedDouble<T>& rhs)
{
    return lhs.unit() && rhs.unit() ? lhs.get(lhs.unit()) / rhs.get(lhs.unit())
                                    : NAN;
}

template<class T>
inline UnitizedDouble<T> operator %(UnitizedDouble<T> lhs, const UnitizedDouble<T>& rhs)
{
    lhs %= rhs;
    return lhs;
}

template<class T>
inline UnitizedDouble<T>::UnitizedDouble(double quantity, Unit unit):
    _unit(unit),
    _quantity(quantity)
{

}

template<class T>
inline typename T::Unit UnitizedDouble<T>::unit() const
{
    return _unit;
}

template<class T>
inline double UnitizedDouble<T>::get(Unit toUnit) const
{
    return T::convert(_quantity, _unit, toUnit);
}

template<class T>
inline UnitizedDouble<T> UnitizedDouble<T>::in(typename T::Unit unit) const
{
    return UnitizedDouble<T>(get(unit), unit);
}

template<class T>
inline QString UnitizedDouble<T>::toString() const
{
    if (!_unit) return "";
    return QString("%1 %2").arg(_quantity).arg(T::symbolFor(_unit));
}

} // namespace dewalls

#endif // DEWALLS_UNITIZEDDOUBLE_H