Add nodiscard annotation
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base/Utils.hpp"
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
@@ -36,7 +35,7 @@ namespace openVulkanoCpp
|
||||
width(width), height(height), maxValue(maxValue), color(color), littleEndian(littleEndian)
|
||||
{}
|
||||
|
||||
std::string ToString() const
|
||||
[[nodiscard]] std::string ToString() const
|
||||
{
|
||||
std::stringstream headerStream;
|
||||
headerStream << *this;
|
||||
@@ -73,14 +72,14 @@ namespace openVulkanoCpp
|
||||
return inStream;
|
||||
}
|
||||
|
||||
constexpr size_t GetElementCount() const
|
||||
[[nodiscard]] constexpr size_t GetElementCount() const
|
||||
{
|
||||
size_t size = height * width;
|
||||
if (color) size *= 3;
|
||||
return size;
|
||||
}
|
||||
|
||||
constexpr size_t GetImageSize() const
|
||||
[[nodiscard]] constexpr size_t GetImageSize() const
|
||||
{
|
||||
return GetElementCount() * sizeof(float);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
@@ -40,24 +39,24 @@ namespace openVulkanoCpp
|
||||
width(width), height(height), maxValue(maxValue), color(color), ascii(ascii)
|
||||
{}
|
||||
|
||||
constexpr std::string_view GetFileType() const
|
||||
[[nodiscard]] constexpr std::string_view GetFileType() const
|
||||
{
|
||||
return FILE_TYPES[static_cast<uint8_t>(color) - 1];
|
||||
}
|
||||
|
||||
constexpr std::string_view GetFileExtension() const
|
||||
[[nodiscard]] constexpr std::string_view GetFileExtension() const
|
||||
{
|
||||
return FILE_EXT[static_cast<uint8_t>(color) - 1];
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
[[nodiscard]] std::string ToString() const
|
||||
{
|
||||
std::stringstream headerStream;
|
||||
headerStream << *this;
|
||||
return headerStream.str();
|
||||
}
|
||||
|
||||
constexpr uint8_t GetMagicNumberValue() const
|
||||
[[nodiscard]] constexpr uint8_t GetMagicNumberValue() const
|
||||
{
|
||||
uint8_t value = static_cast<uint8_t>(color);
|
||||
if (!ascii) value += 3;
|
||||
@@ -88,7 +87,7 @@ namespace openVulkanoCpp
|
||||
return inStream;
|
||||
}
|
||||
|
||||
constexpr size_t GetImageSize() const
|
||||
[[nodiscard]] constexpr size_t GetImageSize() const
|
||||
{
|
||||
size_t size = height * width;
|
||||
if (color == ColorMode::COLOR)
|
||||
|
||||
Reference in New Issue
Block a user