• 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 TRANS_EVENT_H
17 #define TRANS_EVENT_H
18 
19 #include "event_agent.h"
20 
21 namespace OHOS {
22 namespace Storage {
23 namespace DistributedFile {
24 class TransEvent : public Event {
25 public:
26     enum {
27         TRANS_SUCCESS = 0,
28         TRANS_FAILURE = 1
29     };
30 public:
TransEvent(int32_t err,std::string fname,int32_t num)31     TransEvent(int32_t err, std::string fname, int32_t num) : errorCode_(err), fileName_(fname), fileCount_(num) {}
TransEvent(int32_t err,std::string fname)32     TransEvent(int32_t err, std::string fname) : errorCode_(err), fileName_(fname) {}
TransEvent(int32_t err)33     TransEvent(int32_t err) : errorCode_(err) {}
~TransEvent()34     virtual ~TransEvent() {}
35     napi_value ToJsObject(napi_env env);
SetName(std::string & name)36     void SetName(std::string &name)
37     {
38         eventName_ = name;
39     }
GetName()40     std::string GetName()
41     {
42         return eventName_;
43     }
44 
45 private:
46     std::string eventName_ = "";
47     int32_t errorCode_ = TRANS_SUCCESS;
48     std::string fileName_ = "";
49     int32_t fileCount_ = 0;
50 };
51 } // namespace DistributedFile
52 } // namespace Storage
53 } // namespace OHOS
54 #endif // TRANS_EVENT_H