]> Some of my projects - anidbudpclient.git/commitdiff
Rework the various flag enums.
authorAPTX <marek321@gmail.com>
Mon, 21 May 2012 19:09:46 +0000 (21:09 +0200)
committerAPTX <marek321@gmail.com>
Mon, 21 May 2012 19:09:46 +0000 (21:09 +0200)
anidbudpclient_global.h

index d885f77f0cb4b21fee1080eb4eda4a3dd0429f99..6e5973eefef942ec253f79f3820b123ab424cb17 100644 (file)
@@ -252,6 +252,8 @@ namespace AniDBUdpClient
                        Aid                             = Q_UINT64_C(0x0000004000000000),
                //      Unused                  = Q_UINT64_C(0x0000008000000000),
 
+                       LastFlag                = Aid,
+
                        Extension               = FileType,
 
                        Byte5                   = MyListOther | MyListSource | MyListStorage
@@ -275,7 +277,7 @@ namespace AniDBUdpClient
        typedef FileFlags FMask;
 
        namespace FileAnimeFlag {
-               enum FileAnimeFlag {
+               enum FileAnimeFlag : quint32 {
                        DateAidRecordUpdated    = 0x00000001,
                //      Unused                                  = 0x00000002,
                //      Unused                                  = 0x00000004,
@@ -312,6 +314,8 @@ namespace AniDBUdpClient
                        HighestEpisodeNumber    = 0x40000000,
                        AnimeTotalEpisodes              = 0x80000000,
 
+                       LastFlag                                = AnimeTotalEpisodes,
+
                        Byte4                                   = DateAidRecordUpdated | GroupShortName
                                                                          | GroupName,
                        Byte3                                   = EpisodeVoteCount | EpisodeRating
@@ -329,86 +333,100 @@ namespace AniDBUdpClient
                };
        }
 
-       Q_FLAGS(FileAnimeFlag::FileAnimeFlag);
-       Q_DECLARE_FLAGS(FileAnimeFlags, FileAnimeFlag::FileAnimeFlag);
-       Q_DECLARE_OPERATORS_FOR_FLAGS(FileAnimeFlags);
+       AniQ_DECLARE_FLAGS(FileAnimeFlags, FileAnimeFlag::FileAnimeFlag, quint32)
+       AniQ_DECLARE_OPERATORS_FOR_FLAGS(FileAnimeFlags)
        typedef FileAnimeFlags FileAMask;
 
        namespace AnimeFlag {
-               typedef quint64 AnimeFlag;
-               static const AnimeFlag CategoryWeightList       = Q_UINT64_C(0x0000000000000001);
-               static const AnimeFlag CategoryList                     = Q_UINT64_C(0x0000000000000002);
-               static const AnimeFlag RelatedAidType           = Q_UINT64_C(0x0000000000000004);
-               static const AnimeFlag RelatedAidList           = Q_UINT64_C(0x0000000000000008);
-               static const AnimeFlag Type                                     = Q_UINT64_C(0x0000000000000010);
-               static const AnimeFlag Year                                     = Q_UINT64_C(0x0000000000000020);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000000000000040);
-               static const AnimeFlag Aid                                      = Q_UINT64_C(0x0000000000000080);
-
-       //      static const AnimeFlag Retired                          = Q_UINT64_C(0x0000000000000100);
-       //      static const AnimeFlag Retired                          = Q_UINT64_C(0x0000000000000200);
-               static const AnimeFlag SynonymList                      = Q_UINT64_C(0x0000000000000400);
-               static const AnimeFlag ShortNameList            = Q_UINT64_C(0x0000000000000800);
-               static const AnimeFlag OtherName                        = Q_UINT64_C(0x0000000000001000);
-               static const AnimeFlag EnglishName                      = Q_UINT64_C(0x0000000000002000);
-               static const AnimeFlag KanjiName                        = Q_UINT64_C(0x0000000000004000);
-               static const AnimeFlag RomajiName                       = Q_UINT64_C(0x0000000000008000);
-
-               static const AnimeFlag CategoryIdList           = Q_UINT64_C(0x0000000000010000);
-               static const AnimeFlag PicName                          = Q_UINT64_C(0x0000000000020000);
-               static const AnimeFlag Url                                      = Q_UINT64_C(0x0000000000040000);
-               static const AnimeFlag EndDate                          = Q_UINT64_C(0x0000000000080000);
-               static const AnimeFlag AirDate                          = Q_UINT64_C(0x0000000000100000);
-               static const AnimeFlag SpecialEpCount           = Q_UINT64_C(0x0000000000200000);
-               static const AnimeFlag NormalEpCount            = Q_UINT64_C(0x0000000000400000);
-               static const AnimeFlag Episodes                         = Q_UINT64_C(0x0000000000800000);
-
-               static const AnimeFlag Is18Restricted           = Q_UINT64_C(0x0000000001000000);
-               static const AnimeFlag AwardList                        = Q_UINT64_C(0x0000000002000000);
-               static const AnimeFlag ReviewCount                      = Q_UINT64_C(0x0000000004000000);
-               static const AnimeFlag AverageReviewRating      = Q_UINT64_C(0x0000000008000000);
-               static const AnimeFlag TempVoteCount            = Q_UINT64_C(0x0000000010000000);
-               static const AnimeFlag TempRating                       = Q_UINT64_C(0x0000000020000000);
-               static const AnimeFlag VoteCount                        = Q_UINT64_C(0x0000000040000000);
-               static const AnimeFlag Rating                           = Q_UINT64_C(0x0000000080000000);
-
-               static const AnimeFlag DateRecordUpdated        = Q_UINT64_C(0x0000000100000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000000200000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000000400000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000000800000000);
-               static const AnimeFlag AniemNfoId                       = Q_UINT64_C(0x0000001000000000);
-               static const AnimeFlag AllCinemaId                      = Q_UINT64_C(0x0000002000000000);
-               static const AnimeFlag ANNId                            = Q_UINT64_C(0x0000004000000000);
-               static const AnimeFlag AnimePlanetId            = Q_UINT64_C(0x0000008000000000);
-
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000010000000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000020000000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000040000000000);
-       //      static const AnimeFlag Unused                           = Q_UINT64_C(0x0000080000000000);
-               static const AnimeFlag ProducerNameList         = Q_UINT64_C(0x0000100000000000);
-               static const AnimeFlag ProducerIdList           = Q_UINT64_C(0x0000200000000000);
-               static const AnimeFlag CreatorIdList            = Q_UINT64_C(0x0000400000000000);
-               static const AnimeFlag CharacterIdList          = Q_UINT64_C(0x0000800000000000);
-
-               static const AnimeFlag Byte1                    = CategoryWeightList | CategoryList | RelatedAidType
-                                                                                                 | RelatedAidList | Type | Year | Aid;
-               static const AnimeFlag Byte2                    = SynonymList | ShortNameList | OtherName
-                                                                                                 | EnglishName | KanjiName | RomajiName;
-               static const AnimeFlag Byte3                    = CategoryIdList | PicName | Url | EndDate | AirDate
-                                                                                                 | SpecialEpCount | NormalEpCount | Episodes;
-               static const AnimeFlag Byte4                    = Is18Restricted | AwardList | ReviewCount
-                                                                                                 | AverageReviewRating | TempVoteCount | TempRating
-                                                                                                 | VoteCount | Rating;
-               static const AnimeFlag Byte5                    = DateRecordUpdated | AniemNfoId | AllCinemaId
-                                                                                                 | ANNId | AnimePlanetId;
-               static const AnimeFlag Byte6                    = ProducerNameList | ProducerIdList | CreatorIdList
-                                                                                                 | CharacterIdList;
-               static const AnimeFlag AllData                  = Byte1 | Byte2 | Byte3 | Byte4
-                                                                                                 | Byte5 | Byte6;
-               static const AnimeFlag InvalidBits              = ~AllData;
+               enum AnimeFlag : quint64 {
+                       //      Unused                  = Q_UINT64_C(0x0000000000000001),
+                       //      Unused                  = Q_UINT64_C(0x0000000000000002),
+                       //      Unused                  = Q_UINT64_C(0x0000000000000004),
+                       SpecialsCount           = Q_UINT64_C(0x0000000000000008),
+                       CreditsCount            = Q_UINT64_C(0x0000000000000010),
+                       OtherCount                      = Q_UINT64_C(0x0000000000000020),
+                       TrailerCount            = Q_UINT64_C(0x0000000000000040),
+                       ParodyCount                     = Q_UINT64_C(0x0000000000000080),
+
+               //      Unused                          = Q_UINT64_C(0x0000000000000100),
+               //      Unused                          = Q_UINT64_C(0x0000000000000200),
+               //      Unused                          = Q_UINT64_C(0x0000000000000400),
+               //      Unused                          = Q_UINT64_C(0x0000000000000800),
+                       MainCreatorNameList     = Q_UINT64_C(0x0000000000001000),
+                       MainCreatorIdList       = Q_UINT64_C(0x0000000000002000),
+                       CreatorIdList           = Q_UINT64_C(0x0000000000004000),
+                       CharacterIdList         = Q_UINT64_C(0x0000000000008000),
+
+                       DateRecordUpdated       = Q_UINT64_C(0x0000000000010000),
+               //      Unused                          = Q_UINT64_C(0x0000000000020000),
+               //      Unused                          = Q_UINT64_C(0x0000000000040000),
+               //      Unused                          = Q_UINT64_C(0x0000000000080000),
+                       AnimeNfoId                      = Q_UINT64_C(0x0000000000100000),
+                       AllCinemaId                     = Q_UINT64_C(0x0000000000200000),
+                       ANNId                           = Q_UINT64_C(0x0000000000400000),
+                       AnimePlanetId           = Q_UINT64_C(0x0000000000800000),
+
+                       Is18Restricted          = Q_UINT64_C(0x0000000001000000),
+                       AwardList                       = Q_UINT64_C(0x0000000002000000),
+                       ReviewCount                     = Q_UINT64_C(0x0000000004000000),
+                       AverageReviewRating     = Q_UINT64_C(0x0000000008000000),
+                       TempVoteCount           = Q_UINT64_C(0x0000000010000000),
+                       TempRating                      = Q_UINT64_C(0x0000000020000000),
+                       VoteCount                       = Q_UINT64_C(0x0000000040000000),
+                       Rating                          = Q_UINT64_C(0x0000000080000000),
+
+                       CategoryIdList          = Q_UINT64_C(0x0000000100000000),
+                       PicName                         = Q_UINT64_C(0x0000000200000000),
+                       Url                                     = Q_UINT64_C(0x0000000400000000),
+                       EndDate                         = Q_UINT64_C(0x0000000800000000),
+                       AirDate                         = Q_UINT64_C(0x0000001000000000),
+                       SpecialEpCount          = Q_UINT64_C(0x0000002000000000),
+                       HighestEpisodeNumber= Q_UINT64_C(0x0000004000000000),
+                       Episodes                        = Q_UINT64_C(0x0000008000000000),
+
+               //      Retired                         = Q_UINT64_C(0x0000010000000000),
+               //      Retired                         = Q_UINT64_C(0x0000020000000000),
+                       SynonymList                     = Q_UINT64_C(0x0000040000000000),
+                       ShortNameList           = Q_UINT64_C(0x0000080000000000),
+                       OtherName                       = Q_UINT64_C(0x0000100000000000),
+                       EnglishName                     = Q_UINT64_C(0x0000200000000000),
+                       KanjiName                       = Q_UINT64_C(0x0000400000000000),
+                       RomajiName                      = Q_UINT64_C(0x0000800000000000),
+
+                       CategoryWeightList      = Q_UINT64_C(0x0001000000000000),
+                       CategoryList            = Q_UINT64_C(0x0002000000000000),
+                       RelatedAidType          = Q_UINT64_C(0x0004000000000000),
+                       RelatedAidList          = Q_UINT64_C(0x0008000000000000),
+                       Type                            = Q_UINT64_C(0x0010000000000000),
+                       Year                            = Q_UINT64_C(0x0020000000000000),
+                       DateFlags                       = Q_UINT64_C(0x0040000000000000),
+                       Aid                                     = Q_UINT64_C(0x0080000000000000),
+
+                       LastFlag                        = Aid,
+
+                       Byte1                   = SpecialsCount | CreditsCount | OtherCount
+                                                       | TrailerCount | ParodyCount,
+                       Byte2                   = MainCreatorNameList | MainCreatorIdList | CreatorIdList
+                                                       | CharacterIdList,
+                       Byte3                   = DateRecordUpdated | AnimeNfoId | AllCinemaId
+                                                       | ANNId | AnimePlanetId,
+                       Byte4                   = Is18Restricted | AwardList | ReviewCount
+                                                       | AverageReviewRating | TempVoteCount | TempRating
+                                                       | VoteCount | Rating,
+                       Byte5                   = CategoryIdList | PicName | Url | EndDate | AirDate
+                                                       | SpecialEpCount | HighestEpisodeNumber | Episodes,
+                       Byte6                   = SynonymList | ShortNameList | OtherName
+                                                       | EnglishName | KanjiName | RomajiName,
+                       Byte7                   = CategoryWeightList | CategoryList | RelatedAidType
+                                                       | RelatedAidList | Type | Year | DateFlags | Aid,
+                       AllData                 = Byte1 | Byte2 | Byte3 | Byte4
+                                                       | Byte5 | Byte6 | Byte7,
+                       InvalidBits             = ~AllData,
+               };
        }
 
-       typedef AnimeFlag::AnimeFlag AnimeFlags;
+       AniQ_DECLARE_FLAGS(AnimeFlags, AnimeFlag::AnimeFlag, quint64)
+       AniQ_DECLARE_OPERATORS_FOR_FLAGS(AnimeFlags)
        typedef AnimeFlags AMask;
 
        namespace HashPrivate {