Back to home page

EIC code displayed by LXR

 
 

    


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

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:  ucharstrie.h
0009 *   encoding:   UTF-8
0010 *   tab size:   8 (not used)
0011 *   indentation:4
0012 *
0013 *   created on: 2010nov14
0014 *   created by: Markus W. Scherer
0015 */
0016 
0017 #ifndef __UCHARSTRIE_H__
0018 #define __UCHARSTRIE_H__
0019 
0020 /**
0021  * \file
0022  * \brief C++ API: Trie for mapping Unicode strings (or 16-bit-unit sequences)
0023  *                 to integer values.
0024  */
0025 
0026 #include "unicode/utypes.h"
0027 
0028 #if U_SHOW_CPLUSPLUS_API
0029 
0030 #include "unicode/unistr.h"
0031 #include "unicode/uobject.h"
0032 #include "unicode/ustringtrie.h"
0033 
0034 U_NAMESPACE_BEGIN
0035 
0036 class Appendable;
0037 class UCharsTrieBuilder;
0038 class UVector32;
0039 
0040 /**
0041  * Light-weight, non-const reader class for a UCharsTrie.
0042  * Traverses a char16_t-serialized data structure with minimal state,
0043  * for mapping strings (16-bit-unit sequences) to non-negative integer values.
0044  *
0045  * This class owns the serialized trie data only if it was constructed by
0046  * the builder's build() method.
0047  * The public constructor and the copy constructor only alias the data (only copy the pointer).
0048  * There is no assignment operator.
0049  *
0050  * This class is not intended for public subclassing.
0051  * @stable ICU 4.8
0052  */
0053 class U_COMMON_API UCharsTrie : public UMemory {
0054 public:
0055     /**
0056      * Constructs a UCharsTrie reader instance.
0057      *
0058      * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder,
0059      * starting with the first char16_t of that sequence.
0060      * The UCharsTrie object will not read more char16_ts than
0061      * the UCharsTrieBuilder generated in the corresponding build() call.
0062      *
0063      * The array is not copied/cloned and must not be modified while
0064      * the UCharsTrie object is in use.
0065      *
0066      * @param trieUChars The char16_t array that contains the serialized trie.
0067      * @stable ICU 4.8
0068      */
0069     UCharsTrie(ConstChar16Ptr trieUChars)
0070             : ownedArray_(nullptr), uchars_(trieUChars),
0071               pos_(uchars_), remainingMatchLength_(-1) {}
0072 
0073     /**
0074      * Destructor.
0075      * @stable ICU 4.8
0076      */
0077     ~UCharsTrie();
0078 
0079     /**
0080      * Copy constructor, copies the other trie reader object and its state,
0081      * but not the char16_t array which will be shared. (Shallow copy.)
0082      * @param other Another UCharsTrie object.
0083      * @stable ICU 4.8
0084      */
0085     UCharsTrie(const UCharsTrie &other)
0086             : ownedArray_(nullptr), uchars_(other.uchars_),
0087               pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {}
0088 
0089     /**
0090      * Resets this trie to its initial state.
0091      * @return *this
0092      * @stable ICU 4.8
0093      */
0094     UCharsTrie &reset() {
0095         pos_=uchars_;
0096         remainingMatchLength_=-1;
0097         return *this;
0098     }
0099 
0100     /**
0101      * Returns the state of this trie as a 64-bit integer.
0102      * The state value is never 0.
0103      *
0104      * @return opaque state value
0105      * @see resetToState64
0106      * @stable ICU 65
0107      */
0108     uint64_t getState64() const {
0109         return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
0110             (uint64_t)(pos_ - uchars_);
0111     }
0112 
0113     /**
0114      * Resets this trie to the saved state.
0115      * Unlike resetToState(State), the 64-bit state value
0116      * must be from getState64() from the same trie object or
0117      * from one initialized the exact same way.
0118      * Because of no validation, this method is faster.
0119      *
0120      * @param state The opaque trie state value from getState64().
0121      * @return *this
0122      * @see getState64
0123      * @see resetToState
0124      * @see reset
0125      * @stable ICU 65
0126      */
0127     UCharsTrie &resetToState64(uint64_t state) {
0128         remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2;
0129         pos_ = uchars_ + (state & kState64PosMask);
0130         return *this;
0131     }
0132 
0133     /**
0134      * UCharsTrie state object, for saving a trie's current state
0135      * and resetting the trie back to this state later.
0136      * @stable ICU 4.8
0137      */
0138     class State : public UMemory {
0139     public:
0140         /**
0141          * Constructs an empty State.
0142          * @stable ICU 4.8
0143          */
0144         State() { uchars=nullptr; }
0145     private:
0146         friend class UCharsTrie;
0147 
0148         const char16_t *uchars;
0149         const char16_t *pos;
0150         int32_t remainingMatchLength;
0151     };
0152 
0153     /**
0154      * Saves the state of this trie.
0155      * @param state The State object to hold the trie's state.
0156      * @return *this
0157      * @see resetToState
0158      * @stable ICU 4.8
0159      */
0160     const UCharsTrie &saveState(State &state) const {
0161         state.uchars=uchars_;
0162         state.pos=pos_;
0163         state.remainingMatchLength=remainingMatchLength_;
0164         return *this;
0165     }
0166 
0167     /**
0168      * Resets this trie to the saved state.
0169      * If the state object contains no state, or the state of a different trie,
0170      * then this trie remains unchanged.
0171      * @param state The State object which holds a saved trie state.
0172      * @return *this
0173      * @see saveState
0174      * @see reset
0175      * @stable ICU 4.8
0176      */
0177     UCharsTrie &resetToState(const State &state) {
0178         if(uchars_==state.uchars && uchars_!=nullptr) {
0179             pos_=state.pos;
0180             remainingMatchLength_=state.remainingMatchLength;
0181         }
0182         return *this;
0183     }
0184 
0185     /**
0186      * Determines whether the string so far matches, whether it has a value,
0187      * and whether another input char16_t can continue a matching string.
0188      * @return The match/value Result.
0189      * @stable ICU 4.8
0190      */
0191     UStringTrieResult current() const;
0192 
0193     /**
0194      * Traverses the trie from the initial state for this input char16_t.
0195      * Equivalent to reset().next(uchar).
0196      * @param uchar Input char value. Values below 0 and above 0xffff will never match.
0197      * @return The match/value Result.
0198      * @stable ICU 4.8
0199      */
0200     inline UStringTrieResult first(int32_t uchar) {
0201         remainingMatchLength_=-1;
0202         return nextImpl(uchars_, uchar);
0203     }
0204 
0205     /**
0206      * Traverses the trie from the initial state for the
0207      * one or two UTF-16 code units for this input code point.
0208      * Equivalent to reset().nextForCodePoint(cp).
0209      * @param cp A Unicode code point 0..0x10ffff.
0210      * @return The match/value Result.
0211      * @stable ICU 4.8
0212      */
0213     UStringTrieResult firstForCodePoint(UChar32 cp);
0214 
0215     /**
0216      * Traverses the trie from the current state for this input char16_t.
0217      * @param uchar Input char value. Values below 0 and above 0xffff will never match.
0218      * @return The match/value Result.
0219      * @stable ICU 4.8
0220      */
0221     UStringTrieResult next(int32_t uchar);
0222 
0223     /**
0224      * Traverses the trie from the current state for the
0225      * one or two UTF-16 code units for this input code point.
0226      * @param cp A Unicode code point 0..0x10ffff.
0227      * @return The match/value Result.
0228      * @stable ICU 4.8
0229      */
0230     UStringTrieResult nextForCodePoint(UChar32 cp);
0231 
0232     /**
0233      * Traverses the trie from the current state for this string.
0234      * Equivalent to
0235      * \code
0236      * Result result=current();
0237      * for(each c in s)
0238      *   if(!USTRINGTRIE_HAS_NEXT(result)) return USTRINGTRIE_NO_MATCH;
0239      *   result=next(c);
0240      * return result;
0241      * \endcode
0242      * @param s A string. Can be nullptr if length is 0.
0243      * @param length The length of the string. Can be -1 if NUL-terminated.
0244      * @return The match/value Result.
0245      * @stable ICU 4.8
0246      */
0247     UStringTrieResult next(ConstChar16Ptr s, int32_t length);
0248 
0249     /**
0250      * Returns a matching string's value if called immediately after
0251      * current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE.
0252      * getValue() can be called multiple times.
0253      *
0254      * Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE!
0255      * @return The value for the string so far.
0256      * @stable ICU 4.8
0257      */
0258     inline int32_t getValue() const {
0259         const char16_t *pos=pos_;
0260         int32_t leadUnit=*pos++;
0261         // U_ASSERT(leadUnit>=kMinValueLead);
0262         return leadUnit&kValueIsFinal ?
0263             readValue(pos, leadUnit&0x7fff) : readNodeValue(pos, leadUnit);
0264     }
0265 
0266     /**
0267      * Determines whether all strings reachable from the current state
0268      * map to the same value.
0269      * @param uniqueValue Receives the unique value, if this function returns true.
0270      *                    (output-only)
0271      * @return true if all strings reachable from the current state
0272      *         map to the same value.
0273      * @stable ICU 4.8
0274      */
0275     inline UBool hasUniqueValue(int32_t &uniqueValue) const {
0276         const char16_t *pos=pos_;
0277         // Skip the rest of a pending linear-match node.
0278         return pos!=nullptr && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
0279     }
0280 
0281     /**
0282      * Finds each char16_t which continues the string from the current state.
0283      * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now.
0284      * @param out Each next char16_t is appended to this object.
0285      * @return the number of char16_ts which continue the string from here
0286      * @stable ICU 4.8
0287      */
0288     int32_t getNextUChars(Appendable &out) const;
0289 
0290     /**
0291      * Iterator for all of the (string, value) pairs in a UCharsTrie.
0292      * @stable ICU 4.8
0293      */
0294     class U_COMMON_API Iterator : public UMemory {
0295     public:
0296         /**
0297          * Iterates from the root of a char16_t-serialized UCharsTrie.
0298          * @param trieUChars The trie char16_ts.
0299          * @param maxStringLength If 0, the iterator returns full strings.
0300          *                        Otherwise, the iterator returns strings with this maximum length.
0301          * @param errorCode Standard ICU error code. Its input value must
0302          *                  pass the U_SUCCESS() test, or else the function returns
0303          *                  immediately. Check for U_FAILURE() on output or use with
0304          *                  function chaining. (See User Guide for details.)
0305          * @stable ICU 4.8
0306          */
0307         Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode);
0308 
0309         /**
0310          * Iterates from the current state of the specified UCharsTrie.
0311          * @param trie The trie whose state will be copied for iteration.
0312          * @param maxStringLength If 0, the iterator returns full strings.
0313          *                        Otherwise, the iterator returns strings with this maximum length.
0314          * @param errorCode Standard ICU error code. Its input value must
0315          *                  pass the U_SUCCESS() test, or else the function returns
0316          *                  immediately. Check for U_FAILURE() on output or use with
0317          *                  function chaining. (See User Guide for details.)
0318          * @stable ICU 4.8
0319          */
0320         Iterator(const UCharsTrie &trie, int32_t maxStringLength, UErrorCode &errorCode);
0321 
0322         /**
0323          * Destructor.
0324          * @stable ICU 4.8
0325          */
0326         ~Iterator();
0327 
0328         /**
0329          * Resets this iterator to its initial state.
0330          * @return *this
0331          * @stable ICU 4.8
0332          */
0333         Iterator &reset();
0334 
0335         /**
0336          * @return true if there are more elements.
0337          * @stable ICU 4.8
0338          */
0339         UBool hasNext() const;
0340 
0341         /**
0342          * Finds the next (string, value) pair if there is one.
0343          *
0344          * If the string is truncated to the maximum length and does not
0345          * have a real value, then the value is set to -1.
0346          * In this case, this "not a real value" is indistinguishable from
0347          * a real value of -1.
0348          * @param errorCode Standard ICU error code. Its input value must
0349          *                  pass the U_SUCCESS() test, or else the function returns
0350          *                  immediately. Check for U_FAILURE() on output or use with
0351          *                  function chaining. (See User Guide for details.)
0352          * @return true if there is another element.
0353          * @stable ICU 4.8
0354          */
0355         UBool next(UErrorCode &errorCode);
0356 
0357         /**
0358          * @return The string for the last successful next().
0359          * @stable ICU 4.8
0360          */
0361         const UnicodeString &getString() const { return str_; }
0362         /**
0363          * @return The value for the last successful next().
0364          * @stable ICU 4.8
0365          */
0366         int32_t getValue() const { return value_; }
0367 
0368     private:
0369         UBool truncateAndStop() {
0370             pos_=nullptr;
0371             value_=-1;  // no real value for str
0372             return true;
0373         }
0374 
0375         const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode);
0376 
0377         const char16_t *uchars_;
0378         const char16_t *pos_;
0379         const char16_t *initialPos_;
0380         int32_t remainingMatchLength_;
0381         int32_t initialRemainingMatchLength_;
0382         UBool skipValue_;  // Skip intermediate value which was already delivered.
0383 
0384         UnicodeString str_;
0385         int32_t maxLength_;
0386         int32_t value_;
0387 
0388         // The stack stores pairs of integers for backtracking to another
0389         // outbound edge of a branch node.
0390         // The first integer is an offset from uchars_.
0391         // The second integer has the str_.length() from before the node in bits 15..0,
0392         // and the remaining branch length in bits 31..16.
0393         // (We could store the remaining branch length minus 1 in bits 30..16 and not use the sign bit,
0394         // but the code looks more confusing that way.)
0395         UVector32 *stack_;
0396     };
0397 
0398 private:
0399     friend class UCharsTrieBuilder;
0400 
0401     /**
0402      * Constructs a UCharsTrie reader instance.
0403      * Unlike the public constructor which just aliases an array,
0404      * this constructor adopts the builder's array.
0405      * This constructor is only called by the builder.
0406      */
0407     UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars)
0408             : ownedArray_(adoptUChars), uchars_(trieUChars),
0409               pos_(uchars_), remainingMatchLength_(-1) {}
0410 
0411     // No assignment operator.
0412     UCharsTrie &operator=(const UCharsTrie &other) = delete;
0413 
0414     inline void stop() {
0415         pos_=nullptr;
0416     }
0417 
0418     // Reads a compact 32-bit integer.
0419     // pos is already after the leadUnit, and the lead unit has bit 15 reset.
0420     static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) {
0421         int32_t value;
0422         if(leadUnit<kMinTwoUnitValueLead) {
0423             value=leadUnit;
0424         } else if(leadUnit<kThreeUnitValueLead) {
0425             value=((leadUnit-kMinTwoUnitValueLead)<<16)|*pos;
0426         } else {
0427             value=(pos[0]<<16)|pos[1];
0428         }
0429         return value;
0430     }
0431     static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) {
0432         if(leadUnit>=kMinTwoUnitValueLead) {
0433             if(leadUnit<kThreeUnitValueLead) {
0434                 ++pos;
0435             } else {
0436                 pos+=2;
0437             }
0438         }
0439         return pos;
0440     }
0441     static inline const char16_t *skipValue(const char16_t *pos) {
0442         int32_t leadUnit=*pos++;
0443         return skipValue(pos, leadUnit&0x7fff);
0444     }
0445 
0446     static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) {
0447         // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal);
0448         int32_t value;
0449         if(leadUnit<kMinTwoUnitNodeValueLead) {
0450             value=(leadUnit>>6)-1;
0451         } else if(leadUnit<kThreeUnitNodeValueLead) {
0452             value=(((leadUnit&0x7fc0)-kMinTwoUnitNodeValueLead)<<10)|*pos;
0453         } else {
0454             value=(pos[0]<<16)|pos[1];
0455         }
0456         return value;
0457     }
0458     static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) {
0459         // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal);
0460         if(leadUnit>=kMinTwoUnitNodeValueLead) {
0461             if(leadUnit<kThreeUnitNodeValueLead) {
0462                 ++pos;
0463             } else {
0464                 pos+=2;
0465             }
0466         }
0467         return pos;
0468     }
0469 
0470     static inline const char16_t *jumpByDelta(const char16_t *pos) {
0471         int32_t delta=*pos++;
0472         if(delta>=kMinTwoUnitDeltaLead) {
0473             if(delta==kThreeUnitDeltaLead) {
0474                 delta=(pos[0]<<16)|pos[1];
0475                 pos+=2;
0476             } else {
0477                 delta=((delta-kMinTwoUnitDeltaLead)<<16)|*pos++;
0478             }
0479         }
0480         return pos+delta;
0481     }
0482 
0483     static const char16_t *skipDelta(const char16_t *pos) {
0484         int32_t delta=*pos++;
0485         if(delta>=kMinTwoUnitDeltaLead) {
0486             if(delta==kThreeUnitDeltaLead) {
0487                 pos+=2;
0488             } else {
0489                 ++pos;
0490             }
0491         }
0492         return pos;
0493     }
0494 
0495     static inline UStringTrieResult valueResult(int32_t node) {
0496         return (UStringTrieResult)(USTRINGTRIE_INTERMEDIATE_VALUE-(node>>15));
0497     }
0498 
0499     // Handles a branch node for both next(uchar) and next(string).
0500     UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar);
0501 
0502     // Requires remainingLength_<0.
0503     UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar);
0504 
0505     // Helper functions for hasUniqueValue().
0506     // Recursively finds a unique value (or whether there is not a unique one)
0507     // from a branch.
0508     static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length,
0509                                                   UBool haveUniqueValue, int32_t &uniqueValue);
0510     // Recursively finds a unique value (or whether there is not a unique one)
0511     // starting from a position on a node lead unit.
0512     static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue);
0513 
0514     // Helper functions for getNextUChars().
0515     // getNextUChars() when pos is on a branch node.
0516     static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out);
0517 
0518     // UCharsTrie data structure
0519     //
0520     // The trie consists of a series of char16_t-serialized nodes for incremental
0521     // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer)
0522     // The root node is at the beginning of the trie data.
0523     //
0524     // Types of nodes are distinguished by their node lead unit ranges.
0525     // After each node, except a final-value node, another node follows to
0526     // encode match values or continue matching further units.
0527     //
0528     // Node types:
0529     //  - Final-value node: Stores a 32-bit integer in a compact, variable-length format.
0530     //    The value is for the string/char16_t sequence so far.
0531     //  - Match node, optionally with an intermediate value in a different compact format.
0532     //    The value, if present, is for the string/char16_t sequence so far.
0533     //
0534     //  Aside from the value, which uses the node lead unit's high bits:
0535     //
0536     //  - Linear-match node: Matches a number of units.
0537     //  - Branch node: Branches to other nodes according to the current input unit.
0538     //    The node unit is the length of the branch (number of units to select from)
0539     //    minus 1. It is followed by a sub-node:
0540     //    - If the length is at most kMaxBranchLinearSubNodeLength, then
0541     //      there are length-1 (key, value) pairs and then one more comparison unit.
0542     //      If one of the key units matches, then the value is either a final value for
0543     //      the string so far, or a "jump" delta to the next node.
0544     //      If the last unit matches, then matching continues with the next node.
0545     //      (Values have the same encoding as final-value nodes.)
0546     //    - If the length is greater than kMaxBranchLinearSubNodeLength, then
0547     //      there is one unit and one "jump" delta.
0548     //      If the input unit is less than the sub-node unit, then "jump" by delta to
0549     //      the next sub-node which will have a length of length/2.
0550     //      (The delta has its own compact encoding.)
0551     //      Otherwise, skip the "jump" delta to the next sub-node
0552     //      which will have a length of length-length/2.
0553 
0554     // Match-node lead unit values, after masking off intermediate-value bits:
0555 
0556     // 0000..002f: Branch node. If node!=0 then the length is node+1, otherwise
0557     // the length is one more than the next unit.
0558 
0559     // For a branch sub-node with at most this many entries, we drop down
0560     // to a linear search.
0561     static const int32_t kMaxBranchLinearSubNodeLength=5;
0562 
0563     // 0030..003f: Linear-match node, match 1..16 units and continue reading the next node.
0564     static const int32_t kMinLinearMatch=0x30;
0565     static const int32_t kMaxLinearMatchLength=0x10;
0566 
0567     // Match-node lead unit bits 14..6 for the optional intermediate value.
0568     // If these bits are 0, then there is no intermediate value.
0569     // Otherwise, see the *NodeValue* constants below.
0570     static const int32_t kMinValueLead=kMinLinearMatch+kMaxLinearMatchLength;  // 0x0040
0571     static const int32_t kNodeTypeMask=kMinValueLead-1;  // 0x003f
0572 
0573     // A final-value node has bit 15 set.
0574     static const int32_t kValueIsFinal=0x8000;
0575 
0576     // Compact value: After testing and masking off bit 15, use the following thresholds.
0577     static const int32_t kMaxOneUnitValue=0x3fff;
0578 
0579     static const int32_t kMinTwoUnitValueLead=kMaxOneUnitValue+1;  // 0x4000
0580     static const int32_t kThreeUnitValueLead=0x7fff;
0581 
0582     static const int32_t kMaxTwoUnitValue=((kThreeUnitValueLead-kMinTwoUnitValueLead)<<16)-1;  // 0x3ffeffff
0583 
0584     // Compact intermediate-value integer, lead unit shared with a branch or linear-match node.
0585     static const int32_t kMaxOneUnitNodeValue=0xff;
0586     static const int32_t kMinTwoUnitNodeValueLead=kMinValueLead+((kMaxOneUnitNodeValue+1)<<6);  // 0x4040
0587     static const int32_t kThreeUnitNodeValueLead=0x7fc0;
0588 
0589     static const int32_t kMaxTwoUnitNodeValue=
0590         ((kThreeUnitNodeValueLead-kMinTwoUnitNodeValueLead)<<10)-1;  // 0xfdffff
0591 
0592     // Compact delta integers.
0593     static const int32_t kMaxOneUnitDelta=0xfbff;
0594     static const int32_t kMinTwoUnitDeltaLead=kMaxOneUnitDelta+1;  // 0xfc00
0595     static const int32_t kThreeUnitDeltaLead=0xffff;
0596 
0597     static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1;  // 0x03feffff
0598 
0599     // For getState64():
0600     // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
0601     // so we need at least 5 bits for that.
0602     // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
0603     static constexpr int32_t kState64RemainingShift = 59;
0604     static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
0605 
0606     char16_t *ownedArray_;
0607 
0608     // Fixed value referencing the UCharsTrie words.
0609     const char16_t *uchars_;
0610 
0611     // Iterator variables.
0612 
0613     // Pointer to next trie unit to read. nullptr if no more matches.
0614     const char16_t *pos_;
0615     // Remaining length of a linear-match node, minus 1. Negative if not in such a node.
0616     int32_t remainingMatchLength_;
0617 };
0618 
0619 U_NAMESPACE_END
0620 
0621 #endif /* U_SHOW_CPLUSPLUS_API */
0622 
0623 #endif  // __UCHARSTRIE_H__