Class for specifying the size of a 3D shape or object */
| 34 | { |
| 35 | /** Class for specifying the size of a 3D shape or object */ |
| 36 | class Size3D |
| 37 | { |
| 38 | public: |
| 39 | /** Default constructor */ |
| 40 | Size3D() = default; |
| 41 | /** Constructor. Initializes "width", "height" and "depth" respectively with "w", "h" and "d" |
| 42 | * |
| 43 | * @param[in] w Width of the 3D shape or object |
| 44 | * @param[in] h Height of the 3D shape or object |
| 45 | * @param[in] d Depth of the 3D shape or object |
| 46 | */ |
| 47 | Size3D(size_t w, size_t h, size_t d) noexcept : width(w), height(h), depth(d) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | /** Convert the values stored to string |
| 52 | * |
| 53 | * @return string of (width x height x depth). |
| 54 | */ |
| 55 | std::string to_string() const; |
| 56 | |
| 57 | /** Semantic accessor for width as x. |
| 58 | * |
| 59 | * @return x. |
| 60 | */ |
| 61 | size_t x() const |
| 62 | { |
| 63 | return width; |
| 64 | } |
| 65 | |
| 66 | /** Semantic accessor for height as y. |
| 67 | * |
| 68 | * @return y. |
| 69 | */ |
| 70 | size_t y() const |
| 71 | { |
| 72 | return height; |
| 73 | } |
| 74 | |
| 75 | /** Semantic accessor for depth as z. |
| 76 | * |
| 77 | * @return z. |
| 78 | */ |
| 79 | size_t z() const |
| 80 | { |
| 81 | return depth; |
| 82 | } |
| 83 | |
| 84 | bool operator!=(const Size3D &other) const |
| 85 | { |
| 86 | return !(*this == other); |
| 87 | } |
| 88 | |
| 89 | bool operator==(const Size3D &other) const |
| 90 | { |
| 91 | return (width == other.width) && (height == other.height) && (depth == other.depth); |
| 92 | } |
| 93 |
no outgoing calls
no test coverage detected