Porytiles
Loading...
Searching...
No Matches
porytiles2::ColorSet Class Reference

A set of colors represented as a bitset. More...

#include <color_set.hpp>

Public Member Functions

 ColorSet ()=default
 
bool test (ColorIndex index) const
 Tests whether a bit at the given index is set.
 
void set (ColorIndex index, bool value=true)
 Sets a bit at the given index.
 
void reset (ColorIndex index)
 Resets a bit at the given index to false.
 
const std::bitset< num_colors > & colors () const
 Gets the underlying bitset.
 
bool operator== (const ColorSet &other) const =default
 Compares two ColorSet objects for equality.
 

Detailed Description

A set of colors represented as a bitset.

ColorSet tracks which colors are present in a set using a fixed-size bitset. Each bit position corresponds to a specific color index.

Definition at line 19 of file color_set.hpp.

Constructor & Destructor Documentation

◆ ColorSet()

porytiles2::ColorSet::ColorSet ( )
default

Member Function Documentation

◆ colors()

const std::bitset< num_colors > & porytiles2::ColorSet::colors ( ) const
inline

Gets the underlying bitset.

Returns a const reference to the internal bitset representation.

Returns
A const reference to the bitset

Definition at line 63 of file color_set.hpp.

◆ operator==()

bool porytiles2::ColorSet::operator== ( const ColorSet other) const
default

Compares two ColorSet objects for equality.

Returns true if both ColorSet objects have identical bitsets.

Parameters
otherThe ColorSet to compare with
Returns
true if equal, false otherwise

◆ reset()

void porytiles2::ColorSet::reset ( ColorIndex  index)

Resets a bit at the given index to false.

Clears the bit at the specified index, setting it to false.

Parameters
indexThe index of the bit to reset

Definition at line 15 of file color_set.cpp.

◆ set()

void porytiles2::ColorSet::set ( ColorIndex  index,
bool  value = true 
)

Sets a bit at the given index.

Sets the bit at the specified index to the given value (default true).

Parameters
indexThe index of the bit to set
valueThe value to set (true or false)

Definition at line 10 of file color_set.cpp.

◆ test()

bool porytiles2::ColorSet::test ( ColorIndex  index) const

Tests whether a bit at the given index is set.

Returns true if the bit at the specified index is set, false otherwise.

Parameters
indexThe index of the bit to test
Returns
true if the bit is set, false otherwise

Definition at line 5 of file color_set.cpp.


The documentation for this class was generated from the following files: