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 #include "rotate_input.h" 27 28 namespace OHOS { 29 namespace WuKong { GetInputAction(InputType type)30std::shared_ptr<InputAction> InputFactory::GetInputAction(InputType type) 31 { 32 std::shared_ptr<InputAction> input_action = nullptr; 33 switch (type) { 34 case INPUTTYPE_TOUCHINPUT: { 35 input_action = std::make_shared<TouchInput>(); 36 break; 37 } 38 case INPUTTYPE_SWAPINPUT: { 39 input_action = std::make_shared<SwapInput>(); 40 break; 41 } 42 case INPUTTYPE_MOUSEINPUT: { 43 input_action = std::make_shared<MouseInput>(); 44 break; 45 } 46 case INPUTTYPE_KEYBOARDINPUT: { 47 input_action = std::make_shared<KeyboardInput>(); 48 break; 49 } 50 case INPUTTYPE_APPSWITCHINPUT: { 51 input_action = std::make_shared<AppswitchInput>(); 52 break; 53 } 54 case INPUTTYPE_ELEMENTINPUT: { 55 input_action = std::make_shared<ComponentInput>(); 56 break; 57 } 58 case INPUTTYPE_HARDKEYINPUT: { 59 input_action = std::make_shared<HardkeyInput>(); 60 break; 61 } 62 case INPUTTYPE_RECORDINPUT: { 63 input_action = std::make_shared<RecordInput>(); 64 break; 65 } 66 case INPUTTYPE_REPPLAYINPUT: { 67 input_action = std::make_shared<RecordInput>(); 68 break; 69 } 70 case INPUTTYPE_ROTATEINPUT: { 71 input_action = std::make_shared<RotateInput>(); 72 break; 73 } 74 default: { 75 break; 76 } 77 } 78 return input_action; 79 } 80 } // namespace WuKong 81 } // namespace OHOS 82