RestKit/RestKit — pull request #489 by inquinity (2012-01-02 20:01:21+00:00)
Title: Added set parser class using regular expressions

Design notes:

RegexForMIMEType: MIMETypes should be specifiable as regular expressions.

* Separate literals from regular expressions; this will preserve current runtime characteristics (lookup time) and provide greater compatibility with existing client code.
* Keep RegularExpressions in an array; since multiple regular expressions may match a single MIMEType, it is important that there be a definite order of evaluation.
* Order of Evaluation (parserForMIMEType: and parserClassForMIMEType:)
1.	Lookup MIMEType in _MIMETypeToParserClasses
2.	Lookup MIMEType in _MIMETypeToParserClassesRegularExpressions, starting with _MIMETypeToParserClassesRegularExpressions[0]

Fields:

* _MIMETypeToParserClassesRegularExpressions -- NSArray of parser class and regular expression pairs

Methods:

* setParserClass:forMIMETypeRegex: -- add a (NSArray of) regular expression and class to _MIMETypeToParserClassesRegularExpressions

Other Changes:

* parserForMIMEType: and parserClassForMIMEType: should return the parser class following the specified order of evaluation (above)