gpg:: ParticipantResults
#include <participant_results.h>
一种数据结构,包含有关每个参与者的 TurnBasedMatch
结果的数据。
摘要
构造函数和析构函数 |
|
---|---|
ParticipantResults()
|
|
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
|
|
ParticipantResults(const ParticipantResults & copy_from)
创建现有
ParticipantResults 对象的副本。 |
|
ParticipantResults(ParticipantResults && move_from)
移动现有的
ParticipantResults 对象。 |
公共函数 |
|
---|---|
HasResultsForParticipant(const std::string & participant_id) const
|
bool
如果此
ParticipantResults 对象有给定 MultiplayerParticipant 的结果,则返回 true。 |
MatchResultForParticipant(const std::string & participant_id) const
|
返回
TurnBasedMatch 中指定参与者的 MatchResult 。 |
PlaceForParticipant(const std::string & participant_id) const
|
uint32_t
返回指定参与者在
TurnBasedMatch 中的放置位置。 |
Valid() const
|
bool
如果此
ParticipantResults 对象中填充了数据,则返回 true。 |
WithResult(const std::string & participant_id, uint32_t placing, MatchResult result) const
|
创建一个新的
ParticipantResults ,其中包含所有现有结果和传入此函数的其他结果数据。 |
operator=(const ParticipantResults & copy_from)
|
从另一个对象分配此
ParticipantResults 对象。 |
operator=(ParticipantResults && move_from)
|
将另一个对象移到此
ParticipantResults 对象中,以分配该对象。 |
公共函数
HasResultsForParticipant
bool HasResultsForParticipant( const std::string & participant_id ) const
如果此 ParticipantResults
对象有给定 MultiplayerParticipant
的结果,则返回 true。
Valid 必须返回 true 才可用。
MatchResultForParticipant
MatchResult MatchResultForParticipant( const std::string & participant_id ) const
返回 TurnBasedMatch
中指定参与者的 MatchResult
。
请注意,并非所有参与者都有 MatchResult;如果 HasResultsForParticipant 未返回 true,此函数将返回 MatchResult::NONE
。Valid 必须返回 true 才可用。
ParticipantResults
ParticipantResults()
ParticipantResults
ParticipantResults( std::shared_ptr< const ParticipantResultsImpl > impl )
构造从 shared_ptr
到 ParticipantResultsImpl
的 ParticipantResults
对象。
供 API 内部使用。
ParticipantResults
ParticipantResults( const ParticipantResults & copy_from )
创建现有 ParticipantResults
对象的副本。
ParticipantResults
ParticipantResults( ParticipantResults && move_from )
移动现有的 ParticipantResults
对象。
PlaceForParticipant
uint32_t PlaceForParticipant( const std::string & participant_id ) const
返回指定参与者在 TurnBasedMatch
中的放置位置。
请注意,并非所有参与者都有结果;如果 HasResultsForParticipant 未返回 true,则对于尚未排名的玩家,此函数将返回 0。Valid 必须返回 true 才可用。
有效
bool Valid() const
如果此 ParticipantResults
对象中填充了数据,则返回 true。
必须设为 true,此 ParticipantResults
对象的 getter 函数(PlaceForParticipant
、MatchResultForParticipant
等)才可用。
WithResult
ParticipantResults WithResult( const std::string & participant_id, uint32_t placing, MatchResult result ) const
创建一个新的 ParticipantResults
,其中包含所有现有结果和传入此函数的其他结果数据。
请注意,每个参与者只能设置一次结果。如果尝试设置多个结果,系统会记录错误,并且 ParticipantResults
不会进行修改。Valid 必须返回 true 才可用。
详细信息 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
operator=
ParticipantResults & operator=( const ParticipantResults & copy_from )
从另一个对象分配此 ParticipantResults
对象。
operator=
ParticipantResults & operator=( ParticipantResults && move_from )
将另一个对象移到此 ParticipantResults
对象中,以分配该对象。