@class CheckedInt
@brief Integer wrapper class checking for integer overflow and other errors
@param T the integer type to wrap. Can be any type among the following:
- any basic integer type such as |int|
- any stdint type such as |int8_t|
This class is designed to cause crashes when various kinds of memory
corruption are observed. For instance, let’s say we have a class C where we
suspect out-of-bounds writes to some members. We can insert a member of type
Poison near the members we suspect are being corrupted by out-of-bounds
writes. Or perhaps we have a class K we suspect is subject to use-after-free
violations, in which case it doesn’t particularly matter where in the class
we add the member of type Poison.
DebugOnly contains a value of type T, but only in debug builds. In release
builds, it does not contain a value. This helper is intended to be used with
MOZ_ASSERT()-style macros, allowing one to write:
EnumSet<T, U> is a set of values defined by an enumeration. It is implemented
using a bit mask with the size of U for each value. It works both for enum
and enum class types. EnumSet also works with U being a BitSet.
A tag used to differentiate between GenericErrorResult created by the Err
function (completely new error) and GenericErrorResult created by the
Result::propagateErr function (propagated error). This can be used to track
error propagation and eventually produce error stacks for logging/debugging
purposes.
A type that auto-converts to an error Result. This is like a Result without
a success type. It’s the best return type for functions that always return
an error–functions designed to build and populate error objects. It’s also
useful in error-handling macros; see MOZ_TRY for an example.
Empty struct, indicating success for operations that have no return value.
For example, if you declare another empty struct struct OutOfMemory {};,
then Result<Ok, OutOfMemory> represents either success or OOM.
Opaque is a replacement for integral T in cases where only comparisons
must be supported, and it’s desirable to prevent accidental dependency on
exact values.
Result<V, E> represents the outcome of an operation that can either succeed
or fail. It contains either a success value of type V or an error value of
type E.
This structure precedes the string buffers “we” allocate. It may be the
case that nsTAString::mData does not point to one of these special
buffers. The mDataFlags member variable distinguishes the buffer type.
Instances of this class represent moments in time, or a special
“null” moment. We do not use the non-monotonic system clock or
local time, since they can be reset, causing apparent backward
travel in time, which can confuse algorithms. Instead we measure
elapsed time according to the system. This time can never go
backwards (i.e. it never wraps around, at least not in less than
five million years of system elapsed time). It might not advance
while the system is sleeping. If TimeStamp::SetNow() is not called
at all for hours or days, we might not notice the passage of some
of that time.
LinkedList supports refcounted elements using this adapter class. Clients
using LinkedList<RefPtr> will get a data structure that holds a strong
reference to T as long as T is in the list.
@class CheckedInt
@brief Integer wrapper class checking for integer overflow and other errors
@param T the integer type to wrap. Can be any type among the following:
- any basic integer type such as |int|
- any stdint type such as |int8_t|
Opaque is a replacement for integral T in cases where only comparisons
must be supported, and it’s desirable to prevent accidental dependency on
exact values.
LinkedList supports refcounted elements using this adapter class. Clients
using LinkedList<RefPtr> will get a data structure that holds a strong
reference to T as long as T is in the list.
LinkedList supports refcounted elements using this adapter class. Clients
using LinkedList<RefPtr> will get a data structure that holds a strong
reference to T as long as T is in the list.
A code unit within a UTF-8 encoded string. (A code unit is the smallest
unit within the Unicode encoding of a string. For UTF-8 this is an 8-bit
number; for UTF-16 it would be a 16-bit number.)