]> Some of my projects - localmylist.git/commitdiff
Add copy c-tor and assignment operator to node data classes. The intrusive parts...
authorAPTX <marek321@gmail.com>
Tue, 9 Apr 2013 12:49:01 +0000 (14:49 +0200)
committerAPTX <marek321@gmail.com>
Tue, 9 Apr 2013 12:49:01 +0000 (14:49 +0200)
localmylist/mylistnodedata.h

index 09e6efed59ea9ce788df4ccffcd4ac91221b5f88..eacfd9690bf035fe98d4dec7e88eadbe3711f852 100644 (file)
@@ -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