blob: d362521c769dc25d7d65605969586abf83e3a34f [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
22#include <string>
23
24namespace aapt {
25
26/**
27 * Strips xliff elements and provides the caller with a view of the
28 * underlying XML without xliff.
29 */
30class XliffXmlPullParser : public XmlPullParser {
31public:
32 XliffXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
33 XliffXmlPullParser(const XliffXmlPullParser& rhs) = delete;
34
35 Event getEvent() const;
36 const std::string& getLastError() const;
37 Event next();
38
39 const std::u16string& getComment() const;
40 size_t getLineNumber() const;
41 size_t getDepth() const;
42
43 const std::u16string& getText() const;
44
45 const std::u16string& getNamespacePrefix() const;
46 const std::u16string& getNamespaceUri() const;
47
48 const std::u16string& getElementNamespace() const;
49 const std::u16string& getElementName() const;
50
51 const_iterator beginAttributes() const;
52 const_iterator endAttributes() const;
53 size_t getAttributeCount() const;
54
55private:
56 std::shared_ptr<XmlPullParser> mParser;
57};
58
59} // namespace aapt
60
61#endif // AAPT_XLIFF_XML_PULL_PARSER_H