From ab6683fdb2805f0f041bda7eccde49be661c5bfa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Nov 2023 16:29:54 +0100 Subject: foo --- .../LibOVRKernel/Src/Kernel/OVR_Nullptr.h | 159 +++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 ovr_sdk_win_23.0.0/LibOVRKernel/Src/Kernel/OVR_Nullptr.h (limited to 'ovr_sdk_win_23.0.0/LibOVRKernel/Src/Kernel/OVR_Nullptr.h') diff --git a/ovr_sdk_win_23.0.0/LibOVRKernel/Src/Kernel/OVR_Nullptr.h b/ovr_sdk_win_23.0.0/LibOVRKernel/Src/Kernel/OVR_Nullptr.h new file mode 100644 index 0000000..9a6494f --- /dev/null +++ b/ovr_sdk_win_23.0.0/LibOVRKernel/Src/Kernel/OVR_Nullptr.h @@ -0,0 +1,159 @@ +/************************************************************************************ + +Filename : OVR_Nullptr.h +Content : Implements C++11 nullptr for the case that the compiler doesn't. +Created : June 19, 2014 +Notes : + +Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved. + +Licensed under the Oculus Master SDK License Version 1.0 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +https://developer.oculus.com/licenses/oculusmastersdk-1.0 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + +#ifndef OVR_Nullptr_h +#define OVR_Nullptr_h + +#pragma once + +#include "OVR_Types.h" + +//----------------------------------------------------------------------------------- +// ***** OVR_HAVE_std_nullptr_t +// +// Identifies if includes std::nullptr_t. +// +#if !defined(OVR_HAVE_std_nullptr_t) && defined(OVR_CPP11_ENABLED) +#if defined(OVR_STDLIB_LIBCPP) +#define OVR_HAVE_std_nullptr_t 1 +#elif defined(OVR_STDLIB_LIBSTDCPP) +#if (__GLIBCXX__ >= 20110325) && (__GLIBCXX__ != 20110428) && (__GLIBCXX__ != 20120702) +#define OVR_HAVE_std_nullptr_t 1 +#endif +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) // VS2010+ +#define OVR_HAVE_std_nullptr_t 1 +#elif defined(__clang__) +#define OVR_HAVE_std_nullptr_t 1 +#elif defined(OVR_CPP_GNUC) && (OVR_CC_VERSION >= 406) // GCC 4.6+ +#define OVR_HAVE_std_nullptr_t 1 +#endif +#endif + +//----------------------------------------------------------------------------------- +// ***** nullptr / std::nullptr_t +// +// Declares and defines nullptr and related types. +// +#if defined(OVR_CPP_NO_NULLPTR) +namespace std { +class nullptr_t { + public: + template + operator T*() const { + return 0; + } + + template + operator T C::*() const { + return 0; + } + +#if OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS + typedef void* (nullptr_t::*bool_)() + const; // 4.12,p1. We can't portably use operator bool(){ return false; } because bool + operator bool_() const // is convertable to int which breaks other required functionality. + { + return false; + } +#else + operator bool() const { + return false; + } +#endif + + private: + void operator&() const; // 5.2.10,p9 +}; + +inline nullptr_t nullptr_get() { + nullptr_t n = {}; + return n; +} + +#if !defined(nullptr) +#define nullptr nullptr_get() +#endif + +} // namespace std + +// 5.9,p2 p4 +// 13.6, p13 +template +inline bool operator==(T* pT, const std::nullptr_t) { + return pT == 0; +} + +template +inline bool operator==(const std::nullptr_t, T* pT) { + return pT == 0; +} + +template +inline bool operator==(const std::nullptr_t, T U::*pU) { + return pU == 0; +} + +template +inline bool operator==(T U::*pTU, const std::nullptr_t) { + return pTU == 0; +} + +inline bool operator==(const std::nullptr_t, const std::nullptr_t) { + return true; +} + +inline bool operator!=(const std::nullptr_t, const std::nullptr_t) { + return false; +} + +inline bool operator<(const std::nullptr_t, const std::nullptr_t) { + return false; +} + +inline bool operator<=(const std::nullptr_t, const std::nullptr_t) { + return true; +} + +inline bool operator>(const std::nullptr_t, const std::nullptr_t) { + return false; +} + +inline bool operator>=(const std::nullptr_t, const std::nullptr_t) { + return true; +} + +using std::nullptr_get; +using std::nullptr_t; + +// Some compilers natively support C++11 nullptr but the standard library being used +// doesn't declare std::nullptr_t, in which case we provide one ourselves. +#elif !defined(OVR_HAVE_std_nullptr_t) && !defined(OVR_CPP_NO_DECLTYPE) +namespace std { +typedef decltype(nullptr) nullptr_t; +} +#endif + +#endif -- cgit v1.2.3