#include <uint28.h>
Public Methods | |
uint28 (uint32 val=0) | |
Default constructor. More... | |
uint28 (const uchar *data) | |
Creates a uint28 object from a character string. More... | |
uint28 (const uint28 &rhs) | |
Copy constructor. More... | |
virtual | ~uint28 () |
uint28 & | operator= (uint32 val) |
Assigns a uint28 object a new value. More... | |
uint28 & | operator= (const uint28 &rhs) |
Assignment operator. More... | |
uint28 & | operator= (const uchar *data) |
Unsigned Character string assignment operator. More... | |
uint28 & | operator= (const char *data) |
Character string assignment operator. More... | |
uint32 | to_uint32 () const |
Converts the unsigned 28-bit integer object to a built-in unsigned 32-bit integer. More... | |
size_t | Parse (const uchar *data) |
Extracts a 28-bit integer from a character string. More... | |
size_t | Parse (const char *data) |
size_t | Render (uchar *) const |
Renders a 28-bit integer to a character string. More... | |
size_t | Render (char *) const |
Static Public Attributes | |
const unsigned short | BITSUSED = 7 |
The number of bits used per byte of an unsigned 28-bit integer *. More... | |
const uint32 | MINVAL = 0 |
The minimum value this class can represent *. More... | |
const uint32 | MAXVAL = MASK(BITSUSED*sizeof(uint32)) |
The maximum value this class can represent (2^28-1) *. More... |
The ID3v2 tag specification (http://www.id3.org) defines an unsigned 28-bit integer in which the most-significant bit in each of the integer's 4 bytes is set to 0. This is done to avoid having integers in an id3v2 tag that might be mistaken for an MP3 sync-signal, which is why this representation is sometimes referred to as "syncsafe integers."
Since these 4 bits are unavailable as representation of the integer, this leaves 28 bits to define its value. Therefore a uint28 object can represent values between 0 and 2^28-1 (or ~256M)
To be useful within id3lib's implementation of the ID3v2 spec, the uint28 class enables instantiations to be created from and written to 4-byte (or more) character buffers. In keeping with the ID3v2 spec, uint28 numbers use a big-endian byte ordering, such that the number 0x12345678 is represented as 0x12 0x34 0x56 0x78 in byte form. A big-endian representation of 255, normally 0x00 0x00 0x00 0xFF for 32-bit integers, would be 0x00 0x00 0x01 0x7F for a 28-bit integer.
|
Default constructor.
|
|
Creates a uint28 object from a character string.
|
|
Copy constructor.
|
|
|
|
|
|
Extracts a 28-bit integer from a character string.
|
|
|
|
Renders a 28-bit integer to a character string.
|
|
Character string assignment operator.
|
|
Unsigned Character string assignment operator.
|
|
Assignment operator.
|
|
Assigns a uint28 object a new value. If the value assigned is greater than can be represented,
|
|
Converts the unsigned 28-bit integer object to a built-in unsigned 32-bit integer.
|
|
The number of bits used per byte of an unsigned 28-bit integer *.
|
|
The maximum value this class can represent (2^28-1) *.
|
|
The minimum value this class can represent *.
|