1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/udatamem.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* 1.5 +****************************************************************************** 1.6 +* 1.7 +* Copyright (C) 1999-2010, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +******************************************************************************/ 1.11 + 1.12 + 1.13 +/*---------------------------------------------------------------------------------- 1.14 + * 1.15 + * UDataMemory A class-like struct that serves as a handle to a piece of memory 1.16 + * that contains some ICU data (resource, converters, whatever.) 1.17 + * 1.18 + * When an application opens ICU data (with udata_open, for example, 1.19 + * a UDataMemory * is returned. 1.20 + * 1.21 + *----------------------------------------------------------------------------------*/ 1.22 +#ifndef __UDATAMEM_H__ 1.23 +#define __UDATAMEM_H__ 1.24 + 1.25 +#include "unicode/udata.h" 1.26 +#include "ucmndata.h" 1.27 + 1.28 +struct UDataMemory { 1.29 + const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */ 1.30 + 1.31 + const DataHeader *pHeader; /* Header of the memory being described by this */ 1.32 + /* UDataMemory object. */ 1.33 + const void *toc; /* For common memory, table of contents for */ 1.34 + /* the pieces within. */ 1.35 + UBool heapAllocated; /* True if this UDataMemory Object is on the */ 1.36 + /* heap and thus needs to be deleted when closed. */ 1.37 + 1.38 + void *mapAddr; /* For mapped or allocated memory, the start addr. */ 1.39 + /* Only non-null if a close operation should unmap */ 1.40 + /* the associated data. */ 1.41 + void *map; /* Handle, or other data, OS dependent. */ 1.42 + /* Only non-null if a close operation should unmap */ 1.43 + /* the associated data, and additional info */ 1.44 + /* beyond the mapAddr is needed to do that. */ 1.45 + int32_t length; /* Length of the data in bytes; -1 if unknown. */ 1.46 +}; 1.47 + 1.48 +U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr); 1.49 +U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source); 1.50 +U_CFUNC void UDataMemory_init (UDataMemory *This); 1.51 +U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This); 1.52 +U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr); 1.53 + 1.54 +U_CFUNC const DataHeader *UDataMemory_normalizeDataPointer(const void *p); 1.55 + 1.56 +U_CAPI int32_t U_EXPORT2 1.57 +udata_getLength(const UDataMemory *pData); 1.58 + 1.59 +U_CAPI const void * U_EXPORT2 1.60 +udata_getRawMemory(const UDataMemory *pData); 1.61 + 1.62 +#endif