1 /*
2  * Copyright (c) 2021-2022 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_ACE_FRAMEWORKS_CORE_COMPONENTS_PLUGIN_RESOURCE_PLUGIN_REQUEST_DATA_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PLUGIN_RESOURCE_PLUGIN_REQUEST_DATA_H
18 
19 #include <sstream>
20 #include <string>
21 
22 #include "base/geometry/dimension.h"
23 #include "base/utils/utils.h"
24 
25 namespace OHOS::Ace {
26 struct RequestPluginInfo {
27     int32_t id = 0;
28     std::string pluginName;
29     std::string bundleName;
30     std::string abilityName;
31     std::string moduleName;
32     std::string source;
33     std::string moduleResPath;
34     int32_t dimension = -1;
35     bool allowUpdate = true;
36     Dimension width;
37     Dimension height;
38     uint64_t index = GetNanoseconds();
39 
ToStringRequestPluginInfo40     std::string ToString() const
41     {
42         std::stringstream paramStream;
43         paramStream << bundleName << abilityName << moduleName << pluginName << source << dimension << index;
44         return paramStream.str();
45     }
46 
47     bool operator==(const RequestPluginInfo& pluginInfo) const
48     {
49         return id == pluginInfo.id && pluginName == pluginInfo.pluginName && bundleName == pluginInfo.bundleName &&
50                abilityName == pluginInfo.abilityName && moduleName == pluginInfo.moduleName &&
51                source == pluginInfo.source && moduleResPath == pluginInfo.moduleResPath &&
52                dimension == pluginInfo.dimension && allowUpdate == pluginInfo.allowUpdate &&
53                width == pluginInfo.width && height == pluginInfo.height && index == pluginInfo.index;
54     }
55 };
56 } // namespace OHOS::Ace
57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PLUGIN_RESOURCE_PLUGIN_REQUEST_DATA_H
58