]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/putil.h
2 ******************************************************************************
4 * Copyright (C) 1997-2014, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
11 * Date Name Description
12 * 05/14/98 nos Creation (content moved here from utypes.h).
13 * 06/17/99 erm Added IEEE_754
14 * 07/22/98 stephen Added IEEEremainder, max, min, trunc
15 * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
16 * 08/24/98 stephen Added longBitsFromDouble
17 * 03/02/99 stephen Removed openFile(). Added AS400 support.
18 * 04/15/99 stephen Converted to C
19 * 11/15/99 helena Integrated S/390 changes for IEEE support.
20 * 01/11/00 helena Added u_getVersion.
21 ******************************************************************************
27 #include "unicode/utypes.h"
30 * \brief C API: Platform Utilities
33 /*==========================================================================*/
34 /* Platform utilities */
35 /*==========================================================================*/
38 * Platform utilities isolates the platform dependencies of the
39 * libarary. For each platform which this code is ported to, these
40 * functions may have to be re-implemented.
44 * Return the ICU data directory.
45 * The data directory is where common format ICU data files (.dat files)
46 * are loaded from. Note that normal use of the built-in ICU
47 * facilities does not require loading of an external data file;
48 * unless you are adding custom data to ICU, the data directory
49 * does not need to be set.
51 * The data directory is determined as follows:
52 * If u_setDataDirectory() has been called, that is it, otherwise
53 * if the ICU_DATA environment variable is set, use that, otherwise
54 * If a data directory was specifed at ICU build time
57 * #define ICU_DATA_DIR "path"
60 * otherwise no data directory is available.
62 * @return the data directory, or an empty string ("") if no data directory has
67 U_STABLE
const char* U_EXPORT2
u_getDataDirectory(void);
71 * Set the ICU data directory.
72 * The data directory is where common format ICU data files (.dat files)
73 * are loaded from. Note that normal use of the built-in ICU
74 * facilities does not require loading of an external data file;
75 * unless you are adding custom data to ICU, the data directory
76 * does not need to be set.
78 * This function should be called at most once in a process, before the
79 * first ICU operation (e.g., u_init()) that will require the loading of an
81 * This function is not thread-safe. Use it before calling ICU APIs from
84 * @param directory The directory to be set.
89 U_STABLE
void U_EXPORT2
u_setDataDirectory(const char *directory
);
91 #ifndef U_HIDE_INTERNAL_API
93 * Return the time zone files override directory, or an empty string if
94 * no directory was specified. Certain time zone resources will be preferrentially
95 * loaded from individual files in this directory.
97 * @return the time zone data override directory.
100 U_INTERNAL
const char * U_EXPORT2
u_getTimeZoneFilesDirectory(UErrorCode
*status
);
103 * Set the time zone files override directory.
104 * This function is not thread safe; it must not be called concurrently with
105 * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.
106 * This function should only be called before using any ICU service that
107 * will access the time zone data.
110 U_INTERNAL
void U_EXPORT2
u_setTimeZoneFilesDirectory(const char *path
, UErrorCode
*status
);
111 #endif /* U_HIDE_INTERNAL_API */
116 * Filesystem file and path separator characters.
117 * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
120 #if U_PLATFORM_USES_ONLY_WIN32_API
121 # define U_FILE_SEP_CHAR '\\'
122 # define U_FILE_ALT_SEP_CHAR '/'
123 # define U_PATH_SEP_CHAR ';'
124 # define U_FILE_SEP_STRING "\\"
125 # define U_FILE_ALT_SEP_STRING "/"
126 # define U_PATH_SEP_STRING ";"
128 # define U_FILE_SEP_CHAR '/'
129 # define U_FILE_ALT_SEP_CHAR '/'
130 # define U_PATH_SEP_CHAR ':'
131 # define U_FILE_SEP_STRING "/"
132 # define U_FILE_ALT_SEP_STRING "/"
133 # define U_PATH_SEP_STRING ":"
139 * Convert char characters to UChar characters.
140 * This utility function is useful only for "invariant characters"
141 * that are encoded in the platform default encoding.
142 * They are a small, constant subset of the encoding and include
143 * just the latin letters, digits, and some punctuation.
144 * For details, see U_CHARSET_FAMILY.
146 * @param cs Input string, points to <code>length</code>
147 * character bytes from a subset of the platform encoding.
148 * @param us Output string, points to memory for <code>length</code>
149 * Unicode characters.
150 * @param length The number of characters to convert; this may
151 * include the terminating <code>NUL</code>.
153 * @see U_CHARSET_FAMILY
156 U_STABLE
void U_EXPORT2
157 u_charsToUChars(const char *cs
, UChar
*us
, int32_t length
);
160 * Convert UChar characters to char characters.
161 * This utility function is useful only for "invariant characters"
162 * that can be encoded in the platform default encoding.
163 * They are a small, constant subset of the encoding and include
164 * just the latin letters, digits, and some punctuation.
165 * For details, see U_CHARSET_FAMILY.
167 * @param us Input string, points to <code>length</code>
168 * Unicode characters that can be encoded with the
169 * codepage-invariant subset of the platform encoding.
170 * @param cs Output string, points to memory for <code>length</code>
172 * @param length The number of characters to convert; this may
173 * include the terminating <code>NUL</code>.
175 * @see U_CHARSET_FAMILY
178 U_STABLE
void U_EXPORT2
179 u_UCharsToChars(const UChar
*us
, char *cs
, int32_t length
);