本文整理汇总了C++中rb_define_class函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_define_class函数的具体用法?C++ rb_define_class怎么用?C++ rb_define_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_define_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init_spf4r
void
Init_spf4r()
{
cSPF = rb_define_class("SPF", rb_cHash);
rb_define_method (cSPF,"query", t_query, 1);
rb_define_const (cSPF,"SPF_RESULT_PASS",INT2NUM(SPF_RESULT_PASS));
rb_define_const (cSPF,"SPF_RESULT_FAIL",INT2NUM(SPF_RESULT_FAIL));
rb_define_const (cSPF,"SPF_RESULT_SOFTFAIL",INT2NUM(SPF_RESULT_SOFTFAIL));
rb_define_const (cSPF,"SPF_RESULT_NEUTRAL",INT2NUM(SPF_RESULT_NEUTRAL));
rb_define_const (cSPF,"SPF_RESULT_NONE",INT2NUM(SPF_RESULT_NONE));
rb_define_const (cSPF,"SPF_RESULT_TEMPERROR",INT2NUM(SPF_RESULT_TEMPERROR));
rb_define_const (cSPF,"SPF_RESULT_PERMERROR",INT2NUM(SPF_RESULT_PERMERROR));
rb_define_const (cSPF,"SPF_RESULT_INVALID",INT2NUM(SPF_RESULT_INVALID));
}
示例2: Init_trie
void Init_trie() {
cTrie = rb_define_class("Trie", rb_cObject);
rb_define_alloc_func(cTrie, rb_trie_alloc);
rb_define_module_function(cTrie, "read", rb_trie_read, 1);
rb_define_method(cTrie, "has_key?", rb_trie_has_key, 1);
rb_define_method(cTrie, "get", rb_trie_get, 1);
rb_define_method(cTrie, "add", rb_trie_add, -2);
rb_define_method(cTrie, "delete", rb_trie_delete, 1);
rb_define_method(cTrie, "children", rb_trie_children, 1);
rb_define_method(cTrie, "children_with_values", rb_trie_children_with_values, 1);
rb_define_method(cTrie, "root", rb_trie_root, 0);
rb_define_method(cTrie, "save", rb_trie_save, 1);
cTrieNode = rb_define_class("TrieNode", rb_cObject);
rb_define_alloc_func(cTrieNode, rb_trie_node_alloc);
rb_define_method(cTrieNode, "initialize_copy", rb_trie_node_initialize_copy, 1);
rb_define_method(cTrieNode, "state", rb_trie_node_get_state, 0);
rb_define_method(cTrieNode, "full_state", rb_trie_node_get_full_state, 0);
rb_define_method(cTrieNode, "walk!", rb_trie_node_walk_bang, 1);
rb_define_method(cTrieNode, "walk", rb_trie_node_walk, 1);
rb_define_method(cTrieNode, "value", rb_trie_node_value, 0);
rb_define_method(cTrieNode, "terminal?", rb_trie_node_terminal, 0);
rb_define_method(cTrieNode, "leaf?", rb_trie_node_leaf, 0);
}
示例3: Init_util_spec
void Init_util_spec() {
VALUE cls = rb_define_class("CApiUtilSpecs", rb_cObject);
#ifdef HAVE_RB_SCAN_ARGS
rb_define_method(cls, "rb_scan_args", util_spec_rb_scan_args, 4);
#endif
#ifdef HAVE_RB_LONG2INT
rb_define_method(cls, "rb_long2int", util_spec_rb_long2int, 1);
#endif
#ifdef HAVE_RB_ITER_BREAK
rb_define_method(cls, "rb_iter_break", util_spec_rb_iter_break, 0);
#endif
}
示例4: rb_define_fs_pack
void
rb_define_fs_pack(){
rb_cPack = rb_define_class("FSPack", rb_cObject);
rb_define_alloc_func(rb_cPack, wrap_Pack_allocate);
rb_define_method(rb_cPack, "initialize", RUBY_METHOD_FUNC(rb_Pack_initialize), -1);
rb_define_method(rb_cPack, "read_data", RUBY_METHOD_FUNC(rb_Pack_read_data), 0);
rb_define_method(rb_cPack, "write_data", RUBY_METHOD_FUNC(rb_Pack_write_data), 0);
rb_define_method(rb_cPack, "read_data=", RUBY_METHOD_FUNC(rb_Pack_set_read_data), 1);
rb_define_method(rb_cPack, "write_data=", RUBY_METHOD_FUNC(rb_Pack_set_write_data), 1);
rb_define_method(rb_cPack, "type", RUBY_METHOD_FUNC(rb_Pack_type), 0);
}
示例5: Init_Vector
/* This is a fast vector class for Ruby scientific computation.
It is different from NArray because it's not generalized from a matrix.
These are pure vectors, and as such around 1.3 times faster than NArray
on average */
void Init_Vector() {
cVector = rb_define_class("Vector", rb_cObject);
rb_define_alloc_func(cVector, vector_alloc);
rb_define_method(cVector, "initialize", vector_init, -2);
rb_define_method(cVector, "print", vector_print, 0);
rb_define_method(cVector, "change", vector_change, 1);
rb_define_method(cVector, "+", vector_add, 1);
rb_define_method(cVector, "-", vector_subtract, 1);
rb_define_method(cVector, "*", vector_inner_product, 1);
rb_define_method(cVector, "mag", vector_magnitude, 0);
rb_define_method(cVector, "cross", vector_cross_product, 1);
rb_define_method(cVector, "[]", vector_at_entry, 1);
rb_define_method(cVector, "[]=", vector_change_entry,2);
rb_define_method(cVector, "size", print_size, 0);
}
示例6: Init_Traverser_Clone2_c
void Init_Traverser_Clone2_c() {
cls_Traverser_Clone2=rb_define_class("Traverser_Clone2",rb_const_get(rb_cObject,rb_intern("Amethyst")));
failobj=rb_eval_string("FAIL");
rb_define_method(cls_Traverser_Clone2,"profile_report",profile_report_Traverser_Clone2,0);
switchhash_Traverser_Clone2_1=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=AmethystAST\nnext h[k]=1 if k<=Array\nnext h[k]=2 if k<=Object\n}");
rb_global_variable(&switchhash_Traverser_Clone2_1);;
sy_Traverser_Clone2__lp_src_dot_cla_2024=rb_intern("Traverser_Clone2__lp_src_dot_cla_2024");
sy_Traverser_Clone2_bind_lb_1_rb__lt__7b20=rb_intern("Traverser_Clone2_bind_lb_1_rb__lt__7b20");
sy_Traverser_Clone2_bind_lb_1_rb__sp__6af0=rb_intern("Traverser_Clone2_bind_lb_1_rb__sp__6af0");
sy_Traverser_Clone2_if_sp_bind_lb__1bed=rb_intern("Traverser_Clone2_if_sp_bind_lb__1bed");
sy_visit=rb_intern("visit");
rb_define_method(cls_Traverser_Clone2,"root",Traverser_Clone2_root,0);
rb_define_method(cls_Traverser_Clone2,"traverse",Traverser_Clone2_traverse,0);
rb_define_method(cls_Traverser_Clone2,"traverse_item",Traverser_Clone2_traverse_item,0);
}
示例7: Init_bsdconv
void Init_bsdconv(){
VALUE Bsdconv = rb_define_class("Bsdconv", rb_cObject);
rb_define_singleton_method(Bsdconv, "new", m_new, 1);
rb_define_method(Bsdconv, "conv", m_conv, 1);
rb_define_method(Bsdconv, "init", m_init, 0);
rb_define_method(Bsdconv, "ctl", m_ctl, 3);
rb_define_method(Bsdconv, "conv_chunk", m_conv_chunk, 1);
rb_define_method(Bsdconv, "conv_chunk_last", m_conv_chunk_last, 1);
rb_define_method(Bsdconv, "conv_file", m_conv_file, 2);
rb_define_method(Bsdconv, "counter", m_counter, -1);
rb_define_method(Bsdconv, "counter_reset", m_counter_reset, -1);
rb_define_method(Bsdconv, "inspect", m_inspect, 0);
rb_define_const(Bsdconv, "FILTER", INT2NUM(FILTER));
rb_define_const(Bsdconv, "FROM", INT2NUM(FROM));
rb_define_const(Bsdconv, "INTER", INT2NUM(INTER));
rb_define_const(Bsdconv, "TO", INT2NUM(TO));
rb_define_const(Bsdconv, "CTL_ATTACH_SCORE", INT2NUM(BSDCONV_CTL_ATTACH_SCORE));
rb_define_const(Bsdconv, "CTL_ATTACH_OUTPUT_FILE", INT2NUM(BSDCONV_CTL_ATTACH_OUTPUT_FILE));
rb_define_const(Bsdconv, "CTL_AMBIGUOUS_PAD", INT2NUM(BSDCONV_CTL_AMBIGUOUS_PAD));
rb_define_singleton_method(Bsdconv, "insert_phase", f_insert_phase, 4);
rb_define_singleton_method(Bsdconv, "insert_codec", f_insert_codec, 4);
rb_define_singleton_method(Bsdconv, "replace_phase", f_replace_phase, 4);
rb_define_singleton_method(Bsdconv, "replace_codec", f_replace_codec, 4);
rb_define_singleton_method(Bsdconv, "error", f_error, 0);
rb_define_singleton_method(Bsdconv, "modules_list", f_modules_list, 1);
rb_define_singleton_method(Bsdconv, "module_check", f_module_check, 2);
rb_define_singleton_method(Bsdconv, "codecs_list", f_modules_list, 1);
rb_define_singleton_method(Bsdconv, "codec_check", f_module_check, 2);
rb_define_singleton_method(Bsdconv, "mktemp", f_mktemp, 1);
rb_define_singleton_method(Bsdconv, "fopen", f_fopen, 2);
Bsdconv_file = rb_define_class("Bsdconv_file", rb_cObject);
}
示例8: Init_priority_queue
void Init_priority_queue() {
id_compare_operator = rb_intern("<=>");
id_format = rb_intern("format");
cPriorityQueue = rb_define_class("PriorityQueue", rb_cObject);
rb_define_alloc_func(cPriorityQueue, pq_alloc);
rb_define_method(cPriorityQueue, "initialize", pq_init, 0);
rb_define_method(cPriorityQueue, "push", pq_push, 2);
rb_define_method(cPriorityQueue, "min", pq_min, 0);
rb_define_method(cPriorityQueue, "pop_min", pq_pop_min, 0);
rb_define_method(cPriorityQueue, "decrease_priority", pq_decrease_priority, 2);
rb_define_method(cPriorityQueue, "length", pq_length, 0);
rb_define_method(cPriorityQueue, "to_dot", pq_to_dot, 0);
}
示例9: Init_luxio
void Init_luxio()
{
VALUE klass;
klass = rb_define_class("LuxIOBtree" ,rb_cObject);
rb_define_singleton_method(klass, "new", reinterpret_cast<VALUE(*)(...)>(luxio_object_alloc), 0);
rb_define_method(klass, "open", reinterpret_cast<VALUE(*)(...)>(rb_luxiobtree_open), 2);
rb_define_method(klass, "put", reinterpret_cast<VALUE(*)(...)>(rb_luxiobtree_put), 2);
rb_define_method(klass, "get", reinterpret_cast<VALUE(*)(...)>(rb_luxiobtree_get), 1);
rb_define_method(klass, "del", reinterpret_cast<VALUE(*)(...)>(rb_luxiobtree_del), 1);
rb_define_const(klass, "LUX_DB_RDONLY", INT2NUM(Lux::IO::DB_RDONLY));
rb_define_const(klass, "LUX_DB_RDWR", INT2NUM(Lux::IO::DB_RDWR));
rb_define_const(klass, "LUX_DB_CREAT", INT2NUM(Lux::IO::DB_CREAT));
rb_define_const(klass, "LUX_DB_TRUNC", INT2NUM(Lux::IO::DB_TRUNC));
}
示例10: Init_module_spec
void Init_module_spec() {
VALUE cls, mod;
cls = rb_define_class("CApiModuleSpecs", rb_cObject);
rb_define_method(cls, "rb_define_const", sm_define_const, 2);
rb_define_method(cls, "rb_const_defined", sm_const_defined, 2);
cls = rb_define_class("CApiDefineAliasSpecs", rb_cObject);
rb_define_method(cls, "rb_define_alias", sa_define_alias, 3);
cls = rb_define_class("CApiMethodVisSpecs", rb_cObject);
mod = rb_define_module("CApiMethodVisModule");
rb_define_method(cls, "smv_test_public", smv_test, 0);
rb_define_protected_method(cls, "smv_test_protected", smv_test, 0);
rb_define_private_method(cls, "smv_test_private", smv_test, 0);
rb_define_singleton_method(mod, "smv_test_singleton", smv_test, 0);
rb_define_module_function(mod, "smv_test_module_function", smv_test, 0);
rb_define_global_function("smv_test_global_function", smv_test, 0);
rb_define_method(cls, "rb_undef_method", smv_undef_method, 2);
}
示例11: Init_rcsfile
/* Module initialization {{{1 */
void
Init_rcsfile(void)
{
rb_cRCSFile = rb_define_class("RCSFile", rb_cObject);
rb_define_alloc_func(rb_cRCSFile, rb_rcsfile_s_alloc);
rb_define_singleton_method(rb_cRCSFile, "open", rb_rcsfile_s_open, -1);
rb_define_method(rb_cRCSFile, "initialize", rb_rcsfile_initialize, -1);
rb_define_method(rb_cRCSFile, "close", rb_rcsfile_close, 0);
rb_define_method(rb_cRCSFile, "head", rb_rcsfile_head, 0);
rb_define_method(rb_cRCSFile, "branch", rb_rcsfile_branch, 0);
rb_define_method(rb_cRCSFile, "access", rb_rcsfile_access, 0);
rb_define_method(rb_cRCSFile, "symbols", rb_rcsfile_symbols, 0);
rb_define_method(rb_cRCSFile, "locks", rb_rcsfile_locks, 0);
rb_define_method(rb_cRCSFile, "strict", rb_rcsfile_strict, 0);
rb_define_method(rb_cRCSFile, "comment", rb_rcsfile_comment, 0);
rb_define_method(rb_cRCSFile, "expand", rb_rcsfile_expand, 0);
rb_define_method(rb_cRCSFile, "desc", rb_rcsfile_desc, 0);
rb_define_method(rb_cRCSFile, "checkout", rb_rcsfile_checkout, -1);
rb_define_method(rb_cRCSFile, "resolve_sym", rb_rcsfile_resolve_sym, -1);
rb_define_method(rb_cRCSFile, "getlog", rb_rcsfile_getlog, 1);
/* Hash-like interface to revs */
rb_include_module(rb_cRCSFile, rb_mEnumerable);
rb_define_method(rb_cRCSFile, "[]", rb_revtree_aref, 1);
rb_define_method(rb_cRCSFile, "each", rb_revtree_each, 0);
rb_define_method(rb_cRCSFile, "each_pair", rb_revtree_each_pair, 0);
rb_define_method(rb_cRCSFile, "each_key", rb_revtree_each_key, 0);
rb_define_method(rb_cRCSFile, "each_value", rb_revtree_each_value, 0);
rb_define_method(rb_cRCSFile, "empty?", rb_revtree_empty_p, 0);
rb_define_method(rb_cRCSFile, "key?", rb_revtree_key_p, 1);
rb_define_method(rb_cRCSFile, "has_key?", rb_revtree_key_p, 1);
rb_define_method(rb_cRCSFile, "include?", rb_revtree_key_p, 1);
rb_define_method(rb_cRCSFile, "member?", rb_revtree_key_p, 1);
rb_define_method(rb_cRCSFile, "keys", rb_revtree_keys, 0);
rb_define_method(rb_cRCSFile, "values", rb_revtree_values, 0);
rb_define_method(rb_cRCSFile, "to_a", rb_revtree_to_a, 0);
rb_define_method(rb_cRCSFile, "to_hash", rb_revtree_to_hash, 0);
rb_cRev = rb_define_class_under(rb_cRCSFile, "Rev", rb_cObject);
rb_attr2(rb_cRev, "rev", 1, 0);
rb_attr2(rb_cRev, "date", 1, 0);
rb_attr2(rb_cRev, "author", 1, 0);
rb_attr2(rb_cRev, "state", 1, 0);
rb_attr2(rb_cRev, "branches", 1, 0);
rb_attr2(rb_cRev, "next", 1, 0);
rb_attr2(rb_cRev, "commitid", 1, 0);
rb_attr2(rb_cRev, "log", 1, 1);
}
示例12: rsock_init_basicsocket
void
rsock_init_basicsocket(void)
{
/*
* Document-class: BasicSocket < IO
*
* BasicSocket is the super class for all the Socket classes.
*/
rb_cBasicSocket = rb_define_class("BasicSocket", rb_cIO);
rb_undef_method(rb_cBasicSocket, "initialize");
rb_define_singleton_method(rb_cBasicSocket, "do_not_reverse_lookup",
bsock_do_not_rev_lookup, 0);
rb_define_singleton_method(rb_cBasicSocket, "do_not_reverse_lookup=",
bsock_do_not_rev_lookup_set, 1);
rb_define_singleton_method(rb_cBasicSocket, "for_fd", bsock_s_for_fd, 1);
rb_define_method(rb_cBasicSocket, "close_read", bsock_close_read, 0);
rb_define_method(rb_cBasicSocket, "close_write", bsock_close_write, 0);
rb_define_method(rb_cBasicSocket, "shutdown", bsock_shutdown, -1);
rb_define_method(rb_cBasicSocket, "setsockopt", bsock_setsockopt, -1);
rb_define_method(rb_cBasicSocket, "getsockopt", bsock_getsockopt, 2);
rb_define_method(rb_cBasicSocket, "getsockname", bsock_getsockname, 0);
rb_define_method(rb_cBasicSocket, "getpeername", bsock_getpeername, 0);
rb_define_method(rb_cBasicSocket, "getpeereid", bsock_getpeereid, 0);
rb_define_method(rb_cBasicSocket, "local_address", bsock_local_address, 0);
rb_define_method(rb_cBasicSocket, "remote_address", bsock_remote_address, 0);
rb_define_method(rb_cBasicSocket, "send", rsock_bsock_send, -1);
rb_define_method(rb_cBasicSocket, "recv", bsock_recv, -1);
rb_define_method(rb_cBasicSocket, "do_not_reverse_lookup", bsock_do_not_reverse_lookup, 0);
rb_define_method(rb_cBasicSocket, "do_not_reverse_lookup=", bsock_do_not_reverse_lookup_set, 1);
/* for ext/socket/lib/socket.rb use only: */
rb_define_private_method(rb_cBasicSocket,
"__recv_nonblock", bsock_recv_nonblock, 4);
/* in ancdata.c */
rb_define_private_method(rb_cBasicSocket, "__sendmsg",
rsock_bsock_sendmsg, 4);
rb_define_private_method(rb_cBasicSocket, "__sendmsg_nonblock",
rsock_bsock_sendmsg_nonblock, 5);
rb_define_private_method(rb_cBasicSocket, "__recvmsg",
rsock_bsock_recvmsg, 4);
rb_define_private_method(rb_cBasicSocket, "__recvmsg_nonblock",
rsock_bsock_recvmsg_nonblock, 5);
}
示例13: rb_define_class
///////////////////////////////////////////////////////////
// ARGSS Color initialize
///////////////////////////////////////////////////////////
void ARGSS::AColor::Init() {
id = rb_define_class("Color", rb_cObject);
rb_define_method(id, "initialize", (rubyfunc)rinitialize, -1);
rb_define_method(id, "set", (rubyfunc)rset, -1);
rb_define_method(id, "red", (rubyfunc)rred, 0);
rb_define_method(id, "red=", (rubyfunc)rredE, 1);
rb_define_method(id, "green", (rubyfunc)rgreen, 0);
rb_define_method(id, "green=", (rubyfunc)rgreenE, 1);
rb_define_method(id, "blue", (rubyfunc)rblue, 0);
rb_define_method(id, "blue=", (rubyfunc)rblueE, 1);
rb_define_method(id, "alpha", (rubyfunc)ralpha, 0);
rb_define_method(id, "alpha=", (rubyfunc)ralphaE, 1);
rb_define_method(id, "inspect", (rubyfunc)rinspect, 0);
rb_define_method(id, "_dump", (rubyfunc)rdump, -1);
rb_define_singleton_method(id, "_load", (rubyfunc)rload, 1);
}
示例14: Init_fsevent
void Init_fsevent() {
rb_require("fsevent/signal_ext");
fsevent_class = rb_define_class("FSEvent", rb_cObject);
rb_define_method(fsevent_class, "initialize", t_init, 0);
rb_define_method(fsevent_class, "on_change", t_on_change, 1);
rb_define_method(fsevent_class, "watch_directories", t_watch_directories, 1);
rb_define_method(fsevent_class, "start", t_start, 0);
rb_define_method(fsevent_class, "stop", t_stop, 0);
rb_define_method(fsevent_class, "restart", t_restart, 0);
rb_define_attr(fsevent_class, "latency", 1, 1);
rb_define_attr(fsevent_class, "registered_directories", 1, 1);
register_signal_delegation();
}
示例15: Init_Constant_Propagator_c
void Init_Constant_Propagator_c(){
cls_Constant_Propagator=rb_define_class("Constant_Propagator",rb_const_get(rb_cObject,rb_intern("Amethyst")));
failobj=rb_eval_string("FAIL");
rb_define_method(cls_Constant_Propagator,"profile_report",profile_report_Constant_Propagator,0);
switchhash_Constant_Propagator_1=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Act\nnext h[k]=1 if k<=Bind\nnext h[k]=2 if k<=CAct\nnext h[k]=3 if k<=Local\nnext h[k]=4 if k<=Object\n}");rb_global_variable(&switchhash_Constant_Propagator_1);;
switchhash_Constant_Propagator_2=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Lambda\nnext h[k]=1 if k<=Local\nnext h[k]=2 if k<=Object\n}");rb_global_variable(&switchhash_Constant_Propagator_2);;
sy_Constant_Propagator_Constant_8840=rb_intern("Constant_Propagator_Constant_8840");
sy_Constant_Propagator_Constant_bf42=rb_intern("Constant_Propagator_Constant_bf42");
sy_Constant_Propagator_Constant_db03=rb_intern("Constant_Propagator_Constant_db03");
sy_Constant_Propagator__at_depend_eq__07a9=rb_intern("Constant_Propagator__at_depend_eq__07a9");
sy_Constant_Propagator_a_eq_Consta_2e1d=rb_intern("Constant_Propagator_a_eq_Consta_2e1d");
sy_Constant_Propagator_src_25d9=rb_intern("Constant_Propagator_src_25d9");
sy_valof=rb_intern("valof");
rb_define_method(cls_Constant_Propagator,"root",Constant_Propagator_root,0);
rb_define_method(cls_Constant_Propagator,"step",Constant_Propagator_step,1);
}