SplitDescription.h revision 40e8eefbedcafc51948945647d746daaee092f16
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 17#ifndef H_ANDROID_SPLIT_SPLIT_DESCRIPTION 18#define H_ANDROID_SPLIT_SPLIT_DESCRIPTION 19 20#include "aapt/ConfigDescription.h" 21#include "Abi.h" 22 23#include <utils/String8.h> 24#include <utils/Vector.h> 25 26namespace split { 27 28struct SplitDescription { 29 SplitDescription(); 30 SplitDescription(const SplitDescription&) = default; 31 32 ConfigDescription config; 33 abi::Variant abi; 34 35 int compare(const SplitDescription& rhs) const; 36 inline bool operator<(const SplitDescription& rhs) const; 37 inline bool operator==(const SplitDescription& rhs) const; 38 inline bool operator!=(const SplitDescription& rhs) const; 39 40 bool match(const SplitDescription& o) const; 41 bool isBetterThan(const SplitDescription& o, const SplitDescription& target) const; 42 43 android::String8 toString() const; 44 45 static bool parse(const android::String8& str, SplitDescription* outSplit); 46}; 47 48ssize_t parseAbi(const android::Vector<android::String8>& parts, const ssize_t index, 49 SplitDescription* outSplit); 50 51bool SplitDescription::operator<(const SplitDescription& rhs) const { 52 return compare(rhs) < 0; 53} 54 55bool SplitDescription::operator==(const SplitDescription& rhs) const { 56 return compare(rhs) == 0; 57} 58 59bool SplitDescription::operator!=(const SplitDescription& rhs) const { 60 return compare(rhs) != 0; 61} 62 63} // namespace split 64 65#endif // H_ANDROID_SPLIT_SPLIT_DESCRIPTION 66