gpg::ParticipantResults

#include <participant_results.h>

一个包含 TurnBasedMatch 中每个参与者结果的数据结构。

摘要

构造函数和析构函数

ParticipantResults()
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
从指向 ParticipantResultsImplshared_ptr 构造一个 ParticipantResults 对象。
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 中指定参与者的名次 (placing)。
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
)

从指向 ParticipantResultsImplshared_ptr 构造一个 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 中指定参与者的名次 (placing)。

请注意,并非所有参与者都可能有结果;如果 HasResultsForParticipant 未返回 true,此函数将为尚未排名的玩家返回 0。此函数可用的前提是 Valid 必须返回 true。

Valid

bool Valid() const 

如果此 ParticipantResults 对象已填充数据,则返回 true。

此函数可用的前提是,此 ParticipantResults 对象的 getter 函数(PlaceForParticipantMatchResultForParticipant 等)必须可用。

WithResult

ParticipantResults WithResult(
  const std::string & participant_id,
  uint32_t placing,
  MatchResult result
) const 

创建一个新的 ParticipantResults,其中包含所有现有结果以及传递到此函数的额外结果数据。

请注意,每个参与者只能设置一次结果。尝试设置多个结果将记录错误并保持 ParticipantResults 不变。此函数可用的前提是 Valid 必须返回 true。

详细信息
参数
participant_id
要添加结果的 MultiplayerParticipant
placing
参与者在比赛中的名次 (placing)。
result
参与者在比赛中的 MatchResult

operator=

ParticipantResults & operator=(
  const ParticipantResults & copy_from
)

将此 ParticipantResults 对象分配自另一个对象。

operator=

ParticipantResults & operator=(
  ParticipantResults && move_from
)

通过将另一个 ParticipantResults 对象移动到此对象中来分配此对象。