Changeset View
Changeset View
Standalone View
Standalone View
src/musicaudiogenre.cpp
Show All 11 Lines | |||||
12 | * Lesser General Public License for more details. | 12 | * Lesser General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public License | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "musicaudiogenre.h" | 18 | #include "musicaudiogenre.h" | ||
19 | 19 | | |||
20 | #include <QSharedData> | ||||
21 | | ||||
20 | #include <QDebug> | 22 | #include <QDebug> | ||
21 | 23 | | |||
22 | class MusicAudioGenrePrivate | 24 | class MusicAudioGenrePrivate : public QSharedData | ||
23 | { | 25 | { | ||
24 | public: | 26 | public: | ||
25 | 27 | | |||
26 | QString mName; | 28 | QString mName; | ||
27 | 29 | | |||
28 | qulonglong mDatabaseId = 0; | 30 | qulonglong mDatabaseId = 0; | ||
29 | 31 | | |||
30 | }; | 32 | }; | ||
31 | 33 | | |||
32 | MusicAudioGenre::MusicAudioGenre() : d(std::make_unique<MusicAudioGenrePrivate>()) | 34 | MusicAudioGenre::MusicAudioGenre() : d(new MusicAudioGenrePrivate()) | ||
33 | { | 35 | { | ||
34 | } | 36 | } | ||
35 | 37 | | |||
36 | MusicAudioGenre::MusicAudioGenre(MusicAudioGenre &&other) | 38 | MusicAudioGenre::MusicAudioGenre(MusicAudioGenre &&other) noexcept = default; | ||
37 | { | | |||
38 | d.swap(other.d); | | |||
39 | } | | |||
40 | 39 | | |||
41 | MusicAudioGenre::MusicAudioGenre(const MusicAudioGenre &other) : d(std::make_unique<MusicAudioGenrePrivate>(*other.d)) | 40 | MusicAudioGenre::MusicAudioGenre(const MusicAudioGenre &other) = default; | ||
42 | { | | |||
43 | } | | |||
44 | 41 | | |||
45 | MusicAudioGenre& MusicAudioGenre::operator=(MusicAudioGenre &&other) | 42 | MusicAudioGenre& MusicAudioGenre::operator=(MusicAudioGenre &&other) noexcept = default; | ||
46 | { | | |||
47 | if (&other != this) { | | |||
48 | d.reset(); | | |||
49 | d.swap(other.d); | | |||
50 | } | | |||
51 | 43 | | |||
52 | return *this; | 44 | MusicAudioGenre &MusicAudioGenre::operator=(const MusicAudioGenre &other) = default; | ||
53 | } | | |||
54 | | ||||
55 | MusicAudioGenre &MusicAudioGenre::operator=(const MusicAudioGenre &other) | | |||
56 | { | | |||
57 | if (&other != this) { | | |||
58 | (*d) = (*other.d); | | |||
59 | } | | |||
60 | | ||||
61 | return *this; | | |||
62 | } | | |||
63 | 45 | | |||
64 | MusicAudioGenre::~MusicAudioGenre() | 46 | MusicAudioGenre::~MusicAudioGenre() | ||
65 | = default; | 47 | = default; | ||
66 | 48 | | |||
67 | void MusicAudioGenre::setName(const QString &aName) | 49 | void MusicAudioGenre::setName(const QString &aName) | ||
68 | { | 50 | { | ||
69 | d->mName = aName; | 51 | d->mName = aName; | ||
70 | } | 52 | } | ||
Show All 27 Lines |