Refactor AUL metadata plugin parser
[platform/core/appfw/aul-1.git] / parser / metadata / common / app_event_args.hh
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef COMMON_APP_EVENT_ARGS_HH_
18 #define COMMON_APP_EVENT_ARGS_HH_
19
20 #include <list>
21 #include <memory>
22 #include <string>
23
24 #include "common/event_type.hh"
25 #include "common/metadata.hh"
26
27 namespace plugin {
28
29 class AppEventArgs {
30  public:
31   AppEventArgs(std::string appid, std::string pkgid, EventType event_type)
32     : appid_(std::move(appid)),
33       pkgid_(std::move(pkgid)),
34       event_type_(event_type) {
35   }
36
37   virtual ~AppEventArgs() = default;
38
39   const std::string& GetAppId() {
40     return appid_;
41   }
42
43   const std::string& GetPkgId() {
44     return pkgid_;
45   }
46
47   EventType GetEventType() const {
48     return event_type_;
49   }
50
51   const std::list<std::unique_ptr<Metadata>>& GetMetadataList() {
52     return list_;
53   }
54
55   void AddMetadata(std::unique_ptr<Metadata> metadata) {
56     list_.push_back(std::move(metadata));
57   }
58
59  private:
60   std::string appid_;
61   std::string pkgid_;
62   EventType event_type_;
63   std::list<std::unique_ptr<Metadata>> list_;
64 };
65
66 }  // namespace plugin
67
68 #endif  // COMMON_APP_EVENT_ARGS_HH_