Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/putil.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ******************************************************************************
0005 *
0006 *   Copyright (C) 1997-2014, International Business Machines
0007 *   Corporation and others.  All Rights Reserved.
0008 *
0009 ******************************************************************************
0010 *
0011 *  FILE NAME : putil.h
0012 *
0013 *   Date        Name        Description
0014 *   05/14/98    nos         Creation (content moved here from utypes.h).
0015 *   06/17/99    erm         Added IEEE_754
0016 *   07/22/98    stephen     Added IEEEremainder, max, min, trunc
0017 *   08/13/98    stephen     Added isNegativeInfinity, isPositiveInfinity
0018 *   08/24/98    stephen     Added longBitsFromDouble
0019 *   03/02/99    stephen     Removed openFile().  Added AS400 support.
0020 *   04/15/99    stephen     Converted to C
0021 *   11/15/99    helena      Integrated S/390 changes for IEEE support.
0022 *   01/11/00    helena      Added u_getVersion.
0023 ******************************************************************************
0024 */
0025 
0026 #ifndef PUTIL_H
0027 #define PUTIL_H
0028 
0029 #include "unicode/utypes.h"
0030  /**
0031   * \file
0032   * \brief C API: Platform Utilities
0033   */
0034 
0035 /*==========================================================================*/
0036 /* Platform utilities                                                       */
0037 /*==========================================================================*/
0038 
0039 /**
0040  * Platform utilities isolates the platform dependencies of the
0041  * library.  For each platform which this code is ported to, these
0042  * functions may have to be re-implemented.
0043  */
0044 
0045 /**
0046  * Return the ICU data directory. 
0047  * The data directory is where common format ICU data files (.dat files)
0048  *   are loaded from.  Note that normal use of the built-in ICU
0049  *   facilities does not require loading of an external data file;
0050  *   unless you are adding custom data to ICU, the data directory
0051  *   does not need to be set.
0052  *
0053  * The data directory is determined as follows:
0054  *    If u_setDataDirectory() has been called, that is it, otherwise
0055  *    if the ICU_DATA environment variable is set, use that, otherwise
0056  *    If a data directory was specified at ICU build time
0057  *      <code>
0058  * \code
0059  *        #define ICU_DATA_DIR "path" 
0060  * \endcode
0061  * </code> use that,
0062  *    otherwise no data directory is available.
0063  *
0064  * @return the data directory, or an empty string ("") if no data directory has
0065  *         been specified.
0066  *   
0067  * @stable ICU 2.0
0068  */
0069 U_CAPI const char* U_EXPORT2 u_getDataDirectory(void);
0070 
0071 
0072 /** 
0073  * Set the ICU data directory. 
0074  * The data directory is where common format ICU data files (.dat files)
0075  *   are loaded from.  Note that normal use of the built-in ICU
0076  *   facilities does not require loading of an external data file;
0077  *   unless you are adding custom data to ICU, the data directory
0078  *   does not need to be set.
0079  *
0080  * This function should be called at most once in a process, before the
0081  * first ICU operation (e.g., u_init()) that will require the loading of an
0082  * ICU data file.
0083  * This function is not thread-safe. Use it before calling ICU APIs from
0084  * multiple threads.
0085  *
0086  * @param directory The directory to be set.
0087  *
0088  * @see u_init
0089  * @stable ICU 2.0
0090  */
0091 U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory);
0092 
0093 #ifndef U_HIDE_INTERNAL_API
0094 /**
0095   * Return the time zone files override directory, or an empty string if
0096   * no directory was specified. Certain time zone resources will be preferentially
0097   * loaded from individual files in this directory.
0098   *
0099   * @return the time zone data override directory.
0100   * @internal
0101   */ 
0102 U_CAPI const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);
0103 
0104 /**
0105   * Set the time zone files override directory.
0106   * This function is not thread safe; it must not be called concurrently with
0107   *   u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.
0108   * This function should only be called before using any ICU service that
0109   *   will access the time zone data.
0110   * @internal
0111   */
0112 U_CAPI void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status);
0113 #endif  /* U_HIDE_INTERNAL_API */
0114 
0115 
0116 /**
0117  * @{
0118  * Filesystem file and path separator characters.
0119  * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
0120  * @stable ICU 2.0
0121  */
0122 #if U_PLATFORM_USES_ONLY_WIN32_API
0123 #   define U_FILE_SEP_CHAR '\\'
0124 #   define U_FILE_ALT_SEP_CHAR '/'
0125 #   define U_PATH_SEP_CHAR ';'
0126 #   define U_FILE_SEP_STRING "\\"
0127 #   define U_FILE_ALT_SEP_STRING "/"
0128 #   define U_PATH_SEP_STRING ";"
0129 #else
0130 #   define U_FILE_SEP_CHAR '/'
0131 #   define U_FILE_ALT_SEP_CHAR '/'
0132 #   define U_PATH_SEP_CHAR ':'
0133 #   define U_FILE_SEP_STRING "/"
0134 #   define U_FILE_ALT_SEP_STRING "/"
0135 #   define U_PATH_SEP_STRING ":"
0136 #endif
0137 
0138 /** @} */
0139 
0140 /**
0141  * Convert char characters to UChar characters.
0142  * This utility function is useful only for "invariant characters"
0143  * that are encoded in the platform default encoding.
0144  * They are a small, constant subset of the encoding and include
0145  * just the latin letters, digits, and some punctuation.
0146  * For details, see U_CHARSET_FAMILY.
0147  *
0148  * @param cs Input string, points to <code>length</code>
0149  *           character bytes from a subset of the platform encoding.
0150  * @param us Output string, points to memory for <code>length</code>
0151  *           Unicode characters.
0152  * @param length The number of characters to convert; this may
0153  *               include the terminating <code>NUL</code>.
0154  *
0155  * @see U_CHARSET_FAMILY
0156  * @stable ICU 2.0
0157  */
0158 U_CAPI void U_EXPORT2
0159 u_charsToUChars(const char *cs, UChar *us, int32_t length);
0160 
0161 /**
0162  * Convert UChar characters to char characters.
0163  * This utility function is useful only for "invariant characters"
0164  * that can be encoded in the platform default encoding.
0165  * They are a small, constant subset of the encoding and include
0166  * just the latin letters, digits, and some punctuation.
0167  * For details, see U_CHARSET_FAMILY.
0168  *
0169  * @param us Input string, points to <code>length</code>
0170  *           Unicode characters that can be encoded with the
0171  *           codepage-invariant subset of the platform encoding.
0172  * @param cs Output string, points to memory for <code>length</code>
0173  *           character bytes.
0174  * @param length The number of characters to convert; this may
0175  *               include the terminating <code>NUL</code>.
0176  *
0177  * @see U_CHARSET_FAMILY
0178  * @stable ICU 2.0
0179  */
0180 U_CAPI void U_EXPORT2
0181 u_UCharsToChars(const UChar *us, char *cs, int32_t length);
0182 
0183 #endif