• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 ANDROID_VINTF_XML_FILE_H
18 #define ANDROID_VINTF_XML_FILE_H
19 
20 #include <string>
21 
22 #include "Version.h"
23 #include "VersionRange.h"
24 #include "XmlSchemaFormat.h"
25 
26 namespace android {
27 namespace vintf {
28 
29 struct XmlFile {
30    public:
nameXmlFile31     inline const std::string& name() const { return mName; }
overriddenPathXmlFile32     inline const std::string& overriddenPath() const { return mOverriddenPath; }
33 
34    protected:
35     std::string mName;
36     std::string mOverriddenPath;
37 };
38 
39 // An <xmlfile> entry in matrix
40 struct MatrixXmlFile : public XmlFile {
optionalMatrixXmlFile41     inline bool optional() const { return mOptional; }
formatMatrixXmlFile42     inline XmlSchemaFormat format() const { return mFormat; }
versionRangeMatrixXmlFile43     inline const VersionRange& versionRange() const { return mVersionRange; }
44     bool operator==(const MatrixXmlFile& other) const;
45 
46    private:
47     friend struct CompatibilityMatrix;
48     friend struct MatrixXmlFileConverter;
49     friend struct LibVintfTest;
50     bool mOptional;
51     XmlSchemaFormat mFormat;
52     VersionRange mVersionRange;
53 };
54 
55 // An <xmlfile> entry in manifest
56 struct ManifestXmlFile : public XmlFile {
versionManifestXmlFile57     inline const Version& version() const { return mVersion; }
58     bool operator==(const ManifestXmlFile& other) const;
59 
60    private:
61     friend struct ManifestXmlFileConverter;
62     friend struct LibVintfTest;
63     Version mVersion;
64 };
65 
66 }  // namespace vintf
67 }  // namespace android
68 #endif  // ANDROID_VINTF_XML_FILE_H
69