[jerryx/arg]add jerryx_arg_utf8_string (#2133)

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2018-01-08 17:17:40 +08:00
committed by Zoltan Herczeg
parent 290bc22f0c
commit 4e7a9d2d53
5 changed files with 212 additions and 22 deletions
+32 -1
View File
@@ -28,6 +28,7 @@ typedef struct
- [jerryx_arg_number](#jerryx_arg_number)
- [jerryx_arg_boolean](#jerryx_arg_boolean)
- [jerryx_arg_string](#jerryx_arg_string)
- [jerryx_arg_utf8_string](#jerryx_arg_utf8_string)
- [jerryx_arg_function](#jerryx_arg_function)
- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)
- [jerryx_arg_ignore](#jerryx_arg_ignore)
@@ -461,7 +462,7 @@ jerryx_arg_boolean (bool *dest,
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `string` JS argument and stores it into a C `char` array.
consume one `string` JS argument and stores it into a CESU-8 C `char` array.
**Prototype**
@@ -482,6 +483,36 @@ jerryx_arg_string (char *dest,
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerry_arg_utf8_string](#jerry_arg_utf8_string)
## jerryx_arg_utf8_string
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `string` JS argument and stores it into a UTF-8 C `char` array.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_utf8_string (char *dest,
uint32_t size,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the native char array where the result should be stored.
- `size` - the size of native char array.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerry_arg_string](#jerry_arg_string)
## jerryx_arg_function