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 FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_SUPPORT_MAPPER_H 17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_SUPPORT_MAPPER_H 18 19 #include <map> 20 #include <string> 21 #include "singleton.h" 22 23 namespace OHOS { 24 namespace EventFwk { 25 class CommonEventSupportMapper : public DelayedSingleton<CommonEventSupportMapper> { 26 public: 27 CommonEventSupportMapper(); 28 29 ~CommonEventSupportMapper() = default; 30 31 /** 32 * Inits mapper. 33 * 34 */ 35 void Init(); 36 37 /** 38 * Gets mapped support. 39 * 40 * @param support the input event name 41 * @param mappedSupport the output event name 42 * @return Returns true if successful; false otherwise. 43 */ 44 bool GetMappedSupport(const std::string &support, std::string &mappedSupport); 45 private: 46 std::map<std::string, std::string> map_; 47 }; 48 } // namespace EventFwk 49 } // namespace OHOS 50 51 #endif // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_SUPPORT_MAPPER_H