1 /* 2 * Copyright (c) 2023 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_PROPERTY_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_PROPERTY_H 18 19 namespace OHOS { 20 namespace AppExecFwk { 21 #define BMS_DEFINE_PROPERTY_MEMBER_FILED(funcName, memberFiled, attribute, type) \ 22 void Set##funcName(const type& defaultValue) \ 23 { \ 24 memberFiled->attribute = defaultValue; \ 25 } \ 26 type Get##funcName() const \ 27 { \ 28 return memberFiled->attribute; \ 29 } 30 31 #define BMS_DEFINE_PROPERTY_MEMBER_FILED_SET(funcName, memberFiled, attribute, type) \ 32 void Set##funcName(const type& defaultValue) \ 33 { \ 34 memberFiled->attribute = defaultValue; \ 35 } 36 37 #define BMS_DEFINE_PROPERTY_MEMBER_FILED_GET(funcName, memberFiled, attribute, type) \ 38 type Get##funcName() const \ 39 { \ 40 return memberFiled->attribute; \ 41 } 42 43 #define BMS_DEFINE_PROPERTY(funcName, attribute, type) \ 44 void Set##funcName(const type& defaultValue) \ 45 { \ 46 attribute = defaultValue; \ 47 } \ 48 type Get##funcName() const \ 49 { \ 50 return attribute; \ 51 } 52 53 #define BMS_DEFINE_PROPERTY_SET(funcName, attribute, type) \ 54 void Set##funcName(const type& defaultValue) \ 55 { \ 56 attribute = defaultValue; \ 57 } 58 59 #define BMS_DEFINE_PROPERTY_GET(funcName, attribute, type) \ 60 type Get##funcName() const \ 61 { \ 62 return attribute; \ 63 } 64 } // namespace AppExecFwk 65 } // namespace OHOS 66 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_PROPERTY_H