| OLD | NEW | 
|    1 /* |    1 /* | 
|    2 ******************************************************************************* |    2 ******************************************************************************* | 
|    3 *   Copyright (C) 2010-2012, International Business Machines |    3 *   Copyright (C) 2010-2012,2014, International Business Machines | 
|    4 *   Corporation and others.  All Rights Reserved. |    4 *   Corporation and others.  All Rights Reserved. | 
|    5 ******************************************************************************* |    5 ******************************************************************************* | 
|    6 *   file name:  stringtriebuilder.h |    6 *   file name:  stringtriebuilder.h | 
|    7 *   encoding:   US-ASCII |    7 *   encoding:   US-ASCII | 
|    8 *   tab size:   8 (not used) |    8 *   tab size:   8 (not used) | 
|    9 *   indentation:4 |    9 *   indentation:4 | 
|   10 * |   10 * | 
|   11 *   created on: 2010dec24 |   11 *   created on: 2010dec24 | 
|   12 *   created by: Markus W. Scherer |   12 *   created by: Markus W. Scherer | 
|   13 */ |   13 */ | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  155      * Makes sure that there is only one unique FinalValueNode registered |  155      * Makes sure that there is only one unique FinalValueNode registered | 
|  156      * with this value. |  156      * with this value. | 
|  157      * Avoids creating a node if the value is a duplicate. |  157      * Avoids creating a node if the value is a duplicate. | 
|  158      * @param value A final value. |  158      * @param value A final value. | 
|  159      * @param errorCode ICU in/out UErrorCode. |  159      * @param errorCode ICU in/out UErrorCode. | 
|  160                         Set to U_MEMORY_ALLOCATION_ERROR if it was success but n
     ewNode==NULL. |  160                         Set to U_MEMORY_ALLOCATION_ERROR if it was success but n
     ewNode==NULL. | 
|  161      * @return A FinalValueNode with the given value. |  161      * @return A FinalValueNode with the given value. | 
|  162      * @internal |  162      * @internal | 
|  163      */ |  163      */ | 
|  164     Node *registerFinalValue(int32_t value, UErrorCode &errorCode); |  164     Node *registerFinalValue(int32_t value, UErrorCode &errorCode); | 
 |  165 #endif  /* U_HIDE_INTERNAL_API */ | 
|  165  |  166  | 
|  166     /* |  167     /* | 
|  167      * C++ note: |  168      * C++ note: | 
|  168      * registerNode() and registerFinalValue() take ownership of their input nod
     es, |  169      * registerNode() and registerFinalValue() take ownership of their input nod
     es, | 
|  169      * and only return owned nodes. |  170      * and only return owned nodes. | 
|  170      * If they see a failure UErrorCode, they will delete the input node. |  171      * If they see a failure UErrorCode, they will delete the input node. | 
|  171      * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR. |  172      * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR. | 
|  172      * If there is a failure, they return NULL. |  173      * If there is a failure, they return NULL. | 
|  173      * |  174      * | 
|  174      * NULL Node pointers can be safely passed into other Nodes because |  175      * NULL Node pointers can be safely passed into other Nodes because | 
|  175      * they call the static Node::hashCode() which checks for a NULL pointer fir
     st. |  176      * they call the static Node::hashCode() which checks for a NULL pointer fir
     st. | 
|  176      * |  177      * | 
|  177      * Therefore, as long as builder functions register a new node, |  178      * Therefore, as long as builder functions register a new node, | 
|  178      * they need to check for failures only before explicitly dereferencing |  179      * they need to check for failures only before explicitly dereferencing | 
|  179      * a Node pointer, or before setting a new UErrorCode. |  180      * a Node pointer, or before setting a new UErrorCode. | 
|  180      */ |  181      */ | 
|  181  |  182  | 
|  182     // Hash set of nodes, maps from nodes to integer 1. |  183     // Hash set of nodes, maps from nodes to integer 1. | 
|  183     /** @internal */ |  184     /** @internal */ | 
|  184     UHashtable *nodes; |  185     UHashtable *nodes; | 
|  185  |  186  | 
 |  187 #ifndef U_HIDE_INTERNAL_API | 
|  186     /** @internal */ |  188     /** @internal */ | 
|  187     class Node : public UObject { |  189     class Node : public UObject { | 
|  188     public: |  190     public: | 
|  189         Node(int32_t initialHash) : hash(initialHash), offset(0) {} |  191         Node(int32_t initialHash) : hash(initialHash), offset(0) {} | 
|  190         inline int32_t hashCode() const { return hash; } |  192         inline int32_t hashCode() const { return hash; } | 
|  191         // Handles node==NULL. |  193         // Handles node==NULL. | 
|  192         static inline int32_t hashCode(const Node *node) { return node==NULL ? 0
      : node->hashCode(); } |  194         static inline int32_t hashCode(const Node *node) { return node==NULL ? 0
      : node->hashCode(); } | 
|  193         // Base class operator==() compares the actual class types. |  195         // Base class operator==() compares the actual class types. | 
|  194         virtual UBool operator==(const Node &other) const; |  196         virtual UBool operator==(const Node &other) const; | 
|  195         inline UBool operator!=(const Node &other) const { return !operator==(ot
     her); } |  197         inline UBool operator!=(const Node &other) const { return !operator==(ot
     her); } | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  391     virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal) = 0; |  393     virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal) = 0; | 
|  392     /** @internal */ |  394     /** @internal */ | 
|  393     virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t nod
     e) = 0; |  395     virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t nod
     e) = 0; | 
|  394     /** @internal */ |  396     /** @internal */ | 
|  395     virtual int32_t writeDeltaTo(int32_t jumpTarget) = 0; |  397     virtual int32_t writeDeltaTo(int32_t jumpTarget) = 0; | 
|  396 }; |  398 }; | 
|  397  |  399  | 
|  398 U_NAMESPACE_END |  400 U_NAMESPACE_END | 
|  399  |  401  | 
|  400 #endif  // __STRINGTRIEBUILDER_H__ |  402 #endif  // __STRINGTRIEBUILDER_H__ | 
| OLD | NEW |