Skip to content

Commit

Permalink
Add a setEncoder method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack Powers committed Apr 2, 2012
1 parent 78d64d3 commit 2183baa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions XMLRPCRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- (NSString *)userAgent;

#pragma mark -
- (void)setEncoder: (id <XMLRPCEncoder>) encoder;

- (void)setMethod: (NSString *)method;

Expand Down
9 changes: 9 additions & 0 deletions XMLRPCRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ - (NSString *)userAgent {

#pragma mark -

//XXX:Does Assigning ids cause a leak if the previous assignment isn't free'd?
- (void)setEncoder:(id<XMLRPCEncoder>)encoder {
//Copy the old method and parameters to the new encoder.
NSString *method = [myXMLEncoder method];
NSArray *parameters = [myXMLEncoder parameters];
myXMLEncoder = encoder;
[myXMLEncoder setMethod:method withParameters:parameters];
}

- (void)setMethod: (NSString *)method {
[myXMLEncoder setMethod: method withParameters: nil];
}
Expand Down

0 comments on commit 2183baa

Please sign in to comment.