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 )
建構 ParticipantResults
物件從 shared_ptr
到 ParticipantResultsImpl
。
主要供 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,這個函式才會使用。
詳細說明 | |||||||
---|---|---|---|---|---|---|---|
參數 |
|
運算子=
ParticipantResults & operator=( const ParticipantResults & copy_from )
從其他物件指派這個 ParticipantResults
物件。
運算子=
ParticipantResults & operator=( ParticipantResults && move_from )
將其他物件移至該 ParticipantResults
物件,即可指派這個物件。