intl/icu/source/common/ucnv_imp.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 **********************************************************************
michael@0 3 * Copyright (C) 1999-2011, International Business Machines
michael@0 4 * Corporation and others. All Rights Reserved.
michael@0 5 **********************************************************************
michael@0 6 *
michael@0 7 *
michael@0 8 * ucnv_imp.h:
michael@0 9 * Contains all internal and external data structure definitions
michael@0 10 * Created & Maitained by Bertrand A. Damiba
michael@0 11 *
michael@0 12 *
michael@0 13 *
michael@0 14 * ATTENTION:
michael@0 15 * ---------
michael@0 16 * Although the data structures in this file are open and stack allocatable
michael@0 17 * we reserve the right to hide them in further releases.
michael@0 18 */
michael@0 19
michael@0 20 #ifndef UCNV_IMP_H
michael@0 21 #define UCNV_IMP_H
michael@0 22
michael@0 23 #include "unicode/utypes.h"
michael@0 24
michael@0 25 #if !UCONFIG_NO_CONVERSION
michael@0 26
michael@0 27 #include "unicode/uloc.h"
michael@0 28 #include "ucnv_bld.h"
michael@0 29
michael@0 30 /*
michael@0 31 * Fast check for whether a charset name is "UTF-8".
michael@0 32 * This does not recognize all of the variations that ucnv_open()
michael@0 33 * and other functions recognize, but it covers most cases.
michael@0 34 * @param name const char * charset name
michael@0 35 * @return
michael@0 36 */
michael@0 37 #define UCNV_FAST_IS_UTF8(name) \
michael@0 38 (((name[0]=='U' ? \
michael@0 39 ( name[1]=='T' && name[2]=='F') : \
michael@0 40 (name[0]=='u' && name[1]=='t' && name[2]=='f'))) \
michael@0 41 && (name[3]=='-' ? \
michael@0 42 (name[4]=='8' && name[5]==0) : \
michael@0 43 (name[3]=='8' && name[4]==0)))
michael@0 44
michael@0 45 typedef struct {
michael@0 46 char cnvName[UCNV_MAX_CONVERTER_NAME_LENGTH];
michael@0 47 char locale[ULOC_FULLNAME_CAPACITY];
michael@0 48 uint32_t options;
michael@0 49 } UConverterNamePieces;
michael@0 50
michael@0 51 U_CFUNC UBool
michael@0 52 ucnv_canCreateConverter(const char *converterName, UErrorCode *err);
michael@0 53
michael@0 54 /* figures out if we need to go to file to read in the data tables.
michael@0 55 * @param converterName The name of the converter
michael@0 56 * @param err The error code
michael@0 57 * @return the newly created converter
michael@0 58 */
michael@0 59 U_CAPI UConverter *
michael@0 60 ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err);
michael@0 61
michael@0 62 /*
michael@0 63 * Open a purely algorithmic converter, specified by a type constant.
michael@0 64 * @param myUConverter NULL, or pre-allocated UConverter structure to avoid
michael@0 65 * a memory allocation
michael@0 66 * @param type requested converter type
michael@0 67 * @param locale locale parameter, or ""
michael@0 68 * @param options converter options bit set (default 0)
michael@0 69 * @param err ICU error code, not tested for U_FAILURE on input
michael@0 70 * because this is an internal function
michael@0 71 * @internal
michael@0 72 */
michael@0 73 U_CFUNC UConverter *
michael@0 74 ucnv_createAlgorithmicConverter(UConverter *myUConverter,
michael@0 75 UConverterType type,
michael@0 76 const char *locale, uint32_t options,
michael@0 77 UErrorCode *err);
michael@0 78
michael@0 79 /*
michael@0 80 * Creates a converter from shared data.
michael@0 81 * Adopts mySharedConverterData: No matter what happens, the caller must not
michael@0 82 * unload mySharedConverterData, except via ucnv_close(return value)
michael@0 83 * if this function is successful.
michael@0 84 */
michael@0 85 U_CFUNC UConverter *
michael@0 86 ucnv_createConverterFromSharedData(UConverter *myUConverter,
michael@0 87 UConverterSharedData *mySharedConverterData,
michael@0 88 UConverterLoadArgs *pArgs,
michael@0 89 UErrorCode *err);
michael@0 90
michael@0 91 U_CFUNC UConverter *
michael@0 92 ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode *err);
michael@0 93
michael@0 94 /**
michael@0 95 * Load a converter but do not create a UConverter object.
michael@0 96 * Simply return the UConverterSharedData.
michael@0 97 * Performs alias lookup etc.
michael@0 98 * The UConverterNamePieces need not be initialized
michael@0 99 * before calling this function.
michael@0 100 * The UConverterLoadArgs must be initialized
michael@0 101 * before calling this function.
michael@0 102 * If the args are passed in, then the pieces must be passed in too.
michael@0 103 * In other words, the following combinations are allowed:
michael@0 104 * - pieces==NULL && args==NULL
michael@0 105 * - pieces!=NULL && args==NULL
michael@0 106 * - pieces!=NULL && args!=NULL
michael@0 107 * @internal
michael@0 108 */
michael@0 109 U_CFUNC UConverterSharedData *
michael@0 110 ucnv_loadSharedData(const char *converterName,
michael@0 111 UConverterNamePieces *pieces,
michael@0 112 UConverterLoadArgs *pArgs,
michael@0 113 UErrorCode * err);
michael@0 114
michael@0 115 /**
michael@0 116 * This may unload the shared data in a thread safe manner.
michael@0 117 * This will only unload the data if no other converters are sharing it.
michael@0 118 */
michael@0 119 U_CFUNC void
michael@0 120 ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData);
michael@0 121
michael@0 122 /**
michael@0 123 * This is a thread safe way to increment the reference count.
michael@0 124 */
michael@0 125 U_CFUNC void
michael@0 126 ucnv_incrementRefCount(UConverterSharedData *sharedData);
michael@0 127
michael@0 128 /**
michael@0 129 * These are the default error handling callbacks for the charset conversion framework.
michael@0 130 * For performance reasons, they are only called to handle an error (not normally called for a reset or close).
michael@0 131 */
michael@0 132 #define UCNV_TO_U_DEFAULT_CALLBACK ((UConverterToUCallback) UCNV_TO_U_CALLBACK_SUBSTITUTE)
michael@0 133 #define UCNV_FROM_U_DEFAULT_CALLBACK ((UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE)
michael@0 134
michael@0 135 #endif
michael@0 136
michael@0 137 #endif /* _UCNV_IMP */

mercurial