2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef H_ANDROID_SPLIT_SPLIT_DESCRIPTION
18 #define H_ANDROID_SPLIT_SPLIT_DESCRIPTION
20 #include "aapt/ConfigDescription.h"
23 #include <utils/String8.h>
24 #include <utils/Vector.h>
28 struct SplitDescription {
31 ConfigDescription config;
34 int compare(const SplitDescription& rhs) const;
35 inline bool operator<(const SplitDescription& rhs) const;
36 inline bool operator==(const SplitDescription& rhs) const;
37 inline bool operator!=(const SplitDescription& rhs) const;
39 bool match(const SplitDescription& o) const;
40 bool isBetterThan(const SplitDescription& o, const SplitDescription& target) const;
42 android::String8 toString() const;
44 static bool parse(const android::String8& str, SplitDescription* outSplit);
47 ssize_t parseAbi(const android::Vector<android::String8>& parts, const ssize_t index,
48 SplitDescription* outSplit);
50 bool SplitDescription::operator<(const SplitDescription& rhs) const {
51 return compare(rhs) < 0;
54 bool SplitDescription::operator==(const SplitDescription& rhs) const {
55 return compare(rhs) == 0;
58 bool SplitDescription::operator!=(const SplitDescription& rhs) const {
59 return compare(rhs) != 0;
64 #endif // H_ANDROID_SPLIT_SPLIT_DESCRIPTION