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
;
55 UDataOffsetTOCEntry entry
[2]; /* Actual size of array is from count. */
59 * Get the header size from a const DataHeader *udh.
60 * Handles opposite-endian data.
65 udata_getHeaderSize(const DataHeader
*udh
);
68 * Get the UDataInfo.size from a const UDataInfo *info.
69 * Handles opposite-endian data.
74 udata_getInfoSize(const UDataInfo
*info
);
78 * "Virtual" functions for data lookup.
79 * To call one, given a UDataMemory *p, the code looks like this:
80 * p->vFuncs.Lookup(p, tocEntryName, pErrorCode);
81 * (I sure do wish this was written in C++, not C)
84 typedef const DataHeader
*
85 (U_CALLCONV
* LookupFn
)(const UDataMemory
*pData
,
86 const char *tocEntryName
,
88 UErrorCode
*pErrorCode
);
91 (U_CALLCONV
* NumEntriesFn
)(const UDataMemory
*pData
);
97 NumEntriesFn NumEntries
;
102 * Functions to check whether a UDataMemory refers to memory containing
103 * a recognizable header and table of contents a Common Data Format
105 * If a valid header and TOC are found,
106 * set the CommonDataFuncs function dispatch vector in the UDataMemory
107 * to point to the right functions for the TOC type.
111 U_CFUNC
void udata_checkCommonData(UDataMemory
*pData
, UErrorCode
*pErrorCode
);