+/* Progress Data {{{ */
+@interface CydiaProgressData : NSObject {
+ _transient id delegate_;
+
+ bool running_;
+ float percent_;
+
+ float current_;
+ float total_;
+ float speed_;
+
+ _H<NSMutableArray> events_;
+ _H<NSString> title_;
+
+ _H<NSString> status_;
+ _H<NSString> finish_;
+}
+
+@end
+
+@implementation CydiaProgressData
+
++ (NSArray *) _attributeKeys {
+ return [NSArray arrayWithObjects:
+ @"current",
+ @"events",
+ @"finish",
+ @"percent",
+ @"running",
+ @"speed",
+ @"title",
+ @"total",
+ nil];
+}
+
+- (NSArray *) attributeKeys {
+ return [[self class] _attributeKeys];
+}
+
++ (BOOL) isKeyExcludedFromWebScript:(const char *)name {
+ return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
+}
+
+- (id) init {
+ if ((self = [super init]) != nil) {
+ events_ = [NSMutableArray arrayWithCapacity:32];
+ } return self;
+}
+
+- (void) setDelegate:(id)delegate {
+ delegate_ = delegate;
+}
+
+- (void) setPercent:(float)value {
+ percent_ = value;
+}
+
+- (NSNumber *) percent {
+ return [NSNumber numberWithFloat:percent_];
+}
+
+- (void) setCurrent:(float)value {
+ current_ = value;
+}
+
+- (NSNumber *) current {
+ return [NSNumber numberWithFloat:current_];
+}
+
+- (void) setTotal:(float)value {
+ total_ = value;
+}
+
+- (NSNumber *) total {
+ return [NSNumber numberWithFloat:total_];
+}
+
+- (void) setSpeed:(float)value {
+ speed_ = value;
+}
+
+- (NSNumber *) speed {
+ return [NSNumber numberWithFloat:speed_];
+}
+
+- (NSArray *) events {
+ return events_;
+}
+
+- (void) removeAllEvents {
+ [events_ removeAllObjects];
+}
+
+- (void) addEvent:(CydiaProgressEvent *)event {
+ [events_ addObject:event];
+}
+
+- (void) setTitle:(NSString *)text {
+ title_ = text;
+}
+
+- (NSString *) title {
+ return title_;
+}
+
+- (void) setFinish:(NSString *)text {
+ finish_ = text;
+}
+
+- (NSString *) finish {
+ return (id) finish_ ?: [NSNull null];
+}
+
+- (void) setRunning:(bool)running {
+ running_ = running;
+}
+
+- (NSNumber *) running {
+ return running_ ? (NSNumber *) kCFBooleanTrue : (NSNumber *) kCFBooleanFalse;
+}
+
+@end
+/* }}} */