Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: dbe71da0fd
Fetching contributors…

Cannot retrieve contributors at this time

file 68 lines (53 sloc) 1.705 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
/* FSCNStatementList.m Copyright (c) 2008-2009 Philippe Mougin. */
/* This software is open source. See the license. */

#import "FSCNStatementList.h"


@implementation FSCNStatementList

- (void)dealloc
{
  for (NSUInteger i = 0; i < statementCount; i++) [statements[i] release];
  free(statements);
  [super dealloc];
}

- (NSString *)description
{
  return @"Statement list";
}

- (void)encodeWithCoder:(NSCoder *)coder
{
  [super encodeWithCoder:coder];
  [coder encodeObject:[NSArray arrayWithObjects:statements count:statementCount] forKey:@"statements"];
}

- (id)initWithCoder:(NSCoder *)coder
{
  self = [super initWithCoder:coder];
  nodeType = STATEMENT_LIST;

  NSArray *theStatements = [coder decodeObjectForKey:@"statements"];
  statementCount = [theStatements count];
  statements = NSAllocateCollectable(statementCount * sizeof(id), NSScannedOption);
  [theStatements getObjects:statements];
  [theStatements makeObjectsPerformSelector:@selector(retain)];

  return self;
}

- (id)initWithStatements:(NSArray *)theStatements
{
  self = [super init];
  if (self != nil)
  {
    nodeType = STATEMENT_LIST;
    statementCount = [theStatements count];
    statements = NSAllocateCollectable(statementCount * sizeof(id), NSScannedOption);
    [theStatements getObjects:statements];
    [theStatements makeObjectsPerformSelector:@selector(retain)];
  }
  return self;
}

- (NSArray *)statements
{
  return [NSArray arrayWithObjects:statements count:statementCount];
}

- (void)translateCharRange:(int32_t)translation
{
  [super translateCharRange:translation];
  
  for (NSUInteger i = 0; i < statementCount; i++) [statements[i] translateCharRange:translation];
}


@end
Something went wrong with that request. Please try again.