2 ******************************************************************************
4 * Copyright (C) 1999-2010, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************/
10 /*----------------------------------------------------------------------------------
12 * UCommonData An abstract interface for dealing with ICU Common Data Files.
13 * ICU Common Data Files are a grouping of a number of individual
14 * data items (resources, converters, tables, anything) into a
15 * single file or dll. The combined format includes a table of
16 * contents for locating the individual items by name.
18 * Two formats for the table of contents are supported, which is
19 * why there is an abstract inteface involved.
21 * These functions are part of the ICU internal implementation, and
22 * are not inteded to be used directly by applications.
25 #ifndef __UCMNDATA_H__
26 #define __UCMNDATA_H__
28 #include "unicode/udata.h"
32 #define COMMON_DATA_NAME U_ICUDATA_NAME
42 MappedData dataHeader
;
49 } UDataOffsetTOCEntry
;
53 UDataOffsetTOCEntry entry
[2]; /* Actual size of array is from count. */
57 * Get the header size from a const DataHeader *udh.
58 * Handles opposite-endian data.
63 udata_getHeaderSize(const DataHeader
*udh
);
66 * Get the UDataInfo.size from a const UDataInfo *info.
67 * Handles opposite-endian data.
72 udata_getInfoSize(const UDataInfo
*info
);
75 * "Virtual" functions for data lookup.
76 * To call one, given a UDataMemory *p, the code looks like this:
77 * p->vFuncs.Lookup(p, tocEntryName, pErrorCode);
78 * (I sure do wish this was written in C++, not C)
81 typedef const DataHeader
*
82 (* LookupFn
)(const UDataMemory
*pData
,
83 const char *tocEntryName
,
85 UErrorCode
*pErrorCode
);
88 (* NumEntriesFn
)(const UDataMemory
*pData
);
92 NumEntriesFn NumEntries
;
97 * Functions to check whether a UDataMemory refers to memory containing
98 * a recognizable header and table of contents a Common Data Format
100 * If a valid header and TOC are found,
101 * set the CommonDataFuncs function dispatch vector in the UDataMemory
102 * to point to the right functions for the TOC type.
106 U_CFUNC
void udata_checkCommonData(UDataMemory
*pData
, UErrorCode
*pErrorCode
);