/usr/include/oce/Standard_CLocaleSentry.hxx is in liboce-foundation-dev 0.17.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | // Created on: 2013-01-17
// Created by: Kirill GAVRILOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Standard_CLocaleSentry_H__
#define _Standard_CLocaleSentry_H__
#include <Standard_Macro.hxx>
#include <locale.h>
#ifndef HAVE_XLOCALE_H
//! "xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension
//! and become part of POSIX since '2008.
//! Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L)
//! since POSIX didn't declared such identifier.
#if defined(__APPLE__)
#define HAVE_XLOCALE_H
#endif
//! We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler.
#if defined(_GNU_SOURCE) && !defined(__ANDROID__)
#define HAVE_XLOCALE_H
#endif
#endif // ifndef HAVE_LOCALE_H
#ifdef HAVE_XLOCALE_H
#include <xlocale.h>
#endif
#if !defined(__ANDROID__)
//! This class intended to temporary switch C locale and logically equivalent to setlocale(LC_ALL, "C").
//! It is intended to format text regardless of user locale settings (for import/export functionality).
//! Thus following calls to sprintf, atoi and other functions will use "C" locale.
//! Destructor of this class will return original locale.
//!
//! Notice that this functionality is platfrom dependent and intended only to workaround alien code
//! that doesn't setup locale correctly.
//!
//! Internally you should prefer more portable C++ locale interfaces
//! or OCCT wrappers to some C functions like Sprintf, Atof, Strtod.
class Standard_CLocaleSentry
{
public:
//! Setup current C locale to "C".
Standard_EXPORT Standard_CLocaleSentry();
//! Restore previous locale.
Standard_EXPORT ~Standard_CLocaleSentry();
public:
#ifdef HAVE_XLOCALE_H
typedef locale_t clocale_t;
#elif defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
typedef _locale_t clocale_t;
#else
typedef void* clocale_t;
#endif
//! @return locale "C" instance (locale_t within xlocale or _locale_t within Windows)
//! to be used for _l functions with locale argument.
static Standard_EXPORT clocale_t GetCLocale();
private:
void* myPrevLocale; //!< previous locale, platform-dependent pointer!
#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
int myPrevTLocaleState; //!< previous thread-locale state, MSVCRT-specific
#endif
private:
//! Copying disallowed
Standard_CLocaleSentry (const Standard_CLocaleSentry& );
Standard_CLocaleSentry& operator= (const Standard_CLocaleSentry& );
};
#else
//! C/C++ runtime on Android currently supports only C-locale, no need to call anything.
class Standard_CLocaleSentry
{
public:
Standard_CLocaleSentry() {}
typedef void* clocale_t;
static clocale_t GetCLocale() { return 0; }
};
#endif // __ANDROID__
#endif // _Standard_CLocaleSentry_H__
|