NSProcessInfo_PECocoaBackports.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2014 Petroules Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * 1. Redistributions of source code must retain the above copyright notice, this
  8. * list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright notice,
  10. * this list of conditions and the following disclaimer in the documentation
  11. * and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  14. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  15. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  16. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  17. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  18. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  19. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  22. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #import <Foundation/Foundation.h>
  25. #import <TargetConditionals.h>
  26. #import <AvailabilityMacros.h>
  27. #if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \
  28. (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
  29. #import <Availability.h>
  30. #endif
  31. #import "PECocoaBackportsGlobal.h"
  32. #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
  33. #if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
  34. #ifndef DECLARE_OPERATING_SYSTEM_VERSION
  35. #define DECLARE_OPERATING_SYSTEM_VERSION 1
  36. #endif
  37. #endif
  38. #if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
  39. #ifndef LOAD_OPERATING_SYSTEM_VERSION
  40. #define LOAD_OPERATING_SYSTEM_VERSION 1
  41. #endif
  42. #endif
  43. #elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
  44. #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
  45. #ifndef DECLARE_OPERATING_SYSTEM_VERSION
  46. #define DECLARE_OPERATING_SYSTEM_VERSION 1
  47. #endif
  48. #endif
  49. #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
  50. #ifndef LOAD_OPERATING_SYSTEM_VERSION
  51. #define LOAD_OPERATING_SYSTEM_VERSION 1
  52. #endif
  53. #endif
  54. #endif
  55. #ifndef DECLARE_OPERATING_SYSTEM_VERSION
  56. #define DECLARE_OPERATING_SYSTEM_VERSION 0
  57. #endif
  58. #ifndef LOAD_OPERATING_SYSTEM_VERSION
  59. #define LOAD_OPERATING_SYSTEM_VERSION 0
  60. #endif
  61. #if DECLARE_OPERATING_SYSTEM_VERSION
  62. typedef struct {
  63. NSInteger majorVersion;
  64. NSInteger minorVersion;
  65. NSInteger patchVersion;
  66. } NSOperatingSystemVersion;
  67. #endif
  68. @interface NSProcessInfo (PECocoaBackports)
  69. #if DECLARE_OPERATING_SYSTEM_VERSION
  70. - (NSOperatingSystemVersion)operatingSystemVersion NS_AVAILABLE(10_5, 2_0);
  71. - (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version NS_AVAILABLE(10_5, 2_0);
  72. #endif
  73. @end