1 /*
2  * Copyright (C) 2021 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 #include "ValueTransformer.h"
18 
19 #include "ResourceValues.h"
20 
21 namespace aapt {
22 
23 #define VALUE_CREATE_VALUE_DECL(T)                                          \
24   std::unique_ptr<Value> ValueTransformer::TransformValue(const T* value) { \
25     return TransformDerived(value);                                         \
26   }
27 
28 #define VALUE_CREATE_ITEM_DECL(T)                                           \
29   std::unique_ptr<Item> ValueTransformer::TransformItem(const T* value) {   \
30     return TransformDerived(value);                                         \
31   }                                                                         \
32   std::unique_ptr<Value> ValueTransformer::TransformValue(const T* value) { \
33     return TransformItem(value);                                            \
34   }
35 
36 VALUE_CREATE_ITEM_DECL(Id);
37 VALUE_CREATE_ITEM_DECL(Reference);
38 VALUE_CREATE_ITEM_DECL(RawString);
39 VALUE_CREATE_ITEM_DECL(String);
40 VALUE_CREATE_ITEM_DECL(StyledString);
41 VALUE_CREATE_ITEM_DECL(FileReference);
42 VALUE_CREATE_ITEM_DECL(BinaryPrimitive);
43 
44 VALUE_CREATE_VALUE_DECL(Attribute);
45 VALUE_CREATE_VALUE_DECL(Style);
46 VALUE_CREATE_VALUE_DECL(Array);
47 VALUE_CREATE_VALUE_DECL(Plural);
48 VALUE_CREATE_VALUE_DECL(Styleable);
49 VALUE_CREATE_VALUE_DECL(Macro);
50 
51 }  // namespace aapt