• 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 #ifndef STORAGE_SERVICES_FILE_INFO_H
16 #define STORAGE_SERVICES_FILE_INFO_H
17 
18 #include <cstdint>
19 #include <string>
20 #include "parcel.h"
21 
22 namespace OHOS {
23 namespace FileManagerService {
24 class FileInfo : public Parcelable {
25 public:
FileInfo(const std::string & name,const std::string & path,const std::string & type)26     FileInfo(const std::string &name, const std::string &path, const std::string &type) : path_(path),
27         name_(name), type_(type) {}
28     FileInfo() = default;
29     ~FileInfo() = default;
30 
SetName(std::string & name)31     void SetName(std::string &name)
32     {
33         name_ = name;
34     }
SetPath(std::string & path)35     void SetPath(std::string &path)
36     {
37         path_ = path;
38     }
SetType(std::string & type)39     void SetType(std::string &type)
40     {
41         type_ = type;
42     }
SetSize(int64_t size)43     void SetSize(int64_t size)
44     {
45         size_ = size;
46     }
SetAddedTime(int64_t time)47     void SetAddedTime(int64_t time)
48     {
49         addedTime_ = time;
50     }
SetModifiedTime(int64_t time)51     void SetModifiedTime(int64_t time)
52     {
53         modifiedTime_ =  time;
54     }
GetName()55     std::string GetName() const
56     {
57         return name_;
58     }
GetPath()59     std::string GetPath() const
60     {
61         return path_;
62     }
GetType()63     std::string GetType() const
64     {
65         return type_;
66     }
GetSize()67     int64_t GetSize() const
68     {
69         return size_;
70     }
GetAddedTime()71     int64_t GetAddedTime() const
72     {
73         return addedTime_;
74     }
GetModifiedTime()75     int64_t GetModifiedTime() const
76     {
77         return modifiedTime_;
78     }
79     bool Marshalling(Parcel &parcel) const override;
80     static FileInfo* Unmarshalling(Parcel &parcel);
81 private:
82     std::string path_;
83     std::string name_;
84     std::string type_;
85     int64_t size_ {0};
86     int64_t addedTime_ {0};
87     int64_t modifiedTime_ {0};
88 };
89 } // namespace FileManagerService
90 } // namespace OHOS
91 #endif // STORAGE_SERVICES_FILE_INFO_H