• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 #include "core/common/ai/data_detector_mgr.h"
16 
17 #include "core/common/ai/data_detector_default.h"
18 namespace OHOS::Ace {
GetInstance()19 DataDetectorMgr& DataDetectorMgr::GetInstance()
20 {
21     static DataDetectorMgr instance;
22     return instance;
23 }
24 
DataDetectorMgr()25 DataDetectorMgr::DataDetectorMgr() {}
26 
IsDataDetectorSupported()27 bool DataDetectorMgr::IsDataDetectorSupported()
28 {
29     return false;
30 }
31 
DataDetect(const TextDataDetectInfo & info,const TextDetectResultFunc & resultFunc)32 void DataDetectorMgr::DataDetect(const TextDataDetectInfo& info, const TextDetectResultFunc& resultFunc) {}
33 
AdjustCursorPosition(int32_t & caretPos,const std::string & content,TimeStamp & lastAiPosTimeStamp,const TimeStamp & lastClickTimeStamp)34 void DataDetectorMgr::AdjustCursorPosition(
35     int32_t& caretPos, const std::string& content, TimeStamp& lastAiPosTimeStamp, const TimeStamp& lastClickTimeStamp)
36 {
37     caretPos = GetCursorPosition(content, caretPos);
38 }
39 
AdjustWordSelection(int32_t & caretPos,const std::string & content,int32_t & start,int32_t & end)40 void DataDetectorMgr::AdjustWordSelection(int32_t& caretPos, const std::string& content, int32_t& start, int32_t& end)
41 {
42     auto ret = GetWordSelection(content, caretPos);
43     start = ret[0];
44     end = ret[1];
45 }
46 
GetWordSelection(const std::string & text,int8_t offset)47 std::vector<int8_t> DataDetectorMgr::GetWordSelection(const std::string& text, int8_t offset)
48 {
49     return std::vector<int8_t> { -1, -1 };
50 }
51 
GetCursorPosition(const std::string & text,int8_t offset)52 int8_t DataDetectorMgr::GetCursorPosition(const std::string& text, int8_t offset)
53 {
54     return -1;
55 }
56 } // namespace OHOS::Ace
57