1 /* 2 * Copyright (c) 2021 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 OHOS_ABILITY_RUNTIME_ABILITY_START_SETTING_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_START_SETTING_H 18 19 #include <map> 20 #include <set> 21 #include <string> 22 #include <memory> 23 #include "parcel.h" 24 25 namespace OHOS { 26 namespace AAFwk { 27 class AbilityStartSetting final : public Parcelable, public std::enable_shared_from_this<AbilityStartSetting> { 28 public: 29 static const std::string BOUNDS_KEY; 30 static const std::string WINDOW_DISPLAY_ID_KEY; 31 static const std::string WINDOW_MODE_KEY; 32 static const std::string DEFAULT_RECOVERY_KEY; 33 static const std::string IS_START_BY_SCB_KEY; 34 35 /** 36 * @brief Construct copy function. 37 * @param other indicates instance of abilitystartsetting object 38 * @return none. 39 */ 40 AbilityStartSetting(const AbilityStartSetting &other); 41 /** 42 * @brief Overload assignment operation. 43 * @param other indicates instance of abilitystartsetting object. 44 * @return Returns current instance of abilitystartsetting object. 45 */ 46 AbilityStartSetting &operator=(const AbilityStartSetting &other); 47 48 virtual ~AbilityStartSetting() = default; 49 50 /** 51 * @brief Obtains the names of all the attributes that have been added to this AbilityStartSetting object. 52 * 53 * @return Returns the set of attribute names included in this AbilityStartSetting object. 54 */ 55 std::set<std::string> GetPropertiesKey(); 56 57 /** 58 * @brief Obtains the names of all the attributes that have been added to this AbilityStartSetting object. 59 * 60 * @return Returns the set of attribute names included in this AbilityStartSetting object. 61 */ 62 static std::shared_ptr<AbilityStartSetting> GetEmptySetting(); 63 64 /** 65 * @brief Checks whether this AbilityStartSetting object is empty. 66 * 67 * @return Returns true if this AbilityStartSetting object is empty and animatorOption is null; returns false 68 * otherwise. 69 */ 70 bool IsEmpty(); 71 /** 72 * @brief Sets the names of all the attributes of the AbilityStartSetting object. 73 * 74 * @param key Indicates the name of the key. 75 * @param value The window display mode of the values. 76 */ 77 void AddProperty(const std::string &key, const std::string &value); 78 79 /** 80 * @brief Gets the name of the attributes of the AbilityStartSetting object. 81 * 82 * @param key Indicates the name of the key. 83 * @return Returns value Indicates the value of the attributes of the AbilityStartSetting object 84 */ 85 std::string GetProperty(const std::string &key); 86 87 /* 88 * @brief Write the data of AbilityStartSetting to the file stream 89 * @param parcel indicates write the data of AbilityStartSetting to the file stream through parcel 90 * @return bool 91 */ 92 bool Marshalling(Parcel &parcel) const; 93 94 /** 95 * @brief Reading file stream through parcel to generate AbilityStartSetting instance 96 * @param parcel indicates reading file stream through parcel to generate AbilityStartSetting instance 97 * @return AbilityStartSetting shared_ptr 98 */ 99 static AbilityStartSetting *Unmarshalling(Parcel &parcel); 100 101 protected: 102 AbilityStartSetting() = default; 103 friend std::shared_ptr<AbilityStartSetting> AbilityStartSettingCreator(); 104 105 private: 106 std::map<std::string, std::string> abilityStarKey_; 107 }; 108 } // namespace AAFwk 109 } // namespace OHOS 110 #endif // OHOS_ABILITY_RUNTIME_ABILITY_START_SETTING_H 111