Struct FourCC
A four-character code.
Namespace: UnityEngine.InputSystem.Utilities
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(Int32)
Create a FourCC from the given integer.
Declaration
public FourCC(int code)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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. |
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 |
---|---|
Boolean | True if |
Equals(FourCC)
Compare two FourCCs for equality.
Declaration
public bool Equals(FourCC other)
Parameters
Type | Name | Description |
---|---|---|
FourCC | other | Another FourCC. |
Returns
Type | Description |
---|---|
Boolean | True if the two FourCCs are equal, i.e. have the same exact character codes. |
FromInt32(Int32)
Declaration
public static FourCC FromInt32(int i)
Parameters
Type | Name | Description |
---|---|---|
Int32 | i |
Returns
Type | Description |
---|---|
FourCC |
GetHashCode()
Compute a hash code for the FourCC.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Simply returns the FourCC converted to an |
ToInt32(FourCC)
Declaration
public static int ToInt32(FourCC fourCC)
Parameters
Type | Name | Description |
---|---|---|
FourCC | fourCC |
Returns
Type | Description |
---|---|
Int32 |
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. |
Operators
Equality(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 |
---|---|
Boolean | True if the two FourCCs are equal, i.e. have the same exact character codes. |
Implicit(Int32 to FourCC)
Convert the given int
into a FourCC.
Declaration
public static implicit operator FourCC(int i)
Parameters
Type | Name | Description |
---|---|---|
Int32 | i | FourCC code represented as an |
Returns
Type | Description |
---|---|
FourCC | The FourCC converted from |
Implicit(FourCC to Int32)
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 |
---|---|
Int32 | The four characters of the code packed into one |
Inequality(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 |
---|---|
Boolean | True if the two FourCCs are not equal, i.e. do not have the same exact character codes. |