ucnv_io.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. **********************************************************************
  5. * Copyright (C) 1999-2006, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. **********************************************************************
  8. *
  9. *
  10. * ucnv_io.h:
  11. * defines variables and functions pertaining to converter name resolution
  12. * aspect of the conversion code
  13. */
  14. #ifndef UCNV_IO_H
  15. #define UCNV_IO_H
  16. #include "unicode/utypes.h"
  17. #if !UCONFIG_NO_CONVERSION
  18. #include "udataswp.h"
  19. #define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000
  20. #define UCNV_CONTAINS_OPTION_BIT 0x4000
  21. #define UCNV_CONVERTER_INDEX_MASK 0xFFF
  22. #define UCNV_NUM_RESERVED_TAGS 2
  23. #define UCNV_NUM_HIDDEN_TAGS 1
  24. enum {
  25. UCNV_IO_UNNORMALIZED,
  26. UCNV_IO_STD_NORMALIZED,
  27. UCNV_IO_NORM_TYPE_COUNT
  28. };
  29. typedef struct {
  30. uint16_t stringNormalizationType;
  31. uint16_t containsCnvOptionInfo;
  32. } UConverterAliasOptions;
  33. typedef struct UConverterAlias {
  34. const uint16_t *converterList;
  35. const uint16_t *tagList;
  36. const uint16_t *aliasList;
  37. const uint16_t *untaggedConvArray;
  38. const uint16_t *taggedAliasArray;
  39. const uint16_t *taggedAliasLists;
  40. const UConverterAliasOptions *optionTable;
  41. const uint16_t *stringTable;
  42. const uint16_t *normalizedStringTable;
  43. uint32_t converterListSize;
  44. uint32_t tagListSize;
  45. uint32_t aliasListSize;
  46. uint32_t untaggedConvArraySize;
  47. uint32_t taggedAliasArraySize;
  48. uint32_t taggedAliasListsSize;
  49. uint32_t optionTableSize;
  50. uint32_t stringTableSize;
  51. uint32_t normalizedStringTableSize;
  52. } UConverterAlias;
  53. /**
  54. * \var ucnv_io_stripForCompare
  55. * Remove the underscores, dashes and spaces from the name, and convert
  56. * the name to lower case.
  57. * @param dst The destination buffer, which is <= the buffer of name.
  58. * @param dst The destination buffer, which is <= the buffer of name.
  59. * @see ucnv_compareNames
  60. * @return the destination buffer.
  61. */
  62. #if U_CHARSET_FAMILY==U_ASCII_FAMILY
  63. # define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare
  64. #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
  65. # define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare
  66. #else
  67. # error U_CHARSET_FAMILY is not valid
  68. #endif
  69. U_CAPI char * U_CALLCONV
  70. ucnv_io_stripASCIIForCompare(char *dst, const char *name);
  71. U_CAPI char * U_CALLCONV
  72. ucnv_io_stripEBCDICForCompare(char *dst, const char *name);
  73. /**
  74. * Map a converter alias name to a canonical converter name.
  75. * The alias is searched for case-insensitively, the converter name
  76. * is returned in mixed-case.
  77. * Returns NULL if the alias is not found.
  78. * @param alias The alias name to be searched.
  79. * @param containsOption A return value stating whether the returned converter name contains an option (a comma)
  80. * @param pErrorCode The error code
  81. * @return the converter name in mixed-case, return NULL if the alias is not found.
  82. */
  83. U_CAPI const char *
  84. ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode);
  85. /**
  86. * Return the number of all known converter names (no aliases).
  87. * @param pErrorCode The error code
  88. * @return the number of all aliases
  89. */
  90. U_CAPI uint16_t
  91. ucnv_io_countKnownConverters(UErrorCode *pErrorCode);
  92. /**
  93. * Swap an ICU converter alias table. See implementation for details.
  94. * @internal
  95. */
  96. U_CAPI int32_t U_EXPORT2
  97. ucnv_swapAliases(const UDataSwapper *ds,
  98. const void *inData, int32_t length, void *outData,
  99. UErrorCode *pErrorCode);
  100. #endif
  101. #endif /* _UCNV_IO */
  102. /*
  103. * Hey, Emacs, please set the following:
  104. *
  105. * Local Variables:
  106. * indent-tabs-mode: nil
  107. * End:
  108. *
  109. */