• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "i18n_timezone_impl.h"
17 #include "i18n_ffi.h"
18 namespace OHOS {
19 namespace Global {
20 namespace I18n {
FfiI18nTimeZone(std::unique_ptr<I18nTimeZone> timezone)21     FfiI18nTimeZone::FfiI18nTimeZone(std::unique_ptr<I18nTimeZone> timezone)
22     {
23         timezone_ = std::move(timezone);
24     }
25 
getID()26     char* FfiI18nTimeZone::getID()
27     {
28         return MallocCString(timezone_->GetID());
29     }
30 
getRawOffset()31     int32_t FfiI18nTimeZone::getRawOffset()
32     {
33         return timezone_->GetRawOffset();
34     }
35 
getOffset(double date)36     int32_t FfiI18nTimeZone::getOffset(double date)
37     {
38         return timezone_->GetOffset(date);
39     }
40 
getDisplayName()41     char* FfiI18nTimeZone::getDisplayName()
42     {
43         return MallocCString(timezone_->GetDisplayName());
44     }
45 
getDisplayName(std::string locale)46     char* FfiI18nTimeZone::getDisplayName(std::string locale)
47     {
48         return MallocCString(timezone_->GetDisplayName(locale));
49     }
50 
getDisplayName(std::string locale,bool isDST)51     char* FfiI18nTimeZone::getDisplayName(std::string locale, bool isDST)
52     {
53         return MallocCString(timezone_->GetDisplayName(locale, isDST));
54     }
55 
getDisplayName(bool isDST)56     char* FfiI18nTimeZone::getDisplayName(bool isDST)
57     {
58         return MallocCString(timezone_->GetDisplayName(isDST));
59     }
60 }  // namespace I18n
61 }  // namespace Global
62 }  // namespace OHOS
63