Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:15

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 *******************************************************************************
0005 *   Copyright (C) 2010-2012, International Business Machines
0006 *   Corporation and others.  All Rights Reserved.
0007 *******************************************************************************
0008 *   file name:  udicttrie.h
0009 *   encoding:   UTF-8
0010 *   tab size:   8 (not used)
0011 *   indentation:4
0012 *
0013 *   created on: 2010dec17
0014 *   created by: Markus W. Scherer
0015 */
0016 
0017 #ifndef __USTRINGTRIE_H__
0018 #define __USTRINGTRIE_H__
0019 
0020 /**
0021  * \file
0022  * \brief C API: Helper definitions for dictionary trie APIs.
0023  */
0024 
0025 #include "unicode/utypes.h"
0026 
0027 
0028 /**
0029  * Return values for BytesTrie::next(), UCharsTrie::next() and similar methods.
0030  * @see USTRINGTRIE_MATCHES
0031  * @see USTRINGTRIE_HAS_VALUE
0032  * @see USTRINGTRIE_HAS_NEXT
0033  * @stable ICU 4.8
0034  */
0035 enum UStringTrieResult {
0036     /**
0037      * The input unit(s) did not continue a matching string.
0038      * Once current()/next() return USTRINGTRIE_NO_MATCH,
0039      * all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH,
0040      * until the trie is reset to its original state or to a saved state.
0041      * @stable ICU 4.8
0042      */
0043     USTRINGTRIE_NO_MATCH,
0044     /**
0045      * The input unit(s) continued a matching string
0046      * but there is no value for the string so far.
0047      * (It is a prefix of a longer string.)
0048      * @stable ICU 4.8
0049      */
0050     USTRINGTRIE_NO_VALUE,
0051     /**
0052      * The input unit(s) continued a matching string
0053      * and there is a value for the string so far.
0054      * This value will be returned by getValue().
0055      * No further input byte/unit can continue a matching string.
0056      * @stable ICU 4.8
0057      */
0058     USTRINGTRIE_FINAL_VALUE,
0059     /**
0060      * The input unit(s) continued a matching string
0061      * and there is a value for the string so far.
0062      * This value will be returned by getValue().
0063      * Another input byte/unit can continue a matching string.
0064      * @stable ICU 4.8
0065      */
0066     USTRINGTRIE_INTERMEDIATE_VALUE
0067 };
0068 
0069 /**
0070  * Same as (result!=USTRINGTRIE_NO_MATCH).
0071  * @param result A result from BytesTrie::first(), UCharsTrie::next() etc.
0072  * @return true if the input bytes/units so far are part of a matching string/byte sequence.
0073  * @stable ICU 4.8
0074  */
0075 #define USTRINGTRIE_MATCHES(result) ((result)!=USTRINGTRIE_NO_MATCH)
0076 
0077 /**
0078  * Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but
0079  * this macro evaluates result exactly once.
0080  * @param result A result from BytesTrie::first(), UCharsTrie::next() etc.
0081  * @return true if there is a value for the input bytes/units so far.
0082  * @see BytesTrie::getValue
0083  * @see UCharsTrie::getValue
0084  * @stable ICU 4.8
0085  */
0086 #define USTRINGTRIE_HAS_VALUE(result) ((result)>=USTRINGTRIE_FINAL_VALUE)
0087 
0088 /**
0089  * Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but
0090  * this macro evaluates result exactly once.
0091  * @param result A result from BytesTrie::first(), UCharsTrie::next() etc.
0092  * @return true if another input byte/unit can continue a matching string.
0093  * @stable ICU 4.8
0094  */
0095 #define USTRINGTRIE_HAS_NEXT(result) ((result)&1)
0096 
0097 #endif  /* __USTRINGTRIE_H__ */