• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_RESOURCE_MANAGER_LOCALEMATCHER_H
16 #define OHOS_RESOURCE_MANAGER_LOCALEMATCHER_H
17 #include "res_locale.h"
18 
19 namespace OHOS {
20 namespace Global {
21 namespace Resource {
22 class LocaleMatcher {
23 public:
24     static int8_t IsMoreSuitable(const ResLocale *current,
25         const ResLocale *other,
26         const ResLocale *request);
27 
28     static bool Match(const ResLocale *current, const ResLocale *other);
29 
30     static bool IsLanguageTag(const char *str, int32_t len);
31 
32     static bool IsScriptTag(const char *str, int32_t len);
33 
34     static bool IsRegionTag(const char *str, int32_t len);
35 
36     static bool Normalize(ResLocale *resLocale);
37 
38     static int8_t IsMoreSpecificThan(const ResLocale *current, const ResLocale *target);
39 
40 public:
41     static uint64_t EN_US_ENCODE;
42     static uint64_t EN_GB_ENCODE;
43     static uint64_t EN_QAAG_ENCODE;
44     static uint64_t ZH_HANT_MO_ENCODE;
45     static uint64_t ZH_HK_ENCODE;
46     static uint32_t HANT_ENCODE;
47     static constexpr uint64_t ROOT_LOCALE = 0x0;
48     static constexpr uint16_t NULL_LANGUAGE = 0x0;
49     static constexpr uint16_t NULL_REGION = 0x0;
50     static constexpr uint16_t NULL_SCRIPT = 0x0;
51     static constexpr uint64_t NULL_LOCALE = 0x0;
52     static constexpr uint8_t TRACKPATH_ARRAY_SIZE = 5;
53 };
54 } // namespace Resource
55 } // namespace Global
56 } // namespace OHOS
57 #endif
58