1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_RES_COMMON_H
17 #define OHOS_RES_COMMON_H
18 
19 #include <stdint.h>
20 
21 #ifdef __EXPORT_MGR__
22 #define EXPORT_FUNC __declspec(dllexport)
23 #else
24 #define EXPORT_FUNC
25 #endif
26 
27 namespace OHOS {
28 namespace Global {
29 namespace Resource {
30 // DIRECTION
31 static const char *VERTICAL = "vertical";
32 static const char *HORIZONTAL = "horizontal";
33 
34 // DEVICETYPE
35 static const char *PHONE_STR = "phone";
36 static const char *TABLET_STR = "tablet";
37 static const char *CAR_STR = "car";
38 static const char *PAD_STR = "pad";
39 static const char *TV_STR = "tv";
40 static const char *WEARABLE_STR = "wearable";
41 static const char *TWOINONE_STR = "2in1";
42 
43 // ColorMode
44 static const char *DARK_STR = "dark";
45 static const char *LIGHT_STR = "light";
46 
47 // InputDevice
48 static const char *POINTING_DEVICE_STR = "pointingdevice";
49 
50 // ScreenDensity
51 static const char *RE_120_STR = "sdpi";
52 static const char *RE_160_STR = "mdpi";
53 static const char *RE_240_STR = "ldpi";
54 static const char *RE_320_STR = "xldpi";
55 static const char *RE_480_STR = "xxldpi";
56 static const char *RE_640_STR = "xxxldpi";
57 
58 static const uint32_t MCC_UNDEFINED = 0;
59 static const uint32_t MNC_UNDEFINED = 0;
60 
61 // the type of qualifiers
62 typedef enum KeyType {
63     LANGUAGES       = 0,
64     REGION          = 1,
65     SCREEN_DENSITY  = 2,
66     DIRECTION       = 3,
67     DEVICETYPE      = 4,
68     SCRIPT          = 5,
69     COLORMODE       = 6, // DARK = 0, LIGHT = 1
70     MCC             = 7,
71     MNC             = 8,
72     // RESERVER 9
73     INPUTDEVICE     = 10,
74     KEY_TYPE_MAX,
75 } KeyType;
76 
77 // the type of resources
78 typedef enum ResType {
79     VALUES    = 0,
80     ANIMATION = 1,
81     DRAWABLE  = 2,
82     LAYOUT    = 3,
83     MENU      = 4,
84     MIPMAP    = 5,
85     RAW       = 6,
86     XML       = 7,
87 
88     INTEGER          = 8,
89     STRING           = 9,
90     STRINGARRAY      = 10,
91     INTARRAY         = 11,
92     BOOLEAN          = 12,
93     DIMEN            = 13,
94     COLOR            = 14,
95     ID               = 15,
96     THEME            = 16,
97     PLURALS          = 17,
98     FLOAT            = 18,
99     MEDIA            = 19,
100     PROF             = 20,
101     SVG              = 21,
102     PATTERN          = 22,
103     SYMBOL           = 23,
104     MAX_RES_TYPE     = 24,
105 } ResType;
106 
107 static const uint32_t SELECT_INTEGER = 0x0001;
108 static const uint32_t SELECT_STRING = 0x0002;
109 static const uint32_t SELECT_STRINGARRAY = 0x0004;
110 static const uint32_t SELECT_INTARRAY = 0x0008;
111 static const uint32_t SELECT_BOOLEAN = 0x0010;
112 static const uint32_t SELECT_COLOR = 0x0020;
113 static const uint32_t SELECT_THEME = 0x0040;
114 static const uint32_t SELECT_PLURALS = 0x0080;
115 static const uint32_t SELECT_FLOAT = 0x0100;
116 static const uint32_t SELECT_MEDIA = 0x0200;
117 static const uint32_t SELECT_PROF = 0x0400;
118 static const uint32_t SELECT_PATTERN = 0x0800;
119 static const uint32_t SELECT_SYMBOL = 0x1000;
120 static const uint32_t SELECT_ALL = 0xFFFFFFFF;
121 
122 enum DeviceType {
123     DEVICE_NOT_SET  = -1,
124     DEVICE_PHONE    = 0,
125     DEVICE_TABLET   = 1,
126     DEVICE_CAR      = 2,
127     DEVICE_PAD      = 3,
128     DEVICE_TV       = 4,
129     DEVICE_WEARABLE = 6,
130     DEVICE_TWOINONE = 7,
131 };
132 
133 enum TimeFormat {
134     HOUR_NOT_SET = -1,
135     HOUR_12      = 0,
136     HOUR_24      = 1,
137 };
138 
139 enum ColorMode {
140     COLOR_MODE_NOT_SET = -1,
141     DARK               = 0,
142     LIGHT              = 1,
143 };
144 
145 enum InputDevice {
146     INPUTDEVICE_NOT_SET = -1,
147     INPUTDEVICE_POINTINGDEVICE = 0,
148 };
149 
150 enum ScreenDensity {
151     SCREEN_DENSITY_NOT_SET  = 0,
152     SCREEN_DENSITY_SDPI     = 120,
153     SCREEN_DENSITY_MDPI     = 160,
154     SCREEN_DENSITY_LDPI     = 240,
155     SCREEN_DENSITY_XLDPI    = 320,
156     SCREEN_DENSITY_XXLDPI   = 480,
157     SCREEN_DENSITY_XXXLDPI  = 640,
158 };
159 
160 enum Direction {
161     DIRECTION_NOT_SET = -1,
162     DIRECTION_VERTICAL = 0,
163     DIRECTION_HORIZONTAL = 1
164 };
165 } // namespace Resource
166 } // namespace Global
167 } // namespace OHOS
168 #endif // OHOS_RES_COMMON_H