Home | History | Annotate | Download | only in vintf
      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 
     18 #ifndef ANDROID_VINTF_VNDK_H
     19 #define ANDROID_VINTF_VNDK_H
     20 
     21 #include <set>
     22 #include <string>
     23 
     24 namespace android {
     25 namespace vintf {
     26 
     27 // deprecated. Kept here for libvintf backwards compatibility.
     28 struct [[deprecated]] VndkVersionRange {
     29 
     30     VndkVersionRange() : VndkVersionRange(0u, 0u, 0u) {}
     31     VndkVersionRange(size_t s, size_t v, size_t p)
     32         : VndkVersionRange(s, v, p, p) {}
     33     VndkVersionRange(size_t s, size_t v, size_t pi, size_t pa)
     34         : sdk(s), vndk(v), patchMin(pi), patchMax(pa) {}
     35 
     36     inline bool isSingleVersion() const { return patchMin == patchMax; };
     37 
     38     size_t sdk;
     39     size_t vndk;
     40     size_t patchMin;
     41     size_t patchMax;
     42 };
     43 
     44 // deprecated. Kept here for libvintf backwards compatibility.
     45 struct [[deprecated]] Vndk {
     46 
     47     const VndkVersionRange &versionRange() const { return mVersionRange; }
     48     const std::set<std::string> &libraries() const { return mLibraries; }
     49 
     50 private:
     51     friend struct VndkConverter;
     52     friend struct HalManifestConverter;
     53     friend struct LibVintfTest;
     54     friend struct HalManifest;
     55     friend struct CompatibilityMatrix;
     56     friend bool operator==(const Vndk &, const Vndk &);
     57     VndkVersionRange mVersionRange;
     58     std::set<std::string> mLibraries;
     59 };
     60 
     61 [[deprecated]]
     62 inline bool operator==(const VndkVersionRange &lft, const VndkVersionRange &rgt) {
     63     return lft.sdk == rgt.sdk && lft.vndk == rgt.vndk &&
     64            lft.patchMin == rgt.patchMin && lft.patchMax == rgt.patchMax;
     65 }
     66 
     67 [[deprecated]]
     68 inline bool operator==(const Vndk &lft, const Vndk &rgt) {
     69     return lft.mVersionRange == rgt.mVersionRange &&
     70            lft.mLibraries == rgt.mLibraries;
     71 }
     72 
     73 } // namespace vintf
     74 } // namespace android
     75 
     76 #endif // ANDROID_VINTF_VNDK_H
     77