/core/externals/google-toolbox-for-mac/Foundation/GTMFourCharCode.h

http://macfuse.googlecode.com/ · C++ Header · 51 lines · 13 code · 10 blank · 28 comment · 0 complexity · 07cbb2489ef6093ad83205bcf0eee3e2 MD5 · raw file

  1. //
  2. // GTMFourCharCode
  3. // Wrapper for FourCharCodes
  4. //
  5. // Copyright 2008 Google Inc.
  6. //
  7. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  8. // use this file except in compliance with the License. You may obtain a copy
  9. // of the License at
  10. //
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software
  14. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. // License for the specific language governing permissions and limitations under
  17. // the License.
  18. //
  19. #import <Foundation/Foundation.h>
  20. // FourCharCodes are OSTypes, ResTypes etc. This class wraps them if
  21. // you need to store them in dictionaries etc.
  22. @interface GTMFourCharCode : NSObject <NSCopying, NSCoding> {
  23. FourCharCode code_;
  24. }
  25. // returns a string for a FourCharCode
  26. + (id)stringWithFourCharCode:(FourCharCode)code;
  27. // String must be 4 chars or less, or you will get nil back.
  28. + (id)fourCharCodeWithString:(NSString*)string;
  29. + (id)fourCharCodeWithFourCharCode:(FourCharCode)code;
  30. // String must be 4 chars or less, or you will get nil back.
  31. - (id)initWithString:(NSString*)string;
  32. // Designated Initializer
  33. - (id)initWithFourCharCode:(FourCharCode)code;
  34. // Returns 'APPL' for "APPL"
  35. - (FourCharCode)fourCharCode;
  36. // For FourCharCode of 'APPL' returns "APPL". For 1 returns "\0\0\0\1"
  37. - (NSString*)stringValue;
  38. // For FourCharCode of "APPL" returns an NSNumber with 1095782476 (0x4150504C).
  39. // For 1 returns 1.
  40. - (NSNumber*)numberValue;
  41. @end