Winson | 62ac8b5 | 2019-12-04 08:36:48 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 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 IDMAP2_TESTS_R_H |
| 18 | #define IDMAP2_TESTS_R_H |
| 19 | |
| 20 | #include <idmap2/ResourceUtils.h> |
| 21 | |
| 22 | namespace android::idmap2 { |
| 23 | |
| 24 | static std::string hexify(ResourceId id) { |
| 25 | std::stringstream stream; |
| 26 | stream << std::hex << static_cast<uint32_t>(id); |
| 27 | return stream.str(); |
| 28 | } |
| 29 | |
| 30 | // clang-format off |
| 31 | namespace R::target { |
| 32 | namespace integer { |
| 33 | constexpr ResourceId int1 = 0x7f010000; |
| 34 | |
| 35 | namespace literal { |
| 36 | inline const std::string int1 = hexify(R::target::integer::int1); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | namespace string { |
| 41 | constexpr ResourceId not_overlayable = 0x7f020003; |
| 42 | constexpr ResourceId other = 0x7f020004; |
| 43 | constexpr ResourceId policy_odm = 0x7f020005; |
| 44 | constexpr ResourceId policy_oem = 0x7f020006; |
| 45 | constexpr ResourceId policy_product = 0x7f020007; |
| 46 | constexpr ResourceId policy_public = 0x7f020008; |
| 47 | constexpr ResourceId policy_signature = 0x7f020009; |
| 48 | constexpr ResourceId policy_system = 0x7f02000a; |
| 49 | constexpr ResourceId policy_system_vendor = 0x7f02000b; |
| 50 | constexpr ResourceId str1 = 0x7f02000c; |
| 51 | constexpr ResourceId str3 = 0x7f02000e; |
| 52 | constexpr ResourceId str4 = 0x7f02000f; |
| 53 | |
| 54 | namespace literal { |
| 55 | inline const std::string str1 = hexify(R::target::string::str1); |
| 56 | inline const std::string str3 = hexify(R::target::string::str3); |
| 57 | inline const std::string str4 = hexify(R::target::string::str4); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | namespace R::overlay { |
| 63 | namespace integer { |
| 64 | constexpr ResourceId int1 = 0x7f010000; |
| 65 | } |
| 66 | namespace string { |
| 67 | constexpr ResourceId str1 = 0x7f020000; |
| 68 | constexpr ResourceId str3 = 0x7f020001; |
| 69 | constexpr ResourceId str4 = 0x7f020002; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | namespace R::system_overlay::string { |
| 74 | constexpr ResourceId policy_public = 0x7f010000; |
| 75 | constexpr ResourceId policy_system = 0x7f010001; |
| 76 | constexpr ResourceId policy_system_vendor = 0x7f010002; |
| 77 | } |
| 78 | |
| 79 | namespace R::system_overlay_invalid::string { |
| 80 | constexpr ResourceId not_overlayable = 0x7f010000; |
| 81 | constexpr ResourceId other = 0x7f010001; |
| 82 | constexpr ResourceId policy_odm = 0x7f010002; |
| 83 | constexpr ResourceId policy_oem = 0x7f010003; |
| 84 | constexpr ResourceId policy_product = 0x7f010004; |
| 85 | constexpr ResourceId policy_public = 0x7f010005; |
| 86 | constexpr ResourceId policy_signature = 0x7f010006; |
| 87 | constexpr ResourceId policy_system = 0x7f010007; |
| 88 | constexpr ResourceId policy_system_vendor = 0x7f010008; |
| 89 | }; |
| 90 | // clang-format on |
| 91 | |
| 92 | } // namespace android::idmap2 |
| 93 | |
| 94 | #endif // IDMAP2_TESTS_R_H |