Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RDRMFormatSet Class Reference

Represents a set of DRM formats and their associated modifiers. More...

#include <RDRMFormat.h>

Public Member Functions

const boost::container::flat_set< RDRMFormat, RDRMFormat::Less > & formats () const noexcept
 Returns the internal set of formats with their modifiers.
 
bool has (RFormat format, RModifier modifier) const noexcept
 Checks if a specific format+modifier combination is present.
 
bool add (RFormat format, RModifier modifier) noexcept
 Adds a format+modifier pair to the set.
 
bool remove (RFormat format, RModifier modifier) noexcept
 Removes a specific modifier from a format.
 
bool removeFormat (RFormat format) noexcept
 Removes all modifiers for a given format, effectively removing the format.
 
bool removeModifier (RModifier modifier) noexcept
 Removes the given modifier from all formats.
 
bool addModifier (RModifier modifier) noexcept
 Adds the given modifier to all existing formats.
 
void log () const noexcept
 Logs the contents of the format set (its formats and modifiers) for debugging.
 

Static Public Member Functions

static RDRMFormatSet Union (const RDRMFormatSet &a, const RDRMFormatSet &b) noexcept
 Computes the union of two format sets.
 
static RDRMFormatSet Intersect (const RDRMFormatSet &a, const RDRMFormatSet &b) noexcept
 Computes the intersection of two format sets.
 
static RDRMFormatSet Intersect (const RDRMFormatSet &a, const boost::container::flat_set< RFormat > &b) noexcept
 Computes the intersection between a format set and a set of DRM formats.
 

Detailed Description

Represents a set of DRM formats and their associated modifiers.

This class is typically used by subsystems (e.g. KMS, EGL, etc) to declare supported format+modifier combinations.

Member Function Documentation

◆ formats()

const boost::container::flat_set< RDRMFormat, RDRMFormat::Less > & formats ( ) const
inlinenoexcept

Returns the internal set of formats with their modifiers.

◆ Union()

static RDRMFormatSet Union ( const RDRMFormatSet a,
const RDRMFormatSet b 
)
staticnoexcept

Computes the union of two format sets.

Parameters
aFirst format set.
bSecond format set.
Returns
A new set containing all format+modifier combinations from both inputs.

◆ Intersect() [1/2]

static RDRMFormatSet Intersect ( const RDRMFormatSet a,
const RDRMFormatSet b 
)
staticnoexcept

Computes the intersection of two format sets.

Only formats and modifiers present in both sets will be retained.

Parameters
aFirst format set.
bSecond format set.
Returns
A new set containing only the common format+modifier pairs.

◆ Intersect() [2/2]

static RDRMFormatSet Intersect ( const RDRMFormatSet a,
const boost::container::flat_set< RFormat > &  b 
)
staticnoexcept

Computes the intersection between a format set and a set of DRM formats.

All modifiers for matching formats are retained.

Parameters
aFormat set to filter.
bSet of DRM formats.
Returns
A new set with formats present in both inputs.

◆ has()

bool has ( RFormat  format,
RModifier  modifier 
) const
noexcept

Checks if a specific format+modifier combination is present.

Parameters
formatThe DRM format to check.
modifierThe modifier to check.
Returns
true if the format and modifier exist in the set, false otherwise.

◆ add()

bool add ( RFormat  format,
RModifier  modifier 
)
noexcept

Adds a format+modifier pair to the set.

If the format is new, it is inserted with the modifier. If the format already exists, the modifier is added to its modifier set.

Parameters
formatThe DRM format to add.
modifierThe modifier to add.
Returns
true if the combination was newly added, false if it already existed.

◆ remove()

bool remove ( RFormat  format,
RModifier  modifier 
)
noexcept

Removes a specific modifier from a format.

If the modifier is the last one for that format, the entire format entry is removed.

Parameters
formatThe DRM format.
modifierThe modifier to remove.
Returns
true if the modifier was removed, false if it was not found.

◆ removeFormat()

bool removeFormat ( RFormat  format)
noexcept

Removes all modifiers for a given format, effectively removing the format.

Parameters
formatThe DRM format to remove.
Returns
true if the format was removed, false if it was not present.

◆ removeModifier()

bool removeModifier ( RModifier  modifier)
noexcept

Removes the given modifier from all formats.

If any format ends up with no modifiers, it is removed from the set.

Parameters
modifierThe modifier to remove.
Returns
true if at least one modifier was removed, false otherwise.

◆ addModifier()

bool addModifier ( RModifier  modifier)
noexcept

Adds the given modifier to all existing formats.

Parameters
modifierThe modifier to add.
Returns
true if the modifier was added to at least one format; false otherwise.

◆ log()

void log ( ) const
noexcept

Logs the contents of the format set (its formats and modifiers) for debugging.