1 /* 2 * Copyright (c) 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 #include "input_factory.h" 17 18 #include "appswitch_input.h" 19 #include "component_input.h" 20 #include "keyboard_input.h" 21 #include "swap_input.h" 22 #include "mouse_input.h" 23 #include "hardkey_input.h" 24 #include "touch_input.h" 25 #include "record_input.h" 26 27 namespace OHOS { 28 namespace WuKong { GetInputAction(InputType type)29std::shared_ptr<InputAction> InputFactory::GetInputAction(InputType type) 30 { 31 std::shared_ptr<InputAction> input_action = nullptr; 32 switch (type) { 33 case INPUTTYPE_TOUCHINPUT: { 34 input_action = std::make_shared<TouchInput>(); 35 break; 36 } 37 case INPUTTYPE_SWAPINPUT: { 38 input_action = std::make_shared<SwapInput>(); 39 break; 40 } 41 case INPUTTYPE_MOUSEINPUT: { 42 input_action = std::make_shared<MouseInput>(); 43 break; 44 } 45 case INPUTTYPE_KEYBOARDINPUT: { 46 input_action = std::make_shared<KeyboardInput>(); 47 break; 48 } 49 case INPUTTYPE_APPSWITCHINPUT: { 50 input_action = std::make_shared<AppswitchInput>(); 51 break; 52 } 53 case INPUTTYPE_ELEMENTINPUT: { 54 input_action = std::make_shared<ComponentInput>(); 55 break; 56 } 57 case INPUTTYPE_HARDKEYINPUT: { 58 input_action = std::make_shared<HardkeyInput>(); 59 break; 60 } 61 case INPUTTYPE_RECORDINPUT: { 62 input_action = std::make_shared<RecordInput>(); 63 break; 64 } 65 case INPUTTYPE_REPPLAYINPUT: { 66 input_action = std::make_shared<RecordInput>(); 67 break; 68 } 69 default: { 70 break; 71 } 72 } 73 return input_action; 74 } 75 } // namespace WuKong 76 } // namespace OHOS 77