SplitDescription.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2014 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 H_ANDROID_SPLIT_SPLIT_DESCRIPTION
  17. #define H_ANDROID_SPLIT_SPLIT_DESCRIPTION
  18. #include "aapt/ConfigDescription.h"
  19. #include "Abi.h"
  20. #include <utils/String8.h>
  21. #include <utils/Vector.h>
  22. namespace split {
  23. struct SplitDescription {
  24. SplitDescription();
  25. ConfigDescription config;
  26. abi::Variant abi;
  27. int compare(const SplitDescription& rhs) const;
  28. inline bool operator<(const SplitDescription& rhs) const;
  29. inline bool operator==(const SplitDescription& rhs) const;
  30. inline bool operator!=(const SplitDescription& rhs) const;
  31. bool match(const SplitDescription& o) const;
  32. bool isBetterThan(const SplitDescription& o, const SplitDescription& target) const;
  33. android::String8 toString() const;
  34. static bool parse(const android::String8& str, SplitDescription* outSplit);
  35. };
  36. ssize_t parseAbi(const android::Vector<android::String8>& parts, const ssize_t index,
  37. SplitDescription* outSplit);
  38. bool SplitDescription::operator<(const SplitDescription& rhs) const {
  39. return compare(rhs) < 0;
  40. }
  41. bool SplitDescription::operator==(const SplitDescription& rhs) const {
  42. return compare(rhs) == 0;
  43. }
  44. bool SplitDescription::operator!=(const SplitDescription& rhs) const {
  45. return compare(rhs) != 0;
  46. }
  47. } // namespace split
  48. #endif // H_ANDROID_SPLIT_SPLIT_DESCRIPTION