1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ******************************************************************************
6 * Copyright (C) 1999-2011, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 ******************************************************************************/
12 /*----------------------------------------------------------------------------------
14 * UCommonData An abstract interface for dealing with ICU Common Data Files.
15 * ICU Common Data Files are a grouping of a number of individual
16 * data items (resources, converters, tables, anything) into a
17 * single file or dll. The combined format includes a table of
18 * contents for locating the individual items by name.
20 * Two formats for the table of contents are supported, which is
21 * why there is an abstract inteface involved.
23 * These functions are part of the ICU internal implementation, and
24 * are not inteded to be used directly by applications.
27 #ifndef __UCMNDATA_H__
28 #define __UCMNDATA_H__
30 #include "unicode/udata.h"
34 #define COMMON_DATA_NAME U_ICUDATA_NAME
44 MappedData dataHeader
;
51 } UDataOffsetTOCEntry
;
56 * Variable-length array declared with length 1 to disable bounds checkers.
57 * The actual array length is in the count field.
59 UDataOffsetTOCEntry entry
[1];
63 * Get the header size from a const DataHeader *udh.
64 * Handles opposite-endian data.
69 udata_getHeaderSize(const DataHeader
*udh
);
72 * Get the UDataInfo.size from a const UDataInfo *info.
73 * Handles opposite-endian data.
78 udata_getInfoSize(const UDataInfo
*info
);
82 * "Virtual" functions for data lookup.
83 * To call one, given a UDataMemory *p, the code looks like this:
84 * p->vFuncs.Lookup(p, tocEntryName, pErrorCode);
85 * (I sure do wish this was written in C++, not C)
88 typedef const DataHeader
*
89 (U_CALLCONV
* LookupFn
)(const UDataMemory
*pData
,
90 const char *tocEntryName
,
92 UErrorCode
*pErrorCode
);
95 (U_CALLCONV
* NumEntriesFn
)(const UDataMemory
*pData
);
101 NumEntriesFn NumEntries
;
106 * Functions to check whether a UDataMemory refers to memory containing
107 * a recognizable header and table of contents a Common Data Format
109 * If a valid header and TOC are found,
110 * set the CommonDataFuncs function dispatch vector in the UDataMemory
111 * to point to the right functions for the TOC type.
115 U_CFUNC
void udata_checkCommonData(UDataMemory
*pData
, UErrorCode
*pErrorCode
);