NSCharacterSet+SVGKExtensions.m 883 B

12345678910111213141516171819202122232425262728293031
  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. #import "SVGKDefine_Private.h"
  10. @implementation NSCharacterSet (SVGKExtensions)
  11. /**
  12. wsp:
  13. (#x20 | #x9 | #xD | #xA)
  14. */
  15. + (NSCharacterSet *)SVGWhitespaceCharacterSet;
  16. {
  17. static NSCharacterSet *sWhitespaceCharacterSet = nil;
  18. static dispatch_once_t onceToken;
  19. dispatch_once(&onceToken, ^{
  20. SVGKitLogVerbose(@"Allocating static NSCharacterSet containing whitespace characters. Should be small, but Apple seems to take up 5+ megabytes each time?");
  21. sWhitespaceCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%c%c%c%c", 0x20, 0x9, 0xD, 0xA]];
  22. // required, this is a non-ARC project.
  23. });
  24. return sWhitespaceCharacterSet;
  25. }
  26. @end