Home | History | Annotate | Download | only in canvas

Lines Matching refs:CheckedInt

40 // Necessary modifications are made to the original CheckedInt.h file to remove
357 /*** Step 4: Now define the CheckedInt class.
360 /** \class CheckedInt
378 CheckedInt<int32_t> checked_result = (CheckedInt<int32_t>(x) + y) / z;
388 CheckedInt<uint8_t> x(1); // 1 is of type int, is found to be in range for uint8_t, x is valid
389 CheckedInt<uint8_t> x(-1); // -1 is of type int, is found not to be in range for uint8_t, x is invalid
390 CheckedInt<int8_t> x(-1); // -1 is of type int, is found to be in range for int8_t, x is valid
391 CheckedInt<int8_t> x(int16_t(1000)); // 1000 is of type int16_t, is found not to be in range for int8_t, x is invalid
392 CheckedInt<int32_t> x(uint32_t(123456789)); // 3123456789 is of type uint32_t, is found not to be in range
405 class CheckedInt
413 CheckedInt(const U& value, bool isValid) : mValue(value), mIsValid(isValid)
424 * As explained in the above documentation for class CheckedInt, this constructor checks that its argument is
428 CheckedInt(const U& value)
436 CheckedInt() : mIsValid(1)
450 template<typename U> friend CheckedInt<U> operator +(const CheckedInt<U>& lhs, const CheckedInt<U>& rhs);
452 template<typename U> CheckedInt& operator +=(const U &rhs);
454 template<typename U> friend CheckedInt<U> operator -(const CheckedInt<U>& lhs, const CheckedInt<U> &rhs);
456 template<typename U> CheckedInt& operator -=(const U &rhs);
458 template<typename U> friend CheckedInt<U> operator *(const CheckedInt<U>& lhs, const CheckedInt<U> &rhs);
460 template<typename U> CheckedInt& operator *=(const U &rhs);
462 template<typename U> friend CheckedInt<U> operator /(const CheckedInt<U>& lhs, const CheckedInt<U> &rhs);
464 template<typename U> CheckedInt& operator /=(const U &rhs);
467 CheckedInt operator -() const
471 return CheckedInt(result,
476 bool operator ==(const CheckedInt& other) const
491 inline CheckedInt<T> operator OP(const CheckedInt<T> &lhs, const CheckedInt<T> &rhs) \
499 return CheckedInt<T>(result, \
512 inline CheckedInt<T> operator /(const CheckedInt<T> &lhs, const CheckedInt<T> &rhs)
519 return CheckedInt<T>(result,
526 // - it allows x to be either a CheckedInt<T> or any integer type that can be casted to T
527 // - if x is already a CheckedInt<T>, we just return a reference to it, instead of copying it (optimization)
532 typedef CheckedInt<T> return_type;
533 static CheckedInt<T> run(const U& u) { return u; }
537 struct cast_to_CheckedInt_impl<T, CheckedInt<T> >
539 typedef const CheckedInt<T>& return_type;
540 static const CheckedInt<T>& run(const CheckedInt<T>& u) { return u; }
553 CheckedInt<T>& CheckedInt<T>::operator COMPOUND_OP(const U &rhs) \
559 inline CheckedInt<T> operator OP(const CheckedInt<T> &lhs, const U &rhs) \
564 inline CheckedInt<T> operator OP(const U & lhs, const CheckedInt<T> &rhs) \
575 inline bool operator ==(const CheckedInt<T> &lhs, const U &rhs)
581 inline bool operator ==(const U & lhs, const CheckedInt<T> &rhs)