@implementation WORepetition
+static Class NSArrayClass = Nil;
+
+ (int)version {
return [super version] + 1 /* v3 */;
}
@"invalid superclass (%@) version %i !",
NSStringFromClass([self superclass]), [super version]);
+ NSArrayClass = [NSArray class];
+
if (debugTakeValues == -1) {
debugTakeValues =
[[NSUserDefaults standardUserDefaults] boolForKey:@"WODebugTakeValues"]
#endif
array = [self->list valueInComponent:sComponent];
+ if ((array != nil) && ![array isKindOfClass:NSArrayClass])
+ array = [NSArray arrayWithObject:array];
count = [array count];
if (count > 0) {
NSArray *array;
array = [self->list valueInComponent:sComponent];
-
+ if ((array != nil) && ![array isKindOfClass:NSArrayClass])
+ array = [NSArray arrayWithObject:array];
+
if (self->index)
[self->index setUnsignedIntValue:_idx inComponent:sComponent];
sComponent = [_ctx component];
array = [self->list valueInContext:_ctx];
+ if ((array != nil) && ![array isKindOfClass:NSArrayClass])
+ array = [NSArray arrayWithObject:array];
aCount = [array count];
goCount = self->count
}
- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
- static Class NSAutoreleasePoolClass = Nil;
- WOComponent *sComponent;
- NSArray *array;
- unsigned aCount, goCount, startIdx;
NSAutoreleasePool *pool;
+ WOComponent *sComponent;
+ NSArray *array;
+ unsigned aCount, goCount, startIdx;
#if DEBUG
if (descriptiveIDs)
[_ctx appendElementIDComponent:self->repName];
#endif
- if (NSAutoreleasePoolClass == Nil)
- NSAutoreleasePoolClass = [NSAutoreleasePool class];
-
- pool = [[NSAutoreleasePoolClass alloc] init];
+ pool = [[NSAutoreleasePool alloc] init];
sComponent = [_ctx component];
- array = [self->list valueInContext:_ctx];
- aCount = [array count];
- startIdx = [self->startIndex unsignedIntValueInComponent:sComponent];
+ array = [self->list valueInContext:_ctx];
+ if ((array != nil) && ![array isKindOfClass:NSArrayClass])
+ array = [NSArray arrayWithObject:array];
+
+ aCount = [array count];
+ startIdx = [self->startIndex unsignedIntValueInComponent:sComponent];
goCount = self->count
? [self->count unsignedIntValueInComponent:sComponent]
}
- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
- static Class NSAutoreleasePoolClass = Nil;
- WOComponent *sComponent;
- NSArray *array;
- unsigned aCount;
NSAutoreleasePool *pool;
+ WOComponent *sComponent;
+ NSArray *array;
+ unsigned aCount;
#if DEBUG
if (descriptiveIDs)
[_ctx appendElementIDComponent:self->repName];
#endif
- if (NSAutoreleasePoolClass == Nil)
- NSAutoreleasePoolClass = [NSAutoreleasePool class];
-
- pool = [[NSAutoreleasePoolClass alloc] init];
+ pool = [[NSAutoreleasePool alloc] init];
sComponent = [_ctx component];
- array = [self->list valueInContext:_ctx];
- aCount = [array count];
+ array = [self->list valueInContext:_ctx];
+ if ((array != nil) && ![array isKindOfClass:NSArrayClass])
+ array = [NSArray arrayWithObject:array];
+ aCount = [array count];
if (aCount > 0) {
unsigned cnt;
inComponent:sComponent];
}
else {
- [_ctx pushCursor:[array objectAtIndex:cnt]];
+ [_ctx pushCursor:[array objectAtIndex:cnt]];
}
#if HTML_DEBUG
[_ctx incrementLastElementIDComponent];
if (self->item == nil)
- [_ctx popCursor];
+ [_ctx popCursor];
}
[_ctx deleteLastElementIDComponent]; /* repetition index */