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