Repository: xbmc/xbmc
File: xbmc/video/VideoDatabase.h (C/C++)

Code before:

private:
  static constexpr std::string_view enumToSV(VideoDbContentType type)
  {
    using namespace std::literals::string_view_literals;
    switch (type)
    {
      case VideoDbContentType::UNKNOWN:
        return "unknown"sv;
      case VideoDbContentType::MOVIES:
        return "movies"sv;
      case VideoDbContentType::TVSHOWS:
        return "TV shows"sv;
      case VideoDbContentType::MUSICVIDEOS:
        return "music videos"sv;
      case VideoDbContentType::EPISODES:
        return "episodes"sv;
      case VideoDbContentType::MOVIE_SETS:
        return "movie sets"sv;
      case VideoDbContentType::MUSICALBUMS:
        return "music albums"sv;
    };
    throw std::invalid_argument("no videodb content string found");
  }
};

typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
{
  VIDEODB_ID_MIN = -1,
  VIDEODB_ID_TITLE = 0,
  VIDEODB_ID_PLOT = 1,
  VIDEODB_ID_PLOTOUTLINE = 2,
  VIDEODB_ID_TAGLINE = 3,
  VIDEODB_ID_VOTES = 4, // unused
  VIDEODB_ID_RATING_ID = 5,
  VIDEODB_ID_CREDITS = 6,
  VIDEODB_ID_YEAR = 7, // unused
  VIDEODB_ID_THUMBURL = 8,
  VIDEODB_ID_IDENT_ID = 9,
  VIDEODB_ID_SORTTITLE = 10,
  VIDEODB_ID_RUNTIME = 11,
  VIDEODB_ID_MPAA = 12,
  VIDEODB_ID_TOP250 = 13,
  VIDEODB_ID_GENRE = 14,
  VIDEODB_ID_DIRECTOR = 15,
  VIDEODB_ID_ORIGINALTITLE = 16,
  VIDEODB_ID_THUMBURL_SPOOF = 17,
  VIDEODB_ID_STUDIOS = 18,
  VIDEODB_ID_TRAILER = 19,
  VIDEODB_ID_FANART = 20,
  VIDEODB_ID_COUNTRY = 21,

Review comment (suggestion):
For `std::invalid_argument`, `#include <stdexcept>` should be added.

Code after:
  {
    return fmt::formatter<std::string_view>::format(enumToSV(type), ctx);
  }

private:
  static constexpr std::string_view enumToSV(VideoDbContentType type)
  {
    using namespace std::literals::string_view_literals;
    switch (type)
    {
      case VideoDbContentType::UNKNOWN:
        return "unknown"sv;
      case VideoDbContentType::MOVIES:
        return "movies"sv;
      case VideoDbContentType::TVSHOWS:
        return "TV shows"sv;
      case VideoDbContentType::MUSICVIDEOS:
        return "music videos"sv;
      case VideoDbContentType::EPISODES:
        return "episodes"sv;
      case VideoDbContentType::MOVIE_SETS:
        return "movie sets"sv;
      case VideoDbContentType::MUSICALBUMS:
        return "music albums"sv;
    };
    throw std::invalid_argument("no videodb content string found");
  }
};

typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
{
  VIDEODB_ID_MIN = -1,
  VIDEODB_ID_TITLE = 0,
  VIDEODB_ID_PLOT = 1,
  VIDEODB_ID_PLOTOUTLINE = 2,
  VIDEODB_ID_TAGLINE = 3,
  VIDEODB_ID_VOTES = 4, // unused
  VIDEODB_ID_RATING_ID = 5,
  VIDEODB_ID_CREDITS = 6,
  VIDEODB_ID_YEAR = 7, // unused
  VIDEODB_ID_THUMBURL = 8,
  VIDEODB_ID_IDENT_ID = 9,
  VIDEODB_ID_SORTTITLE = 10,
  VIDEODB_ID_RUNTIME = 11,
  VIDEODB_ID_MPAA = 12,
  VIDEODB_ID_TOP250 = 13,
  VIDEODB_ID_GENRE = 14,
  VIDEODB_ID_DIRECTOR = 15,
  VIDEODB_ID_ORIGINALTITLE = 16,
  VIDEODB_ID_THUMBURL_SPOOF = 17,
  VIDEODB_ID_STUDIOS = 18,