Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * Copyright (C) 2010-2012, International Business Machines |
michael@0 | 4 | * Corporation and others. All Rights Reserved. |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | * file name: udicttrie.h |
michael@0 | 7 | * encoding: US-ASCII |
michael@0 | 8 | * tab size: 8 (not used) |
michael@0 | 9 | * indentation:4 |
michael@0 | 10 | * |
michael@0 | 11 | * created on: 2010dec17 |
michael@0 | 12 | * created by: Markus W. Scherer |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | #ifndef __USTRINGTRIE_H__ |
michael@0 | 16 | #define __USTRINGTRIE_H__ |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * \file |
michael@0 | 20 | * \brief C API: Helper definitions for dictionary trie APIs. |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | #include "unicode/utypes.h" |
michael@0 | 24 | |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * Return values for BytesTrie::next(), UCharsTrie::next() and similar methods. |
michael@0 | 28 | * @see USTRINGTRIE_MATCHES |
michael@0 | 29 | * @see USTRINGTRIE_HAS_VALUE |
michael@0 | 30 | * @see USTRINGTRIE_HAS_NEXT |
michael@0 | 31 | * @stable ICU 4.8 |
michael@0 | 32 | */ |
michael@0 | 33 | enum UStringTrieResult { |
michael@0 | 34 | /** |
michael@0 | 35 | * The input unit(s) did not continue a matching string. |
michael@0 | 36 | * Once current()/next() return USTRINGTRIE_NO_MATCH, |
michael@0 | 37 | * all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH, |
michael@0 | 38 | * until the trie is reset to its original state or to a saved state. |
michael@0 | 39 | * @stable ICU 4.8 |
michael@0 | 40 | */ |
michael@0 | 41 | USTRINGTRIE_NO_MATCH, |
michael@0 | 42 | /** |
michael@0 | 43 | * The input unit(s) continued a matching string |
michael@0 | 44 | * but there is no value for the string so far. |
michael@0 | 45 | * (It is a prefix of a longer string.) |
michael@0 | 46 | * @stable ICU 4.8 |
michael@0 | 47 | */ |
michael@0 | 48 | USTRINGTRIE_NO_VALUE, |
michael@0 | 49 | /** |
michael@0 | 50 | * The input unit(s) continued a matching string |
michael@0 | 51 | * and there is a value for the string so far. |
michael@0 | 52 | * This value will be returned by getValue(). |
michael@0 | 53 | * No further input byte/unit can continue a matching string. |
michael@0 | 54 | * @stable ICU 4.8 |
michael@0 | 55 | */ |
michael@0 | 56 | USTRINGTRIE_FINAL_VALUE, |
michael@0 | 57 | /** |
michael@0 | 58 | * The input unit(s) continued a matching string |
michael@0 | 59 | * and there is a value for the string so far. |
michael@0 | 60 | * This value will be returned by getValue(). |
michael@0 | 61 | * Another input byte/unit can continue a matching string. |
michael@0 | 62 | * @stable ICU 4.8 |
michael@0 | 63 | */ |
michael@0 | 64 | USTRINGTRIE_INTERMEDIATE_VALUE |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Same as (result!=USTRINGTRIE_NO_MATCH). |
michael@0 | 69 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. |
michael@0 | 70 | * @return true if the input bytes/units so far are part of a matching string/byte sequence. |
michael@0 | 71 | * @stable ICU 4.8 |
michael@0 | 72 | */ |
michael@0 | 73 | #define USTRINGTRIE_MATCHES(result) ((result)!=USTRINGTRIE_NO_MATCH) |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | * Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but |
michael@0 | 77 | * this macro evaluates result exactly once. |
michael@0 | 78 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. |
michael@0 | 79 | * @return true if there is a value for the input bytes/units so far. |
michael@0 | 80 | * @see BytesTrie::getValue |
michael@0 | 81 | * @see UCharsTrie::getValue |
michael@0 | 82 | * @stable ICU 4.8 |
michael@0 | 83 | */ |
michael@0 | 84 | #define USTRINGTRIE_HAS_VALUE(result) ((result)>=USTRINGTRIE_FINAL_VALUE) |
michael@0 | 85 | |
michael@0 | 86 | /** |
michael@0 | 87 | * Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but |
michael@0 | 88 | * this macro evaluates result exactly once. |
michael@0 | 89 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. |
michael@0 | 90 | * @return true if another input byte/unit can continue a matching string. |
michael@0 | 91 | * @stable ICU 4.8 |
michael@0 | 92 | */ |
michael@0 | 93 | #define USTRINGTRIE_HAS_NEXT(result) ((result)&1) |
michael@0 | 94 | |
michael@0 | 95 | #endif /* __USTRINGTRIE_H__ */ |