ICU 73.2  73.2
udata.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 ******************************************************************************
00005 *
00006 *   Copyright (C) 1999-2014, International Business Machines
00007 *   Corporation and others.  All Rights Reserved.
00008 *
00009 ******************************************************************************
00010 *   file name:  udata.h
00011 *   encoding:   UTF-8
00012 *   tab size:   8 (not used)
00013 *   indentation:4
00014 *
00015 *   created on: 1999oct25
00016 *   created by: Markus W. Scherer
00017 */
00018 
00019 #ifndef __UDATA_H__
00020 #define __UDATA_H__
00021 
00022 #include "unicode/utypes.h"
00023 
00024 #if U_SHOW_CPLUSPLUS_API
00025 #include "unicode/localpointer.h"
00026 #endif   // U_SHOW_CPLUSPLUS_API
00027 
00028 U_CDECL_BEGIN
00029 
00045 #ifndef U_HIDE_INTERNAL_API
00046 
00050 #define U_TREE_SEPARATOR '-'
00051 
00056 #define U_TREE_SEPARATOR_STRING "-"
00057 
00062 #define U_TREE_ENTRY_SEP_CHAR '/'
00063 
00068 #define U_TREE_ENTRY_SEP_STRING "/"
00069 
00074 #define U_ICUDATA_ALIAS "ICUDATA"
00075 
00076 #endif /* U_HIDE_INTERNAL_API */
00077 
00116 typedef struct {
00119     uint16_t size;
00120 
00123     uint16_t reservedWord;
00124 
00125     /* platform data properties */
00128     uint8_t isBigEndian;
00129 
00132     uint8_t charsetFamily;
00133 
00136     uint8_t sizeofUChar;
00137 
00140     uint8_t reservedByte;
00141 
00144     uint8_t dataFormat[4];
00145 
00148     uint8_t formatVersion[4];
00149 
00152     uint8_t dataVersion[4];
00153 } UDataInfo;
00154 
00155 /* API for reading data -----------------------------------------------------*/
00156 
00161 typedef struct UDataMemory UDataMemory;
00162 
00176 typedef UBool U_CALLCONV
00177 UDataMemoryIsAcceptable(void *context,
00178                         const char *type, const char *name,
00179                         const UDataInfo *pInfo);
00180 
00181 
00203 U_CAPI UDataMemory * U_EXPORT2
00204 udata_open(const char *path, const char *type, const char *name,
00205            UErrorCode *pErrorCode);
00206 
00255 U_CAPI UDataMemory * U_EXPORT2
00256 udata_openChoice(const char *path, const char *type, const char *name,
00257                  UDataMemoryIsAcceptable *isAcceptable, void *context,
00258                  UErrorCode *pErrorCode);
00259 
00267 U_CAPI void U_EXPORT2
00268 udata_close(UDataMemory *pData);
00269 
00279 U_CAPI const void * U_EXPORT2
00280 udata_getMemory(UDataMemory *pData);
00281 
00300 U_CAPI void U_EXPORT2
00301 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
00302 
00346 U_CAPI void U_EXPORT2
00347 udata_setCommonData(const void *data, UErrorCode *err);
00348 
00349 
00377 U_CAPI void U_EXPORT2
00378 udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
00379 
00385 typedef enum UDataFileAccess {
00387     UDATA_FILES_FIRST,
00389     UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST,
00391     UDATA_ONLY_PACKAGES,
00394     UDATA_PACKAGES_FIRST,
00396     UDATA_NO_FILES,
00397 #ifndef U_HIDE_DEPRECATED_API
00398 
00402     UDATA_FILE_ACCESS_COUNT
00403 #endif  // U_HIDE_DEPRECATED_API
00404 } UDataFileAccess;
00405 
00416 U_CAPI void U_EXPORT2
00417 udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
00418 
00419 U_CDECL_END
00420 
00421 #if U_SHOW_CPLUSPLUS_API
00422 
00423 U_NAMESPACE_BEGIN
00424 
00434 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
00435 
00436 U_NAMESPACE_END
00437 
00438 #endif  // U_SHOW_CPLUSPLUS_API
00439 
00440 #endif