Loading...
Searching...
No Matches
midi_ci::Encodings Struct Reference

Utility functions for working with data formats used by property exchange messages. More...

#include <juce_CIEncodings.h>

Public Member Functions

 Encodings ()=delete
 

Static Public Member Functions

static String stringFrom7BitText (Span< const std::byte > bytes)
 Text in ACK and NAK messages can't be utf-8 or ASCII because each byte only has 7 usable bits.
 
static std::vector< std::byte > stringTo7BitText (const String &text)
 Text in ACK and NAK messages can't be utf-8 or ASCII because each byte only has 7 usable bits.
 
static var jsonFrom7BitText (Span< const std::byte > bytes)
 Converts a list of bytes representing a 7-bit ASCII string to JSON.
 
static std::vector< std::byte > jsonTo7BitText (const var &v)
 Converts a JSON object to a list of bytes in 7-bit ASCII format.
 
static std::vector< std::byte > toMcoded7 (Span< const std::byte > bytes)
 Each group of seven stored bytes is transmitted as eight bytes.
 
static std::vector< std::byte > fromMcoded7 (Span< const std::byte > bytes)
 Each group of seven stored bytes is transmitted as eight bytes.
 
static std::optional< std::vector< std::byte > > tryEncode (Span< const std::byte > bytes, Encoding mutualEncoding)
 Attempts to encode the provided byte span using the specified encoding.
 
static std::vector< std::byte > decode (Span< const std::byte > bytes, Encoding mutualEncoding)
 Decodes the provided byte span using the specified encoding.
 

Detailed Description

Utility functions for working with data formats used by property exchange messages.

Constructor & Destructor Documentation

◆ Encodings()

midi_ci::Encodings::Encodings ( )
delete

Member Function Documentation

◆ stringFrom7BitText()

static String midi_ci::Encodings::stringFrom7BitText ( Span< const std::byte > bytes)
static

Text in ACK and NAK messages can't be utf-8 or ASCII because each byte only has 7 usable bits.

The encoding rules are in section 5.10.4 of the CI spec.

Referenced by midi_ci::Message::ACK::getMessageTextAsString(), midi_ci::Message::NAK::getMessageTextAsString(), and jsonFrom7BitText().

◆ stringTo7BitText()

static std::vector< std::byte > midi_ci::Encodings::stringTo7BitText ( const String & text)
static

Text in ACK and NAK messages can't be utf-8 or ASCII because each byte only has 7 usable bits.

The encoding rules are in section 5.10.4 of the CI spec.

Referenced by jsonTo7BitText().

◆ jsonFrom7BitText()

static var midi_ci::Encodings::jsonFrom7BitText ( Span< const std::byte > bytes)
static

Converts a list of bytes representing a 7-bit ASCII string to JSON.

References JSON::parse(), and stringFrom7BitText().

◆ jsonTo7BitText()

static std::vector< std::byte > midi_ci::Encodings::jsonTo7BitText ( const var & v)
static

Converts a JSON object to a list of bytes in 7-bit ASCII format.

References JSON::none, stringTo7BitText(), JSON::toString(), and JSON::FormatOptions::withSpacing().

◆ toMcoded7()

static std::vector< std::byte > midi_ci::Encodings::toMcoded7 ( Span< const std::byte > bytes)
static

Each group of seven stored bytes is transmitted as eight bytes.

First, the sign bits of the seven bytes are sent, followed by the low-order 7 bits of each byte.

◆ fromMcoded7()

static std::vector< std::byte > midi_ci::Encodings::fromMcoded7 ( Span< const std::byte > bytes)
static

Each group of seven stored bytes is transmitted as eight bytes.

First, the sign bits of the seven bytes are sent, followed by the low-order 7 bits of each byte.

◆ tryEncode()

static std::optional< std::vector< std::byte > > midi_ci::Encodings::tryEncode ( Span< const std::byte > bytes,
Encoding mutualEncoding )
static

Attempts to encode the provided byte span using the specified encoding.

The ASCII encoding does not make any changes to the input stream, but encoding will fail if any byte has its most significant bit set.

◆ decode()

static std::vector< std::byte > midi_ci::Encodings::decode ( Span< const std::byte > bytes,
Encoding mutualEncoding )
static

Decodes the provided byte span using the specified encoding.

All bytes of the input must be 7-bit values, i.e. all most-significant bits are unset.


The documentation for this struct was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram