19596a2c1Sopenharmony_ci/*
29596a2c1Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
39596a2c1Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49596a2c1Sopenharmony_ci * you may not use this file except", "in compliance with the License.
59596a2c1Sopenharmony_ci * You may obtain a copy of the License at
69596a2c1Sopenharmony_ci *
79596a2c1Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89596a2c1Sopenharmony_ci *
99596a2c1Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109596a2c1Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119596a2c1Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129596a2c1Sopenharmony_ci * See the License for the specific language governing permissions and
139596a2c1Sopenharmony_ci * limitations under the License.
149596a2c1Sopenharmony_ci */
159596a2c1Sopenharmony_ci#ifndef OHOS_GLOBAL_I18N_UTILS_H
169596a2c1Sopenharmony_ci#define OHOS_GLOBAL_I18N_UTILS_H
179596a2c1Sopenharmony_ci
189596a2c1Sopenharmony_ci#include <regex>
199596a2c1Sopenharmony_ci#include <string>
209596a2c1Sopenharmony_ci#include <vector>
219596a2c1Sopenharmony_ci#include <unordered_set>
229596a2c1Sopenharmony_ci#include <unicode/locid.h>
239596a2c1Sopenharmony_ci#include "set"
249596a2c1Sopenharmony_ci#include "i18n_types.h"
259596a2c1Sopenharmony_ci
269596a2c1Sopenharmony_cinamespace OHOS {
279596a2c1Sopenharmony_cinamespace Global {
289596a2c1Sopenharmony_cinamespace I18n {
299596a2c1Sopenharmony_cistatic std::set<std::string> availableIDs;
309596a2c1Sopenharmony_ci
319596a2c1Sopenharmony_civoid Split(const std::string &src, const std::string &sep, std::vector<std::string> &dest);
329596a2c1Sopenharmony_civoid Merge(const std::vector<std::string>& src, const std::string& sep, std::string& dest);
339596a2c1Sopenharmony_cistd::string ReadSystemParameter(const char *paramKey, const int paramLength);
349596a2c1Sopenharmony_ciint32_t ConvertString2Int(const std::string &numberStr, int32_t& status);
359596a2c1Sopenharmony_cibool IsValidLocaleTag(icu::Locale &locale);
369596a2c1Sopenharmony_civoid GetAllValidLocalesTag(std::unordered_set<std::string>& allValidLocalesLanguageTag);
379596a2c1Sopenharmony_cibool CheckTzDataFilePath(const std::string &filePath);
389596a2c1Sopenharmony_cistd::string StrReplaceAll(const std::string& str,
399596a2c1Sopenharmony_ci    const std::string& target, const std::string& replace);
409596a2c1Sopenharmony_cistd::string GetISO3Language(const std::string& language);
419596a2c1Sopenharmony_cistd::string GetISO3Country(const std::string& country);
429596a2c1Sopenharmony_cistd::string trim(std::string &s);
439596a2c1Sopenharmony_cibool FileExist(const std::string& path);
449596a2c1Sopenharmony_cibool FileCopy(const std::string& srcPath, const std::string& dstPath);
459596a2c1Sopenharmony_cibool IsLegalPath(const std::string& path);
469596a2c1Sopenharmony_civoid Split(const std::string &src, const std::string &sep, std::vector<std::string> &dest);
479596a2c1Sopenharmony_cibool IsDirExist(const char *path);
489596a2c1Sopenharmony_cibool GetPseudoLocalizationEnforce();
499596a2c1Sopenharmony_cistd::string PseudoLocalizationProcessor(const std::string &input);
509596a2c1Sopenharmony_cistd::string PseudoLocalizationProcessor(const std::string &input, bool ifEnforce);
519596a2c1Sopenharmony_cibool CheckSystemPermission();
529596a2c1Sopenharmony_cisize_t ConvertBytesToSizeT(const char *byteArray);
539596a2c1Sopenharmony_cistd::set<std::string> GetTimeZoneAvailableIDs(I18nErrorCode &errorCode);
549596a2c1Sopenharmony_cibool RegexSearchNoExcept(const std::string& str, std::smatch& match, const std::regex& regex);
559596a2c1Sopenharmony_ci} // namespace I18n
569596a2c1Sopenharmony_ci} // namespace Global
579596a2c1Sopenharmony_ci} // namespace OHOS
589596a2c1Sopenharmony_ci#endif