// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * * Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ /*---------------------------------------------------------------------------------- * * UDataMemory A class-like struct that serves as a handle to a piece of memory * that contains some ICU data (resource, converters, whatever.) * * When an application opens ICU data (with udata_open, for example, * a UDataMemory * is returned. * *----------------------------------------------------------------------------------*/ #include "unicode/utypes.h" #include "cmemory.h" #include "unicode/udata.h" #include "udatamem.h" U_CFUNC void UDataMemory_init(UDataMemory *This) { … } U_CFUNC void UDatamemory_assign(UDataMemory *dest, UDataMemory *source) { … } U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) { … } U_CFUNC const DataHeader * UDataMemory_normalizeDataPointer(const void *p) { … } U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr) { … } U_CAPI void U_EXPORT2 udata_close(UDataMemory *pData) { … } U_CAPI const void * U_EXPORT2 udata_getMemory(UDataMemory *pData) { … } /** * Get the length of the data item if possible. * The length may be up to 15 bytes larger than the actual data. * * TODO Consider making this function public. * It would have to return the actual length in more cases. * For example, the length of the last item in a .dat package could be * computed from the size of the whole .dat package minus the offset of the * last item. * The size of a file that was directly memory-mapped could be determined * using some system API. * * In order to get perfect values for all data items, we may have to add a * length field to UDataInfo, but that complicates data generation * and may be overkill. * * @param pData The data item. * @return the length of the data item, or -1 if not known * @internal Currently used only in cintltst/udatatst.c */ U_CAPI int32_t U_EXPORT2 udata_getLength(const UDataMemory *pData) { … } /** * Get the memory including the data header. * Used in cintltst/udatatst.c * @internal */ U_CAPI const void * U_EXPORT2 udata_getRawMemory(const UDataMemory *pData) { … } U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This) { … }