intl/icu/source/common/usc_impl.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 * File USC_IMPL.H
michael@0 8 *
michael@0 9 * Modification History:
michael@0 10 *
michael@0 11 * Date Name Description
michael@0 12 * 07/08/2002 Eric Mader Creation.
michael@0 13 ******************************************************************************
michael@0 14 */
michael@0 15
michael@0 16 #ifndef USC_IMPL_H
michael@0 17 #define USC_IMPL_H
michael@0 18 #include "unicode/utypes.h"
michael@0 19 #include "unicode/uscript.h"
michael@0 20
michael@0 21 /**
michael@0 22 * <code>UScriptRun</code> is used to find runs of characters in
michael@0 23 * the same script. It implements a simple iterator over an array
michael@0 24 * of characters. The iterator will resolve script-neutral characters
michael@0 25 * like punctuation into the script of the surrounding characters.
michael@0 26 *
michael@0 27 * The iterator will try to match paired punctuation. If it sees an
michael@0 28 * opening punctuation character, it will remember the script that
michael@0 29 * was assigned to that character, and assign the same script to the
michael@0 30 * matching closing punctuation.
michael@0 31 *
michael@0 32 * Scripts are chosen based on the <code>UScriptCode</code> enumeration.
michael@0 33 * No attempt is made to combine related scripts into a single run. In
michael@0 34 * particular, Hiragana, Katakana, and Han characters will appear in seperate
michael@0 35 * runs.
michael@0 36
michael@0 37 * Here is an example of how to iterate over script runs:
michael@0 38 * <pre>
michael@0 39 * \code
michael@0 40 * void printScriptRuns(const UChar *text, int32_t length)
michael@0 41 * {
michael@0 42 * UErrorCode error = U_ZERO_ERROR;
michael@0 43 * UScriptRun *scriptRun = uscript_openRun(text, testLength, &error);
michael@0 44 * int32_t start = 0, limit = 0;
michael@0 45 * UScriptCode code = USCRIPT_INVALID_CODE;
michael@0 46 *
michael@0 47 * while (uscript_nextRun(&start, &limit, &code)) {
michael@0 48 * printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, limit);
michael@0 49 * }
michael@0 50 *
michael@0 51 * uscript_closeRun(scriptRun);
michael@0 52 * }
michael@0 53 * </pre>
michael@0 54 */
michael@0 55 struct UScriptRun;
michael@0 56
michael@0 57 typedef struct UScriptRun UScriptRun;
michael@0 58
michael@0 59 /**
michael@0 60 * Create a <code>UScriptRun</code> object for iterating over the given text. This object must
michael@0 61 * be freed using <code>uscript_closeRun()</code>. Note that this object does not copy the source text,
michael@0 62 * only the pointer to it. You must make sure that the pointer remains valid until you call
michael@0 63 * <code>uscript_closeRun()</code> or <code>uscript_setRunText()</code>.
michael@0 64 *
michael@0 65 * @param src is the address of the array of characters over which to iterate.
michael@0 66 * if <code>src == NULL</code> and <code>length == 0</code>,
michael@0 67 * an empty <code>UScriptRun</code> object will be returned.
michael@0 68 *
michael@0 69 * @param length is the number of characters over which to iterate.
michael@0 70 *
michael@0 71 * @param pErrorCode is a pointer to a valid <code>UErrorCode</code> value. If this value
michael@0 72 * indicates a failure on entry, the function will immediately return.
michael@0 73 * On exit the value will indicate the success of the operation.
michael@0 74 *
michael@0 75 * @return the address of <code>UScriptRun</code> object which will iterate over the text,
michael@0 76 * or <code>NULL</code> if the operation failed.
michael@0 77 */
michael@0 78 U_CAPI UScriptRun * U_EXPORT2
michael@0 79 uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode);
michael@0 80
michael@0 81 /**
michael@0 82 * Frees the given <code>UScriptRun</code> object and any storage associated with it.
michael@0 83 * On return, scriptRun no longer points to a valid <code>UScriptRun</code> object.
michael@0 84 *
michael@0 85 * @param scriptRun is the <code>UScriptRun</code> object which will be freed.
michael@0 86 */
michael@0 87 U_CAPI void U_EXPORT2
michael@0 88 uscript_closeRun(UScriptRun *scriptRun);
michael@0 89
michael@0 90 /**
michael@0 91 * Reset the <code>UScriptRun</code> object so that it will start iterating from
michael@0 92 * the beginning.
michael@0 93 *
michael@0 94 * @param scriptRun is the address of the <code>UScriptRun</code> object to be reset.
michael@0 95 */
michael@0 96 U_CAPI void U_EXPORT2
michael@0 97 uscript_resetRun(UScriptRun *scriptRun);
michael@0 98
michael@0 99 /**
michael@0 100 * Change the text over which the given <code>UScriptRun</code> object iterates.
michael@0 101 *
michael@0 102 * @param scriptRun is the <code>UScriptRun</code> object which will be changed.
michael@0 103 *
michael@0 104 * @param src is the address of the new array of characters over which to iterate.
michael@0 105 * If <code>src == NULL</code> and <code>length == 0</code>,
michael@0 106 * the <code>UScriptRun</code> object will become empty.
michael@0 107 *
michael@0 108 * @param length is the new number of characters over which to iterate
michael@0 109 *
michael@0 110 * @param pErrorCode is a pointer to a valid <code>UErrorCode</code> value. If this value
michael@0 111 * indicates a failure on entry, the function will immediately return.
michael@0 112 * On exit the value will indicate the success of the operation.
michael@0 113 */
michael@0 114 U_CAPI void U_EXPORT2
michael@0 115 uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode);
michael@0 116
michael@0 117 /**
michael@0 118 * Advance the <code>UScriptRun</code> object to the next script run, return the start and limit
michael@0 119 * offsets, and the script of the run.
michael@0 120 *
michael@0 121 * @param scriptRun is the address of the <code>UScriptRun</code> object.
michael@0 122 *
michael@0 123 * @param pRunStart is a pointer to the variable to receive the starting offset of the next run.
michael@0 124 * This pointer can be <code>NULL</code> if the value is not needed.
michael@0 125 *
michael@0 126 * @param pRunLimit is a pointer to the variable to receive the limit offset of the next run.
michael@0 127 * This pointer can be <code>NULL</code> if the value is not needed.
michael@0 128 *
michael@0 129 * @param pRunScript is a pointer to the variable to receive the UScriptCode for the
michael@0 130 * script of the current run. This pointer can be <code>NULL</code> if the value is not needed.
michael@0 131 *
michael@0 132 * @return true if there was another script run.
michael@0 133 */
michael@0 134 U_CAPI UBool U_EXPORT2
michael@0 135 uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, UScriptCode *pRunScript);
michael@0 136
michael@0 137 #endif

mercurial