• 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 "interfaces/inner_api/ace_kit/src/view/theme/theme_style_impl.h"
17 
18 namespace OHOS::Ace::Kit {
ThemeStyleImpl(const RefPtr<AceThemeStyle> & themeStyle)19 ThemeStyleImpl::ThemeStyleImpl(const RefPtr<AceThemeStyle>& themeStyle) : themeStyle_(themeStyle)
20 {}
21 
~ThemeStyleImpl()22 ThemeStyleImpl::~ThemeStyleImpl()
23 {
24     themeStyle_.Reset();
25 }
26 
GetColorAttr(const std::string & attr,const Ace::Color & errorVal,Ace::Color & retVal)27 void ThemeStyleImpl::GetColorAttr(const std::string& attr, const Ace::Color& errorVal, Ace::Color& retVal)
28 {
29     retVal = themeStyle_->GetAttr<Ace::Color>(attr, errorVal);
30 }
31 
GetDimensionAttr(const std::string & attr,const Ace::Dimension & errorVal,Ace::Dimension & retVal)32 void ThemeStyleImpl::GetDimensionAttr(const std::string& attr, const Ace::Dimension& errorVal, Ace::Dimension& retVal)
33 {
34     retVal = themeStyle_->GetAttr<Ace::Dimension>(attr, errorVal);
35 }
36 
GetIntAttr(const std::string & attr,const int32_t & errorVal,int32_t & retVal)37 void ThemeStyleImpl::GetIntAttr(const std::string& attr, const int32_t& errorVal, int32_t& retVal)
38 {
39     retVal = themeStyle_->GetAttr<int32_t>(attr, errorVal);
40 }
41 
GetUintAttr(const std::string & attr,const uint32_t & errorVal,uint32_t & retVal)42 void ThemeStyleImpl::GetUintAttr(const std::string& attr, const uint32_t& errorVal, uint32_t& retVal)
43 {
44     retVal = themeStyle_->GetAttr<uint32_t>(attr, errorVal);
45 }
46 
GetDoubleAttr(const std::string & attr,const double & errorVal,double & retVal)47 void ThemeStyleImpl::GetDoubleAttr(const std::string& attr, const double& errorVal, double& retVal)
48 {
49     retVal = themeStyle_->GetAttr<double>(attr, errorVal);
50 }
51 
GetStringAttr(const std::string & attr,const std::string & errorVal,std::string & retVal)52 void ThemeStyleImpl::GetStringAttr(const std::string& attr, const std::string& errorVal, std::string& retVal)
53 {
54     retVal = themeStyle_->GetAttr<std::string>(attr, errorVal);
55 }
56 
57 } // namespace OHOS::Ace::Kit
58