blob: 4f999a2ff0c600c7266b303fee4671633423e90f [file] [log] [blame]
Adam Lesinskifab50872014-04-16 14:40:42 -07001/*
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 __CONFIG_DESCRIPTION_H
18#define __CONFIG_DESCRIPTION_H
19
20#include <androidfw/ResourceTypes.h>
21
22/**
23 * Subclass of ResTable_config that adds convenient
24 * initialization and comparison methods.
25 */
26struct ConfigDescription : public android::ResTable_config {
27 ConfigDescription() {
28 memset(this, 0, sizeof(*this));
29 size = sizeof(android::ResTable_config);
30 }
Adam Lesinski40e8eef2014-09-16 14:43:29 -070031
Adam Lesinskifab50872014-04-16 14:40:42 -070032 ConfigDescription(const android::ResTable_config&o) {
33 *static_cast<android::ResTable_config*>(this) = o;
34 size = sizeof(android::ResTable_config);
35 }
Adam Lesinski40e8eef2014-09-16 14:43:29 -070036
Adam Lesinskifab50872014-04-16 14:40:42 -070037 ConfigDescription(const ConfigDescription&o) {
38 *static_cast<android::ResTable_config*>(this) = o;
39 }
40
41 ConfigDescription& operator=(const android::ResTable_config& o) {
42 *static_cast<android::ResTable_config*>(this) = o;
43 size = sizeof(android::ResTable_config);
44 return *this;
45 }
Adam Lesinski40e8eef2014-09-16 14:43:29 -070046
Adam Lesinskifab50872014-04-16 14:40:42 -070047 ConfigDescription& operator=(const ConfigDescription& o) {
48 *static_cast<android::ResTable_config*>(this) = o;
49 return *this;
50 }
51
52 inline bool operator<(const ConfigDescription& o) const { return compare(o) < 0; }
53 inline bool operator<=(const ConfigDescription& o) const { return compare(o) <= 0; }
54 inline bool operator==(const ConfigDescription& o) const { return compare(o) == 0; }
55 inline bool operator!=(const ConfigDescription& o) const { return compare(o) != 0; }
56 inline bool operator>=(const ConfigDescription& o) const { return compare(o) >= 0; }
57 inline bool operator>(const ConfigDescription& o) const { return compare(o) > 0; }
58};
59
60#endif // __CONFIG_DESCRIPTION_H