NSCharacterSet+SVGKExtensions.m 852 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // NSCharacterSet+SVGKExtensions.m
  3. // Avatar
  4. //
  5. // Created by Devin Chalmers on 3/6/13.
  6. // Copyright (c) 2013 DJZ. All rights reserved.
  7. //
  8. #import "NSCharacterSet+SVGKExtensions.h"
  9. @implementation NSCharacterSet (SVGKExtensions)
  10. /**
  11. wsp:
  12. (#x20 | #x9 | #xD | #xA)
  13. */
  14. + (NSCharacterSet *)SVGWhitespaceCharacterSet;
  15. {
  16. static NSCharacterSet *sWhitespaceCharacterSet = nil;
  17. static dispatch_once_t onceToken;
  18. dispatch_once(&onceToken, ^{
  19. SVGKitLogVerbose(@"Allocating static NSCharacterSet containing whitespace characters. Should be small, but Apple seems to take up 5+ megabytes each time?");
  20. sWhitespaceCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%c%c%c%c", 0x20, 0x9, 0xD, 0xA]];
  21. // required, this is a non-ARC project.
  22. });
  23. return sWhitespaceCharacterSet;
  24. }
  25. @end