• 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 OHOS_MOCK_RESOURCE_MANAGER_RESOURCEMANAGER1_H
16 #define OHOS_MOCK_RESOURCE_MANAGER_RESOURCEMANAGER1_H
17 
18 #include "res_config.h"
19 #include <string>
20 #include <vector>
21 #include <map>
22 
23 #include "resource_manager.h"
24 
25 namespace OHOS {
26 namespace Global {
27 namespace Resource {
28 class ResourceManager2 : public ResourceManager {
29 public:
ResourceManager2()30     ResourceManager2(){};
~ResourceManager2()31     virtual ~ResourceManager2(){};
32 
33     virtual bool AddResource(const char *path) = 0;
34 
35     virtual RState UpdateResConfig(ResConfig &resConfig) = 0;
36 
37     virtual void GetResConfig(ResConfig &resConfig) = 0;
38 
39     virtual RState GetStringById(uint32_t id, std::string &outValue) = 0;
40     virtual void SetStringById(uint32_t id, std::string &outValue) = 0;
41 
42     virtual RState GetStringByName(const char *name, std::string &outValue) = 0;
43 
44     virtual RState GetStringFormatById(std::string &outValue, uint32_t id, ...) = 0;
45     virtual void SetStringFormatById(std::string &outValue, uint32_t id, ...) = 0;
46 
47     virtual RState GetStringFormatByName(std::string &outValue, const char *name, ...) = 0;
48 
49     virtual RState GetStringArrayById(uint32_t id, std::vector<std::string> &outValue) = 0;
50     virtual void SetStringArrayById(uint32_t id, std::vector<std::string> &outValue) = 0;
51 
52     virtual RState GetStringArrayByName(const char *name, std::vector<std::string> &outValue) = 0;
53 
54     virtual RState GetPatternById(uint32_t id, std::map<std::string, std::string> &outValue) = 0;
55     virtual void SetPatternById(uint32_t id, std::map<std::string, std::string> &outValue) = 0;
56 
57     virtual RState GetPatternByName(const char *name, std::map<std::string, std::string> &outValue) = 0;
58 
59     virtual RState GetPluralStringById(uint32_t id, int quantity, std::string &outValue) = 0;
60 
61     virtual RState GetPluralStringByName(const char *name, int quantity, std::string &outValue) = 0;
62 
63     virtual RState GetPluralStringByIdFormat(std::string &outValue, uint32_t id, int quantity, ...) = 0;
64 
65     virtual RState GetPluralStringByNameFormat(std::string &outValue, const char *name, int quantity, ...) = 0;
66 
67     virtual RState GetThemeById(uint32_t id, std::map<std::string, std::string> &outValue) = 0;
68     virtual void SetThemeById(uint32_t id, std::map<std::string, std::string> &outValue) = 0;
69 
70     virtual RState GetThemeByName(const char *name, std::map<std::string, std::string> &outValue) = 0;
71 
72     virtual RState GetBooleanById(uint32_t id, bool &outValue) = 0;
73 
74     virtual RState GetBooleanByName(const char *name, bool &outValue) = 0;
75 
76     virtual RState GetIntegerById(uint32_t id, int &outValue) = 0;
77 
78     virtual RState GetIntegerByName(const char *name, int &outValue) = 0;
79 
80     virtual RState GetFloatById(uint32_t id, float &outValue) = 0;
81 
82     virtual RState GetFloatByName(const char *name, float &outValue) = 0;
83 
84     virtual RState GetIntArrayById(uint32_t id, std::vector<int> &outValue) = 0;
85     virtual void SetIntArrayById(uint32_t id, std::vector<int> &outValue) = 0;
86 
87     virtual RState GetIntArrayByName(const char *name, std::vector<int> &outValue) = 0;
88 
89     virtual RState GetColorById(uint32_t id, uint32_t &outValue) = 0;
90     virtual void SetColorById(uint32_t id, uint32_t &outValue) = 0;
91 
92     virtual RState GetColorByName(const char *name, uint32_t &outValue) = 0;
93 
94     virtual RState GetProfileById(uint32_t id, std::string &outValue) = 0;
95 
96     virtual RState GetProfileByName(const char *name, std::string &outValue) = 0;
97 
98     virtual RState GetMediaById(uint32_t id, std::string &outValue) = 0;
99 
100     virtual RState GetMediaByName(const char *name, std::string &outValue) = 0;
101 };
102 
103 std::shared_ptr<ResourceManager2> CreateResourceManager2();
104 }  // namespace Resource
105 }  // namespace Global
106 }  // namespace OHOS
107 #endif