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
GetAIEntityMenu(TextDataDetectResult & textDataDetectResult)32 void DataDetectorMgr::GetAIEntityMenu(TextDataDetectResult& textDataDetectResult) {}
33
DataDetect(const TextDataDetectInfo & info,const TextDetectResultFunc & resultFunc)34 void DataDetectorMgr::DataDetect(const TextDataDetectInfo& info, const TextDetectResultFunc& resultFunc) {}
35
AdjustCursorPosition(int32_t & caretPos,const std::string & content,TimeStamp & lastAiPosTimeStamp,const TimeStamp & lastClickTimeStamp)36 void DataDetectorMgr::AdjustCursorPosition(
37 int32_t& caretPos, const std::string& content, TimeStamp& lastAiPosTimeStamp, const TimeStamp& lastClickTimeStamp)
38 {
39 caretPos = GetCursorPosition(content, caretPos);
40 }
41
AdjustWordSelection(int32_t & caretPos,const std::string & content,int32_t & start,int32_t & end)42 void DataDetectorMgr::AdjustWordSelection(int32_t& caretPos, const std::string& content, int32_t& start, int32_t& end)
43 {
44 auto ret = GetWordSelection(content, caretPos);
45 start = ret[0];
46 end = ret[1];
47 }
48
GetWordSelection(const std::string & text,int8_t offset)49 std::vector<int8_t> DataDetectorMgr::GetWordSelection(const std::string& text, int8_t offset)
50 {
51 return std::vector<int8_t> { -1, -1 };
52 }
53
GetCursorPosition(const std::string & text,int8_t offset)54 int8_t DataDetectorMgr::GetCursorPosition(const std::string& text, int8_t offset)
55 {
56 return -1;
57 }
58 } // namespace OHOS::Ace
59