]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/udatamem.h
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / udatamem.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4******************************************************************************
5*
729e4ab9 6* Copyright (C) 1999-2010, International Business Machines
b75a7d8f
A
7* Corporation and others. All Rights Reserved.
8*
9******************************************************************************/
10
11
12/*----------------------------------------------------------------------------------
13 *
14 * UDataMemory A class-like struct that serves as a handle to a piece of memory
15 * that contains some ICU data (resource, converters, whatever.)
16 *
17 * When an application opens ICU data (with udata_open, for example,
18 * a UDataMemory * is returned.
19 *
20 *----------------------------------------------------------------------------------*/
21#ifndef __UDATAMEM_H__
22#define __UDATAMEM_H__
23
24#include "unicode/udata.h"
25#include "ucmndata.h"
26
27struct UDataMemory {
28 const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */
29
30 const DataHeader *pHeader; /* Header of the memory being described by this */
31 /* UDataMemory object. */
32 const void *toc; /* For common memory, table of contents for */
33 /* the pieces within. */
34 UBool heapAllocated; /* True if this UDataMemory Object is on the */
35 /* heap and thus needs to be deleted when closed. */
36
37 void *mapAddr; /* For mapped or allocated memory, the start addr. */
38 /* Only non-null if a close operation should unmap */
39 /* the associated data. */
40 void *map; /* Handle, or other data, OS dependent. */
41 /* Only non-null if a close operation should unmap */
42 /* the associated data, and additional info */
43 /* beyond the mapAddr is needed to do that. */
374ca955 44 int32_t length; /* Length of the data in bytes; -1 if unknown. */
b75a7d8f
A
45};
46
729e4ab9
A
47U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr);
48U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source);
49U_CFUNC void UDataMemory_init (UDataMemory *This);
50U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This);
51U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr);
b75a7d8f 52
729e4ab9 53U_CFUNC const DataHeader *UDataMemory_normalizeDataPointer(const void *p);
374ca955
A
54
55U_CAPI int32_t U_EXPORT2
56udata_getLength(const UDataMemory *pData);
57
58U_CAPI const void * U_EXPORT2
59udata_getRawMemory(const UDataMemory *pData);
60
b75a7d8f 61#endif