gpg::ParticipantResults

#include <participant_results.h>

מבנה נתונים שמכיל נתונים לגבי התוצאות של TurnBasedMatch לכל משתתף.

סיכום

בנייה

ParticipantResults()
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
יוצרת אובייקט ParticipantResults מ-shared_ptr ל-ParticipantResultsImpl.
ParticipantResults(const ParticipantResults & copy_from)
יצירת עותק של אובייקט ParticipantResults קיים.
ParticipantResults(ParticipantResults && move_from)
העברת אובייקט ParticipantResults קיים.

פונקציות ציבוריות

HasResultsForParticipant(const std::string & participant_id) const
bool
הפונקציה מחזירה את הערך true אם לאובייקט ParticipantResults הזה יש תוצאה עבור MultiplayerParticipant הנתון.
MatchResultForParticipant(const std::string & participant_id) const
הפונקציה מחזירה את הערך MatchResult של המשתתף שצוין בתוך TurnBasedMatch.
PlaceForParticipant(const std::string & participant_id) const
uint32_t
הפונקציה מחזירה את המיקום של המשתתף שצוין בתוך TurnBasedMatch.
Valid() const
bool
הפונקציה מחזירה true אם האובייקט ParticipantResults הזה מאוכלס בנתונים.
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 

הפונקציה מחזירה את הערך true אם לאובייקט ParticipantResults הזה יש תוצאה עבור MultiplayerParticipant הנתון.

כדי שאפשר יהיה להשתמש בפונקציה תקינה, הפונקציה צריכה להחזיר את הערך True.

MatchResultForParticipant

MatchResult MatchResultForParticipant(
  const std::string & participant_id
) const 

הפונקציה מחזירה את הערך MatchResult של המשתתף שצוין בתוך TurnBasedMatch.

שימו לב שלא לכל המשתתפים עשויה להיות תוצאת התאמה. אם הפונקציה HasResultsForParticipant לא מחזירה את הערך true, הפונקציה הזו מחזירה MatchResult::NONE. כדי שאפשר יהיה להשתמש בפונקציה תקינה, הפונקציה צריכה להחזיר את הערך 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 לשחקן שעדיין לא דורג. כדי שאפשר יהיה להשתמש בפונקציה תקינה, הפונקציה צריכה להחזיר את הערך True.

נתונים תקפים

bool Valid() const 

הפונקציה מחזירה true אם האובייקט ParticipantResults הזה מאוכלס בנתונים.

חייב להיות True כדי שניתן יהיה להשתמש בפונקציות getter (PlaceForParticipant, MatchResultForParticipant וכו'...) באובייקט ParticipantResults הזה.

WithResult

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

הפונקציה יוצרת ParticipantResults חדש שמכיל את כל התוצאות הקיימות ואת נתוני התוצאות הנוספים שמועברים לפונקציה הזו.

הערה: אפשר להגדיר תוצאה פעם אחת בלבד לכל משתתף. ניסיון להגדיר יותר מתוצאה אחת יתעד שגיאה וישאיר את ParticipantResults ללא שינויים. כדי שאפשר יהיה להשתמש בפונקציה תקינה, הפונקציה צריכה להחזיר את הערך True.

פרטים
פרמטרים
participant_id
MultiplayerParticipant שעבורו יש להוסיף תוצאה.
placing
המיקום של המשתתף בהתאמה.
result
MatchResult של המשתתף בהתאמה.

operator=

ParticipantResults & operator=(
  const ParticipantResults & copy_from
)

הקצאה של אובייקט ParticipantResults הזה מאובייקט אחר.

operator=

ParticipantResults & operator=(
  ParticipantResults && move_from
)

הקצאת אובייקט ParticipantResults זה על ידי העברת אובייקט אחר אליו.