Vndk.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #ifndef ANDROID_VINTF_VNDK_H
  17. #define ANDROID_VINTF_VNDK_H
  18. #include <set>
  19. #include <string>
  20. namespace android {
  21. namespace vintf {
  22. // deprecated. Kept here for libvintf backwards compatibility.
  23. struct [[deprecated]] VndkVersionRange {
  24. VndkVersionRange() : VndkVersionRange(0u, 0u, 0u) {}
  25. VndkVersionRange(size_t s, size_t v, size_t p)
  26. : VndkVersionRange(s, v, p, p) {}
  27. VndkVersionRange(size_t s, size_t v, size_t pi, size_t pa)
  28. : sdk(s), vndk(v), patchMin(pi), patchMax(pa) {}
  29. inline bool isSingleVersion() const { return patchMin == patchMax; }
  30. size_t sdk;
  31. size_t vndk;
  32. size_t patchMin;
  33. size_t patchMax;
  34. };
  35. // deprecated. Kept here for libvintf backwards compatibility.
  36. struct [[deprecated]] Vndk {
  37. const VndkVersionRange &versionRange() const { return mVersionRange; }
  38. const std::set<std::string> &libraries() const { return mLibraries; }
  39. private:
  40. friend struct VndkConverter;
  41. friend struct HalManifestConverter;
  42. friend struct LibVintfTest;
  43. friend struct HalManifest;
  44. friend struct CompatibilityMatrix;
  45. friend bool operator==(const Vndk &, const Vndk &);
  46. VndkVersionRange mVersionRange;
  47. std::set<std::string> mLibraries;
  48. };
  49. #pragma clang diagnostic push
  50. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  51. inline bool operator==(const VndkVersionRange &lft, const VndkVersionRange &rgt) {
  52. return lft.sdk == rgt.sdk && lft.vndk == rgt.vndk &&
  53. lft.patchMin == rgt.patchMin && lft.patchMax == rgt.patchMax;
  54. }
  55. inline bool operator==(const Vndk &lft, const Vndk &rgt) {
  56. return lft.mVersionRange == rgt.mVersionRange &&
  57. lft.mLibraries == rgt.mLibraries;
  58. }
  59. #pragma clang diagnostic pop
  60. } // namespace vintf
  61. } // namespace android
  62. #endif // ANDROID_VINTF_VNDK_H