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