Added url parser class to find out which type of url is entered
This commit is contained in:
28
src/url_parser.hpp
Normal file
28
src/url_parser.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
enum class UrlType {
|
||||
SpotifyTrack,
|
||||
SpotifyPlaylist,
|
||||
SpotifyAlbum,
|
||||
SpotifyArtist,
|
||||
|
||||
YoutubeVideo,
|
||||
YoutubePlaylist,
|
||||
|
||||
Unknown
|
||||
};
|
||||
|
||||
struct ParsedUrl {
|
||||
UrlType type;
|
||||
std::string id;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, UrlType type);
|
||||
|
||||
class UrlParser {
|
||||
public:
|
||||
static std::optional<ParsedUrl> parse(const std::string &url);
|
||||
};
|
||||
Reference in New Issue
Block a user