• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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_SYSTEM_SDK_H
18 #define ANDROID_VINTF_SYSTEM_SDK_H
19 
20 #include <stdint.h>
21 
22 #include <set>
23 #include <string>
24 
25 namespace android {
26 namespace vintf {
27 
28 // System SDK versions provided for vendor apps.
29 class SystemSdk {
30    public:
31     SystemSdk() = default;
SystemSdk(std::set<std::string> && versions)32     SystemSdk(std::set<std::string>&& versions) : mVersions(std::move(versions)) {}
SystemSdk(const std::set<std::string> & versions)33     SystemSdk(const std::set<std::string>& versions) : mVersions(versions) {}
versions()34     const std::set<std::string>& versions() const { return mVersions; }
empty()35     bool empty() const { return versions().empty(); }
36 
37     bool operator==(const SystemSdk& other) const;
38     // return {v : v in this and not in other}
39     SystemSdk removeVersions(const SystemSdk& other) const;
40 
41     // Move all from "other" to "this".
42     void addAll(SystemSdk* other);
43 
44    private:
45     friend class AssembleVintfImpl;
46     friend struct SystemSdkConverter;
47     std::set<std::string> mVersions;
48 };
49 
50 }  // namespace vintf
51 }  // namespace android
52 
53 #endif  // ANDROID_VINTF_SYSTEM_SDK_H
54