Remove the cache when language change event occurs
[platform/core/appfw/pkgmgr-info.git] / src / server / request_handler / abstract_request_handler.hh
1 // Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVER_ABSTRACT_REQUEST_HANDLER_HH_
6 #define SERVER_ABSTRACT_REQUEST_HANDLER_HH_
7
8 #include "abstract_parcelable.hh"
9
10 #include <string>
11
12 #include <sys/types.h>
13
14 #include <parcel.hh>
15
16 namespace pkgmgr_server {
17 namespace request_handler {
18
19 #ifndef EXPORT_API
20 #define EXPORT_API __attribute__((visibility("default")))
21 #endif
22
23 class EXPORT_API AbstractRequestHandler {
24  public:
25   virtual ~AbstractRequestHandler() = default;
26   virtual bool HandleRequest(unsigned char* data, size_t size,
27       const std::string& locale) = 0;
28
29   virtual tizen_base::Parcel ExtractResult();
30
31   virtual void PreExec();
32   virtual void PostExec();
33   void SetPID(pid_t pid);
34   void SetUID(uid_t uid);
35
36  protected:
37   std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> result_;
38   pid_t GetPID();
39   uid_t GetUID();
40
41  private:
42   pid_t pid_ = -1;
43   uid_t uid_ = 0;
44 };
45
46 }  // namespace request_handler
47 }  // namespace pkgmgr_server
48
49 #endif  // SERVER_ABSTRACT_REQUEST_HANDLER_HH_