From a65c8d64b5025fb6bf259e54ba3f2137a0963554 Mon Sep 17 00:00:00 2001 From: Karutoh Date: Tue, 9 Jul 2024 19:23:24 -0700 Subject: [PATCH] Fixed constructor to use move constructors. --- include/ehs/io/socket/rest/Spotify.h | 12 ++++++------ src/io/socket/rest/Spotify.cpp | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ehs/io/socket/rest/Spotify.h b/include/ehs/io/socket/rest/Spotify.h index 2ae077d..37140d5 100644 --- a/include/ehs/io/socket/rest/Spotify.h +++ b/include/ehs/io/socket/rest/Spotify.h @@ -21,7 +21,7 @@ namespace ehs Str_8 id; }; - class Spotify + class Spotify final { private: SSL client; @@ -40,14 +40,14 @@ namespace ehs Spotify(); - Spotify(const Str_8& clientId, const Str_8& secret, const Str_8& redURI, const Array& scopes, const bool forceVerify); + Spotify(Str_8 clientId, Str_8 secret, Str_8 redURI, Array scopes, bool forceVerify); bool Authorize(); /// Sets the volume for a device. /// @param [in] level The percentage to set the volume to. /// @returns The response code. - UInt_32 SetVolume(const UInt_8 level); + UInt_32 SetVolume(UInt_8 level); /// Resume playback for a device. /// @returns The response code. @@ -60,12 +60,12 @@ namespace ehs /// Repeats playback for a device. /// @param [in] status The status to set it to. /// @returns The response code. - UInt_32 SetRepeat(const SpotifyState state); + UInt_32 SetRepeat(SpotifyState state); /// Shuffles playback for a device. /// @param [in] state The state to set shuffle to. /// @returns The response code. - UInt_32 SetShuffle(const bool state); + UInt_32 SetShuffle(bool state); UInt_32 SearchTrack(Vector& artists, Str_8& id, Str_8& name); @@ -93,7 +93,7 @@ namespace ehs /// Seeks to a position of the currently playing track in milliseconds. /// @param [in] pos The position in milliseconds to seek to. /// @returns The response code. - UInt_32 Seek(const UInt_32 pos); + UInt_32 Seek(UInt_32 pos); Str_8 GetClientId() const; diff --git a/src/io/socket/rest/Spotify.cpp b/src/io/socket/rest/Spotify.cpp index 83cac55..6a60501 100644 --- a/src/io/socket/rest/Spotify.cpp +++ b/src/io/socket/rest/Spotify.cpp @@ -17,8 +17,9 @@ namespace ehs { } - Spotify::Spotify(const Str_8& clientId, const Str_8& secret, const Str_8& redURI, const Array& scopes, const bool forceVerify) - : client(AddrType::IPV4), clientId(clientId), secret(secret), redURI(redURI), scopes(scopes), forceVerify(forceVerify) + Spotify::Spotify(Str_8 clientId, Str_8 secret, Str_8 redURI, Array scopes, const bool forceVerify) + : client(AddrType::IPV4), clientId((Str_8 &&)clientId), secret((Str_8 &&)secret), redURI((Str_8 &&)redURI), + scopes((Array &&)scopes), forceVerify(forceVerify) { }