ICU 77.1  77.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 
24 #if U_SHOW_CPLUSPLUS_API
25 #include "unicode/localpointer.h"
26 #endif // U_SHOW_CPLUSPLUS_API
27 
29 
45 #ifndef U_HIDE_INTERNAL_API
50 #define U_TREE_SEPARATOR '-'
51 
56 #define U_TREE_SEPARATOR_STRING "-"
57 
62 #define U_TREE_ENTRY_SEP_CHAR '/'
63 
68 #define U_TREE_ENTRY_SEP_STRING "/"
69 
74 #define U_ICUDATA_ALIAS "ICUDATA"
75 
76 #endif /* U_HIDE_INTERNAL_API */
77 
116 typedef struct {
119  uint16_t size;
120 
123  uint16_t reservedWord;
124 
125  /* platform data properties */
128  uint8_t isBigEndian;
129 
132  uint8_t charsetFamily;
133 
136  uint8_t sizeofUChar;
137 
140  uint8_t reservedByte;
141 
144  uint8_t dataFormat[4];
145 
148  uint8_t formatVersion[4];
149 
152  uint8_t dataVersion[4];
153 } UDataInfo;
154 
155 /* API for reading data -----------------------------------------------------*/
156 
161 typedef struct UDataMemory UDataMemory;
162 
176 typedef UBool U_CALLCONV
178  const char *type, const char *name,
179  const UDataInfo *pInfo);
180 
181 
203 U_CAPI UDataMemory * U_EXPORT2
204 udata_open(const char *path, const char *type, const char *name,
205  UErrorCode *pErrorCode);
206 
255 U_CAPI UDataMemory * U_EXPORT2
256 udata_openChoice(const char *path, const char *type, const char *name,
257  UDataMemoryIsAcceptable *isAcceptable, void *context,
258  UErrorCode *pErrorCode);
259 
267 U_CAPI void U_EXPORT2
269 
279 U_CAPI const void * U_EXPORT2
281 
300 U_CAPI void U_EXPORT2
302 
346 U_CAPI void U_EXPORT2
347 udata_setCommonData(const void *data, UErrorCode *err);
348 
349 
377 U_CAPI void U_EXPORT2
378 udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
379 
385 typedef enum UDataFileAccess {
397 #ifndef U_HIDE_DEPRECATED_API
403 #endif // U_HIDE_DEPRECATED_API
405 
416 U_CAPI void U_EXPORT2
418 
420 
421 #if U_SHOW_CPLUSPLUS_API
422 
423 U_NAMESPACE_BEGIN
424 
435 
436 U_NAMESPACE_END
437 
438 #endif // U_SHOW_CPLUSPLUS_API
439 
440 #endif
"Smart pointer" class, closes a UDataMemory via udata_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition: platform.h:846
UDataInfo contains the properties about the requested data.
Definition: udata.h:116
uint8_t sizeofUChar
sizeof(UChar), one of { 1, 2, 4 }
Definition: udata.h:136
uint8_t charsetFamily
see U_CHARSET_FAMILY values in utypes.h
Definition: udata.h:132
uint8_t isBigEndian
0 for little-endian machine, 1 for big-endian
Definition: udata.h:128
uint16_t size
sizeof(UDataInfo)
Definition: udata.h:119
uint8_t reservedByte
unused, set to 0
Definition: udata.h:140
uint16_t reservedWord
unused, set to 0
Definition: udata.h:123
U_CAPI 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...
UDataFileAccess
Possible settings for udata_setFileAccess()
Definition: udata.h:385
@ UDATA_FILE_ACCESS_COUNT
Number of real UDataFileAccess values.
Definition: udata.h:402
@ UDATA_ONLY_PACKAGES
ICU only loads data from packages, not from single files.
Definition: udata.h:391
@ UDATA_DEFAULT_ACCESS
An alias for the default access mode.
Definition: udata.h:389
@ UDATA_FILES_FIRST
ICU looks for data in single files first, then in packages.
Definition: udata.h:387
@ 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:394
@ UDATA_NO_FILES
ICU does not access the file system for data loading.
Definition: udata.h:396
U_CAPI UDataMemory * udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode)
Data loading function.
U_CAPI void udata_getInfo(UDataMemory *pData, UDataInfo *pInfo)
Get the information from the data memory header.
U_CAPI void udata_setFileAccess(UDataFileAccess access, UErrorCode *status)
This function may be called to control how ICU loads data.
U_CAPI void udata_close(UDataMemory *pData)
Close the data memory.
U_CAPI UDataMemory * udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode)
Convenience function.
U_CAPI void udata_setCommonData(const void *data, UErrorCode *err)
This function bypasses the normal ICU data loading process and allows you to force ICU's system data ...
UBool UDataMemoryIsAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo)
Callback function for udata_openChoice().
Definition: udata.h:177
struct UDataMemory UDataMemory
Forward declaration of the data memory type.
Definition: udata.h:161
U_CAPI const void * udata_getMemory(UDataMemory *pData)
Get the pointer to the actual data inside the data memory.
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:86
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:85
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:430