2011-08-05 22:36:51 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2011-08-05 22:36:51 +04:00
|
|
|
|
|
|
|
#ifndef nsCocoaFeatures_h_
|
|
|
|
#define nsCocoaFeatures_h_
|
|
|
|
|
2013-07-30 18:25:31 +04:00
|
|
|
#include <stdint.h>
|
2011-08-05 22:36:51 +04:00
|
|
|
|
2014-11-29 01:28:59 +03:00
|
|
|
/// 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.
|
2011-08-05 22:36:51 +04:00
|
|
|
class nsCocoaFeatures {
|
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t OSXVersion();
|
2013-12-19 20:42:19 +04:00
|
|
|
static int32_t OSXVersionMajor();
|
|
|
|
static int32_t OSXVersionMinor();
|
|
|
|
static int32_t OSXVersionBugFix();
|
2014-06-06 02:02:46 +04:00
|
|
|
static bool OnYosemiteOrLater();
|
2015-09-10 02:08:25 +03:00
|
|
|
static bool OnElCapitanOrLater();
|
2016-07-05 00:25:25 +03:00
|
|
|
static bool OnSierraOrLater();
|
2012-05-17 11:53:20 +04:00
|
|
|
|
2014-11-11 06:15:22 +03:00
|
|
|
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
|
|
|
|
|
2014-11-29 01:28:59 +03:00
|
|
|
// 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);
|
|
|
|
|
2011-08-05 22:36:51 +04:00
|
|
|
private:
|
2013-12-19 20:42:19 +04:00
|
|
|
static void InitializeVersionNumbers();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t mOSXVersion;
|
2011-08-05 22:36:51 +04:00
|
|
|
};
|
|
|
|
#endif // nsCocoaFeatures_h_
|