17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci/** 167777dab0Sopenharmony_ci * @addtogroup InputMethod 177777dab0Sopenharmony_ci * @{ 187777dab0Sopenharmony_ci * 197777dab0Sopenharmony_ci * @brief InputMethod provides functions to use input methods and develop input methods. 207777dab0Sopenharmony_ci * 217777dab0Sopenharmony_ci * @since 12 227777dab0Sopenharmony_ci */ 237777dab0Sopenharmony_ci 247777dab0Sopenharmony_ci/** 257777dab0Sopenharmony_ci * @file inputmethod_private_command_capi.h 267777dab0Sopenharmony_ci * 277777dab0Sopenharmony_ci * @brief Provides functions to manage private commands. 287777dab0Sopenharmony_ci * 297777dab0Sopenharmony_ci * @library libohinputmethod.so 307777dab0Sopenharmony_ci * @kit IMEKit 317777dab0Sopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 327777dab0Sopenharmony_ci * @since 12 337777dab0Sopenharmony_ci * @version 1.0 347777dab0Sopenharmony_ci */ 357777dab0Sopenharmony_ci#ifndef OHOS_INPUTMETHOD_PRIVATE_COMMAND_CAPI_H 367777dab0Sopenharmony_ci#define OHOS_INPUTMETHOD_PRIVATE_COMMAND_CAPI_H 377777dab0Sopenharmony_ci#include <stddef.h> 387777dab0Sopenharmony_ci#include <stdint.h> 397777dab0Sopenharmony_ci 407777dab0Sopenharmony_ci#include "inputmethod_types_capi.h" 417777dab0Sopenharmony_ci#ifdef __cplusplus 427777dab0Sopenharmony_ciextern "C" { 437777dab0Sopenharmony_ci#endif /* __cplusplus */ 447777dab0Sopenharmony_ci/** 457777dab0Sopenharmony_ci * @brief Define the InputMethod_PrivateCommand structure type. 467777dab0Sopenharmony_ci * 477777dab0Sopenharmony_ci * The private command between text editor and input method. 487777dab0Sopenharmony_ci * 497777dab0Sopenharmony_ci * @since 12 507777dab0Sopenharmony_ci */ 517777dab0Sopenharmony_citypedef struct InputMethod_PrivateCommand InputMethod_PrivateCommand; 527777dab0Sopenharmony_ci 537777dab0Sopenharmony_ci/** 547777dab0Sopenharmony_ci * @brief Create a new {@link InputMethod_PrivateCommand} instance. 557777dab0Sopenharmony_ci * 567777dab0Sopenharmony_ci * @param key The key of the private command. 577777dab0Sopenharmony_ci * @param keyLength The length of the key. 587777dab0Sopenharmony_ci * @return If the creation succeeds, a pointer to the newly created {@link InputMethod_PrivateCommand} 597777dab0Sopenharmony_ci * instance is returned. If the creation fails, NULL is returned, possible cause is insufficient memory. 607777dab0Sopenharmony_ci * @since 12 617777dab0Sopenharmony_ci */ 627777dab0Sopenharmony_ciInputMethod_PrivateCommand *OH_PrivateCommand_Create(char key[], size_t keyLength); 637777dab0Sopenharmony_ci/** 647777dab0Sopenharmony_ci * @brief Destroy a {@link InputMethod_PrivateCommand} instance. 657777dab0Sopenharmony_ci * 667777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be destroyed. 677777dab0Sopenharmony_ci * @since 12 687777dab0Sopenharmony_ci */ 697777dab0Sopenharmony_civoid OH_PrivateCommand_Destroy(InputMethod_PrivateCommand *command); 707777dab0Sopenharmony_ci/** 717777dab0Sopenharmony_ci * @brief Set key value into {@link InputMethod_PrivateCommand}. 727777dab0Sopenharmony_ci * 737777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be set value. 747777dab0Sopenharmony_ci * @param key Represents key value. 757777dab0Sopenharmony_ci * @param keyLength Represents key length. 767777dab0Sopenharmony_ci * @return Returns a specific error code. 777777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 787777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 797777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 807777dab0Sopenharmony_ci * @since 12 817777dab0Sopenharmony_ci */ 827777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_SetKey(InputMethod_PrivateCommand *command, char key[], size_t keyLength); 837777dab0Sopenharmony_ci/** 847777dab0Sopenharmony_ci * @brief Set bool data value into {@link InputMethod_PrivateCommand}. 857777dab0Sopenharmony_ci * 867777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be set value. 877777dab0Sopenharmony_ci * @param value Represents bool data value. 887777dab0Sopenharmony_ci * @return Returns a specific error code. 897777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 907777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 917777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 927777dab0Sopenharmony_ci * @since 12 937777dab0Sopenharmony_ci */ 947777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_SetBoolValue(InputMethod_PrivateCommand *command, bool value); 957777dab0Sopenharmony_ci/** 967777dab0Sopenharmony_ci * @brief Set integer data value into {@link InputMethod_PrivateCommand}. 977777dab0Sopenharmony_ci * 987777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be set value. 997777dab0Sopenharmony_ci * @param value Represents integer data value. 1007777dab0Sopenharmony_ci * @return Returns a specific error code. 1017777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1027777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1037777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1047777dab0Sopenharmony_ci * @since 12 1057777dab0Sopenharmony_ci */ 1067777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_SetIntValue(InputMethod_PrivateCommand *command, int32_t value); 1077777dab0Sopenharmony_ci/** 1087777dab0Sopenharmony_ci * @brief Set string data value into {@link InputMethod_PrivateCommand}. 1097777dab0Sopenharmony_ci * 1107777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be set value. 1117777dab0Sopenharmony_ci * @param value Represents string data value. 1127777dab0Sopenharmony_ci * @param valueLength Represents the length of string data value. 1137777dab0Sopenharmony_ci * @return Returns a specific error code. 1147777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1157777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1167777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1177777dab0Sopenharmony_ci * @since 12 1187777dab0Sopenharmony_ci */ 1197777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_SetStrValue( 1207777dab0Sopenharmony_ci InputMethod_PrivateCommand *command, char value[], size_t valueLength); 1217777dab0Sopenharmony_ci 1227777dab0Sopenharmony_ci/** 1237777dab0Sopenharmony_ci * @brief Get key value from {@link InputMethod_PrivateCommand}. 1247777dab0Sopenharmony_ci * 1257777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be get value from. 1267777dab0Sopenharmony_ci * @param key Represents key value. 1277777dab0Sopenharmony_ci * @param keyLength Represents key length. 1287777dab0Sopenharmony_ci * @return Returns a specific error code. 1297777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1307777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1317777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1327777dab0Sopenharmony_ci * @since 12 1337777dab0Sopenharmony_ci */ 1347777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_GetKey( 1357777dab0Sopenharmony_ci InputMethod_PrivateCommand *command, const char **key, size_t *keyLength); 1367777dab0Sopenharmony_ci/** 1377777dab0Sopenharmony_ci * @brief Get value type from {@link InputMethod_PrivateCommand}. 1387777dab0Sopenharmony_ci * 1397777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be get value from. 1407777dab0Sopenharmony_ci * @param type Represents a pointer to a {@link InputMethod_CommandValueType} instance. Indicates the data type of the 1417777dab0Sopenharmony_ci * value. 1427777dab0Sopenharmony_ci * @return Returns a specific error code. 1437777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1447777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1457777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1467777dab0Sopenharmony_ci * @since 12 1477777dab0Sopenharmony_ci */ 1487777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_GetValueType( 1497777dab0Sopenharmony_ci InputMethod_PrivateCommand *command, InputMethod_CommandValueType *type); 1507777dab0Sopenharmony_ci/** 1517777dab0Sopenharmony_ci * @brief Get bool data value from {@link InputMethod_PrivateCommand}. 1527777dab0Sopenharmony_ci * 1537777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be get value from. 1547777dab0Sopenharmony_ci * @param value Represents bool data value. 1557777dab0Sopenharmony_ci * @return Returns a specific error code. 1567777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1577777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1587777dab0Sopenharmony_ci * {@link IME_ERR_QUERY_FAILED} - query failed, no bool value in command. 1597777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1607777dab0Sopenharmony_ci * @since 12 1617777dab0Sopenharmony_ci */ 1627777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_GetBoolValue(InputMethod_PrivateCommand *command, bool *value); 1637777dab0Sopenharmony_ci/** 1647777dab0Sopenharmony_ci * @brief Get integer data value from {@link InputMethod_PrivateCommand}. 1657777dab0Sopenharmony_ci * 1667777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be get value from. 1677777dab0Sopenharmony_ci * @param value Represents integer data value. 1687777dab0Sopenharmony_ci * @return Returns a specific error code. 1697777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1707777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1717777dab0Sopenharmony_ci * {@link IME_ERR_QUERY_FAILED} - query failed, no integer value in command. 1727777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1737777dab0Sopenharmony_ci * @since 12 1747777dab0Sopenharmony_ci */ 1757777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_GetIntValue(InputMethod_PrivateCommand *command, int32_t *value); 1767777dab0Sopenharmony_ci/** 1777777dab0Sopenharmony_ci * @brief Get string data value from {@link InputMethod_PrivateCommand}. 1787777dab0Sopenharmony_ci * 1797777dab0Sopenharmony_ci * @param command Represents a pointer to an {@link InputMethod_PrivateCommand} instance which will be get value from. 1807777dab0Sopenharmony_ci * @param value Represents string data value. 1817777dab0Sopenharmony_ci * @param valueLength Represents the length of string data value. 1827777dab0Sopenharmony_ci * @return Returns a specific error code. 1837777dab0Sopenharmony_ci * {@link IME_ERR_OK} - success. 1847777dab0Sopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 1857777dab0Sopenharmony_ci * {@link IME_ERR_QUERY_FAILED} - query failed, no string value in command. 1867777dab0Sopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 1877777dab0Sopenharmony_ci * @since 12 1887777dab0Sopenharmony_ci */ 1897777dab0Sopenharmony_ciInputMethod_ErrorCode OH_PrivateCommand_GetStrValue( 1907777dab0Sopenharmony_ci InputMethod_PrivateCommand *command, const char **value, size_t *valueLength); 1917777dab0Sopenharmony_ci#ifdef __cplusplus 1927777dab0Sopenharmony_ci} 1937777dab0Sopenharmony_ci#endif /* __cplusplus */ 1947777dab0Sopenharmony_ci/** @} */ 1957777dab0Sopenharmony_ci#endif // OHOS_INPUTMETHOD_PRIVATE_COMMAND_CAPI_H