• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

design question


  • Subject: design question
  • From: Ariel Feinerman <email@hidden>
  • Date: Tue, 22 Mar 2011 21:29:36 +0200

Hi,

can someone look at and say is a returning of immutable objects necessary or
no?

@interface XMLElement : NSObject {


 NSString *_name;

NSMutableString *_text;

 NSMutableDictionary *_attributes;

NSMutableArray *_children;

 XMLElement *_parent;

}

@implementation XMLElement


- (NSArray *) elementsForName: (NSString *) name {

 NSMutableArray *children = [NSMutableArray new];

 for (XMLElement *element in _children)

if ([[element name] isEqualToString: name])

[children addObject: element];

 NSArray *lchildren = [children copy];

[children release];

 return [lchildren autorelease];

}

- (void) setChildren: (NSArray *) children {

 [_children release];

_children = [children mutableCopy];

}


- (NSArray *) children {

 return [[_children copy] autorelease];

}

- (NSString *) XMLString {

 return [[[self _XMLString] copy] autorelease];

}

//


@end


--
best regards
Ariel
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: design question
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: (no subject)
  • Next by Date: Changing tooltips in a custom view
  • Previous by thread: Re: (no subject)
  • Next by thread: Re: design question
  • Index(es):
    • Date
    • Thread