1 /* 2 * Copyright (c) 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 INTERFACES_CJ_INCLUDE_I18N_PHONE_NUMBER_FORMAT_IMPL_H 17 #define INTERFACES_CJ_INCLUDE_I18N_PHONE_NUMBER_FORMAT_IMPL_H 18 19 #include <string> 20 #include "ffi_remote_data.h" 21 #include "i18n_ffi.h" 22 #include "phone_number_format.h" 23 24 namespace OHOS { 25 namespace Global { 26 namespace I18n { 27 class FfiI18nPhoneNumberFormat : public OHOS::FFI::FFIData { 28 DECL_TYPE(FfiI18nPhoneNumberFormat, FFIData) 29 public: 30 explicit FfiI18nPhoneNumberFormat(std::unique_ptr<OHOS::Global::I18n::PhoneNumberFormat> phoneNumberFormat); 31 ~FfiI18nPhoneNumberFormat() = default; 32 char* format(std::string number); 33 bool isValidNumber(std::string number); 34 char* getLocationName(std::string number, std::string locale); 35 private: 36 std::unique_ptr<OHOS::Global::I18n::PhoneNumberFormat> phoneNumberFormat_ = nullptr; 37 friend class OHOS::FFI::RuntimeType; 38 friend class OHOS::FFI::TypeBase; 39 }; 40 } // namespace I18n 41 } // namespace Global 42 } // namespace OHOS 43 44 #endif // INTERFACES_CJ_INCLUDE_I18N_CALENDAR_IMPL_H_ 45