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