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