ICU 64.2  64.2
Macros | Enumerations
ustringtrie.h File Reference

C API: Helper definitions for dictionary trie APIs. More...

#include "unicode/utypes.h"

Go to the source code of this file.

Macros

#define USTRINGTRIE_MATCHES(result)   ((result)!=USTRINGTRIE_NO_MATCH)
 Same as (result!=USTRINGTRIE_NO_MATCH). More...
 
#define USTRINGTRIE_HAS_VALUE(result)   ((result)>=USTRINGTRIE_FINAL_VALUE)
 Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but this macro evaluates result exactly once. More...
 
#define USTRINGTRIE_HAS_NEXT(result)   ((result)&1)
 Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but this macro evaluates result exactly once. More...
 

Enumerations

enum  UStringTrieResult { USTRINGTRIE_NO_MATCH, USTRINGTRIE_NO_VALUE, USTRINGTRIE_FINAL_VALUE, USTRINGTRIE_INTERMEDIATE_VALUE }
 Return values for BytesTrie::next(), UCharsTrie::next() and similar methods. More...
 

Detailed Description

C API: Helper definitions for dictionary trie APIs.

Definition in file ustringtrie.h.

Macro Definition Documentation

◆ USTRINGTRIE_HAS_NEXT

#define USTRINGTRIE_HAS_NEXT (   result)    ((result)&1)

Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but this macro evaluates result exactly once.

Parameters
resultA result from BytesTrie::first(), UCharsTrie::next() etc.
Returns
true if another input byte/unit can continue a matching string.
Stable:
ICU 4.8

Definition at line 95 of file ustringtrie.h.

◆ USTRINGTRIE_HAS_VALUE

#define USTRINGTRIE_HAS_VALUE (   result)    ((result)>=USTRINGTRIE_FINAL_VALUE)

Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but this macro evaluates result exactly once.

Parameters
resultA result from BytesTrie::first(), UCharsTrie::next() etc.
Returns
true if there is a value for the input bytes/units so far.
See also
BytesTrie::getValue
UCharsTrie::getValue
Stable:
ICU 4.8

Definition at line 86 of file ustringtrie.h.

◆ USTRINGTRIE_MATCHES

#define USTRINGTRIE_MATCHES (   result)    ((result)!=USTRINGTRIE_NO_MATCH)

Same as (result!=USTRINGTRIE_NO_MATCH).

Parameters
resultA result from BytesTrie::first(), UCharsTrie::next() etc.
Returns
true if the input bytes/units so far are part of a matching string/byte sequence.
Stable:
ICU 4.8

Definition at line 75 of file ustringtrie.h.

Enumeration Type Documentation

◆ UStringTrieResult

Return values for BytesTrie::next(), UCharsTrie::next() and similar methods.

See also
USTRINGTRIE_MATCHES
USTRINGTRIE_HAS_VALUE
USTRINGTRIE_HAS_NEXT
Stable:
ICU 4.8
Enumerator
USTRINGTRIE_NO_MATCH 

The input unit(s) did not continue a matching string.

Once current()/next() return USTRINGTRIE_NO_MATCH, all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH, until the trie is reset to its original state or to a saved state.

Stable:
ICU 4.8
USTRINGTRIE_NO_VALUE 

The input unit(s) continued a matching string but there is no value for the string so far.

(It is a prefix of a longer string.)

Stable:
ICU 4.8
USTRINGTRIE_FINAL_VALUE 

The input unit(s) continued a matching string and there is a value for the string so far.

This value will be returned by getValue(). No further input byte/unit can continue a matching string.

Stable:
ICU 4.8
USTRINGTRIE_INTERMEDIATE_VALUE 

The input unit(s) continued a matching string and there is a value for the string so far.

This value will be returned by getValue(). Another input byte/unit can continue a matching string.

Stable:
ICU 4.8

Definition at line 35 of file ustringtrie.h.