ICU 65.1 65.1

udata.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 * Copyright (C) 1999-2014, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 ******************************************************************************
10 * file name: udata.h
11 * encoding: UTF-8
12 * tab size: 8 (not used)
13 * indentation:4
14 *
15 * created on: 1999oct25
16 * created by: Markus W. Scherer
17 */
18
19 #ifndef __UDATA_H__
20 #define __UDATA_H__
21
22 #include "unicode/utypes.h"
23 #include "unicode/localpointer.h"
24
25 U_CDECL_BEGIN
26
42 #ifndef U_HIDE_INTERNAL_API
43
47 #define U_TREE_SEPARATOR '-'
48
53 #define U_TREE_SEPARATOR_STRING "-"
54
59 #define U_TREE_ENTRY_SEP_CHAR '/'
60
65 #define U_TREE_ENTRY_SEP_STRING "/"
66
71 #define U_ICUDATA_ALIAS "ICUDATA"
72
73 #endif /* U_HIDE_INTERNAL_API */
74
113 typedef struct {
116 uint16_t size;
117
120 uint16_t reservedWord;
121
122 /* platform data properties */
125 uint8_t isBigEndian;
126
129 uint8_t charsetFamily;
130
133 uint8_t sizeofUChar;
134
137 uint8_t reservedByte;
138
141 uint8_t dataFormat[4];
142
145 uint8_t formatVersion[4];
146
149 uint8_t dataVersion[4];
150 } UDataInfo;
151
152 /* API for reading data -----------------------------------------------------*/
153
158 typedef struct UDataMemory UDataMemory;
159
173 typedef UBool U_CALLCONV
174 UDataMemoryIsAcceptable(void *context,
175 const char *type, const char *name,
176 const UDataInfo *pInfo);
177
178
200 U_STABLE UDataMemory * U_EXPORT2
201 udata_open(const char *path, const char *type, const char *name,
202 UErrorCode *pErrorCode);
203
252 U_STABLE UDataMemory * U_EXPORT2
253 udata_openChoice(const char *path, const char *type, const char *name,
254 UDataMemoryIsAcceptable *isAcceptable, void *context,
255 UErrorCode *pErrorCode);
256
264 U_STABLE void U_EXPORT2
265 udata_close(UDataMemory *pData);
266
276 U_STABLE const void * U_EXPORT2
277 udata_getMemory(UDataMemory *pData);
278
297 U_STABLE void U_EXPORT2
298 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
299
343 U_STABLE void U_EXPORT2
344 udata_setCommonData(const void *data, UErrorCode *err);
345
346
374 U_STABLE void U_EXPORT2
375 udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
376
382 typedef enum UDataFileAccess {
384 UDATA_FILES_FIRST,
386 UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST,
388 UDATA_ONLY_PACKAGES,
391 UDATA_PACKAGES_FIRST,
393 UDATA_NO_FILES,
394 #ifndef U_HIDE_DEPRECATED_API
395
399 UDATA_FILE_ACCESS_COUNT
400 #endif // U_HIDE_DEPRECATED_API
401 } UDataFileAccess;
402
413 U_STABLE void U_EXPORT2
414 udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
415
416 U_CDECL_END
417
418 #if U_SHOW_CPLUSPLUS_API
419
420 U_NAMESPACE_BEGIN
421
431 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
432
433 U_NAMESPACE_END
434
435 #endif // U_SHOW_CPLUSPLUS_API
436
437 #endif
udata_setAppData
void udata_setAppData(const char *packageName, const void *data, UErrorCode *err)
This function bypasses the normal ICU data loading process for application-specific data and allows y...
udata_getInfo
void udata_getInfo(UDataMemory *pData, UDataInfo *pInfo)
Get the information from the data memory header.
UDataInfo::isBigEndian
uint8_t isBigEndian
0 for little-endian machine, 1 for big-endian
Definition: udata.h:125
udata_setCommonData
void udata_setCommonData(const void *data, UErrorCode *err)
This function bypasses the normal ICU data loading process and allows you to force ICU&#39;s system data ...
UDataFileAccess
UDataFileAccess
Possible settings for udata_setFileAccess()
Definition: udata.h:382
U_CALLCONV
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition: platform.h:870
UDataInfo::charsetFamily
uint8_t charsetFamily
see U_CHARSET_FAMILY values in utypes.h
Definition: udata.h:129
UDATA_FILE_ACCESS_COUNT
Number of real UDataFileAccess values.
Definition: udata.h:399
UDATA_PACKAGES_FIRST
ICU loads data from packages first, and only from single files if the data cannot be found in a packa...
Definition: udata.h:391
UDataInfo::size
uint16_t size
sizeof(UDataInfo)
Definition: udata.h:116
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:84
udata_open
UDataMemory * udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode)
Convenience function.
UDATA_FILES_FIRST
ICU looks for data in single files first, then in packages.
Definition: udata.h:384
UDATA_DEFAULT_ACCESS
An alias for the default access mode.
Definition: udata.h:386
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:562
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UDataMemory
struct UDataMemory UDataMemory
Forward declaration of the data memory type.
Definition: udata.h:158
udata_close
void udata_close(UDataMemory *pData)
Close the data memory.
UDataMemoryIsAcceptable
UBool UDataMemoryIsAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo)
Callback function for udata_openChoice().
Definition: udata.h:174
LocalUDataMemoryPointer
"Smart pointer" class, closes a UDataMemory via udata_close().
udata_setFileAccess
void udata_setFileAccess(UDataFileAccess access, UErrorCode *status)
This function may be called to control how ICU loads data.
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:85
UDATA_NO_FILES
ICU does not access the file system for data loading.
Definition: udata.h:393
udata_getMemory
const void * udata_getMemory(UDataMemory *pData)
Get the pointer to the actual data inside the data memory.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
udata_openChoice
UDataMemory * udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode)
Data loading function.
UDataInfo
UDataInfo contains the properties about the requested data.
Definition: udata.h:113
UDataInfo::reservedByte
uint8_t reservedByte
unused, set to 0
Definition: udata.h:137
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UDataInfo::sizeofUChar
uint8_t sizeofUChar
sizeof(UChar), one of { 1, 2, 4 }
Definition: udata.h:133
UDATA_ONLY_PACKAGES
ICU only loads data from packages, not from single files.
Definition: udata.h:388
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
UDataInfo::reservedWord
uint16_t reservedWord
unused, set to 0
Definition: udata.h:120