platform/shared/ruby/ext/rho/rhoruby.h in rhodes-3.5.1.12 vs platform/shared/ruby/ext/rho/rhoruby.h in rhodes-5.5.0

- old
+ new

@@ -64,19 +64,21 @@ void rho_ruby_reset_db_on_sync_user_changed(); void rho_ruby_start_threadidle(); void rho_ruby_stop_threadidle(); int rho_ruby_is_started(); void rho_ruby_callmethod(const char* szMethodPath); - +VALUE rho_ruby_callmethod_arg(VALUE classValue, const char *name, VALUE arg); + VALUE rho_ruby_createHash(); VALUE addTimeToHash(VALUE hash, const char* key, time_t val); VALUE addIntToHash(VALUE hash, const char* key, int val); VALUE addBoolToHash(VALUE hash, const char* key, int val); VALUE addStrToHash(VALUE hash, const char* key, const char* val); VALUE addStrToHashLen(VALUE hash, const char* key, const char* val, int len); VALUE addHashToHash(VALUE hash, const char* key, VALUE val); VALUE rho_ruby_hash_aref(VALUE hash, const char* key); +VALUE rho_ruby_hash_get(VALUE hash, VALUE key); VALUE rho_ruby_array_get(VALUE ar, int nIndex); int rho_ruby_array_get_size(VALUE ar); char* getStringFromValue(VALUE val); int getStringLenFromValue(VALUE val); @@ -95,10 +97,11 @@ //const char* RhoGetRootPath(); VALUE rho_ruby_get_NIL(); int rho_ruby_is_NIL(VALUE val); int rho_ruby_get_bool(VALUE val); long rho_ruby_get_int(VALUE val); +double rho_ruby_get_double(VALUE val); VALUE rho_ruby_create_array(); VALUE rho_ruby_create_string(const char* szVal); VALUE rho_ruby_create_string_withlen(int len); VALUE rho_ruby_create_string_withlen2(const char* szVal, int len); VALUE rho_ruby_create_boolean(unsigned char b); @@ -115,15 +118,21 @@ VALUE rho_ruby_create_byte_array(unsigned char* buf, int length); int rho_ruby_unpack_byte_array(VALUE array_value, unsigned char* buf, int max_length); const char* rho_ruby_getRhoDBVersion(); -typedef void rho_hash_eachstr_func(const char*, const char*, void*); +typedef void rho_hash_eachstr_func(const char*, const char*, int, void*); +typedef void rho_hash_each_func(const char*, VALUE, void*); void rho_ruby_enum_strhash(VALUE hash, rho_hash_eachstr_func *, void* data); +void rho_ruby_enum_strhash_json(VALUE hash, rho_hash_eachstr_func *, void* data); +void rho_ruby_enum_hash(VALUE hash, rho_hash_each_func *, void* data); -typedef void rho_ary_eachstr_func(const char*, void*); +typedef void rho_ary_eachstr_func(const char*, int, void*); +typedef void rho_ary_each_func(VALUE, void*); void rho_ruby_enum_strary(VALUE ary, rho_ary_eachstr_func *, void* data); +void rho_ruby_enum_strary_json(VALUE ary, rho_ary_eachstr_func *, void* data); +void rho_ruby_enum_ary(VALUE ary, rho_ary_each_func *, void* data); struct CRhoRubyStringOrInt { const char* m_szStr; uint64__ m_nInt; @@ -143,9 +152,38 @@ void rho_ruby_lock_mutex(VALUE val); void rho_ruby_unlock_mutex(VALUE val); void rho_ruby_raise_runtime(const char* szText); void rho_ruby_raise_argerror(const char *fmt, ...); + +VALUE rho_ruby_create_object_with_id( VALUE klass, const char* szID ); +const char* rho_ruby_get_object_id( VALUE valObj ); +void rho_ruby_clear_object_id( VALUE valObj ); +int rho_ruby_is_string(VALUE val); +int rho_ruby_is_array(VALUE val); +int rho_ruby_is_hash(VALUE val); +int rho_ruby_is_proc(VALUE val); +int rho_ruby_is_method(VALUE val); +int rho_ruby_is_object_of_class(VALUE val, VALUE valClass); +VALUE rho_ruby_get_object_class(VALUE val); +VALUE rho_ruby_get_class_byname(const char* szName); +VALUE rho_ruby_getProcBinding(VALUE proc); +int rho_ruby_is_integer(VALUE val); +int rho_ruby_is_boolean(VALUE val); +int rho_ruby_is_double(VALUE val); + +int rho_ruby_to_int(VALUE val, int* dest); +int rho_ruby_to_double(VALUE val, double* dest); +int rho_ruby_to_bool(VALUE val, int* dest); +int rho_ruby_to_str(VALUE val, const char** dest, int* len); +// convert primitive types to string, otherwise to json +int rho_ruby_to_str_ex(VALUE val, const char** dest, int* len); + +VALUE rho_ruby_hash_keys(VALUE val); +VALUE rho_ruby_each_key(VALUE val); + + +VALUE rho_ruby_safe_require(const char *fname); #define RHO_PARAM_UNKNWON 0 #define RHO_PARAM_STRING 1 #define RHO_PARAM_ARRAY 2 #define RHO_PARAM_HASH 3