blob: 77912277b31ee0f2a30bd946f603a98c6aa2dfa2 [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
Adam Lesinski24aad162015-04-24 19:19:30 -070036 Event getEvent() const override;
37 const std::string& getLastError() const override;
38 Event next() override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080039
Adam Lesinski24aad162015-04-24 19:19:30 -070040 const std::u16string& getComment() const override;
41 size_t getLineNumber() const override;
42 size_t getDepth() const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080043
Adam Lesinski24aad162015-04-24 19:19:30 -070044 const std::u16string& getText() const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080045
Adam Lesinski24aad162015-04-24 19:19:30 -070046 const std::u16string& getNamespacePrefix() const override;
47 const std::u16string& getNamespaceUri() const override;
48 bool applyPackageAlias(std::u16string* package, const std::u16string& defaultPackage)
49 const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080050
Adam Lesinski24aad162015-04-24 19:19:30 -070051 const std::u16string& getElementNamespace() const override;
52 const std::u16string& getElementName() const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080053
Adam Lesinski24aad162015-04-24 19:19:30 -070054 const_iterator beginAttributes() const override;
55 const_iterator endAttributes() const override;
56 size_t getAttributeCount() const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080057
58private:
59 std::shared_ptr<XmlPullParser> mParser;
60};
61
62} // namespace aapt
63
64#endif // AAPT_XLIFF_XML_PULL_PARSER_H