SystemSdk.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef ANDROID_VINTF_SYSTEM_SDK_H
  17. #define ANDROID_VINTF_SYSTEM_SDK_H
  18. #include <stdint.h>
  19. #include <set>
  20. #include <string>
  21. namespace android {
  22. namespace vintf {
  23. // System SDK versions provided for vendor apps.
  24. class SystemSdk {
  25. public:
  26. SystemSdk() = default;
  27. SystemSdk(std::set<std::string>&& versions) : mVersions(std::move(versions)) {}
  28. SystemSdk(const std::set<std::string>& versions) : mVersions(versions) {}
  29. const std::set<std::string>& versions() const { return mVersions; }
  30. bool empty() const { return versions().empty(); }
  31. bool operator==(const SystemSdk& other) const;
  32. // return {v : v in this and not in other}
  33. SystemSdk removeVersions(const SystemSdk& other) const;
  34. // Move all from "other" to "this".
  35. void addAll(SystemSdk* other);
  36. private:
  37. friend class AssembleVintfImpl;
  38. friend struct SystemSdkConverter;
  39. std::set<std::string> mVersions;
  40. };
  41. } // namespace vintf
  42. } // namespace android
  43. #endif // ANDROID_VINTF_SYSTEM_SDK_H