From 13bc639770e82eb869fbaa6eb8ff79b359ce89cf Mon Sep 17 00:00:00 2001 From: Rokashevich Svetlana Date: Wed, 30 Jul 2025 17:30:57 +0800 Subject: [PATCH] Update ani.h Signed-off-by: Rokashevich Svetlana Change-Id: Ib497185817476424378181dc299d92b99ca6b7fe --- ani/ani.h | 125 +++++++++--------------------------------------------- 1 file changed, 20 insertions(+), 105 deletions(-) diff --git a/ani/ani.h b/ani/ani.h index fa9278f31..13994d86c 100644 --- a/ani/ani.h +++ b/ani/ani.h @@ -56,7 +56,8 @@ typedef int64_t ani_long; typedef float ani_float; typedef double ani_double; -#ifdef __cplusplus // Reference types: +// Reference types: +#ifdef __cplusplus class __ani_ref {}; class __ani_module : public __ani_ref {}; class __ani_namespace : public __ani_ref {}; @@ -441,46 +442,6 @@ struct __ani_interaction_api { */ ani_status (*FindEnum)(ani_env *env, const char *enum_descriptor, ani_enum *result); - /** - * @brief Finds a namespace within a module by its descriptor. - * - * This function locates a namespace within the specified module based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] module The module to search within. - * @param[in] namespace_descriptor The descriptor of the namespace to find. - * @param[out] result A pointer to the namespace object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Module_FindNamespace)(ani_env *env, ani_module module, const char *namespace_descriptor, - ani_namespace *result); - - /** - * @brief Finds a class within a module by its descriptor. - * - * This function locates a class within the specified module based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] module The module to search within. - * @param[in] class_descriptor The descriptor of the class to find. - * @param[out] result A pointer to the class object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Module_FindClass)(ani_env *env, ani_module module, const char *class_descriptor, ani_class *result); - - /** - * @brief Finds an enum within a module by its descriptor. - * - * This function locates an enum within the specified module based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] module The module to search within. - * @param[in] enum_descriptor The descriptor of the enum to find. - * @param[out] result A pointer to the enum object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Module_FindEnum)(ani_env *env, ani_module module, const char *enum_descriptor, ani_enum *result); - /** * @brief Finds a function within a module by its name and signature. * @@ -509,46 +470,6 @@ struct __ani_interaction_api { */ ani_status (*Module_FindVariable)(ani_env *env, ani_module module, const char *name, ani_variable *result); - /** - * @brief Finds a namespace within another namespace by its descriptor. - * - * This function locates a namespace within the specified parent namespace based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] ns The parent namespace to search within. - * @param[in] namespace_descriptor The descriptor of the namespace to find. - * @param[out] result A pointer to the namespace object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Namespace_FindNamespace)(ani_env *env, ani_namespace ns, const char *namespace_descriptor, - ani_namespace *result); - - /** - * @brief Finds a class within a namespace by its descriptor. - * - * This function locates a class within the specified namespace based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] ns The namespace to search within. - * @param[in] class_descriptor The descriptor of the class to find. - * @param[out] result A pointer to the class object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Namespace_FindClass)(ani_env *env, ani_namespace ns, const char *class_descriptor, ani_class *result); - - /** - * @brief Finds an enum within a namespace by its descriptor. - * - * This function locates an enum within the specified namespace based on its descriptor. - * - * @param[in] env A pointer to the environment structure. - * @param[in] ns The namespace to search within. - * @param[in] enum_descriptor The descriptor of the enum to find. - * @param[out] result A pointer to the enum object. - * @return Returns a status code of type `ani_status` indicating success or failure. - */ - ani_status (*Namespace_FindEnum)(ani_env *env, ani_namespace ns, const char *enum_descriptor, ani_enum *result); - /** * @brief Finds a function within a namespace by its name and signature. * @@ -6230,6 +6151,20 @@ struct __ani_interaction_api { * @return Returns a status code of type `ani_status` indicating success or failure. */ ani_status (*Any_New)(ani_env *env, ani_ref ctor, ani_size argc, ani_ref *argv, ani_ref *result); + + /** + * @brief Binds static native methods to a class. + * + * This function binds an array of static native methods to the specified class. + * + * @param[in] env A pointer to the environment structure. + * @param[in] cls The class to which the native methods will be bound. + * @param[in] methods A pointer to an array of static native methods to bind. + * @param[in] nr_methods The number of static native methods in the array. + * @return Returns a status code of type `ani_status` indicating success or failure. + */ + ani_status (*Class_BindStaticNativeMethods)(ani_env *env, ani_class cls, const ani_native_function *methods, + ani_size nr_methods); }; // C++ API @@ -6316,18 +6251,6 @@ struct __ani_env { { return c_api->FindEnum(this, enum_descriptor, result); } - ani_status Module_FindNamespace(ani_module module, const char *namespace_descriptor, ani_namespace *result) - { - return c_api->Module_FindNamespace(this, module, namespace_descriptor, result); - } - ani_status Module_FindClass(ani_module module, const char *class_descriptor, ani_class *result) - { - return c_api->Module_FindClass(this, module, class_descriptor, result); - } - ani_status Module_FindEnum(ani_module module, const char *enum_descriptor, ani_enum *result) - { - return c_api->Module_FindEnum(this, module, enum_descriptor, result); - } ani_status Module_FindFunction(ani_module module, const char *name, const char *signature, ani_function *result) { return c_api->Module_FindFunction(this, module, name, signature, result); @@ -6336,18 +6259,6 @@ struct __ani_env { { return c_api->Module_FindVariable(this, module, name, result); } - ani_status Namespace_FindNamespace(ani_namespace ns, const char *namespace_descriptor, ani_namespace *result) - { - return c_api->Namespace_FindNamespace(this, ns, namespace_descriptor, result); - } - ani_status Namespace_FindClass(ani_namespace ns, const char *class_descriptor, ani_class *result) - { - return c_api->Namespace_FindClass(this, ns, class_descriptor, result); - } - ani_status Namespace_FindEnum(ani_namespace ns, const char *enum_descriptor, ani_enum *result) - { - return c_api->Namespace_FindEnum(this, ns, enum_descriptor, result); - } ani_status Namespace_FindFunction(ani_namespace ns, const char *name, const char *signature, ani_function *result) { return c_api->Namespace_FindFunction(this, ns, name, signature, result); @@ -8276,6 +8187,10 @@ struct __ani_env { { return c_api->Any_New(this, ctor, argc, argv, result); } + ani_status Class_BindStaticNativeMethods(ani_class cls, const ani_native_function *methods, ani_size nr_methods) + { + return c_api->Class_BindStaticNativeMethods(this, cls, methods, nr_methods); + } #endif // __cplusplus }; -- Gitee