michael@0: /* michael@0: ****************************************************************************** michael@0: * michael@0: * Copyright (C) 1999-2010, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************/ michael@0: michael@0: michael@0: /*---------------------------------------------------------------------------------- michael@0: * michael@0: * UDataMemory A class-like struct that serves as a handle to a piece of memory michael@0: * that contains some ICU data (resource, converters, whatever.) michael@0: * michael@0: * When an application opens ICU data (with udata_open, for example, michael@0: * a UDataMemory * is returned. michael@0: * michael@0: *----------------------------------------------------------------------------------*/ michael@0: #ifndef __UDATAMEM_H__ michael@0: #define __UDATAMEM_H__ michael@0: michael@0: #include "unicode/udata.h" michael@0: #include "ucmndata.h" michael@0: michael@0: struct UDataMemory { michael@0: const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */ michael@0: michael@0: const DataHeader *pHeader; /* Header of the memory being described by this */ michael@0: /* UDataMemory object. */ michael@0: const void *toc; /* For common memory, table of contents for */ michael@0: /* the pieces within. */ michael@0: UBool heapAllocated; /* True if this UDataMemory Object is on the */ michael@0: /* heap and thus needs to be deleted when closed. */ michael@0: michael@0: void *mapAddr; /* For mapped or allocated memory, the start addr. */ michael@0: /* Only non-null if a close operation should unmap */ michael@0: /* the associated data. */ michael@0: void *map; /* Handle, or other data, OS dependent. */ michael@0: /* Only non-null if a close operation should unmap */ michael@0: /* the associated data, and additional info */ michael@0: /* beyond the mapAddr is needed to do that. */ michael@0: int32_t length; /* Length of the data in bytes; -1 if unknown. */ michael@0: }; michael@0: michael@0: U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr); michael@0: U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source); michael@0: U_CFUNC void UDataMemory_init (UDataMemory *This); michael@0: U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This); michael@0: U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr); michael@0: michael@0: U_CFUNC const DataHeader *UDataMemory_normalizeDataPointer(const void *p); michael@0: michael@0: U_CAPI int32_t U_EXPORT2 michael@0: udata_getLength(const UDataMemory *pData); michael@0: michael@0: U_CAPI const void * U_EXPORT2 michael@0: udata_getRawMemory(const UDataMemory *pData); michael@0: michael@0: #endif