Path: blob/jdk8u272-b10-aarch32-20201026/jdk/src/share/native/common/unicode/putil.h
48773 views
// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3******************************************************************************4*5* Copyright (C) 1997-2014, International Business Machines6* Corporation and others. All Rights Reserved.7*8******************************************************************************9*10* FILE NAME : putil.h11*12* Date Name Description13* 05/14/98 nos Creation (content moved here from utypes.h).14* 06/17/99 erm Added IEEE_75415* 07/22/98 stephen Added IEEEremainder, max, min, trunc16* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity17* 08/24/98 stephen Added longBitsFromDouble18* 03/02/99 stephen Removed openFile(). Added AS400 support.19* 04/15/99 stephen Converted to C20* 11/15/99 helena Integrated S/390 changes for IEEE support.21* 01/11/00 helena Added u_getVersion.22******************************************************************************23*/2425#ifndef PUTIL_H26#define PUTIL_H2728#include "unicode/utypes.h"29/**30* \file31* \brief C API: Platform Utilities32*/3334/*==========================================================================*/35/* Platform utilities */36/*==========================================================================*/3738/**39* Platform utilities isolates the platform dependencies of the40* library. For each platform which this code is ported to, these41* functions may have to be re-implemented.42*/4344/**45* Return the ICU data directory.46* The data directory is where common format ICU data files (.dat files)47* are loaded from. Note that normal use of the built-in ICU48* facilities does not require loading of an external data file;49* unless you are adding custom data to ICU, the data directory50* does not need to be set.51*52* The data directory is determined as follows:53* If u_setDataDirectory() has been called, that is it, otherwise54* if the ICU_DATA environment variable is set, use that, otherwise55* If a data directory was specified at ICU build time56* <code>57* \code58* #define ICU_DATA_DIR "path"59* \endcode60* </code> use that,61* otherwise no data directory is available.62*63* @return the data directory, or an empty string ("") if no data directory has64* been specified.65*66* @stable ICU 2.067*/68U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);697071/**72* Set the ICU data directory.73* The data directory is where common format ICU data files (.dat files)74* are loaded from. Note that normal use of the built-in ICU75* facilities does not require loading of an external data file;76* unless you are adding custom data to ICU, the data directory77* does not need to be set.78*79* This function should be called at most once in a process, before the80* first ICU operation (e.g., u_init()) that will require the loading of an81* ICU data file.82* This function is not thread-safe. Use it before calling ICU APIs from83* multiple threads.84*85* @param directory The directory to be set.86*87* @see u_init88* @stable ICU 2.089*/90U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);9192#ifndef U_HIDE_INTERNAL_API93/**94* Return the time zone files override directory, or an empty string if95* no directory was specified. Certain time zone resources will be preferentially96* loaded from individual files in this directory.97*98* @return the time zone data override directory.99* @internal100*/101U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);102103/**104* Set the time zone files override directory.105* This function is not thread safe; it must not be called concurrently with106* u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.107* This function should only be called before using any ICU service that108* will access the time zone data.109* @internal110*/111U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status);112#endif /* U_HIDE_INTERNAL_API */113114115/**116* @{117* Filesystem file and path separator characters.118* Example: '/' and ':' on Unix, '\\' and ';' on Windows.119* @stable ICU 2.0120*/121#if U_PLATFORM_USES_ONLY_WIN32_API122# define U_FILE_SEP_CHAR '\\'123# define U_FILE_ALT_SEP_CHAR '/'124# define U_PATH_SEP_CHAR ';'125# define U_FILE_SEP_STRING "\\"126# define U_FILE_ALT_SEP_STRING "/"127# define U_PATH_SEP_STRING ";"128#else129# define U_FILE_SEP_CHAR '/'130# define U_FILE_ALT_SEP_CHAR '/'131# define U_PATH_SEP_CHAR ':'132# define U_FILE_SEP_STRING "/"133# define U_FILE_ALT_SEP_STRING "/"134# define U_PATH_SEP_STRING ":"135#endif136137/** @} */138139/**140* Convert char characters to UChar characters.141* This utility function is useful only for "invariant characters"142* that are encoded in the platform default encoding.143* They are a small, constant subset of the encoding and include144* just the latin letters, digits, and some punctuation.145* For details, see U_CHARSET_FAMILY.146*147* @param cs Input string, points to <code>length</code>148* character bytes from a subset of the platform encoding.149* @param us Output string, points to memory for <code>length</code>150* Unicode characters.151* @param length The number of characters to convert; this may152* include the terminating <code>NUL</code>.153*154* @see U_CHARSET_FAMILY155* @stable ICU 2.0156*/157U_STABLE void U_EXPORT2158u_charsToUChars(const char *cs, UChar *us, int32_t length);159160/**161* Convert UChar characters to char characters.162* This utility function is useful only for "invariant characters"163* that can be encoded in the platform default encoding.164* They are a small, constant subset of the encoding and include165* just the latin letters, digits, and some punctuation.166* For details, see U_CHARSET_FAMILY.167*168* @param us Input string, points to <code>length</code>169* Unicode characters that can be encoded with the170* codepage-invariant subset of the platform encoding.171* @param cs Output string, points to memory for <code>length</code>172* character bytes.173* @param length The number of characters to convert; this may174* include the terminating <code>NUL</code>.175*176* @see U_CHARSET_FAMILY177* @stable ICU 2.0178*/179U_STABLE void U_EXPORT2180u_UCharsToChars(const UChar *us, char *cs, int32_t length);181182#endif183184185