• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 MAP_MSE_FOLDER_H
17 #define MAP_MSE_FOLDER_H
18 
19 #include <cstdint>
20 #include <memory>
21 #include <string>
22 #include <unordered_map>
23 #include "base_def.h"
24 #include "bt_def.h"
25 #include "log.h"
26 #include "map_mse_types.h"
27 
28 namespace OHOS {
29 namespace bluetooth {
30 class MapMseFolder {
31 public:
32     explicit MapMseFolder(const std::string &name);
33     explicit MapMseFolder(const std::string &name, MapMseFolder &parent);
34     virtual ~MapMseFolder();
35     MapMseFolder *SetFolder(const std::string &name);
36     MapMseFolder *SetSmsMmsFolder(const std::string &name);
37     MapMseFolder *SetEmailFolder(int folderId, const std::string &name);
38     MapMseFolder *SetImFolder(int folderId, const std::string &name);
39     MapMseFolder *GetRoot(void);
40     MapMseFolder *GetParent(void) const;
41     MapMseFolder *GetFolderByName(const std::string &name);
42     MapMseFolder *GetSubFolder(const std::string &folderName);
43     std::string GetData(uint16_t offset, uint16_t count) const;
44     std::string GetName(void) const;
45     std::string GetFullPath(void) const;
46     uint16_t GetSubFolderSize(void) const;
47     int GetFolderId(void) const;
48     bool IsIgnore(void) const;
49     void SetIgnore(const bool ignore);
50 
51 private:
52     std::string name_ = "";
53     MapMseFolder *parent_ = nullptr;
54     MapMseFolder *root_ = nullptr;
55     void SetFolderId(const int folderId);
56     int folderId_ = 0;
57     bool ignore_ = false;
58     std::unordered_map<std::string, std::shared_ptr<MapMseFolder>> subFolders_ {};
59     BT_DISALLOW_COPY_AND_ASSIGN(MapMseFolder);
60 };
61 }  // namespace bluetooth
62 }  // namespace OHOS
63 
64 #endif  // MAP_MSE_FOLDER_H
65