• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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_GLOBAL_I18N_I18N_TYPES_H
17 #define OHOS_GLOBAL_I18N_I18N_TYPES_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Global {
23 namespace I18n {
24 enum class I18nErrorCode {
25     SUCCESS = 0,
26     FAILED = 1,
27     NO_PERMISSION = 2,
28     INCONSISTENT_DESCRIPTOR = 3,
29     INVALID_LANGUAGE_TAG = 4,
30     INVALID_REGION_TAG = 5,
31     INVALID_LOCALE_TAG = 6,
32     REMOVE_PREFERRED_LANGUAGE_FAILED = 7,
33     ADD_PREFERRED_LANGUAGE_NON_EXIST_FAILED = 8,
34     ADD_PREFERRED_LANGUAGE_EXIST_FAILED = 9,
35     UPDATE_LOCAL_DIGIT_FAILED = 10,
36     UPDATE_24_HOUR_CLOCK_FAILED = 11,
37     UPDATE_SYSTEM_LANGUAGE_FAILED = 12,
38     UPDATE_SYSTEM_LOCALE_FAILED = 13,
39     UPDATE_SYSTEM_PREFERRED_LANGUAGE_FAILED = 14,
40     PUBLISH_COMMON_EVENT_FAILED = 15,
41     LOAD_SA_FAILED = 16,
42     INVALID_24_HOUR_CLOCK_TAG = 17,
43     NOT_SYSTEM_APP = 18,
44     INVALID_TEMPERATURE_TYPE = 19,
45     UPDATE_TEMPERATURE_TYPE_FAILED = 20,
46     INVALID_WEEK_DAY = 21,
47     UPDATE_WEEK_DAY_FAILED = 22,
48     INVALID_NUMBER_FORMAT_SKELETON = 23,
49     INVALID_DATE_TIME_FORMAT_SKELETON = 24,
50     INVALID_DATE_TIME_FORMAT_PATTERN = 25,
51     INVALID_PARAM = 26,
52     MISSING_PARAM = 27
53 };
54 
55 enum I18nNormalizerMode {
56     NFC = 1,
57     NFD,
58     NFKC,
59     NFKD
60 };
61 
62 enum TemperatureType {
63     CELSIUS = 1,
64     FAHRENHEIT = 2,
65     KELVIN = 3,
66 };
67 
68 enum WeekDay {
69     MON = 1,
70     TUE = 2,
71     WED = 3,
72     THU = 4,
73     FRI = 5,
74     SAT = 6,
75     SUN = 7,
76 };
77 
78 enum class LocaleType {
79     INVALID = 0,
80     BUILTINS_LOCALE = 1,
81     LOCALE_INFO = 2,
82 };
83 
84 enum class ErrorType {
85     NO_ERROR,
86     TYPE_ERROR,
87     RANGE_ERROR
88 };
89 
90 struct ErrorMessage {
91     ErrorType type = ErrorType::NO_ERROR;
92     std::string message = "";
93 };
94 } // namespace I18n
95 } // namespace Global
96 } // namespace OHOS
97 #endif