Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::FourCharacterCode_t Struct Reference

Helper structure to create 4 characters codes. More...

Public Member Functions

 operator const char * () const noexcept
 Access the character code as an char array.
 
 operator char * () noexcept
 Access the character code as an char array.
 
 operator uint32_t () const noexcept
 Read the four character code as an integer.
 
FourCharacterCode_toperator= (uint32_t uInput) noexcept
 Assign a four character code with an integer.
 
uint32_t GetCode (void) const noexcept
 Read the four character code as an integer.
 
void SetCode (uint32_t uInput) noexcept
 Assign a four character code with an integer.
 

Public Attributes

union { 
 
   char   c [4] 
 Array of 4 characters for the code. More...
 
   uint32_t   w 
 Value in binary. More...
 
};  
 

Detailed Description

Helper structure to create 4 characters codes.


On some platforms and file formats, a four character code is stored in a big endian 32 bit integer. To ensure these codes are generated in a platform neutral way, this structure is used to statically create a code that can be translated directly into a 32 bit value that can be used to directly to a single integer comparison for testing codes.

const Burger::FourCharacterCode_t AIFFCode = {'A','I','F','F'};
uint32_t MatchAIFF(const void *pData)
{
return static_cast<const uint32_t *>(pData)[0] == AIFFCode;
}
Helper structure to create 4 characters codes.
Definition burger.h:12466

Member Function Documentation

◆ GetCode()

uint32_t Burger::FourCharacterCode_t::GetCode ( void ) const
inlinenoexcept

Read the four character code as an integer.


Returns
The four character code as a 32 bit unsigned integer.
See also
operator uint32_t() const

◆ operator char *()

Burger::FourCharacterCode_t::operator char * ( )
inlinenoexcept

Access the character code as an char array.


Returns
Pointer to the first character in the four character code

◆ operator const char *()

Burger::FourCharacterCode_t::operator const char * ( ) const
inlinenoexcept

Access the character code as an char array.


Returns
Pointer to the first character in the four character code

◆ operator uint32_t()

Burger::FourCharacterCode_t::operator uint32_t ( ) const
inlinenoexcept

Read the four character code as an integer.


Returns
The four character code as a 32 bit unsigned integer.
See also
GetCode(void) const

◆ operator=()

FourCharacterCode_t & Burger::FourCharacterCode_t::operator= ( uint32_t uInput)
inlinenoexcept

Assign a four character code with an integer.


Parameters
uInputFour character code in big endian format
Returns
A reference to the FourCharacterCode_t
See also
SetCode(uint32_t uInput)

◆ SetCode()

void Burger::FourCharacterCode_t::SetCode ( uint32_t uInput)
inlinenoexcept

Assign a four character code with an integer.


Parameters
uInputFour character code in big endian format
See also
operator = (uint32_t uInput)

Member Data Documentation

◆ [union]

◆ c

char Burger::FourCharacterCode_t::c[4]

Array of 4 characters for the code.

◆ w

uint32_t Burger::FourCharacterCode_t::w

Value in binary.