GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/RGB.hpp Lines: 1 1 100.0 %
Date: 2022-10-11 07:18:13 Branches: 0 0 - %

Line Branch Exec Source
1
/**
2
 * @file RGB.hpp
3
 * @brief Header file for blink1_lib::RGB
4
 */
5
6
#pragma once
7
8
#include <cstdint>
9
#include <ostream>
10
11
namespace blink1_lib {
12
13
    /**
14
     * Represents a color
15
     */
16
    struct RGB {
17
18
        /**
19
         * Red component
20
         */
21
        std::uint8_t r{0};
22
23
        /**
24
         * Green component
25
         */
26
        std::uint8_t g{0};
27
28
        /**
29
         * Blue component
30
         */
31
        std::uint8_t b{0};
32
33
        /**
34
         * @param r Red value
35
         * @param g Green value
36
         * @param b Blue value
37
         */
38
        RGB(const std::uint8_t r, const std::uint8_t g, const std::uint8_t b) noexcept;
39
40
        /**
41
         * Default constructor
42
         *
43
         * Intializes all values to 0
44
         */
45
10
        RGB() noexcept = default;
46
47
        /**
48
         * Equality operator
49
         *
50
         * @param other Object to compare to
51
         * @return true if the objects are equal, false otherwise
52
         */
53
        [[nodiscard]] bool operator==(const RGB& other) const noexcept;
54
55
        /**
56
         * Inequality operator
57
         *
58
         * @param other Object to compare to
59
         * @return true if the objects are not equal, false otherwise
60
         */
61
        [[nodiscard]] bool operator!=(const RGB& other) const noexcept;
62
63
        /**
64
         * Output operator
65
         *
66
         * @param os Output stream
67
         * @param rgb RGB object to output
68
         */
69
        friend std::ostream& operator<<(std::ostream& os, const RGB& rgb);
70
    };
71
}