1 /* 2 * @Description: 3 * @Date: 2022-05-15 18:49:26 4 * @LastEditTime: 2022-05-15 19:49:06 5 * @FilePath: /wukong/report/include/input_info.h 6 * @author: lemon 7 */ 8 /* 9 * Copyright (c) 2022 Huawei Device Co., Ltd. 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 */ 22 23 #ifndef TEST_WUKONG_INPUF_INFO_H 24 #define TEST_WUKONG_INPUF_INFO_H 25 26 #include <iostream> 27 #include <map> 28 #include <string> 29 #include <vector> 30 31 #include "input_action.h" 32 #include "report.h" 33 #include "singleton.h" 34 35 namespace OHOS { 36 namespace WuKong { 37 class InputInfo final : public DelayedSingleton<InputInfo> { 38 DECLARE_DELAYED_SINGLETON(InputInfo) 39 friend class Report; 40 public: 41 void SetBundleName(const std::string &bundleName); 42 void SetAbilityName(const std::string &abilityName); 43 void SetInputType(InputType inputType); 44 void SetComponmentName(const std::string &componmentName); 45 void SetComponmentInputedTimes(int componmentInputedTimes); 46 void SetComponmentTotals(int componmentTotals); 47 private: 48 std::string GetBundleName(); 49 std::string GetAbilityName(); 50 std::string GetComponmentName(); 51 std::string GetComponmentInputedTimes(); 52 std::string GetComponmentTotals(); 53 void reset(); 54 /* 55 * @brief update current conponment statistics 56 * @param componmentStatistics in order mean componment type, input times, total componment 57 * @return 58 */ 59 std::string InputTypeToString(); 60 61 std::string bundleName_; 62 std::string abilityName_; 63 InputType inputType_; 64 std::string componmentName_; 65 int componmentInputedTimes_; 66 int componmentTotals_; 67 }; 68 } // namespace WuKong 69 } // namespace OHOS 70 71 #endif