Public Member Functions | Static Public Member Functions | Protected Attributes | Properties

OFScoreEnumerator Class Reference

#import <OFScoreEnumerator.h>

List of all members.

Public Member Functions

(BOOL) - nextPage
(BOOL) - previousPage
(void) - pageWithCurrentUser
(void) - jumpToPage:

Static Public Member Functions

(void) + setDelegate:
(OFScoreEnumerator *) + scoreEnumeratorForLeaderboard:pageSize:filter:

Protected Attributes

OFScoreFilter filter
NSString * leaderboardId
OFRequestHandleactiveRequest

Properties

NSInteger pageSize
NSInteger currentPage
NSInteger totalPages
BOOL hasScores
NSArray * scores
BOOL isCurrentUserPage

Detailed Description

OFScoreEnumerator objects provide a convenient way to enumerate the scores for a particular leaderboard.

Enumeration works by downloading one 'page' at a time. A page is simply a fixed-size array of scores.

See also:
OFScoreEnumeratorDelegate
OFLeaderboard

Member Function Documentation

- (void) jumpToPage: (NSInteger)  page

Retrieve a given page of scores. The page index is a one-based value such that page == 1 refers to the first page.

Note:
Invokes -(void)didReceiveScoresOFScoreEnumerator: on success, -(void)didFailReceiveScoresOFScoreEnumerator: on failure.
- (BOOL) nextPage

Retrieve the next page of scores.

Returns:
YES if the next page is being downloaded, NO if the current page is already the last page.
Note:
Invokes -(void)didReceiveScoresOFScoreEnumerator: on success, -(void)didFailReceiveScoresOFScoreEnumerator: on failure.
- (void) pageWithCurrentUser

Retrieve the page of scores that contains the current user's score.

Note:
Invokes -(void)didReceiveScoresOFScoreEnumerator: on success, -(void)didFailReceiveScoresOFScoreEnumerator: on failure.
- (BOOL) previousPage

Retrieve the previous page of scores.

Returns:
YES if the previous page is being downloaded, NO if the current page is already the first page.
Note:
Invokes -(void)didReceiveScoresOFScoreEnumerator: on success, -(void)didFailReceiveScoresOFScoreEnumerator: on failure.
+ (OFScoreEnumerator*) scoreEnumeratorForLeaderboard: (OFLeaderboard *)  leaderboard
pageSize: (NSInteger)  pageSize
filter: (OFScoreFilter filter 

Returns an initialized score enumerator which will enumerate a set of scores of a given leaderboard based on a filter. The enumerator object will immediately fetch the first page of scores, but they will not be available when this method returns. One of the following delegate methods will be called to when the asynchronous server response has been received. The first page of scores is passed as a parameter to the success delegate.

Note:
Invokes -(void)didReceiveScoresOFScoreEnumerator: on success, -(void)didFailReceiveScoresOFScoreEnumerator: on failure.
Parameters:
leaderboardThe leaderboard to enumerator over
pageSizeNumber of scores contained in each page
filterThe filter to use when getting the scores
Returns:
An initialized OFScoreEnumerator object.
+ (void) setDelegate: (id< OFScoreEnumeratorDelegate >)  delegate

Set a delegate for all OFScoreEnumerator related actions. Must adopt the OFScoreEnumeratorDelegate protocol.

Note:
Defaults to nil. Weak reference

Member Data Documentation

- (OFRequestHandle*) activeRequest [protected]
- (OFScoreFilter) filter [protected]
- (NSString*) leaderboardId [protected]

Property Documentation

- (NSInteger) currentPage [read, assign]

The current page of scores contained in the scores property.

Note:
Page numbers are 1-based.
- (BOOL) hasScores [read, assign]

YES if the enumerator has a valid set of scores, NO otherwise

- (BOOL) isCurrentUserPage [read, assign]

YES if the current page of scores contains the current user's score, NO otherwise

- (NSInteger) pageSize [read, assign]

The number of scores requested at one time.

- (NSArray *) scores [read, assign]

The current page of scores. The score objects contained in the array are instances of the OFHighScore class.

- (NSInteger) totalPages [read, assign]

The total number of pages of scores that are enumerable.

Note:
Page numbers are 1-based.

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Properties