Home | History | Annotate | Download | only in aapt
      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 __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  */
     26 struct ConfigDescription : public android::ResTable_config {
     27     ConfigDescription() {
     28         memset(this, 0, sizeof(*this));
     29         size = sizeof(android::ResTable_config);
     30     }
     31     ConfigDescription(const android::ResTable_config&o) {
     32         *static_cast<android::ResTable_config*>(this) = o;
     33         size = sizeof(android::ResTable_config);
     34     }
     35     ConfigDescription(const ConfigDescription&o) {
     36         *static_cast<android::ResTable_config*>(this) = o;
     37     }
     38 
     39     ConfigDescription& operator=(const android::ResTable_config& o) {
     40         *static_cast<android::ResTable_config*>(this) = o;
     41         size = sizeof(android::ResTable_config);
     42         return *this;
     43     }
     44     ConfigDescription& operator=(const ConfigDescription& o) {
     45         *static_cast<android::ResTable_config*>(this) = o;
     46         return *this;
     47     }
     48 
     49     inline bool operator<(const ConfigDescription& o) const { return compare(o) < 0; }
     50     inline bool operator<=(const ConfigDescription& o) const { return compare(o) <= 0; }
     51     inline bool operator==(const ConfigDescription& o) const { return compare(o) == 0; }
     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 };
     56 
     57 #endif // __CONFIG_DESCRIPTION_H
     58