From: APTX Date: Tue, 9 Apr 2013 12:49:01 +0000 (+0200) Subject: Add copy c-tor and assignment operator to node data classes. The intrusive parts... X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=70c5e8919a8573457065c3efee575886dd34f85c;p=localmylist.git Add copy c-tor and assignment operator to node data classes. The intrusive parts should not get copied --- diff --git a/localmylist/mylistnodedata.h b/localmylist/mylistnodedata.h index 09e6efe..eacfd96 100644 --- a/localmylist/mylistnodedata.h +++ b/localmylist/mylistnodedata.h @@ -13,9 +13,9 @@ class MyListFileLocationNode; struct AnimeData : public boost::intrusive::set_base_hook< > { - Anime data; MyListAnimeNode *node; + Anime data; int episodesInMyList; int watchedEpisodes; @@ -24,13 +24,24 @@ struct AnimeData : public boost::intrusive::set_base_hook< > AnimeData(int aid = 0) { data.aid = aid; } + + AnimeData(const AnimeData &other) + { *this = other; } + + AnimeData &operator=(const AnimeData &other) + { + data = other.data; + episodesInMyList = other.episodesInMyList; + watchedEpisodes = other.watchedEpisodes; + return *this; + } }; struct EpisodeData : public boost::intrusive::set_base_hook< > { - Episode data; MyListEpisodeNode *node; + Episode data; QDateTime watchedDate; int episodeTypeOrdering; @@ -39,25 +50,46 @@ struct EpisodeData : public boost::intrusive::set_base_hook< > EpisodeData(int eid = 0) { data.eid = eid; } + + EpisodeData(const EpisodeData &other) + { *this = other; } + + EpisodeData &operator=(const EpisodeData &other) + { + data = other.data; + watchedDate = other.watchedDate; + episodeTypeOrdering = other.episodeTypeOrdering; + return *this; + } }; struct FileData : public boost::intrusive::set_base_hook< > { - File data; MyListFileNode *node; + File data; + friend bool operator<(const FileData &a, const FileData &b) { return a.data.fid < b.data.fid; } FileData(int fid = 0) { data.fid = fid; } + + FileData(const FileData &other) + { *this = other; } + + FileData &operator=(const FileData &other) + { + data = other.data; + return *this; + } }; struct FileLocationData : public boost::intrusive::set_base_hook< > { - FileLocation data; MyListFileLocationNode *node; + FileLocation data; QString hostName; friend bool operator<(const FileLocationData &a, const FileLocationData &b) @@ -65,6 +97,16 @@ struct FileLocationData : public boost::intrusive::set_base_hook< > FileLocationData(int locationId = 0) { data.locationId = locationId; } + + FileLocationData(const FileLocationData &other) + { *this = other; } + + FileLocationData &operator=(const FileLocationData &other) + { + data = other.data; + hostName = other.hostName; + return *this; + } }; } // namespace LocalMyList