+// © 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
*
BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
UErrorCode &errorCode)
- : bytes_(reinterpret_cast<const uint8_t *>(trieBytes)),
+ : bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), initialPos_(bytes_),
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
} else {
pos_=skipValue(pos, node);
}
- sp_.set(str_->data(), str_->length());
return TRUE;
}
if(maxLength_>0 && str_->length()==maxLength_) {
}
}
+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;
}
str_->append((char)trieByte, errorCode);
if(isFinal) {
pos_=NULL;
- sp_.set(str_->data(), str_->length());
value_=value;
return NULL;
} else {