1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsCocoaFeatures_h_
7 #define nsCocoaFeatures_h_
11 /// Note that this class assumes we support the platform we are running on.
12 /// For better or worse, if the version is unknown or less than what we
13 /// support, we set it to the minimum supported version. GetSystemVersion
14 /// is the only call that returns the unadjusted values.
15 class nsCocoaFeatures
{
17 static int32_t macOSVersion();
18 static int32_t macOSVersionMajor();
19 static int32_t macOSVersionMinor();
20 static int32_t macOSVersionBugFix();
21 static bool OnBigSurOrLater();
22 static bool OnMontereyOrLater();
23 static bool OnVenturaOrLater();
25 static bool IsAtLeastVersion(int32_t aMajor
, int32_t aMinor
,
28 static bool ProcessIsRosettaTranslated();
30 // These are utilities that do not change or depend on the value of
31 // mOSVersion and instead just encapsulate the encoding algorithm. Note that
32 // GetVersion actually adjusts to the lowest supported OS, so it will always
33 // return a "supported" version. GetSystemVersion does not make any
35 static void GetSystemVersion(int& aMajor
, int& aMinor
, int& aBugFix
);
36 static int32_t GetVersion(int32_t aMajor
, int32_t aMinor
, int32_t aBugFix
);
37 static int32_t ExtractMajorVersion(int32_t aVersion
);
38 static int32_t ExtractMinorVersion(int32_t aVersion
);
39 static int32_t ExtractBugFixVersion(int32_t aVersion
);
42 nsCocoaFeatures() = delete; // Prevent instantiation.
43 static void InitializeVersionNumbers();
45 static int32_t mOSVersion
;
48 #endif // nsCocoaFeatures_h_