blob: 6923957a5a22af7c8cf6850aab74f816d7f8fc9d [file] [log] [blame]
Adam Lesinski549e4372017-06-27 18:39:07 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Adam Lesinski66ea8402017-06-28 11:44:11 -070017#ifndef AAPT_TEXT_UTF8ITERATOR_H
18#define AAPT_TEXT_UTF8ITERATOR_H
Adam Lesinski549e4372017-06-27 18:39:07 -070019
20#include "android-base/macros.h"
21#include "androidfw/StringPiece.h"
22
23namespace aapt {
Adam Lesinski66ea8402017-06-28 11:44:11 -070024namespace text {
Adam Lesinski549e4372017-06-27 18:39:07 -070025
26class Utf8Iterator {
27 public:
28 explicit Utf8Iterator(const android::StringPiece& str);
29
30 bool HasNext() const;
31
32 void Skip(int amount);
33
34 char32_t Next();
35
36 private:
37 DISALLOW_COPY_AND_ASSIGN(Utf8Iterator);
38
39 void DoNext();
40
41 android::StringPiece str_;
42 size_t next_pos_;
43 char32_t current_codepoint_;
44};
45
Adam Lesinski66ea8402017-06-28 11:44:11 -070046} // namespace text
Adam Lesinski549e4372017-06-27 18:39:07 -070047} // namespace aapt
48
Adam Lesinski66ea8402017-06-28 11:44:11 -070049#endif // AAPT_TEXT_UTF8ITERATOR_H