00001 // Copyright 2009-2010 Aurora Feint, Inc. 00002 // 00003 // Licensed under the Apache License, Version 2.0 (the "License"); 00004 // you may not use this file except in compliance with the License. 00005 // You may obtain a copy of the License at 00006 // 00007 // http://www.apache.org/licenses/LICENSE-2.0 00008 // 00009 // Unless required by applicable law or agreed to in writing, software 00010 // distributed under the License is distributed on an "AS IS" BASIS, 00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 // See the License for the specific language governing permissions and 00013 // limitations under the License. 00014 00015 #pragma once 00016 00017 #import "OFHighScore.h" 00018 00019 @class OFRequestHandle; 00020 @class OFLeaderboard; 00021 @protocol OFScoreEnumeratorDelegate; 00022 00033 @interface OFScoreEnumerator : NSObject<OFCallbackable> 00034 { 00035 BOOL isCurrentUserPage; 00036 NSInteger pageSize; 00037 NSInteger currentPage; 00038 NSInteger totalPages; 00039 NSArray* scores; 00040 OFScoreFilter filter; 00041 NSString* leaderboardId; 00042 OFRequestHandle* activeRequest; 00043 } 00044 00051 + (void)setDelegate:(id<OFScoreEnumeratorDelegate>)delegate; 00052 00070 + (OFScoreEnumerator*)scoreEnumeratorForLeaderboard:(OFLeaderboard*)leaderboard pageSize:(NSInteger)pageSize filter:(OFScoreFilter)filter; 00071 00081 - (BOOL)nextPage; 00082 00092 - (BOOL)previousPage; 00093 00100 - (void)pageWithCurrentUser; 00101 00109 - (void)jumpToPage:(NSInteger)page; 00110 00114 @property (nonatomic, readonly) NSInteger pageSize; 00115 00121 @property (nonatomic, readonly) NSInteger currentPage; 00122 00128 @property (nonatomic, readonly) NSInteger totalPages; 00129 00133 @property (nonatomic, readonly) BOOL hasScores; 00134 00139 @property (nonatomic, readonly) NSArray* scores; 00140 00144 @property (nonatomic, readonly) BOOL isCurrentUserPage; 00145 00146 @end 00147 00148 @protocol OFScoreEnumeratorDelegate 00149 @optional 00155 - (void)didReceiveScoresOFScoreEnumerator:(OFScoreEnumerator*)scoreEnumerator; 00156 00162 - (void)didFailReceiveScoresOFScoreEnumerator:(OFScoreEnumerator*)scoreEnumerator; 00163 @end