author | Michael Krelin <hacker@klever.net> | 2012-12-08 21:19:17 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2012-12-11 21:59:29 (UTC) |
commit | 8808689fe340bec6e90ab13dd502292b0579cf1f (patch) (side-by-side diff) | |
tree | 45b7c863151341f687b74e40bffcbd7ab5468783 /pumpkin/IPTransformer.m | |
parent | 6e7e413ca364d79673e523c09767c18e7cff1bec (diff) | |
download | pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.zip pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.tar.gz pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.tar.bz2 |
initial osx portosx/0.0
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | pumpkin/IPTransformer.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pumpkin/IPTransformer.m b/pumpkin/IPTransformer.m new file mode 100644 index 0000000..2307b05 --- a/dev/null +++ b/pumpkin/IPTransformer.m @@ -0,0 +1,21 @@ + +#import "IPTransformer.h" + +#include <arpa/inet.h> + +@implementation IPTransformer + ++(Class)transformedValueClass { return [NSString class]; } ++(BOOL)allowsReverseTransformation { return YES; } +-(id)transformedValue:(id)value { + if(value && + [value respondsToSelector:@selector(UTF8String)] + && inet_addr([value UTF8String])!=INADDR_NONE ) + return value; + return nil; +} +-(id)reverseTransformedValue:(id)value { + return [self transformedValue:value]; +} + +@end
\ No newline at end of file |