chromium/third_party/skia/src/gpu/ganesh/GrAutoLocaleSetter.h

/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrAutoLocaleSetter_DEFINED
#define GrAutoLocaleSetter_DEFINED

#include "include/core/SkTypes.h"
#include "include/private/base/SkNoncopyable.h"

#if defined(SK_BUILD_FOR_WIN)
#include "include/core/SkString.h"
#endif

#if !defined(SK_BUILD_FOR_ANDROID)
#include <locale.h>
#endif

#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#include <xlocale.h>
#include <cstring>
#define HAVE_XLOCALE
#else
#define HAVE_XLOCALE
#endif

#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
#define HAVE_LOCALE_T
#else
#define HAVE_LOCALE_T
#endif

/**
 * Helper class for ensuring that we don't use the wrong locale when building shaders. Android
 * doesn't support locale in the NDK, so this is a no-op there.
 */
class GrAutoLocaleSetter : public SkNoncopyable {};

#undef HAVE_LOCALE_T
#undef HAVE_XLOCALE

#endif