codecheck problem modify

Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
Mupceet 2022-03-09 17:01:55 +08:00
parent 487e3103f3
commit a5203f426d
4 changed files with 177 additions and 83 deletions

View File

@ -20,6 +20,44 @@
namespace OHOS {
namespace Accessibility {
// text move step
const std::string MOVE_UNIT_CHARACTER = "char";
const std::string MOVE_UNIT_WORD = "word";
const std::string MOVE_UNIT_LINE = "line";
const std::string MOVE_UNIT_PAGE = "page";
const std::string MOVE_UNIT_PARAGRAPH = "paragraph";
// Operation Arguments Type
const std::string ACTION_ARGU_INVALID = "invalid";
const std::string ACTION_ARGU_SELECT_TEXT_START = "selectTextBegin";
const std::string ACTION_ARGU_SELECT_TEXT_END = "selectTextEnd";
const std::string ACTION_ARGU_HTML_ELEMENT = "htmlItem";
const std::string ACTION_ARGU_SET_TEXT = "setText";
const std::string ACTION_ARGU_MOVE_UNIT = "textMoveUnit";
// HtmlItemType
const std::string HTML_ITEM_INVALID = "invalid";
const std::string HTML_ITEM_LINK = "link";
const std::string HTML_ITEM_CONTROL = "control";
const std::string HTML_ITEM_GRAPHIC = "graphic";
const std::string HTML_ITEM_LIST_ITEM = "listItem";
const std::string HTML_ITEM_LIST = "list";
const std::string HTML_ITEM_TABLE = "table";
const std::string HTML_ITEM_COMBOX = "combox";
const std::string HTML_ITEM_HEADING = "heading";
const std::string HTML_ITEM_BUTTON = "button";
const std::string HTML_ITEM_CHECKBOX = "checkBox";
const std::string HTML_ITEM_LANDMARK = "landmark";
const std::string HTML_ITEM_TEXT_FIELD = "textField";
const std::string HTML_ITEM_FOCUSABLE = "focusable";
const std::string HTML_ITEM_H1 = "h1";
const std::string HTML_ITEM_H2 = "h2";
const std::string HTML_ITEM_H3 = "h3";
const std::string HTML_ITEM_H4 = "h4";
const std::string HTML_ITEM_H5 = "h5";
const std::string HTML_ITEM_H6 = "h6";
const std::string HTML_ITEM_UNKOWN = "unknown";
/* AccessibilityElementInfo Parcel struct */
bool AccessibilityElementInfo::ReadFromParcel(Parcel &parcel)
{

View File

@ -62,43 +62,44 @@ enum TextMoveUnit : int {
STEP_PAGE = 0x00000008,
STEP_PARAGRAPH = 0x00000010,
};
// text move step
static const std::string MOVE_UNIT_CHARACTER = "char";
static const std::string MOVE_UNIT_WORD = "word";
static const std::string MOVE_UNIT_LINE = "line";
static const std::string MOVE_UNIT_PAGE = "page";
static const std::string MOVE_UNIT_PARAGRAPH = "paragraph";
extern const std::string MOVE_UNIT_CHARACTER;
extern const std::string MOVE_UNIT_WORD;
extern const std::string MOVE_UNIT_LINE;
extern const std::string MOVE_UNIT_PAGE;
extern const std::string MOVE_UNIT_PARAGRAPH;
// Operation Arguments Type
static const std::string ACTION_ARGU_INVALID = "invalid";
static const std::string ACTION_ARGU_SELECT_TEXT_START = "selectTextBegin";
static const std::string ACTION_ARGU_SELECT_TEXT_END = "selectTextEnd";
static const std::string ACTION_ARGU_HTML_ELEMENT = "htmlItem";
static const std::string ACTION_ARGU_SET_TEXT = "setText";
static const std::string ACTION_ARGU_MOVE_UNIT = "textMoveUnit";
extern const std::string ACTION_ARGU_INVALID;
extern const std::string ACTION_ARGU_SELECT_TEXT_START;
extern const std::string ACTION_ARGU_SELECT_TEXT_END;
extern const std::string ACTION_ARGU_HTML_ELEMENT;
extern const std::string ACTION_ARGU_SET_TEXT;
extern const std::string ACTION_ARGU_MOVE_UNIT;
// HtmlItemType
static const std::string HTML_ITEM_INVALID = "invalid";
static const std::string HTML_ITEM_LINK = "link";
static const std::string HTML_ITEM_CONTROL = "control";
static const std::string HTML_ITEM_GRAPHIC = "graphic";
static const std::string HTML_ITEM_LIST_ITEM = "listItem";
static const std::string HTML_ITEM_LIST = "list";
static const std::string HTML_ITEM_TABLE = "table";
static const std::string HTML_ITEM_COMBOX = "combox";
static const std::string HTML_ITEM_HEADING = "heading";
static const std::string HTML_ITEM_BUTTON = "button";
static const std::string HTML_ITEM_CHECKBOX = "checkBox";
static const std::string HTML_ITEM_LANDMARK = "landmark";
static const std::string HTML_ITEM_TEXT_FIELD = "textField";
static const std::string HTML_ITEM_FOCUSABLE = "focusable";
static const std::string HTML_ITEM_H1 = "h1";
static const std::string HTML_ITEM_H2 = "h2";
static const std::string HTML_ITEM_H3 = "h3";
static const std::string HTML_ITEM_H4 = "h4";
static const std::string HTML_ITEM_H5 = "h5";
static const std::string HTML_ITEM_H6 = "h6";
static const std::string HTML_ITEM_UNKOWN = "unknown";
extern const std::string HTML_ITEM_INVALID;
extern const std::string HTML_ITEM_LINK;
extern const std::string HTML_ITEM_CONTROL;
extern const std::string HTML_ITEM_GRAPHIC;
extern const std::string HTML_ITEM_LIST_ITEM;
extern const std::string HTML_ITEM_LIST;
extern const std::string HTML_ITEM_TABLE;
extern const std::string HTML_ITEM_COMBOX;
extern const std::string HTML_ITEM_HEADING;
extern const std::string HTML_ITEM_BUTTON;
extern const std::string HTML_ITEM_CHECKBOX;
extern const std::string HTML_ITEM_LANDMARK;
extern const std::string HTML_ITEM_TEXT_FIELD;
extern const std::string HTML_ITEM_FOCUSABLE;
extern const std::string HTML_ITEM_H1;
extern const std::string HTML_ITEM_H2;
extern const std::string HTML_ITEM_H3;
extern const std::string HTML_ITEM_H4;
extern const std::string HTML_ITEM_H5;
extern const std::string HTML_ITEM_H6;
extern const std::string HTML_ITEM_UNKOWN;
enum FocusMoveDirection :int {
DIRECTION_INVALID = 0,

View File

@ -22,63 +22,61 @@
namespace OHOS {
namespace Accessibility {
const static std::string AccessibleAbility_JSON_FILE_PATH = "/system/app/dummy_accessibility_ability_config.json";
const static std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_EVENT_TYPES = "accessibilityEventTypes";
const static std::string AccessibleAbility_JSON_KEY_TARGET_BUNDLE_NAMES = "targetBundleNames";
const static std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_ABILITY_TYPES = "accessibilityAbilityTypes";
const static std::string AccessibleAbility_JSON_KEY_NOTIFICATION_TIMEOUT = "notificationTimeout";
const static std::string AccessibleAbility_JSON_KEY_UI_NONINTERACTIVE_TIMEOUT = "uiNoninteractiveTimeout";
const static std::string AccessibleAbility_JSON_KEY_UI_INTERACTIVE_TIMEOUT = "uiInteractiveTimeout";
const static std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES = "accessibilityCapabilities";
const static std::string AccessibleAbility_JSON_KEY_DESCRIPTION = "description";
const static std::string AccessibleAbility_JSON_KEY_SETTINGS_ABILITY = "settingsAbility";
const static std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES_RATIONALE =
"accessibilityCapabilityRationale";
const static std::string AccessibleAbility_Config_JSON_FILE_PATH = "/system/app/accessibility_config.json";
extern const std::string AccessibleAbility_JSON_FILE_PATH;
extern const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_EVENT_TYPES;
extern const std::string AccessibleAbility_JSON_KEY_TARGET_BUNDLE_NAMES;
extern const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_ABILITY_TYPES;
extern const std::string AccessibleAbility_JSON_KEY_NOTIFICATION_TIMEOUT;
extern const std::string AccessibleAbility_JSON_KEY_UI_NONINTERACTIVE_TIMEOUT;
extern const std::string AccessibleAbility_JSON_KEY_UI_INTERACTIVE_TIMEOUT;
extern const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES;
extern const std::string AccessibleAbility_JSON_KEY_DESCRIPTION;
extern const std::string AccessibleAbility_JSON_KEY_SETTINGS_ABILITY;
extern const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES_RATIONALE;
extern const std::string AccessibleAbility_Config_JSON_FILE_PATH;
// The json value of event types
const static std::string EVENT_TYPES_JSON_VALUE_CLICK = "click";
const static std::string EVENT_TYPES_JSON_VALUE_LONG_CLICK = "longClick";
const static std::string EVENT_TYPES_JSON_VALUE_SELECT = "select";
const static std::string EVENT_TYPES_JSON_VALUE_FOCUS = "focus";
const static std::string EVENT_TYPES_JSON_VALUE_TEXT_UPDATE = "textUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_PAGE_STATE_UPDATE = "pageStateUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_NOTIFICATION_UPDATE = "notificationUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_HOVER_ENTER = "hoverEnter";
const static std::string EVENT_TYPES_JSON_VALUE_HOVER_EXIT = "hoverExit";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_BEGIN = "touchGuideBegin";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_END = "touchGuideEnd";
const static std::string EVENT_TYPES_JSON_VALUE_PAGE_CONTENT_UPDATE = "pageContentUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_SCROLL = "scroll";
const static std::string EVENT_TYPES_JSON_VALUE_TEXT_SELECTION_UPDATE = "textSelectionUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_PUBLIC_NOTICE = "publicNotice";
const static std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS = "accessibilityFocus";
const static std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS_CLEAR = "accessibilityFocusClear";
const static std::string EVENT_TYPES_JSON_VALUE_TEXT_MOVE_UNIT = "textMoveUnit";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_BEGIN = "touchGuideGestureBegin";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_END = "touchGuideGestureEnd";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_BEGIN = "touchBegin";
const static std::string EVENT_TYPES_JSON_VALUE_TOUCH_END = "touchEnd";
const static std::string EVENT_TYPES_JSON_VALUE_WINDOW_UPDATE = "windowUpdate";
const static std::string EVENT_TYPES_JSON_VALUE_INTERRUPT = "interrupt";
const static std::string EVENT_TYPES_JSON_VALUE_GESTURE_EVENT = "gesture";
const static std::string EVENT_TYPES_JSON_VALUE_ALL = "all";
extern const std::string EVENT_TYPES_JSON_VALUE_CLICK;
extern const std::string EVENT_TYPES_JSON_VALUE_LONG_CLICK;
extern const std::string EVENT_TYPES_JSON_VALUE_SELECT;
extern const std::string EVENT_TYPES_JSON_VALUE_FOCUS;
extern const std::string EVENT_TYPES_JSON_VALUE_TEXT_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_PAGE_STATE_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_NOTIFICATION_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_HOVER_ENTER;
extern const std::string EVENT_TYPES_JSON_VALUE_HOVER_EXIT;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_BEGIN;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_END;
extern const std::string EVENT_TYPES_JSON_VALUE_PAGE_CONTENT_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_SCROLL;
extern const std::string EVENT_TYPES_JSON_VALUE_TEXT_SELECTION_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_PUBLIC_NOTICE;
extern const std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS;
extern const std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS_CLEAR;
extern const std::string EVENT_TYPES_JSON_VALUE_TEXT_MOVE_UNIT;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_BEGIN;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_END;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_BEGIN;
extern const std::string EVENT_TYPES_JSON_VALUE_TOUCH_END;
extern const std::string EVENT_TYPES_JSON_VALUE_WINDOW_UPDATE;
extern const std::string EVENT_TYPES_JSON_VALUE_INTERRUPT;
extern const std::string EVENT_TYPES_JSON_VALUE_GESTURE_EVENT;
extern const std::string EVENT_TYPES_JSON_VALUE_ALL;
// The json value of accessibilityAbility type
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_SPOKEN = "spoken";
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_HAPIC = "haptic";
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_AUDIBLE = "audible";
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_VISUAL = "visual";
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_GENERIC = "generic";
const static std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_ALL = "all";
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_SPOKEN;
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_HAPIC;
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_AUDIBLE;
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_VISUAL;
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_GENERIC;
extern const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_ALL;
// The json value of capabilities
const static std::string CAPABILITIES_JSON_VALUE_RETRIEVE = "retrieve";
const static std::string CAPABILITIES_JSON_VALUE_TOUCH_GUIDE = "touchGuide";
const static std::string CAPABILITIES_JSON_VALUE_KEY_EVENT_OBSERVER = "keyEventObserver";
const static std::string CAPABILITIES_JSON_VALUE_ZOOM = "zoom";
const static std::string CAPABILITIES_JSON_VALUE_GESTURE = "gesture";
extern const std::string CAPABILITIES_JSON_VALUE_RETRIEVE;
extern const std::string CAPABILITIES_JSON_VALUE_TOUCH_GUIDE;
extern const std::string CAPABILITIES_JSON_VALUE_KEY_EVENT_OBSERVER;
extern const std::string CAPABILITIES_JSON_VALUE_ZOOM;
extern const std::string CAPABILITIES_JSON_VALUE_GESTURE;
class JsonUtils {
public:

View File

@ -24,6 +24,63 @@ using namespace std;
namespace OHOS {
namespace Accessibility {
const std::string AccessibleAbility_JSON_FILE_PATH = "/system/app/dummy_accessibility_ability_config.json";
const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_EVENT_TYPES = "accessibilityEventTypes";
const std::string AccessibleAbility_JSON_KEY_TARGET_BUNDLE_NAMES = "targetBundleNames";
const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_ABILITY_TYPES = "accessibilityAbilityTypes";
const std::string AccessibleAbility_JSON_KEY_NOTIFICATION_TIMEOUT = "notificationTimeout";
const std::string AccessibleAbility_JSON_KEY_UI_NONINTERACTIVE_TIMEOUT = "uiNoninteractiveTimeout";
const std::string AccessibleAbility_JSON_KEY_UI_INTERACTIVE_TIMEOUT = "uiInteractiveTimeout";
const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES = "accessibilityCapabilities";
const std::string AccessibleAbility_JSON_KEY_DESCRIPTION = "description";
const std::string AccessibleAbility_JSON_KEY_SETTINGS_ABILITY = "settingsAbility";
const std::string AccessibleAbility_JSON_KEY_ACCESSIBILITY_CAPABILITIES_RATIONALE =
"accessibilityCapabilityRationale";
const std::string AccessibleAbility_Config_JSON_FILE_PATH = "/system/app/accessibility_config.json";
// The json value of event types
const std::string EVENT_TYPES_JSON_VALUE_CLICK = "click";
const std::string EVENT_TYPES_JSON_VALUE_LONG_CLICK = "longClick";
const std::string EVENT_TYPES_JSON_VALUE_SELECT = "select";
const std::string EVENT_TYPES_JSON_VALUE_FOCUS = "focus";
const std::string EVENT_TYPES_JSON_VALUE_TEXT_UPDATE = "textUpdate";
const std::string EVENT_TYPES_JSON_VALUE_PAGE_STATE_UPDATE = "pageStateUpdate";
const std::string EVENT_TYPES_JSON_VALUE_NOTIFICATION_UPDATE = "notificationUpdate";
const std::string EVENT_TYPES_JSON_VALUE_HOVER_ENTER = "hoverEnter";
const std::string EVENT_TYPES_JSON_VALUE_HOVER_EXIT = "hoverExit";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_BEGIN = "touchGuideBegin";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_END = "touchGuideEnd";
const std::string EVENT_TYPES_JSON_VALUE_PAGE_CONTENT_UPDATE = "pageContentUpdate";
const std::string EVENT_TYPES_JSON_VALUE_SCROLL = "scroll";
const std::string EVENT_TYPES_JSON_VALUE_TEXT_SELECTION_UPDATE = "textSelectionUpdate";
const std::string EVENT_TYPES_JSON_VALUE_PUBLIC_NOTICE = "publicNotice";
const std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS = "accessibilityFocus";
const std::string EVENT_TYPES_JSON_VALUE_ACCESSIBILITY_FOCUS_CLEAR = "accessibilityFocusClear";
const std::string EVENT_TYPES_JSON_VALUE_TEXT_MOVE_UNIT = "textMoveUnit";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_BEGIN = "touchGuideGestureBegin";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_GUIDE_GESTURE_END = "touchGuideGestureEnd";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_BEGIN = "touchBegin";
const std::string EVENT_TYPES_JSON_VALUE_TOUCH_END = "touchEnd";
const std::string EVENT_TYPES_JSON_VALUE_WINDOW_UPDATE = "windowUpdate";
const std::string EVENT_TYPES_JSON_VALUE_INTERRUPT = "interrupt";
const std::string EVENT_TYPES_JSON_VALUE_GESTURE_EVENT = "gesture";
const std::string EVENT_TYPES_JSON_VALUE_ALL = "all";
// The json value of accessibilityAbility type
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_SPOKEN = "spoken";
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_HAPIC = "haptic";
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_AUDIBLE = "audible";
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_VISUAL = "visual";
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_GENERIC = "generic";
const std::string ACCESSIBILITY_ABILITY_TYPES_JSON_VALUE_ALL = "all";
// The json value of capabilities
const std::string CAPABILITIES_JSON_VALUE_RETRIEVE = "retrieve";
const std::string CAPABILITIES_JSON_VALUE_TOUCH_GUIDE = "touchGuide";
const std::string CAPABILITIES_JSON_VALUE_KEY_EVENT_OBSERVER = "keyEventObserver";
const std::string CAPABILITIES_JSON_VALUE_ZOOM = "zoom";
const std::string CAPABILITIES_JSON_VALUE_GESTURE = "gesture";
bool JsonUtils::GetJsonObjFromJson(nlohmann::json &jsonObj, const std::string &jsonPath)
{
HILOG_DEBUG("start.");