• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cinttypes>
17 #include "accessibility_element_info.h"
18 #include "hilog_wrapper.h"
19 
20 namespace OHOS {
21 namespace Accessibility {
SetComponentId(const int64_t componentId)22 void AccessibilityElementInfo::SetComponentId(const int64_t componentId)
23 {
24     elementId_ = componentId;
25 }
26 
GetChildId(const int32_t index) const27 int64_t AccessibilityElementInfo::GetChildId(const int32_t index) const
28 {
29     if (index >= childCount_ || index < 0 || index >= static_cast<int32_t>(childNodeIds_.size())) {
30         HILOG_ERROR("index[%{public}d] is invalid", index);
31         return -1;
32     }
33     return childNodeIds_[index];
34 }
35 
GetChildCount() const36 int32_t AccessibilityElementInfo::GetChildCount() const
37 {
38     return childCount_;
39 }
40 
GetChildIds() const41 const std::vector<int64_t> &AccessibilityElementInfo::GetChildIds() const
42 {
43     return childNodeIds_;
44 }
45 
AddChild(const int64_t childId)46 void AccessibilityElementInfo::AddChild(const int64_t childId)
47 {
48     for (int32_t i = 0; i < childCount_; i++) {
49         if (childNodeIds_[i] == childId) {
50             HILOG_ERROR("childId[%{public}" PRId64 "] is exited", childId);
51             return;
52         }
53     }
54     childCount_++;
55     childNodeIds_.push_back(childId);
56 }
57 
RemoveChild(const int64_t childId)58 bool AccessibilityElementInfo::RemoveChild(const int64_t childId)
59 {
60     for (auto iter = childNodeIds_.begin(); iter != childNodeIds_.end(); iter++) {
61         if (*iter == childId) {
62             iter = childNodeIds_.erase(iter);
63             childCount_--;
64             return true;
65         }
66     }
67     HILOG_ERROR("Not find childId[%{public}" PRId64 "]", childId);
68     return false;
69 }
70 
GetActionList() const71 const std::vector<AccessibleAction> &AccessibilityElementInfo::GetActionList() const
72 {
73     return operations_;
74 }
75 
AddAction(AccessibleAction & action)76 void AccessibilityElementInfo::AddAction(AccessibleAction &action)
77 {
78     operations_.push_back(action);
79 }
80 
DeleteAction(AccessibleAction & action)81 void AccessibilityElementInfo::DeleteAction(AccessibleAction &action)
82 {
83     for (auto iter = operations_.begin(); iter != operations_.end(); iter++) {
84         if (iter->GetActionType() == action.GetActionType()) {
85             iter = operations_.erase(iter);
86             return;
87         }
88     }
89     HILOG_ERROR("Not find actionType[%{public}d]", action.GetActionType());
90 }
91 
DeleteAction(ActionType & actionType)92 bool AccessibilityElementInfo::DeleteAction(ActionType &actionType)
93 {
94     for (auto iter = operations_.begin(); iter != operations_.end(); iter++) {
95         if (iter->GetActionType() == actionType) {
96             iter = operations_.erase(iter);
97             return true;
98         }
99     }
100     HILOG_ERROR("Not find actionType[%{public}d]", actionType);
101     return false;
102 }
103 
DeleteAllActions()104 void AccessibilityElementInfo::DeleteAllActions()
105 {
106     operations_.clear();
107 }
108 
SetTextLengthLimit(const int32_t max)109 void AccessibilityElementInfo::SetTextLengthLimit(const int32_t max)
110 {
111     textLengthLimit_ = max;
112 }
113 
GetTextLengthLimit() const114 int32_t AccessibilityElementInfo::GetTextLengthLimit() const
115 {
116     return textLengthLimit_;
117 }
118 
GetWindowId() const119 int32_t AccessibilityElementInfo::GetWindowId() const
120 {
121     return windowId_;
122 }
123 
SetWindowId(const int32_t windowId)124 void AccessibilityElementInfo::SetWindowId(const int32_t windowId)
125 {
126     windowId_ = windowId;
127 }
128 
GetParentNodeId() const129 int64_t AccessibilityElementInfo::GetParentNodeId() const
130 {
131     return parentId_;
132 }
133 
SetParent(const int64_t parentId)134 void AccessibilityElementInfo::SetParent(const int64_t parentId)
135 {
136     parentId_ = parentId;
137 }
138 
GetRectInScreen() const139 const Rect &AccessibilityElementInfo::GetRectInScreen() const
140 {
141     return bounds_;
142 }
143 
SetRectInScreen(Rect & bounds)144 void AccessibilityElementInfo::SetRectInScreen(Rect &bounds)
145 {
146     bounds_.SetLeftTopScreenPostion(bounds.GetLeftTopXScreenPostion(), bounds.GetLeftTopYScreenPostion());
147     bounds_.SetRightBottomScreenPostion(bounds.GetRightBottomXScreenPostion(), bounds.GetRightBottomYScreenPostion());
148 }
149 
IsCheckable() const150 bool AccessibilityElementInfo::IsCheckable() const
151 {
152     return checkable_;
153 }
154 
SetCheckable(const bool checkable)155 void AccessibilityElementInfo::SetCheckable(const bool checkable)
156 {
157     checkable_ = checkable;
158 }
159 
IsChecked() const160 bool AccessibilityElementInfo::IsChecked() const
161 {
162     return checked_;
163 }
164 
SetChecked(const bool checked)165 void AccessibilityElementInfo::SetChecked(const bool checked)
166 {
167     checked_ = checked;
168 }
169 
IsFocusable() const170 bool AccessibilityElementInfo::IsFocusable() const
171 {
172     return focusable_;
173 }
174 
SetFocusable(const bool focusable)175 void AccessibilityElementInfo::SetFocusable(const bool focusable)
176 {
177     focusable_ = focusable;
178 }
179 
IsFocused() const180 bool AccessibilityElementInfo::IsFocused() const
181 {
182     return focused_;
183 }
184 
SetFocused(const bool focused)185 void AccessibilityElementInfo::SetFocused(const bool focused)
186 {
187     focused_ = focused;
188 }
189 
IsVisible() const190 bool AccessibilityElementInfo::IsVisible() const
191 {
192     return visible_;
193 }
194 
SetVisible(const bool visible)195 void AccessibilityElementInfo::SetVisible(const bool visible)
196 {
197     visible_ = visible;
198 }
199 
HasAccessibilityFocus() const200 bool AccessibilityElementInfo::HasAccessibilityFocus() const
201 {
202     return accessibilityFocused_;
203 }
204 
SetAccessibilityFocus(const bool focused)205 void AccessibilityElementInfo::SetAccessibilityFocus(const bool focused)
206 {
207     accessibilityFocused_ = focused;
208 }
209 
IsSelected() const210 bool AccessibilityElementInfo::IsSelected() const
211 {
212     return selected_;
213 }
214 
SetSelected(const bool selected)215 void AccessibilityElementInfo::SetSelected(const bool selected)
216 {
217     selected_ = selected;
218 }
219 
IsClickable() const220 bool AccessibilityElementInfo::IsClickable() const
221 {
222     return clickable_;
223 }
224 
SetClickable(const bool clickable)225 void AccessibilityElementInfo::SetClickable(const bool clickable)
226 {
227     clickable_ = clickable;
228 }
229 
IsLongClickable() const230 bool AccessibilityElementInfo::IsLongClickable() const
231 {
232     return longClickable_;
233 }
234 
SetLongClickable(const bool longClickable)235 void AccessibilityElementInfo::SetLongClickable(const bool longClickable)
236 {
237     longClickable_ = longClickable;
238 }
239 
IsEnabled() const240 bool AccessibilityElementInfo::IsEnabled() const
241 {
242     return enable_;
243 }
244 
SetEnabled(const bool enabled)245 void AccessibilityElementInfo::SetEnabled(const bool enabled)
246 {
247     enable_ = enabled;
248 }
249 
IsPassword() const250 bool AccessibilityElementInfo::IsPassword() const
251 {
252     return isPassword_;
253 }
254 
SetPassword(const bool type)255 void AccessibilityElementInfo::SetPassword(const bool type)
256 {
257     isPassword_ = type;
258 }
259 
IsScrollable() const260 bool AccessibilityElementInfo::IsScrollable() const
261 {
262     return scrollable_;
263 }
264 
SetScrollable(const bool scrollable)265 void AccessibilityElementInfo::SetScrollable(const bool scrollable)
266 {
267     scrollable_ = scrollable;
268 }
269 
GetCurrentIndex() const270 int32_t AccessibilityElementInfo::GetCurrentIndex() const
271 {
272     return currentIndex_;
273 }
274 
SetCurrentIndex(const int32_t index)275 void AccessibilityElementInfo::SetCurrentIndex(const int32_t index)
276 {
277     currentIndex_ = index;
278 }
279 
GetBeginIndex() const280 int32_t AccessibilityElementInfo::GetBeginIndex() const
281 {
282     return beginIndex_;
283 }
284 
SetBeginIndex(const int32_t index)285 void AccessibilityElementInfo::SetBeginIndex(const int32_t index)
286 {
287     beginIndex_ = index;
288 }
289 
GetEndIndex() const290 int32_t AccessibilityElementInfo::GetEndIndex() const
291 {
292     return endIndex_;
293 }
294 
SetEndIndex(const int32_t index)295 void AccessibilityElementInfo::SetEndIndex(const int32_t index)
296 {
297     endIndex_ = index;
298 }
299 
GetInputType() const300 int32_t AccessibilityElementInfo::GetInputType() const
301 {
302     return inputType_;
303 }
304 
SetInputType(const int32_t inputType)305 void AccessibilityElementInfo::SetInputType(const int32_t inputType)
306 {
307     inputType_ = inputType;
308 }
309 
SetValidElement(const bool valid)310 void AccessibilityElementInfo::SetValidElement(const bool valid)
311 {
312     validElement_ = valid;
313 }
314 
SetInspectorKey(const std::string & key)315 void AccessibilityElementInfo::SetInspectorKey(const std::string &key)
316 {
317     inspectorKey_ = key;
318 }
319 
GetInspectorKey() const320 const std::string &AccessibilityElementInfo::GetInspectorKey() const
321 {
322     return inspectorKey_;
323 }
324 
SetPagePath(const std::string & path)325 void AccessibilityElementInfo::SetPagePath(const std::string &path)
326 {
327     pagePath_ = path;
328 }
329 
GetPagePath() const330 const std::string &AccessibilityElementInfo::GetPagePath() const
331 {
332     return pagePath_;
333 }
334 
IsValidElement() const335 bool AccessibilityElementInfo::IsValidElement() const
336 {
337     return validElement_;
338 }
339 
IsEditable() const340 bool AccessibilityElementInfo::IsEditable() const
341 {
342     return editable_;
343 }
344 
SetEditable(const bool editable)345 void AccessibilityElementInfo::SetEditable(const bool editable)
346 {
347     editable_ = editable;
348 }
349 
IsPluraLineSupported() const350 bool AccessibilityElementInfo::IsPluraLineSupported() const
351 {
352     return multiLine_;
353 }
354 
SetPluraLineSupported(const bool multiLine)355 void AccessibilityElementInfo::SetPluraLineSupported(const bool multiLine)
356 {
357     multiLine_ = multiLine;
358 }
359 
IsPopupSupported() const360 bool AccessibilityElementInfo::IsPopupSupported() const
361 {
362     return popupSupported_;
363 }
364 
SetPopupSupported(const bool supportPopup)365 void AccessibilityElementInfo::SetPopupSupported(const bool supportPopup)
366 {
367     popupSupported_ = supportPopup;
368 }
369 
IsDeletable() const370 bool AccessibilityElementInfo::IsDeletable() const
371 {
372     return deletable_;
373 }
374 
SetDeletable(const bool deletable)375 void AccessibilityElementInfo::SetDeletable(const bool deletable)
376 {
377     deletable_ = deletable;
378 }
379 
IsEssential() const380 bool AccessibilityElementInfo::IsEssential() const
381 {
382     return isEssential_;
383 }
384 
SetEssential(const bool essential)385 void AccessibilityElementInfo::SetEssential(const bool essential)
386 {
387     isEssential_ = essential;
388 }
389 
IsGivingHint() const390 bool AccessibilityElementInfo::IsGivingHint() const
391 {
392     return hint_;
393 }
SetHinting(const bool hinting)394 void AccessibilityElementInfo::SetHinting(const bool hinting)
395 {
396     hint_ = hinting;
397 }
398 
GetBundleName() const399 const std::string &AccessibilityElementInfo::GetBundleName() const
400 {
401     return bundleName_;
402 }
403 
SetBundleName(const std::string & bundleName)404 void AccessibilityElementInfo::SetBundleName(const std::string &bundleName)
405 {
406     bundleName_ = bundleName;
407 }
408 
GetComponentType() const409 const std::string &AccessibilityElementInfo::GetComponentType() const
410 {
411     return componentType_;
412 }
413 
SetComponentType(const std::string & className)414 void AccessibilityElementInfo::SetComponentType(const std::string &className)
415 {
416     componentType_ = className;
417 }
418 
GetContent() const419 const std::string &AccessibilityElementInfo::GetContent() const
420 {
421     return text_;
422 }
423 
SetContent(const std::string & text)424 void AccessibilityElementInfo::SetContent(const std::string &text)
425 {
426     text_ = text;
427 }
428 
SetSelectedBegin(const int32_t start)429 void AccessibilityElementInfo::SetSelectedBegin(const int32_t start)
430 {
431     beginSelected_ = start;
432 }
433 
GetSelectedBegin() const434 int32_t AccessibilityElementInfo::GetSelectedBegin() const
435 {
436     return beginSelected_;
437 }
438 
SetSelectedEnd(const int32_t end)439 void AccessibilityElementInfo::SetSelectedEnd(const int32_t end)
440 {
441     endSelected_ = end;
442 }
443 
GetSelectedEnd() const444 int32_t AccessibilityElementInfo::GetSelectedEnd() const
445 {
446     return endSelected_;
447 }
448 
GetHint() const449 const std::string &AccessibilityElementInfo::GetHint() const
450 {
451     return hintText_;
452 }
453 
SetHint(const std::string & hintText)454 void AccessibilityElementInfo::SetHint(const std::string &hintText)
455 {
456     hintText_ = hintText;
457 }
458 
GetDescriptionInfo() const459 const std::string &AccessibilityElementInfo::GetDescriptionInfo() const
460 {
461     return contentDescription_;
462 }
463 
SetDescriptionInfo(const std::string & contentDescription)464 void AccessibilityElementInfo::SetDescriptionInfo(const std::string &contentDescription)
465 {
466     contentDescription_ = contentDescription;
467 }
468 
SetComponentResourceId(const std::string & viewIdResName)469 void AccessibilityElementInfo::SetComponentResourceId(const std::string &viewIdResName)
470 {
471     resourceName_ = viewIdResName;
472 }
473 
GetComponentResourceId() const474 const std::string &AccessibilityElementInfo::GetComponentResourceId() const
475 {
476     return resourceName_;
477 }
478 
SetLiveRegion(const int32_t liveRegion)479 void AccessibilityElementInfo::SetLiveRegion(const int32_t liveRegion)
480 {
481     liveRegion_ = liveRegion;
482 }
483 
GetLiveRegion() const484 int32_t AccessibilityElementInfo::GetLiveRegion() const
485 {
486     return liveRegion_;
487 }
488 
SetContentInvalid(const bool contentInvalid)489 void AccessibilityElementInfo::SetContentInvalid(const bool contentInvalid)
490 {
491     contentInvalid_ = contentInvalid;
492 }
493 
GetContentInvalid() const494 bool AccessibilityElementInfo::GetContentInvalid() const
495 {
496     return contentInvalid_;
497 }
498 
SetError(const std::string & error)499 void AccessibilityElementInfo::SetError(const std::string &error)
500 {
501     error_ = error;
502 }
503 
GetError() const504 const std::string &AccessibilityElementInfo::GetError() const
505 {
506     return error_;
507 }
508 
SetLabeled(const int64_t componentId)509 void AccessibilityElementInfo::SetLabeled(const int64_t componentId)
510 {
511     labeled_ = componentId;
512 }
513 
GetLabeledAccessibilityId() const514 int64_t AccessibilityElementInfo::GetLabeledAccessibilityId() const
515 {
516     return labeled_;
517 }
518 
SetAccessibilityId(const int64_t componentId)519 void AccessibilityElementInfo::SetAccessibilityId(const int64_t componentId)
520 {
521     elementId_ = componentId;
522 }
523 
GetAccessibilityId() const524 int64_t AccessibilityElementInfo::GetAccessibilityId() const
525 {
526     return elementId_;
527 }
528 
GetRange() const529 const RangeInfo &AccessibilityElementInfo::GetRange() const
530 {
531     return rangeInfo_;
532 }
533 
SetRange(RangeInfo & rangeInfo)534 void AccessibilityElementInfo::SetRange(RangeInfo &rangeInfo)
535 {
536     rangeInfo_.SetMax(rangeInfo.GetMax());
537     rangeInfo_.SetMin(rangeInfo.GetMin());
538     rangeInfo_.SetCurrent(rangeInfo.GetCurrent());
539 }
540 
GetGrid() const541 const GridInfo &AccessibilityElementInfo::GetGrid() const
542 {
543     return grid_;
544 }
545 
SetGrid(const GridInfo & grid)546 void AccessibilityElementInfo::SetGrid(const GridInfo &grid)
547 {
548     grid_ = grid;
549 }
550 
GetGridItem() const551 const GridItemInfo &AccessibilityElementInfo::GetGridItem() const
552 {
553     return gridItem_;
554 }
555 
SetGridItem(const GridItemInfo & gridItem)556 void AccessibilityElementInfo::SetGridItem(const GridItemInfo &gridItem)
557 {
558     gridItem_ = gridItem;
559 }
560 
AccessibilityElementInfo()561 AccessibilityElementInfo::AccessibilityElementInfo()
562 {
563 }
564 
AccessibleAction(ActionType actionType,const std::string & description)565 AccessibleAction::AccessibleAction(ActionType actionType, const std::string &description)
566 {
567     actionType_ = actionType;
568     description_ = description;
569 }
570 
GetActionType() const571 ActionType AccessibleAction::GetActionType() const
572 {
573     return actionType_;
574 }
575 
GetDescriptionInfo() const576 const std::string &AccessibleAction::GetDescriptionInfo() const
577 {
578     return description_;
579 }
580 
RangeInfo(int32_t min,int32_t max,int32_t current)581 RangeInfo::RangeInfo(int32_t min, int32_t max, int32_t current)
582 {
583     min_ = min;
584     max_ = max;
585     current_ = current;
586 }
587 
GetMin() const588 int32_t RangeInfo::GetMin() const
589 {
590     return min_;
591 }
592 
GetMax() const593 int32_t RangeInfo::GetMax() const
594 {
595     return max_;
596 }
597 
GetCurrent() const598 int32_t RangeInfo::GetCurrent() const
599 {
600     return current_;
601 }
602 
SetMin(int32_t min)603 void RangeInfo::SetMin(int32_t min)
604 {
605     min_ = min;
606 }
607 
SetMax(int32_t max)608 void RangeInfo::SetMax(int32_t max)
609 {
610     max_ = max;
611 }
612 
SetCurrent(int32_t current)613 void RangeInfo::SetCurrent(int32_t current)
614 {
615     current_ = current;
616 }
617 
GridInfo(int32_t rowCount,int32_t columnCount,int32_t mode)618 GridInfo::GridInfo(int32_t rowCount, int32_t columnCount, int32_t mode)
619 {
620     rowCount_ = rowCount;
621     columnCount_ = columnCount;
622     selectionMode_ = mode;
623 }
624 
SetGrid(int32_t rowCount,int32_t columnCount,int32_t mode)625 void GridInfo::SetGrid(int32_t rowCount, int32_t columnCount, int32_t mode)
626 {
627     rowCount_ = rowCount;
628     columnCount_ = columnCount;
629     selectionMode_ = mode;
630 }
631 
SetGrid(GridInfo other)632 void GridInfo::SetGrid(GridInfo other)
633 {
634     rowCount_ = other.rowCount_;
635     columnCount_ = other.columnCount_;
636     selectionMode_ = other.selectionMode_;
637 }
638 
GetRowCount() const639 int32_t GridInfo::GetRowCount() const
640 {
641     return rowCount_;
642 }
643 
GetColumnCount() const644 int32_t GridInfo::GetColumnCount() const
645 {
646     return columnCount_;
647 }
648 
GetSelectionMode() const649 int32_t GridInfo::GetSelectionMode() const
650 {
651     return selectionMode_;
652 }
653 
GridItemInfo(int32_t rowIndex,int32_t rowSpan,int32_t columnIndex,int32_t columnSpan,bool heading,bool selected)654 GridItemInfo::GridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex, int32_t columnSpan,
655     bool heading, bool selected)
656 {
657     rowIndex_ = rowIndex;
658     rowSpan_ = rowSpan;
659     columnIndex_ = columnIndex;
660     columnSpan_ = columnSpan;
661     heading_ = heading;
662     selected_ = selected;
663 }
664 
SetGridItemInfo(GridItemInfo other)665 void GridItemInfo::SetGridItemInfo(GridItemInfo other)
666 {
667     rowIndex_ = other.rowIndex_;
668     rowSpan_ = other.rowSpan_;
669     columnIndex_ = other.columnIndex_;
670     columnSpan_ = other.columnSpan_;
671     heading_ = other.heading_;
672     selected_ = other.selected_;
673 }
674 
SetGridItemInfo(int32_t rowIndex,int32_t rowSpan,int32_t columnIndex,int32_t columnSpan,bool heading,bool selected)675 void GridItemInfo::SetGridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex,
676     int32_t columnSpan, bool heading, bool selected)
677 {
678     rowIndex_ = rowIndex;
679     rowSpan_ = rowSpan;
680     columnIndex_ = columnIndex;
681     columnSpan_ = columnSpan;
682     heading_ = heading;
683     selected_ = selected;
684 }
685 
GetColumnIndex() const686 int32_t GridItemInfo::GetColumnIndex() const
687 {
688     return columnIndex_;
689 }
690 
GetRowIndex() const691 int32_t GridItemInfo::GetRowIndex() const
692 {
693     return rowIndex_;
694 }
695 
GetColumnSpan() const696 int32_t GridItemInfo::GetColumnSpan() const
697 {
698     return columnSpan_;
699 }
700 
GetRowSpan() const701 int32_t GridItemInfo::GetRowSpan() const
702 {
703     return rowSpan_;
704 }
705 
IsHeading() const706 bool GridItemInfo::IsHeading() const
707 {
708     return heading_;
709 }
710 
IsSelected() const711 bool GridItemInfo::IsSelected() const
712 {
713     return selected_;
714 }
715 
GetPageId() const716 int32_t AccessibilityElementInfo::GetPageId() const
717 {
718     return pageId_;
719 }
720 
SetPageId(const int32_t pageId)721 void AccessibilityElementInfo::SetPageId(const int32_t pageId)
722 {
723     pageId_ = pageId;
724 }
725 
SetTextMovementStep(const TextMoveUnit granularity)726 void AccessibilityElementInfo::SetTextMovementStep(const TextMoveUnit granularity)
727 {
728     textMoveStep_ = granularity;
729 }
730 
GetTextMovementStep() const731 TextMoveUnit AccessibilityElementInfo::GetTextMovementStep() const
732 {
733     return textMoveStep_;
734 }
735 
SetItemCounts(const int32_t itemCounts)736 void AccessibilityElementInfo::SetItemCounts(const int32_t itemCounts)
737 {
738     itemCounts_ = itemCounts;
739 }
740 
GetItemCounts() const741 int32_t AccessibilityElementInfo::GetItemCounts() const
742 {
743     return itemCounts_;
744 }
745 
SetTriggerAction(const ActionType action)746 void AccessibilityElementInfo::SetTriggerAction(const ActionType action)
747 {
748     triggerAction_ = action;
749 }
750 
GetTriggerAction() const751 ActionType AccessibilityElementInfo::GetTriggerAction() const
752 {
753     return triggerAction_;
754 }
755 
SetContentList(const std::vector<std::string> & contentList)756 void AccessibilityElementInfo::SetContentList(const std::vector<std::string> &contentList)
757 {
758     contentList_.clear();
759     contentList_.resize(contentList.size());
760     std::copy(contentList.begin(), contentList.end(), contentList_.begin());
761 }
762 
GetContentList(std::vector<std::string> & contentList) const763 void AccessibilityElementInfo::GetContentList(std::vector<std::string> &contentList) const
764 {
765     contentList.clear();
766     contentList.resize(contentList_.size());
767     std::copy(contentList_.begin(), contentList_.end(), contentList.begin());
768 }
769 
SetLatestContent(const std::string & content)770 void AccessibilityElementInfo::SetLatestContent(const std::string &content)
771 {
772     latestContent_ = content;
773 }
774 
GetLatestContent() const775 const std::string &AccessibilityElementInfo::GetLatestContent() const
776 {
777     return latestContent_;
778 }
779 } // namespace Accessibility
780 } // namespace OHOS