OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3728 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar; | 3728 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar; |
3729 | 3729 |
3730 class CodePointIterator : public ValueObject { | 3730 class CodePointIterator : public ValueObject { |
3731 public: | 3731 public: |
3732 explicit CodePointIterator(const String& str) | 3732 explicit CodePointIterator(const String& str) |
3733 : str_(str), | 3733 : str_(str), |
3734 index_(-1), | 3734 index_(-1), |
3735 ch_(-1) { | 3735 ch_(-1) { |
3736 } | 3736 } |
3737 | 3737 |
3738 int32_t Current() { | 3738 int32_t Current() const { |
3739 ASSERT(index_ >= 0); | 3739 ASSERT(index_ >= 0); |
3740 ASSERT(index_ < str_.Length()); | 3740 ASSERT(index_ < str_.Length()); |
3741 return ch_; | 3741 return ch_; |
3742 } | 3742 } |
3743 | 3743 |
3744 bool Next(); | 3744 bool Next(); |
3745 | 3745 |
3746 void Reset() { | |
cshapiro
2012/11/30 02:49:08
I would prefer that this functionality not be adde
Søren Gjesse
2012/11/30 12:23:07
Done.
| |
3747 index_ = -1; | |
3748 ch_ = -1; | |
3749 } | |
3750 | |
3746 private: | 3751 private: |
3747 const String& str_; | 3752 const String& str_; |
3748 intptr_t index_; | 3753 intptr_t index_; |
3749 int32_t ch_; | 3754 int32_t ch_; |
3750 DISALLOW_IMPLICIT_CONSTRUCTORS(CodePointIterator); | 3755 DISALLOW_IMPLICIT_CONSTRUCTORS(CodePointIterator); |
3751 }; | 3756 }; |
3752 | 3757 |
3753 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } | 3758 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } |
3754 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } | 3759 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } |
3755 | 3760 |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5975 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5980 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
5976 return false; | 5981 return false; |
5977 } | 5982 } |
5978 } | 5983 } |
5979 return true; | 5984 return true; |
5980 } | 5985 } |
5981 | 5986 |
5982 } // namespace dart | 5987 } // namespace dart |
5983 | 5988 |
5984 #endif // VM_OBJECT_H_ | 5989 #endif // VM_OBJECT_H_ |
OLD | NEW |