Class that represents an online profile.
More...
#include <online_profile.hpp>
|
| enum | ConstructorType { C_DEFAULT = 1
, C_RELATION_INFO
} |
| |
|
typedef std::vector< uint32_t > | IDList |
| |
|
| enum | State { S_FETCHING_ACHIEVEMENTS = 0x01
, S_FETCHING_FRIENDS = 0x02
} |
| | The profile can either be fetching data, or be ready.
|
| |
|
|
State | m_state |
| |
|
bool | m_is_current_user |
| |
|
uint32_t | m_id |
| |
|
irr::core::stringw | m_username |
| |
|
RelationInfo * | m_relation_info |
| | information about the relation with the current user
|
| |
|
bool | m_is_friend |
| | Whether or not the user of this profile, is a friend of the current user.
|
| |
|
std::atomic_bool | m_has_fetched_friends |
| |
| std::vector< uint32_t > | m_friends |
| | List of user id's that are friends with the user of this profile. More...
|
| |
|
bool | m_has_fetched_achievements |
| |
|
std::vector< uint32_t > | m_achievements |
| |
|
std::map< uint32_t, irr::core::stringw > | m_friend_server_map |
| |
|
bool | m_cache_bit |
| |
Class that represents an online profile.
It manages the online profile for any user on this system, but also for users for which information is requested (e.g. to see the achievements of friends). All those profiles are managed by the ProfileManager.
◆ OnlineProfile() [1/2]
| Online::OnlineProfile::OnlineProfile |
( |
const uint32_t & |
userid, |
|
|
const irr::core::stringw & |
username, |
|
|
bool |
is_current_user = false |
|
) |
| |
Constructor for a new profile.
It does only store the ID, a name, and if it is the current user.
◆ OnlineProfile() [2/2]
| Online::OnlineProfile::OnlineProfile |
( |
const XMLNode * |
xml, |
|
|
ConstructorType |
type = C_DEFAULT |
|
) |
| |
Creates a new profile from an XML Node.
Two different profiles can be created: either a simple one with no relation, or a profile with relation information, i.e. it contains how this profile is related to the current profile.
- Parameters
-
| xml | The XML node with the data to use. |
| type | Either C_DEFAULT (no relation), or C_RELATION_INFO if the XML node contains relation information. |
◆ addFriend()
| void Online::OnlineProfile::addFriend |
( |
const uint32_t |
id | ) |
|
Adds a friend to the friend list.
- Parameters
-
| id | The id of the profile to add. |
◆ fetchAchievements()
| void Online::OnlineProfile::fetchAchievements |
( |
| ) |
|
Triggers an asynchronous request to get the achievements for this user from the server.
The state of this profile is changed to be fetching, and will be reset to ready when the server request returns.
A simple class that receives the achievements, and calls the right Profile instance to store them.
◆ fetchFriends()
| void Online::OnlineProfile::fetchFriends |
( |
| ) |
|
Triggers an asynchronous request to download the friends for this user.
The state of this profile is changed to be fetching, and will be reset to ready when the server request returns.
◆ getCacheBit()
| bool Online::OnlineProfile::getCacheBit |
( |
| ) |
const |
|
inline |
Returns the cache bit for this profile.
Used by the cache eviction algorithm.
◆ merge()
Merges the information from a given profile with this profile.
Any data that is in the given profile that's not available in this profile will be copied over, then the given profile will be deleted.
◆ removeFriend()
| void Online::OnlineProfile::removeFriend |
( |
const uint32_t |
id | ) |
|
Removed a friend with a given id.
- Parameters
-
◆ setCacheBit()
| void Online::OnlineProfile::setCacheBit |
( |
bool |
cache_bit | ) |
|
|
inline |
Sets the cache bit of this profile.
Used by the cache eviction algorithm.
◆ storeAchievements()
| void Online::OnlineProfile::storeAchievements |
( |
const XMLNode * |
input | ) |
|
|
private |
Stores the achievement ids from an XML node into this profile.
It also sets that achievements have been fetched, and changes the state to be READY again.
- Parameters
-
| input | XML node with the achievements data. |
◆ storeFriends()
| void Online::OnlineProfile::storeFriends |
( |
const XMLNode * |
input | ) |
|
|
private |
Stores the friends from an XML node into this profile.
It also sets that friends have been fetched, and changes the state of the profile to be READY again.
- Parameters
-
| input | XML node with the friends data. |
◆ unsetHasFetchedFriends()
| void Online::OnlineProfile::unsetHasFetchedFriends |
( |
| ) |
|
|
inline |
Unsets the flag that all friends of this profile are in cache.
Used when a profile is pushed out of cache.
◆ m_friends
| std::vector<uint32_t> Online::OnlineProfile::m_friends |
|
private |
List of user id's that are friends with the user of this profile.
In case this profile is of the current user, this list also contains any id's of users that still have a friend request pending.
The documentation for this class was generated from the following files: