inputmethod_private_command_capi.h

Overview

Provides methods for creating, destroying, reading, and writing private data objects.

Header file: <inputmethod/inputmethod_private_command_capi.h>

Library: libohinputmethod.so

System capability: SystemCapability.MiscServices.InputMethodFramework

Since: 12

Related module: InputMethod

Summary

Structs

Name typedef Keyword Description
InputMethod_PrivateCommand InputMethod_PrivateCommand Private data exchanged between the text box and the input method application.

Functions

Name Description
InputMethod_PrivateCommand *OH_PrivateCommand_Create(char key[], size_t keyLength) Creates an InputMethod_PrivateCommand instance.
void OH_PrivateCommand_Destroy(InputMethod_PrivateCommand *command) Destroys an InputMethod_PrivateCommand instance.
InputMethod_ErrorCode OH_PrivateCommand_SetKey(InputMethod_PrivateCommand *command, char key[], size_t keyLength) Sets the key value for InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_SetBoolValue(InputMethod_PrivateCommand *command, bool value) Sets the value of the Boolean type for InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_SetIntValue(InputMethod_PrivateCommand *command, int32_t value) Sets the value of the integer type for InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_SetStrValue(InputMethod_PrivateCommand *command, char value[], size_t valueLength) Sets the value of the string type for InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_GetKey(InputMethod_PrivateCommand *command, const char **key, size_t *keyLength) Obtains the key value from InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_GetValueType(InputMethod_PrivateCommand *command, InputMethod_CommandValueType *type) Obtains the data type of value from InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_GetBoolValue(InputMethod_PrivateCommand *command, bool *value) Obtains the value of the Boolean type from InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_GetIntValue(InputMethod_PrivateCommand *command, int32_t *value) Obtains the value of the integer type from InputMethod_PrivateCommand.
InputMethod_ErrorCode OH_PrivateCommand_GetStrValue(InputMethod_PrivateCommand *command, const char **value, size_t *valueLength) Obtains the value of the string type from InputMethod_PrivateCommand.

Function Description

OH_PrivateCommand_Create()

InputMethod_PrivateCommand *OH_PrivateCommand_Create(char key[], size_t keyLength)

Description

Creates an InputMethod_PrivateCommand instance.

Since: 12

Parameters

Name Description
char key[] Key value of the private data.
size_t keyLength Key length. The total size of all private data and keys in a single operation cannot exceed 32 KB.

Returns

Type Description
InputMethod_PrivateCommand * If the operation is successful, a pointer to the created InputMethod_PrivateCommand instance is returned.
If the operation failed, NULL is returned, which may be caused by insufficient application address space.

OH_PrivateCommand_Destroy()

void OH_PrivateCommand_Destroy(InputMethod_PrivateCommand *command)

Description

Destroys an InputMethod_PrivateCommand instance.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance to be destroyed.

OH_PrivateCommand_SetKey()

InputMethod_ErrorCode OH_PrivateCommand_SetKey(InputMethod_PrivateCommand *command, char key[], size_t keyLength)

Description

Sets the key value for InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance to be set.
char key[] Key value.
size_t keyLength Key length.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_SetBoolValue()

InputMethod_ErrorCode OH_PrivateCommand_SetBoolValue(InputMethod_PrivateCommand *command, bool value)

Description

Sets the value of the Boolean type for InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance to be set.
bool value Boolean value.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_SetIntValue()

InputMethod_ErrorCode OH_PrivateCommand_SetIntValue(InputMethod_PrivateCommand *command, int32_t value)

Description

Sets the value of the integer type for InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance to be set.
int32_t value Value of the integer type.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_SetStrValue()

InputMethod_ErrorCode OH_PrivateCommand_SetStrValue(InputMethod_PrivateCommand *command, char value[], size_t valueLength)

Description

Sets the value of the string type for InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance to be set.
char value[] Value of the string type.
size_t valueLength Value length.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_GetKey()

InputMethod_ErrorCode OH_PrivateCommand_GetKey(InputMethod_PrivateCommand *command, const char **key, size_t *keyLength)

Description

Obtains the key value from InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance from which the key value is to be obtained.
const char **key The lifespan of key is consistent with that of command. You are advised to copy instead of directly saving the key address or writing key.
size_t *keyLength Key length.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_GetValueType()

InputMethod_ErrorCode OH_PrivateCommand_GetValueType(InputMethod_PrivateCommand *command, InputMethod_CommandValueType *type)

Description

Obtains the data type of value from InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance from which the value is to be obtained.
InputMethod_CommandValueType *type Pointer to the InputMethod_CommandValueType instance, used to indicate the data type of the value.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_GetBoolValue()

InputMethod_ErrorCode OH_PrivateCommand_GetBoolValue(InputMethod_PrivateCommand *command, bool *value)

Description

Obtains the value of the Boolean type from InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance from which the value is to be obtained.
bool *value Boolean value.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
IME_ERR_QUERY_FAILED - Query failed as the command contains no Boolean value.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_GetIntValue()

InputMethod_ErrorCode OH_PrivateCommand_GetIntValue(InputMethod_PrivateCommand *command, int32_t *value)

Description

Obtains the value of the integer type from InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance from which the value is to be obtained.
int32_t *value Value of the integer type.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
IME_ERR_QUERY_FAILED - Query failed because the command does not contain an integer value.
For details about the error codes, see InputMethod_ErrorCode.

OH_PrivateCommand_GetStrValue()

InputMethod_ErrorCode OH_PrivateCommand_GetStrValue(InputMethod_PrivateCommand *command, const char **value, size_t *valueLength)

Description

Obtains the value of the string type from InputMethod_PrivateCommand.

Since: 12

Parameters

Name Description
InputMethod_PrivateCommand *command Pointer to the InputMethod_PrivateCommand instance from which the value is to be obtained.
const char **value Value of the string type.
size_t *valueLength The lifespan of value is consistent with that of command. You are advised to copy instead of directly saving the value address or writing value.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_NULL_POINTER - An unexpected null pointer.
IME_ERR_QUERY_FAILED - Query failed because the command does not contain a string value.
For details about the error codes, see InputMethod_ErrorCode.