Struct FourCC
A four-character code.
Implements
Namespace: UnityEngine.InputSystem.Utilities
Assembly: Unity.InputSystem.dll
Syntax
public struct FourCC : IEquatable<FourCC>
Remarks
A four-character code is a struct containing four byte characters totalling a single int
.
FourCCs are frequently used in the input system to identify the format of data sent to or from
the native backend representing events, input device state or commands sent to input devices.
Constructors
FourCC(char, char, char, char)
Create a FourCC from the given four characters.
Declaration
public FourCC(char a, char b = ' ', char c = ' ', char d = ' ')
Parameters
Type | Name | Description |
---|---|---|
char | a | First character. |
char | b | Second character. |
char | c | Third character. |
char | d | Fourth character. |
FourCC(int)
Create a FourCC from the given integer.
Declaration
public FourCC(int code)
Parameters
Type | Name | Description |
---|---|---|
int | code | FourCC code represented as an |
Remarks
This method does not actually verify whether the four characters in the code are printable.
FourCC(string)
Create a FourCC from the given string.
Declaration
public FourCC(string str)
Parameters
Type | Name | Description |
---|---|---|
string | str | A string with four characters or less but with at least one character. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
ArgumentNullException |
|
Methods
Equals(object)
Compare the FourCC to the given object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object. Can be null. |
Returns
Type | Description |
---|---|
bool | True if |
Overrides
Equals(FourCC)
Compare two FourCCs for equality.
Declaration
public bool Equals(FourCC other)
Parameters
Type | Name | Description |
---|---|---|
FourCC | other | Another FourCC. |
Returns
Type | Description |
---|---|
bool | True if the two FourCCs are equal, i.e. have the same exact character codes. |
FromInt32(int)
Declaration
public static FourCC FromInt32(int i)
Parameters
Type | Name | Description |
---|---|---|
int | i |
Returns
Type | Description |
---|---|
FourCC |
GetHashCode()
Compute a hash code for the FourCC.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | Simply returns the FourCC converted to an |
Overrides
ToInt32(FourCC)
Declaration
public static int ToInt32(FourCC fourCC)
Parameters
Type | Name | Description |
---|---|---|
FourCC | fourCC |
Returns
Type | Description |
---|---|
int |
ToString()
Convert the FourCC into a string in the form of "ABCD".
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String representation of the FourCC. |
Overrides
Operators
operator ==(FourCC, FourCC)
Compare two FourCCs for equality.
Declaration
public static bool operator ==(FourCC left, FourCC right)
Parameters
Type | Name | Description |
---|---|---|
FourCC | left | First FourCC. |
FourCC | right | Second FourCC. |
Returns
Type | Description |
---|---|
bool | True if the two FourCCs are equal, i.e. have the same exact character codes. |
implicit operator FourCC(int)
Convert the given int
into a FourCC.
Declaration
public static implicit operator FourCC(int i)
Parameters
Type | Name | Description |
---|---|---|
int | i | FourCC code represented as an |
Returns
Type | Description |
---|---|
FourCC | The FourCC converted from |
implicit operator int(FourCC)
Convert the given FourCC into an int
.
Declaration
public static implicit operator int(FourCC fourCC)
Parameters
Type | Name | Description |
---|---|---|
FourCC | fourCC | A FourCC. |
Returns
Type | Description |
---|---|
int | The four characters of the code packed into one |
operator !=(FourCC, FourCC)
Compare two FourCCs for inequality.
Declaration
public static bool operator !=(FourCC left, FourCC right)
Parameters
Type | Name | Description |
---|---|---|
FourCC | left | First FourCC. |
FourCC | right | Second FourCC. |
Returns
Type | Description |
---|---|
bool | True if the two FourCCs are not equal, i.e. do not have the same exact character codes. |