class Availability
Defined at line 213 of file ../../tools/fidl/fidlc/src/versioning_types.h
An availability represents the versions when a FIDL element was added (A),
deprecated (D), removed (R), and re-added as legacy (L) in a platform. These
versions break the platform's timeline into the following regions:
Present -- [A, R) and [L, +inf) if L is set
Available -- [A, D or R)
Deprecated -- [D, R) if D is set
Legacy -- [L, +inf) if L is set
Absent -- (-inf, A) and [R, L or +inf)
Here is what the timeline looks like for finite versions A, D, R:
-inf A-1 A D-1 D R-1 R +inf
o--- ... ---o---o--- ....... ---o---o--- ....... ---o---o--- ... ---o
| | |-- Available --| |-- Deprecated -| | |
|-- Absent -| |-------------- Present ------------| |-- Absent -|
Here is what the timeline looks like for a legacy element (L = LEGACY):
-inf A-1 A R-1 R L-1 L +inf
o--- ... ---o---o--- ....... ---o---o--- ... ---o----o---- ... ---o
| | |-- Available --| | | |-- Legacy --|
|-- Absent -| |--- Present ---| |-- Absent -| |-- Present -|
Here is what the timeline looks like for Availability::Unbounded():
-inf +inf
o-------------------------------------------------------------------o
|---------------------------- Available ----------------------------|
|----------------------------- Present -----------------------------|
Public Methods
void Availability ()
Defined at line 215 of file ../../tools/fidl/fidlc/src/versioning_types.h
Availability Unbounded ()
Returns an availability that exists forever. This only exists as the base
case for calling `Inherit`. It never occurs as a final result.
Defined at line 219 of file ../../tools/fidl/fidlc/src/versioning_types.h
std::set<Version> points ()
Returns the points demarcating the availability: `added`, `removed`,
`deprecated` (if deprecated), and LEGACY and +inf (if Legacy::kYes).
Must be in the kInherited or kNarrowed state.
VersionSet set ()
Returns the presence set: [added, removed) and possibly [LEGACY, +inf).
Must be in the kInherited or kNarrowed state.
VersionRange range ()
Returns the presence range: [added, removed). Must be in the kNarrowed state.
bool is_deprecated ()
Returns true if the whole range is deprecated, and false if none of it is.
Must be in the kNarrowed state (where deprecation is all-or-nothing).
void Fail ()
Explicitly mark the availability as failed. Must not have called Init yet.
bool Init (InitArgs args)
Must be called first. Initializes the availability from
fields.
Returns false if they do not satisfy `added
<
= deprecated
<
removed`.
InheritResult Inherit (const Availability & parent)
Must be called second. Inherits unset fields from `parent`.
void SetLegacy ()
Optionally call this after Inherit to mark the availability as legacy=true.
TODO(https://fxbug.dev/42085274): This is temporary for the transition from
the LEGACY model to the RFC-0232 model. It will be removed.
void Narrow (VersionRange range)
Must be called third. Narrows the availability to the given range, which
must be a subset of range().
std::string Debug ()
Returns a string representation of the availability for debugging, of the
form "<added> <deprecated> <removed> <legacy>", using "_" for null values.
State state ()
Defined at line 245 of file ../../tools/fidl/fidlc/src/versioning_types.h
Ending ending ()
Returns the availability's ending. Must be in the kNarrowed state.
Defined at line 293 of file ../../tools/fidl/fidlc/src/versioning_types.h
Enumerations
enum State
| Name | Value |
|---|---|
| kUnset | 0 |
| kInitialized | 1 |
| kInherited | 2 |
| kNarrowed | 3 |
| kFailed | 4 |
An availability advances through four states. All reach kNarrowed on
success, except for library availabilities, which stay at kInherited
because libraries do not get decomposed.
Defined at line 231 of file ../../tools/fidl/fidlc/src/versioning_types.h
enum Legacy
| Name | Value |
|---|---|
| kNotApplicable | 0 |
| kNo | 1 |
| kYes | 2 |
Represents whether an availability includes legacy support.
Defined at line 267 of file ../../tools/fidl/fidlc/src/versioning_types.h
enum Ending
| Name | Value |
|---|---|
| kNone | 0 |
| kRemoved | 1 |
| kReplaced | 2 |
| kInherited | 3 |
| kSplit | 4 |
Meaning of the `removed` version, how this availability ends.
Defined at line 278 of file ../../tools/fidl/fidlc/src/versioning_types.h