Skip to content

Commit

Permalink
Rename NewEnumMapper to EnumMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Jul 23, 2024
1 parent a272f7b commit 6e5cef7
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@

using namespace std::string_view_literals;

template <class T, std::size_t N> struct NewEnumMapper
template <class T, std::size_t N> struct EnumMapper
{
using VALUE_AND_NAME = std::pair<T, std::string_view>;

template <typename... Args> constexpr NewEnumMapper(Args... args)
template <typename... Args> constexpr EnumMapper(Args... args)
{
static_assert(sizeof...(Args) == N);
this->addElementsRecursively(0, args...);
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/decoder/decoderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <filesource/FileSourceAnnexBFile.h>
#include <statistics/StatisticsData.h>
#include <video/rgb/videoHandlerRGB.h>
Expand Down Expand Up @@ -64,7 +64,7 @@ enum class DecoderEngine
FFMpeg // The FFMpeg decoder
};

constexpr NewEnumMapper<DecoderEngine, 7>
constexpr EnumMapper<DecoderEngine, 7>
DecoderEngineMapper(std::make_pair(DecoderEngine::Invalid, "Invalid"sv),
std::make_pair(DecoderEngine::Libde265, "Libde265"sv),
std::make_pair(DecoderEngine::HM, "HM"sv),
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/filesource/FileSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <QString>

#include <common/FileInfo.h>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <common/Typedef.h>

enum class InputFormat
Expand All @@ -52,7 +52,7 @@ enum class InputFormat
Libav // This is some sort of container file which we will read using libavformat
};

constexpr NewEnumMapper<InputFormat, 5>
constexpr EnumMapper<InputFormat, 5>
InputFormatMapper(std::make_pair(InputFormat::Invalid, "Invalid"sv),
std::make_pair(InputFormat::AnnexBHEVC, "AnnexBHEVC"sv),
std::make_pair(InputFormat::AnnexBAVC, "AnnexBAVC"sv),
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/AVC/nal_unit_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <parser/common/SubByteReaderLogging.h>

namespace parser::avc
Expand Down Expand Up @@ -67,7 +67,7 @@ enum class NalType
RESERVED_23
};

constexpr NewEnumMapper<NalType, 24> NalTypeMapper(
constexpr EnumMapper<NalType, 24> NalTypeMapper(
std::make_pair(NalType::UNSPECIFIED, "UNSPECIFIED"sv),
std::make_pair(NalType::CODED_SLICE_NON_IDR, "CODED_SLICE_NON_IDR"sv),
std::make_pair(NalType::CODED_SLICE_DATA_PARTITION_A, "CODED_SLICE_DATA_PARTITION_A"sv),
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/HEVC/nal_unit_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <parser/common/SubByteReaderLogging.h>

namespace parser::hevc
Expand Down Expand Up @@ -107,7 +107,7 @@ enum class NalType
UNSPECIFIED
};

constexpr NewEnumMapper<NalType, 65>
constexpr EnumMapper<NalType, 65>
NalTypeMapper(std::make_pair(NalType::TRAIL_N, "TRAIL_N"sv),
std::make_pair(NalType::TRAIL_R, "TRAIL_R"sv),
std::make_pair(NalType::TSA_N, "TSA_N"sv),
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/VVC/adaptation_parameter_set_rbsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "parser/common/SubByteReaderLogging.h"
#include "rbsp_trailing_bits.h"
#include "scaling_list_data.h"
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>

namespace parser::vvc
{
Expand All @@ -50,7 +50,7 @@ enum class APSParamType
SCALING_APS
};

constexpr NewEnumMapper<APSParamType, 3>
constexpr EnumMapper<APSParamType, 3>
APSParamTypeMapper(std::make_pair(APSParamType::ALF_APS, "ALF_APS"sv),
std::make_pair(APSParamType::LMCS_APS, "LMCS_APS"sv),
std::make_pair(APSParamType::SCALING_APS, "SCALING_APS"sv));
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/VVC/nal_unit_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <parser/common/SubByteReaderLogging.h>

namespace parser::vvc
Expand Down Expand Up @@ -75,7 +75,7 @@ enum class NalType
UNSPECIFIED
};

constexpr NewEnumMapper<NalType, 33>
constexpr EnumMapper<NalType, 33>
NalTypeMapper(std::make_pair(NalType::TRAIL_NUT, "TRAIL_NUT"sv),
std::make_pair(NalType::STSA_NUT, "STSA_NUT"sv),
std::make_pair(NalType::RADL_NUT, "RADL_NUT"sv),
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/VVC/slice_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <parser/common/SubByteReaderLogging.h>

#include "NalUnitVVC.h"
Expand All @@ -53,7 +53,7 @@ enum class SliceType
I
};

constexpr NewEnumMapper<SliceType, 3> SliceTypeMapper(std::make_pair(SliceType::B, "B"sv),
constexpr EnumMapper<SliceType, 3> SliceTypeMapper(std::make_pair(SliceType::B, "B"sv),
std::make_pair(SliceType::P, "P"sv),
std::make_pair(SliceType::I, "I"sv));

Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/playlistitem/playlistItemOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <limits>

#include <common/FunctionsGui.h>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>

#define PLAYLISTITEMOVERLAY_DEBUG 0
#if PLAYLISTITEMOVERLAY_DEBUG && !NDEBUG
Expand All @@ -55,7 +55,7 @@
namespace
{

constexpr NewEnumMapper<OverlayLayoutMode, 3>
constexpr EnumMapper<OverlayLayoutMode, 3>
OverlayLayoutModeMapper(std::make_pair(OverlayLayoutMode::Overlay, "Overlay"sv),
std::make_pair(OverlayLayoutMode::Arange, "Average"sv),
std::make_pair(OverlayLayoutMode::Custom, "Custom"sv));
Expand Down
6 changes: 3 additions & 3 deletions YUViewLib/src/statistics/ColorMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#pragma once

#include <common/Color.h>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <common/Typedef.h>
#include <common/YUViewDomElement.h>

Expand Down Expand Up @@ -78,7 +78,7 @@ enum class PredefinedType
Col3_bwg
};

constexpr NewEnumMapper<PredefinedType, 21>
constexpr EnumMapper<PredefinedType, 21>
PredefinedTypeMapper(std::make_pair(PredefinedType::Jet, "Jet"sv),
std::make_pair(PredefinedType::Heat, "Heat"sv),
std::make_pair(PredefinedType::Hsv, "Hsv"sv),
Expand Down Expand Up @@ -108,7 +108,7 @@ enum class MappingType
Predefined
};

constexpr NewEnumMapper<MappingType, 3>
constexpr EnumMapper<MappingType, 3>
MappingTypeMapper(std::make_pair(MappingType::Gradient, "Gradient"sv),
std::make_pair(MappingType::Map, "Map"sv),
std::make_pair(MappingType::Predefined, "Predefined"sv));
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/ui/PlaybackController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <QSettings>

#include <common/FunctionsGui.h>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <common/Typedef.h>
#include <playlistitem/playlistItem.h>

Expand All @@ -52,7 +52,7 @@ using namespace std::chrono_literals;
namespace
{

constexpr NewEnumMapper<PlaybackController::RepeatMode, 3>
constexpr EnumMapper<PlaybackController::RepeatMode, 3>
RepeatModeMapper(std::make_pair(PlaybackController::RepeatMode::Off, "Off"sv),
std::make_pair(PlaybackController::RepeatMode::One, "One"sv),
std::make_pair(PlaybackController::RepeatMode::All, "All"sv));
Expand Down
6 changes: 3 additions & 3 deletions YUViewLib/src/video/PixelFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#pragma once

#include <QMetaType>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>

namespace video
{
Expand All @@ -51,7 +51,7 @@ enum class Endianness
Little
};

constexpr auto EndianessMapper = NewEnumMapper<Endianness, 2>(
constexpr auto EndianessMapper = EnumMapper<Endianness, 2>(
std::make_pair(Endianness::Little, "Little"sv), std::make_pair(Endianness::Big, "Big"sv));

enum class DataLayout
Expand All @@ -60,7 +60,7 @@ enum class DataLayout
Packed
};

constexpr auto DataLayoutMapper = NewEnumMapper<DataLayout, 2>(
constexpr auto DataLayoutMapper = EnumMapper<DataLayout, 2>(
std::make_pair(DataLayout::Packed, "Packed"sv), std::make_pair(DataLayout::Planar, "Planar"sv));

} // namespace video
Expand Down
6 changes: 3 additions & 3 deletions YUViewLib/src/video/rgb/PixelFormatRGB.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <common/Typedef.h>
#include <video/PixelFormat.h>

Expand Down Expand Up @@ -102,7 +102,7 @@ enum class ChannelOrder
BGR
};

constexpr NewEnumMapper<ChannelOrder, 6>
constexpr EnumMapper<ChannelOrder, 6>
ChannelOrderMapper(std::make_pair(ChannelOrder::RGB, "RGB"sv),
std::make_pair(ChannelOrder::RBG, "RBG"sv),
std::make_pair(ChannelOrder::GRB, "GRB"sv),
Expand All @@ -118,7 +118,7 @@ enum class AlphaMode
};

constexpr auto AlphaModeMapper =
NewEnumMapper<AlphaMode, 3>(std::make_pair(AlphaMode::None, "None"sv),
EnumMapper<AlphaMode, 3>(std::make_pair(AlphaMode::None, "None"sv),
std::make_pair(AlphaMode::First, "First"sv),
std::make_pair(AlphaMode::Last, "Last"sv));

Expand Down
6 changes: 3 additions & 3 deletions YUViewLib/src/video/rgb/videoHandlerRGB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <common/Formatting.h>
#include <common/Functions.h>
#include <common/FunctionsGui.h>
#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <video/rgb/ConversionRGB.h>
#include <video/rgb/PixelFormatRGBGuess.h>
#include <video/rgb/videoHandlerRGBCustomFormatDialog.h>
Expand All @@ -50,15 +50,15 @@ namespace video::rgb
namespace
{

constexpr NewEnumMapper<ComponentDisplayMode, 6>
constexpr EnumMapper<ComponentDisplayMode, 6>
ComponentShowMapper(std::make_pair(ComponentDisplayMode::RGBA, "RGBA"sv),
std::make_pair(ComponentDisplayMode::RGB, "RGB"sv),
std::make_pair(ComponentDisplayMode::R, "R"sv),
std::make_pair(ComponentDisplayMode::G, "G"sv),
std::make_pair(ComponentDisplayMode::B, "B"sv),
std::make_pair(ComponentDisplayMode::A, "A"sv));

constexpr NewEnumMapper<ComponentDisplayMode, 6>
constexpr EnumMapper<ComponentDisplayMode, 6>
ComponentShowMapperToDisplayText(std::make_pair(ComponentDisplayMode::RGBA, "RGBA"sv),
std::make_pair(ComponentDisplayMode::RGB, "RGB"sv),
std::make_pair(ComponentDisplayMode::R, "Red Only"sv),
Expand Down
14 changes: 7 additions & 7 deletions YUViewLib/src/video/yuv/PixelFormatYUV.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <common/Typedef.h>
#include <video/PixelFormat.h>

Expand Down Expand Up @@ -68,7 +68,7 @@ enum class ColorConversion
BT2020_FullRange,
};

constexpr NewEnumMapper<ColorConversion, 6> ColorConversionMapper(
constexpr EnumMapper<ColorConversion, 6> ColorConversionMapper(
std::make_pair(ColorConversion::BT709_LimitedRange, "ITU-R.BT709"sv),
std::make_pair(ColorConversion::BT709_FullRange, "ITU-R.BT709 Full Range"sv),
std::make_pair(ColorConversion::BT601_LimitedRange, "ITU-R.BT601"sv),
Expand All @@ -86,7 +86,7 @@ enum class ChromaInterpolation
Interstitial
};

constexpr NewEnumMapper<ChromaInterpolation, 3> ChromaInterpolationMapper(
constexpr EnumMapper<ChromaInterpolation, 3> ChromaInterpolationMapper(
std::make_pair(ChromaInterpolation::NearestNeighbor, "Nearest Neighbor"sv),
std::make_pair(ChromaInterpolation::Bilinear, "Bilinear"sv),
std::make_pair(ChromaInterpolation::Interstitial, "Interstitial"sv));
Expand All @@ -113,7 +113,7 @@ enum class PredefinedPixelFormat
V210
};

constexpr NewEnumMapper<PredefinedPixelFormat, 1>
constexpr EnumMapper<PredefinedPixelFormat, 1>
PredefinedPixelFormatMapper(std::make_pair(PredefinedPixelFormat::V210, "V210"sv));

enum class PackingOrder
Expand All @@ -134,7 +134,7 @@ enum class PackingOrder
UNKNOWN
};

constexpr NewEnumMapper<PackingOrder, 9>
constexpr EnumMapper<PackingOrder, 9>
PackingOrderMapper(std::make_pair(PackingOrder::YUV, "YUV"sv),
std::make_pair(PackingOrder::YVU, "YVU"sv),
std::make_pair(PackingOrder::AYUV, "AYUV"sv),
Expand All @@ -157,7 +157,7 @@ enum class Subsampling
UNKNOWN
};

constexpr NewEnumMapper<Subsampling, 7>
constexpr EnumMapper<Subsampling, 7>
SubsamplingMapper(std::make_pair(Subsampling::YUV_444, "444"sv),
std::make_pair(Subsampling::YUV_422, "422"sv),
std::make_pair(Subsampling::YUV_420, "420"sv),
Expand All @@ -179,7 +179,7 @@ enum class PlaneOrder
YVUA
};

constexpr NewEnumMapper<PlaneOrder, 4> PlaneOrderMapper(std::make_pair(PlaneOrder::YUV, "YUV"sv),
constexpr EnumMapper<PlaneOrder, 4> PlaneOrderMapper(std::make_pair(PlaneOrder::YUV, "YUV"sv),
std::make_pair(PlaneOrder::YVU, "YVU"sv),
std::make_pair(PlaneOrder::YUVA, "YUVA"sv),
std::make_pair(PlaneOrder::YVUA, "YVUA"sv));
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/video/yuv/videoHandlerYUV.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <video/videoHandler.h>
#include <video/yuv/PixelFormatYUV.h>

Expand All @@ -56,7 +56,7 @@ enum class ComponentDisplayMode
DisplayCr
};

const NewEnumMapper<ComponentDisplayMode, 4>
const EnumMapper<ComponentDisplayMode, 4>
ComponentDisplayModeMapper(std::make_pair(ComponentDisplayMode::DisplayAll, "Y'CbCr"sv),
std::make_pair(ComponentDisplayMode::DisplayY, "Luma (Y) Only"sv),
std::make_pair(ComponentDisplayMode::DisplayCb, "Cb only"sv),
Expand Down
2 changes: 1 addition & 1 deletion YUViewUnitTest/video/rgb/ConversionRGBTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "gtest/gtest.h"

#include <common/NewEnumMapper.h>
#include <common/EnumMapper.h>
#include <video/rgb/ConversionRGB.h>

using ::testing::Combine;
Expand Down

0 comments on commit 6e5cef7

Please sign in to comment.