udatamem.h 2.9 KB

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