ICU 56.1: udata.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

udata.h
Go to the documentation of this file.
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2014, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 * file name: udata.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 1999oct25
14 * created by: Markus W. Scherer
15 */
16
17 #ifndef __UDATA_H__
18 #define __UDATA_H__
19
20 #include "unicode/utypes.h"
21 #include "unicode/localpointer.h"
22
23 U_CDECL_BEGIN
24
40 #ifndef U_HIDE_INTERNAL_API
41
45 #define U_TREE_SEPARATOR '-'
46
51 #define U_TREE_SEPARATOR_STRING "-"
52
57 #define U_TREE_ENTRY_SEP_CHAR '/'
58
63 #define U_TREE_ENTRY_SEP_STRING "/"
64
69 #define U_ICUDATA_ALIAS "ICUDATA"
70
71 #endif /* U_HIDE_INTERNAL_API */
72
111 typedef struct {
114 uint16_t size;
115
118 uint16_t reservedWord;
119
120 /* platform data properties */
123 uint8_t isBigEndian;
124
127 uint8_t charsetFamily;
128
131 uint8_t sizeofUChar;
132
135 uint8_t reservedByte;
136
139 uint8_t dataFormat[4];
140
143 uint8_t formatVersion[4];
144
147 uint8_t dataVersion[4];
148 } UDataInfo;
149
150 /* API for reading data -----------------------------------------------------*/
151
156 typedef struct UDataMemory UDataMemory;
157
171 typedef UBool U_CALLCONV
172 UDataMemoryIsAcceptable(void *context,
173 const char *type, const char *name,
174 const UDataInfo *pInfo);
175
176
198 U_STABLE UDataMemory * U_EXPORT2
199 udata_open(const char *path, const char *type, const char *name,
200 UErrorCode *pErrorCode);
201
250 U_STABLE UDataMemory * U_EXPORT2
251 udata_openChoice(const char *path, const char *type, const char *name,
252 UDataMemoryIsAcceptable *isAcceptable, void *context,
253 UErrorCode *pErrorCode);
254
262 U_STABLE void U_EXPORT2
263 udata_close(UDataMemory *pData);
264
265 #if U_SHOW_CPLUSPLUS_API
266
267 U_NAMESPACE_BEGIN
268
278 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
279
280 U_NAMESPACE_END
281
282 #endif
283
293 U_STABLE const void * U_EXPORT2
294 udata_getMemory(UDataMemory *pData);
295
314 U_STABLE void U_EXPORT2
315 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
316
360 U_STABLE void U_EXPORT2
361 udata_setCommonData(const void *data, UErrorCode *err);
362
363
391 U_STABLE void U_EXPORT2
392 udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
393
399 typedef enum UDataFileAccess {
401 UDATA_FILES_FIRST,
403 UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST,
405 UDATA_ONLY_PACKAGES,
408 UDATA_PACKAGES_FIRST,
410 UDATA_NO_FILES,
412 UDATA_FILE_ACCESS_COUNT
413 } UDataFileAccess;
414
425 U_STABLE void U_EXPORT2
426 udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
427
428 U_CDECL_END
429
430 #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:123
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's system data ...
UDataFileAccess
UDataFileAccess
Possible settings for udata_setFileAccess()
Definition: udata.h:399
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:823
UDataInfo::charsetFamily
uint8_t charsetFamily
see U_CHARSET_FAMILY values in utypes.h
Definition: udata.h:127
UDATA_FILE_ACCESS_COUNT
Number of real UDataFileAccess values.
Definition: udata.h:412
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:408
UDataInfo::size
uint16_t size
sizeof(UDataInfo)
Definition: udata.h:114
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:82
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:401
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UDATA_DEFAULT_ACCESS
An alias for the default access mode.
Definition: udata.h:403
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:535
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:156
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:172
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:83
UDATA_NO_FILES
ICU does not access the file system for data loading.
Definition: udata.h:410
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
udata_getMemory
const void * udata_getMemory(UDataMemory *pData)
Get the pointer to the actual data inside the data memory.
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
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:111
UDataInfo::reservedByte
uint8_t reservedByte
unused, set to 0
Definition: udata.h:135
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:131
UDATA_ONLY_PACKAGES
ICU only loads data from packages, not from single files.
Definition: udata.h:405
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
UDataInfo::reservedWord
uint16_t reservedWord
unused, set to 0
Definition: udata.h:118