@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|
CompactPair is the logical concatenation of an instance of A with an instance
B. Space is conserved when possible. Neither A nor B may be a final class.
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.
UniquePtr is a smart pointer that wholly owns a resource. Ownership may be
transferred out of a UniquePtr through explicit action, but otherwise the
resource is destroyed when the UniquePtr is destroyed.
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.)