X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/4388f060552cc537e71e957d32f35e9d75a61233..HEAD:/icuSources/common/bytestrieiterator.cpp diff --git a/icuSources/common/bytestrieiterator.cpp b/icuSources/common/bytestrieiterator.cpp index d8318f65..e64961a1 100644 --- a/icuSources/common/bytestrieiterator.cpp +++ b/icuSources/common/bytestrieiterator.cpp @@ -1,10 +1,12 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* -* Copyright (C) 2010-2011, International Business Machines +* Copyright (C) 2010-2012, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: bytestrieiterator.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -22,7 +24,7 @@ U_NAMESPACE_BEGIN BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength, UErrorCode &errorCode) - : bytes_(reinterpret_cast(trieBytes)), + : bytes_(static_cast(trieBytes)), pos_(bytes_), initialPos_(bytes_), remainingMatchLength_(-1), initialRemainingMatchLength_(-1), str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) { @@ -139,7 +141,6 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { } else { pos_=skipValue(pos, node); } - sp_.set(str_->data(), str_->length()); return TRUE; } if(maxLength_>0 && str_->length()==maxLength_) { @@ -167,10 +168,14 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { } } +StringPiece +BytesTrie::Iterator::getString() const { + return str_ == NULL ? StringPiece() : str_->toStringPiece(); +} + UBool BytesTrie::Iterator::truncateAndStop() { pos_=NULL; - sp_.set(str_->data(), str_->length()); value_=-1; // no real value for str return TRUE; } @@ -199,7 +204,6 @@ BytesTrie::Iterator::branchNext(const uint8_t *pos, int32_t length, UErrorCode & str_->append((char)trieByte, errorCode); if(isFinal) { pos_=NULL; - sp_.set(str_->data(), str_->length()); value_=value; return NULL; } else {