From 26cac6b426f729c7df096cfb1614a3ee7d8eefc4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 6 Jan 2025 15:40:45 +0300 Subject: more code cleaning --- protocols/Steam/src/api/enums.h | 111 ++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 62 deletions(-) (limited to 'protocols/Steam/src/api') diff --git a/protocols/Steam/src/api/enums.h b/protocols/Steam/src/api/enums.h index b93377f5a9..66626da535 100644 --- a/protocols/Steam/src/api/enums.h +++ b/protocols/Steam/src/api/enums.h @@ -1,76 +1,63 @@ #ifndef _STEAM_ENUMS_H_ #define _STEAM_ENUMS_H_ -enum class FriendRelationship : int +namespace FriendRelationship { - None = 0, - Blocked = 1, - RequestRecipient = 2, - Friend = 3, - RequestInitiator = 4, - Ignored = 5, - IgnoredFriend = 6, -}; - -enum class PersonaState : int -{ - Offline = 0, - Online = 1, - Busy = 2, - Away = 3, - Snooze = 4, - LookingToTrade = 5, - LookingToPlay = 6, - Invisible = 7, -}; - -enum class PersonaStateFlag : int -{ - None = 0, - HasRichPresence = 1, - InJoinableGame = 2, - ClientTypeWeb = 256, - ClientTypeMobile = 512, - ClientTypeBigPicture = 1024, - ClientTypeVR = 2048, -}; - -inline PersonaStateFlag operator &(PersonaStateFlag lhs, PersonaStateFlag rhs) -{ - return static_cast ( - static_cast::type>(lhs) & - static_cast::type>(rhs)); + enum { + None = 0, + Blocked = 1, + RequestRecipient = 2, + Friend = 3, + RequestInitiator = 4, + Ignored = 5, + IgnoredFriend = 6, + }; } -enum class PersonaStatusFlag : int +namespace PersonaState { - Status = 1, - PlayerName = 2, - QueryPort = 4, - SourceID = 8, - Presence = 16, - Metadata = 32, - LastSeen = 64, - ClanInfo = 128, - GameExtraInfo = 256, - GameDataBlob = 512, - ClanTag = 1024, - Facebook = 2048, - Unknown = 4096, -}; + enum { + Offline = 0, + Online = 1, + Busy = 2, + Away = 3, + Snooze = 4, + LookingToTrade = 5, + LookingToPlay = 6, + Invisible = 7, + }; +} -inline PersonaStatusFlag operator &(PersonaStatusFlag lhs, PersonaStatusFlag rhs) +namespace PersonaStateFlag { - return static_cast ( - static_cast::type>(lhs) & - static_cast::type>(rhs)); + enum { + None = 0, + HasRichPresence = 1, + InJoinableGame = 2, + ClientTypeWeb = 256, + ClientTypeMobile = 512, + ClientTypeBigPicture = 1024, + ClientTypeVR = 2048, + }; } -template -bool contains_flag(T x, T y) { - return (static_cast::type>(x) - & static_cast::type>(y)) - == static_cast::type>(y); +namespace PersonaStatusFlag +{ + enum { + Status = 1, + PlayerName = 2, + QueryPort = 4, + SourceID = 8, + Presence = 16, + Metadata = 32, + LastSeen = 64, + ClanInfo = 128, + GameExtraInfo = 256, + GameDataBlob = 512, + ClanTag = 1024, + Facebook = 2048, + Unknown = 4096, + }; } #endif //_STEAM_ENUMS_H_ -- cgit v1.2.3