ICU 50.2 50.2
udata.h
Go to the documentation of this file.
1/*
2******************************************************************************
3*
4* Copyright (C) 1999-2012, 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"
22
24
39
40#ifndef U_HIDE_INTERNAL_API
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
106typedef struct {
109 uint16_t size;
110
113 uint16_t reservedWord;
114
115 /* platform data properties */
118 uint8_t isBigEndian;
119
123
126 uint8_t sizeofUChar;
127
131
134 uint8_t dataFormat[4];
135
138 uint8_t formatVersion[4];
139
142 uint8_t dataVersion[4];
143} UDataInfo;
144
145/* API for reading data -----------------------------------------------------*/
146
152
166typedef UBool U_CALLCONV
168 const char *type, const char *name,
169 const UDataInfo *pInfo);
170
171
193U_STABLE UDataMemory * U_EXPORT2
194udata_open(const char *path, const char *type, const char *name,
195 UErrorCode *pErrorCode);
196
245U_STABLE UDataMemory * U_EXPORT2
246udata_openChoice(const char *path, const char *type, const char *name,
247 UDataMemoryIsAcceptable *isAcceptable, void *context,
248 UErrorCode *pErrorCode);
249
257U_STABLE void U_EXPORT2
259
260#if U_SHOW_CPLUSPLUS_API
261
263
274
276
277#endif
278
285U_STABLE const void * U_EXPORT2
287
306U_STABLE void U_EXPORT2
308
349U_STABLE void U_EXPORT2
350udata_setCommonData(const void *data, UErrorCode *err);
351
352
377U_STABLE void U_EXPORT2
378udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
379
400
411U_STABLE void U_EXPORT2
413
415
416#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.
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition platform.h:751
UDataInfo contains the properties about the requested data.
Definition udata.h:106
uint8_t formatVersion[4]
versions: [0] major [1] minor [2] milli [3] micro
Definition udata.h:138
uint8_t sizeofUChar
sizeof(UChar), one of { 1, 2, 4 }
Definition udata.h:126
uint8_t dataFormat[4]
data format identifier
Definition udata.h:134
uint8_t dataVersion[4]
versions: [0] major [1] minor [2] milli [3] micro
Definition udata.h:142
uint8_t charsetFamily
see U_CHARSET_FAMILY values in utypes.h
Definition udata.h:122
uint8_t isBigEndian
0 for little-endian machine, 1 for big-endian
Definition udata.h:118
uint16_t size
sizeof(UDataInfo)
Definition udata.h:109
uint8_t reservedByte
unused, set to 0
Definition udata.h:130
uint16_t reservedWord
unused, set to 0
Definition udata.h:113
void udata_close(UDataMemory *pData)
Close the data memory.
UDataFileAccess
Possible settings for udata_setFileAccess()
Definition udata.h:385
@ UDATA_FILE_ACCESS_COUNT
Number of real UDataFileAccess values.
Definition udata.h:398
@ 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
void udata_getInfo(UDataMemory *pData, UDataInfo *pInfo)
Get the information from the data memory header.
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...
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 ...
const void * udata_getMemory(UDataMemory *pData)
Get the pointer to the actual data inside the data memory.
UDataMemory * udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode)
Convenience function.
void udata_setFileAccess(UDataFileAccess access, UErrorCode *status)
This function may be called to control how ICU loads data.
UDataMemory * udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode)
Data loading function.
UBool UDataMemoryIsAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo)
Callback function for udata_openChoice().
Definition udata.h:167
struct UDataMemory UDataMemory
Forward declaration of the data memory type.
Definition udata.h:151
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition umachine.h:83
int8_t UBool
The ICU boolean type.
Definition umachine.h:200
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition umachine.h:82
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition umachine.h:109
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:476
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129