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