11767c5feSopenharmony_ci/*
21767c5feSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
31767c5feSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
41767c5feSopenharmony_ci * you may not use this file except in compliance with the License.
51767c5feSopenharmony_ci * You may obtain a copy of the License at
61767c5feSopenharmony_ci *
71767c5feSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
81767c5feSopenharmony_ci *
91767c5feSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
101767c5feSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
111767c5feSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121767c5feSopenharmony_ci * See the License for the specific language governing permissions and
131767c5feSopenharmony_ci * limitations under the License.
141767c5feSopenharmony_ci */
151767c5feSopenharmony_ci
161767c5feSopenharmony_ci#ifndef I18N_PHONENUMBERS_UPDATE_GEOCODING_H_
171767c5feSopenharmony_ci#define I18N_PHONENUMBERS_UPDATE_GEOCODING_H_
181767c5feSopenharmony_ci
191767c5feSopenharmony_ci#include <map>
201767c5feSopenharmony_ci#include <string>
211767c5feSopenharmony_ci#include "geocoding_data.pb.h"
221767c5feSopenharmony_ci#include "phonenumbers/geocoding/geocoding_data.h"
231767c5feSopenharmony_ci
241767c5feSopenharmony_cinamespace i18n {
251767c5feSopenharmony_cinamespace phonenumbers {
261767c5feSopenharmony_ciclass UpdateGeocoding {
271767c5feSopenharmony_cipublic:
281767c5feSopenharmony_ci    static void LoadGeocodingData(int fd);
291767c5feSopenharmony_ci    static const PrefixDescriptions* UpdatePrefixDescriptions(const PrefixDescriptions** prePrefixDescriptionsArray,
301767c5feSopenharmony_ci        int index);
311767c5feSopenharmony_ci    static const char** UpdateLanguageCodes(const char** languageCodes, int languageCodesSize);
321767c5feSopenharmony_ci    static int UpdateLanguageCodesSize();
331767c5feSopenharmony_ci    static const CountryLanguages* UpdateCountryLanguages(const CountryLanguages** preCountryLanguagesArray,
341767c5feSopenharmony_ci        int index);
351767c5feSopenharmony_ci    static const int* UpdateCountryCodes(const int* countryCodes, int countryCodesSize);
361767c5feSopenharmony_ci    static int UpdateCountryCodesSize();
371767c5feSopenharmony_ci
381767c5feSopenharmony_ciprivate:
391767c5feSopenharmony_ci    static void AddPrefixDescriptions(const std::string& languageCode, int index);
401767c5feSopenharmony_ci    static void ModifyPrefixDescriptions(int32_t* prefixes, const char** descriptions,
411767c5feSopenharmony_ci        PrefixesInfo& prefixesInfo, int index);
421767c5feSopenharmony_ci    static void ModifyPossibleLengths(int32_t* possibleLengths, PrefixesInfo& prefixesInfo, int index);
431767c5feSopenharmony_ci    static void AddCountryLanguages(int countryCode);
441767c5feSopenharmony_ci
451767c5feSopenharmony_ci    static int FindLanguageCode(const std::string& languageCode);
461767c5feSopenharmony_ci    static int FindCountryCode(int countryCode);
471767c5feSopenharmony_ci    static bool IsLowerThan(const char* s1, const char* s2);
481767c5feSopenharmony_ci    static char* WriteStr(const std::string& str);
491767c5feSopenharmony_ci    static std::map<std::string, PrefixDescriptions>* prefixDescriptionsMap;
501767c5feSopenharmony_ci    static std::map<std::string, PrefixesInfo>* prefixesInfoMap;
511767c5feSopenharmony_ci    static const PrefixDescriptions** prefixDescriptionsArray;
521767c5feSopenharmony_ci    static LanguageCodeInfo* languageCodeInfo;
531767c5feSopenharmony_ci    static bool isupdatedLanguageCodes;
541767c5feSopenharmony_ci    static const char** preLanguageCodes;
551767c5feSopenharmony_ci    static const char** curLanguageCodes;
561767c5feSopenharmony_ci    static int curLanguageCodesSize;
571767c5feSopenharmony_ci    static int preLanguageCodesSize;
581767c5feSopenharmony_ci
591767c5feSopenharmony_ci    static std::map<int, CountryLanguages>* countryLanguagesMap;
601767c5feSopenharmony_ci    static std::map<int, CountriesInfo>* countriesInfoMap;
611767c5feSopenharmony_ci    static const CountryLanguages** countryLanguagesArray;
621767c5feSopenharmony_ci    static CountryCodeInfo* countryCodeInfo;
631767c5feSopenharmony_ci
641767c5feSopenharmony_ci    static bool isupdatedCountryCodes;
651767c5feSopenharmony_ci    static const int* preCountryCodes;
661767c5feSopenharmony_ci    static int* curCountryCodes;
671767c5feSopenharmony_ci    static int curCountryCodesSize;
681767c5feSopenharmony_ci    static int preCountryCodesSize;
691767c5feSopenharmony_ci
701767c5feSopenharmony_ci    static GeocodingInfo* geocodingInfo;
711767c5feSopenharmony_ci};
721767c5feSopenharmony_ci}  // namespace phonenumbers
731767c5feSopenharmony_ci}  // namespace i18n
741767c5feSopenharmony_ci#endif  // I18N_PHONENUMBERS_UPDATE_GEOCODING_H_