blob: d4aa22208a2ab2797dbc4502dcdff5147e026e75 [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001/*
2 * Copyright (C) 2015 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_XLIFF_XML_PULL_PARSER_H
18#define AAPT_XLIFF_XML_PULL_PARSER_H
19
20#include "XmlPullParser.h"
21
Adam Lesinskica2fc352015-04-03 12:08:26 -070022#include <memory>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080023#include <string>
24
25namespace aapt {
26
27/**
28 * Strips xliff elements and provides the caller with a view of the
29 * underlying XML without xliff.
30 */
31class XliffXmlPullParser : public XmlPullParser {
32public:
33 XliffXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
34 XliffXmlPullParser(const XliffXmlPullParser& rhs) = delete;
35
36 Event getEvent() const;
37 const std::string& getLastError() const;
38 Event next();
39
40 const std::u16string& getComment() const;
41 size_t getLineNumber() const;
42 size_t getDepth() const;
43
44 const std::u16string& getText() const;
45
46 const std::u16string& getNamespacePrefix() const;
47 const std::u16string& getNamespaceUri() const;
48
49 const std::u16string& getElementNamespace() const;
50 const std::u16string& getElementName() const;
51
52 const_iterator beginAttributes() const;
53 const_iterator endAttributes() const;
54 size_t getAttributeCount() const;
55
56private:
57 std::shared_ptr<XmlPullParser> mParser;
58};
59
60} // namespace aapt
61
62#endif // AAPT_XLIFF_XML_PULL_PARSER_H