blob: f2507d8786b21571818fee32705304cc44e45e5b [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
17#ifndef AAPT_UTIL_UTF8ITERATOR_H
18#define AAPT_UTIL_UTF8ITERATOR_H
19
20#include "android-base/macros.h"
21#include "androidfw/StringPiece.h"
22
23namespace aapt {
24
25class Utf8Iterator {
26 public:
27 explicit Utf8Iterator(const android::StringPiece& str);
28
29 bool HasNext() const;
30
31 void Skip(int amount);
32
33 char32_t Next();
34
35 private:
36 DISALLOW_COPY_AND_ASSIGN(Utf8Iterator);
37
38 void DoNext();
39
40 android::StringPiece str_;
41 size_t next_pos_;
42 char32_t current_codepoint_;
43};
44
45} // namespace aapt
46
47#endif // AAPT_UTIL_UTF8ITERATOR_H