• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rb_define_alloc_func函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rb_define_alloc_func函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_define_alloc_func函数的具体用法?C++ rb_define_alloc_func怎么用?C++ rb_define_alloc_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rb_define_alloc_func函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Init_ossl_ssl_session

void Init_ossl_ssl_session(void)
{
#if 0
	mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
	mSSL = rb_define_module_under(mOSSL, "SSL");
#endif
	cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
	eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);

	rb_define_alloc_func(cSSLSession, ossl_ssl_session_alloc);
	rb_define_method(cSSLSession, "initialize", ossl_ssl_session_initialize, 1);

	rb_define_method(cSSLSession, "==", ossl_ssl_session_eq, 1);

	rb_define_method(cSSLSession, "time", ossl_ssl_session_get_time, 0);
	rb_define_method(cSSLSession, "time=", ossl_ssl_session_set_time, 1);
	rb_define_method(cSSLSession, "timeout", ossl_ssl_session_get_timeout, 0);
	rb_define_method(cSSLSession, "timeout=", ossl_ssl_session_set_timeout, 1);
	rb_define_method(cSSLSession, "id", ossl_ssl_session_get_id, 0);
	rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
	rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
	rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
}
开发者ID:brettgoulder,项目名称:openssl,代码行数:23,代码来源:ossl_ssl_session.c


示例2: Init_figure_set

/**
 * define class
**/
void
Init_figure_set(void) {
    rb_cFigureSet = rb_define_class("FigureSet", rb_cObject);
    rb_define_alloc_func(rb_cFigureSet, t_allocate);
    rb_define_private_method(rb_cFigureSet, "initialize", t_initialize, -1);
    rb_define_method(rb_cFigureSet, "initialize_copy", t_initialize_copy, 1);
    rb_define_method(rb_cFigureSet, "add", t_add, 1);
    rb_define_method(rb_cFigureSet, "delete", t_delete, 1);
    rb_define_method(rb_cFigureSet, "intersection", t_intersection, 1);
    rb_define_method(rb_cFigureSet, "union", t_union, 1);
    rb_define_method(rb_cFigureSet, "to_a", t_to_a, 0);
    rb_define_method(rb_cFigureSet, "sample", t_sample, -1);
    rb_define_method(rb_cFigureSet, "size", t_size, 0);
    rb_define_method(rb_cFigureSet, "empty?", t_empty, 0);
    rb_define_method(rb_cFigureSet, "clear", t_clear, 0);
    rb_define_alias(rb_cFigureSet, "<<", "add");
    rb_define_alias(rb_cFigureSet, "&", "intersection");
    rb_define_alias(rb_cFigureSet, "|", "union");
    rb_define_alias(rb_cFigureSet, "length", "size");

    // for sample method
    srand((unsigned) time(NULL));
}
开发者ID:tsukasaoishi,项目名称:figure_set,代码行数:26,代码来源:methods.c


示例3: rgeo_init_proj4

static void rgeo_init_proj4()
{
  VALUE rgeo_module;
  VALUE coordsys_module;
  VALUE proj4_class;

  rgeo_module = rb_define_module("RGeo");
  coordsys_module = rb_define_module_under(rgeo_module, "CoordSys");
  proj4_class = rb_define_class_under(coordsys_module, "Proj4", rb_cObject);

  rb_define_alloc_func(proj4_class, alloc_proj4);
  rb_define_module_function(proj4_class, "_create", cmethod_proj4_create, 2);
  rb_define_method(proj4_class, "initialize_copy", method_proj4_initialize_copy, 1);
  rb_define_method(proj4_class, "_set_value", method_proj4_set_value, 2);
  rb_define_method(proj4_class, "_original_str", method_proj4_original_str, 0);
  rb_define_method(proj4_class, "_canonical_str", method_proj4_canonical_str, 0);
  rb_define_method(proj4_class, "_valid?", method_proj4_is_valid, 0);
  rb_define_method(proj4_class, "_geographic?", method_proj4_is_geographic, 0);
  rb_define_method(proj4_class, "_geocentric?", method_proj4_is_geocentric, 0);
  rb_define_method(proj4_class, "_radians?", method_proj4_uses_radians, 0);
  rb_define_method(proj4_class, "_get_geographic", method_proj4_get_geographic, 0);
  rb_define_module_function(proj4_class, "_transform_coords", cmethod_proj4_transform, 5);
}
开发者ID:Cythnk,项目名称:territory_mapper,代码行数:23,代码来源:main.c


示例4: Init_geoip2_compat

void Init_geoip2_compat()
{
  cgeoip2_compat = rb_define_class("GeoIP2Compat", rb_cObject);
  egeoip2_compat_Exception = rb_define_class_under(cgeoip2_compat, "Error", rb_eStandardError);

  rb_global_variable(&cgeoip2_compat);
  rb_global_variable(&egeoip2_compat_Exception);

  rb_define_alloc_func(cgeoip2_compat, geoip2_compat_allocate);
  rb_define_method(cgeoip2_compat, "initialize", geoip2_compat_initialize, 1);
  rb_define_method(cgeoip2_compat, "path", geoip2_compat_path, 0);
  rb_define_method(cgeoip2_compat, "close", geoip2_compat_close, 0);
  rb_define_method(cgeoip2_compat, "lookup", geoip2_compat_lookup, 1);

  geoip2_compat_COUNTRY_CODE  = rb_intern("country_code");
  geoip2_compat_COUNTRY_NAME  = rb_intern("country_name");
  geoip2_compat_REGION        = rb_intern("region");
  geoip2_compat_REGION_NAME   = rb_intern("region_name");
  geoip2_compat_CITY          = rb_intern("city");
  geoip2_compat_POSTAL_CODE   = rb_intern("postal_code");
  geoip2_compat_LATITUDE      = rb_intern("latitude");
  geoip2_compat_LONGITUDE     = rb_intern("longitude");
}
开发者ID:almsrafi,项目名称:geoip2_compat,代码行数:23,代码来源:geoip2_compat.c


示例5: Init_ossl_ns_spki

/*
 * NETSCAPE_SPKI init
 */
void
Init_ossl_ns_spki()
{
    mNetscape = rb_define_module_under(mOSSL, "Netscape");
	
    eSPKIError = rb_define_class_under(mNetscape, "SPKIError", eOSSLError);
	
    cSPKI = rb_define_class_under(mNetscape, "SPKI", rb_cObject);
	
    rb_define_alloc_func(cSPKI, ossl_spki_alloc);
    rb_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
	
    rb_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
    rb_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
    rb_define_alias(cSPKI, "to_s", "to_pem");
    rb_define_method(cSPKI, "to_text", ossl_spki_print, 0);
    rb_define_method(cSPKI, "public_key", ossl_spki_get_public_key, 0);
    rb_define_method(cSPKI, "public_key=", ossl_spki_set_public_key, 1);
    rb_define_method(cSPKI, "sign", ossl_spki_sign, 2);
    rb_define_method(cSPKI, "verify", ossl_spki_verify, 1);
    rb_define_method(cSPKI, "challenge", ossl_spki_get_challenge, 0);
    rb_define_method(cSPKI, "challenge=", ossl_spki_set_challenge, 1);
}
开发者ID:AdamDotCom,项目名称:my-rvm,代码行数:26,代码来源:ossl_ns_spki.c


示例6: Map_register

void Map_register(VALUE module) {
  VALUE klass = rb_define_class_under(module, "Map", rb_cObject);
  rb_define_alloc_func(klass, Map_alloc);
  cMap = klass;
  rb_gc_register_address(&cMap);

  rb_define_method(klass, "initialize", Map_init, -1);
  rb_define_method(klass, "each", Map_each, 0);
  rb_define_method(klass, "keys", Map_keys, 0);
  rb_define_method(klass, "values", Map_values, 0);
  rb_define_method(klass, "[]", Map_index, 1);
  rb_define_method(klass, "[]=", Map_index_set, 2);
  rb_define_method(klass, "has_key?", Map_has_key, 1);
  rb_define_method(klass, "delete", Map_delete, 1);
  rb_define_method(klass, "clear", Map_clear, 0);
  rb_define_method(klass, "length", Map_length, 0);
  rb_define_method(klass, "dup", Map_dup, 0);
  rb_define_method(klass, "==", Map_eq, 1);
  rb_define_method(klass, "hash", Map_hash, 0);
  rb_define_method(klass, "inspect", Map_inspect, 0);
  rb_define_method(klass, "merge", Map_merge, 1);
  rb_include_module(klass, rb_mEnumerable);
}
开发者ID:2007750219,项目名称:protobuf,代码行数:23,代码来源:map.c


示例7: define_ruby_class

void
define_ruby_class()
{
  if (rb_klass)
    return;
  /* 
   * opencv = rb_define_module("OpenCV");
   * 
   * note: this comment is used by rdoc.
   */
  VALUE opencv = rb_module_opencv();  
  rb_klass = rb_define_class_under(opencv, "IplConvKernel", rb_cObject);
  rb_define_alloc_func(rb_klass, rb_allocate);

  rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
  rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
  rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
  rb_define_alias(rb_klass, "columns", "cols");
  rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
  rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
  rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
  rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
}
开发者ID:Wenackles,项目名称:ruby-opencv,代码行数:23,代码来源:iplconvkernel.cpp


示例8: Init_Oni_Animation

void Init_Oni_Animation(VALUE outer){
	VALUE klass = rb_define_class_under(outer, "Animation", rb_cObject);
	
	rb_define_alloc_func(klass, alloc);
	rb_define_method(klass, "initialize", initialize, 1);
	rb_define_method(klass, "update", update, 1);
	
	rb_define_method(klass, "share_skeleton_with", shareSkeletonWith, -1);
	rb_define_method(klass, "bone", getBone, 1);
	
	rb_define_method(klass, "animations", animation_names, 0);
	
	rb_define_method(klass, "[]", getAnimationTrack, 1);
	
	// Add easing equations
	Init_Oni_AnimationEasing(klass);
	
	
	// Nested class
	Init_Oni_Animation_Track(klass);
	Init_Oni_Animation_Bone(klass);
	Init_Oni_AnimationEasing(klass);
}
开发者ID:Avant-Flux,项目名称:oni,代码行数:23,代码来源:animation.c


示例9: Init_grpc_server

void Init_grpc_server() {
  grpc_rb_cServer =
      rb_define_class_under(grpc_rb_mGrpcCore, "Server", rb_cObject);

  /* Allocates an object managed by the ruby runtime */
  rb_define_alloc_func(grpc_rb_cServer, grpc_rb_server_alloc);

  /* Provides a ruby constructor and support for dup/clone. */
  rb_define_method(grpc_rb_cServer, "initialize", grpc_rb_server_init, 1);
  rb_define_method(grpc_rb_cServer, "initialize_copy", grpc_rb_cannot_init_copy,
                   1);

  /* Add the server methods. */
  rb_define_method(grpc_rb_cServer, "request_call", grpc_rb_server_request_call,
                   0);
  rb_define_method(grpc_rb_cServer, "start", grpc_rb_server_start, 0);
  rb_define_method(grpc_rb_cServer, "destroy", grpc_rb_server_destroy, -1);
  rb_define_alias(grpc_rb_cServer, "close", "destroy");
  rb_define_method(grpc_rb_cServer, "add_http2_port",
                   grpc_rb_server_add_http2_port, 2);
  id_at = rb_intern("at");
  id_insecure_server = rb_intern("this_port_is_insecure");
}
开发者ID:deepaklukose,项目名称:grpc,代码行数:23,代码来源:rb_server.c


示例10: Init_bitmapper

void Init_bitmapper() {
    rb_cBitmapper = rb_define_class("Bitmapper", rb_cObject);
    rb_define_alloc_func(rb_cBitmapper, bm_alloc);
    rb_define_method(rb_cBitmapper, "initialize", bm_init, 1);
    rb_define_method(rb_cBitmapper, "reset", bm_reset, 0);
    rb_define_method(rb_cBitmapper, "get_indexes", bm_get_indexes, 0);
    rb_define_method(rb_cBitmapper, "add", bm_add_from_file, 1);
    rb_define_method(rb_cBitmapper, "remove", bm_remove_from_file, 1);
    rb_define_method(rb_cBitmapper, "dump_to", bm_dump_to_file, 1);

    rb_define_method(rb_cBitmapper, "enable_filter", bm_enable_filter, 0);
    rb_define_method(rb_cBitmapper, "disable_filter", bm_disable_filter, 0);
    rb_define_method(rb_cBitmapper, "set_filters", bm_set_filters, 1);
    rb_define_method(rb_cBitmapper, "clear_filters", bm_clear_filters, 1);

    rb_define_method(rb_cBitmapper, "load_from_str", bm_load_str_to_bkt, 2);
    rb_define_method(rb_cBitmapper, "dump_range_to_str", bm_dump_range_bkt_str, 3);
    rb_define_method(rb_cBitmapper, "dump_to_str", bm_dump_bkt_str, 2);

    rb_define_method(rb_cBitmapper, "status?", bm_num_status, 1);
    rb_define_method(rb_cBitmapper, "set", bm_set, 1);
    rb_define_method(rb_cBitmapper, "clear", bm_clear, 1);
}
开发者ID:gouthamvel,项目名称:bitmapper,代码行数:23,代码来源:bitmapper.c


示例11: Init_packet_in

void
Init_packet_in() {
    rb_require( "trema/mac" );
    cPacketIn = rb_define_class_under( mTrema, "PacketIn", rb_cObject );
    rb_define_alloc_func( cPacketIn, packet_in_alloc );
#if 0
    /*
     * Do not remote this is to fake yard to create a constructor for
     * PacketIn object.
     */
    rb_define_method( cPacketIn, "initialize", packet_in_init, 0 );
#endif
    rb_define_method( cPacketIn, "datapath_id", packet_in_datapath_id, 0 );
    rb_define_method( cPacketIn, "transaction_id", packet_in_transaction_id, 0 );
    rb_define_method( cPacketIn, "buffer_id", packet_in_buffer_id, 0 );
    rb_define_method( cPacketIn, "buffered?", packet_in_is_buffered, 0 );
    rb_define_method( cPacketIn, "in_port", packet_in_in_port, 0 );
    rb_define_method( cPacketIn, "total_len", packet_in_total_len, 0 );
    rb_define_method( cPacketIn, "reason", packet_in_reason, 0 );
    rb_define_method( cPacketIn, "data", packet_in_data, 0 );
    rb_define_method( cPacketIn, "macsa", packet_in_macsa, 0 );
    rb_define_method( cPacketIn, "macda", packet_in_macda, 0 );
}
开发者ID:nickkaranatsios,项目名称:trema,代码行数:23,代码来源:packet_in.c


示例12: strb_InitializeFont

VALUE
strb_InitializeFont(VALUE rb_mStarRuby)
{
  VALUE rb_cFont = rb_define_class_under(rb_mStarRuby, "Font", rb_cObject);
  rb_define_singleton_method(rb_cFont, "exist?", Font_s_exist, 1);
  rb_define_singleton_method(rb_cFont, "new",    Font_s_new,   -1);
  rb_define_alloc_func(rb_cFont, Font_alloc);
  rb_define_private_method(rb_cFont, "initialize", Font_initialize, 5);
  rb_define_method(rb_cFont, "bold?",     Font_bold,     0);
  rb_define_method(rb_cFont, "get_size",  Font_get_size, 1);
  rb_define_method(rb_cFont, "italic?",   Font_italic,   0);
  rb_define_method(rb_cFont, "name",      Font_name,     0);
  rb_define_method(rb_cFont, "size",      Font_size,     0);

  symbol_bold      = ID2SYM(rb_intern("bold"));
  symbol_italic    = ID2SYM(rb_intern("italic"));
  symbol_ttc_index = ID2SYM(rb_intern("ttc_index"));

  rbFontCache = rb_hash_new();
  rb_gc_register_address(&rbFontCache);

  return rb_cFont;
}
开发者ID:GunioRobot,项目名称:starruby,代码行数:23,代码来源:font.c


示例13: init_swf_text_field

void init_swf_text_field()
{
  VALUE kedama  = rb_define_module("Kedama");
  VALUE swf     = rb_define_module_under(kedama, "SWF");
  VALUE klass   = rb_define_class_under(swf, "TextField", rb_cObject);

  rb_define_alloc_func(klass, allocate);
  rb_define_method(klass, "height=", set_height, 1);
  rb_define_method(klass, "append", append, 1);
  rb_define_method(klass, "bounds", bounds, 2);
  rb_define_method(klass, "variable_name=", set_variable_name, 1);
  rb_define_method(klass, "field_height=", set_field_height, 1);
  rb_define_method(klass, "left_margin=", set_left_margin, 1);
  rb_define_method(klass, "right_margin=", set_right_margin, 1);
  rb_define_method(klass, "indentation=", set_indentation, 1);
  rb_define_method(klass, "line_spacing=", set_line_spacing, 1);
  rb_define_method(klass, "padding=", set_padding, 1);
  rb_define_method(klass, "length=", set_length, 1);
  rb_define_private_method(klass, "native_set_font", native_set_font, 1);
  rb_define_private_method(klass, "native_set_color", native_set_color, 4);
  rb_define_private_method(klass, "native_set_flags", native_set_flags, 1);
  rb_define_private_method(klass, "native_set_alignment", native_set_alignment, 1);
}
开发者ID:tenderlove,项目名称:kedama,代码行数:23,代码来源:swf_text_field.c


示例14: init_ruby_class

void
init_ruby_class()
{
#if 0
  // For documentation using YARD
  VALUE opencv = rb_define_module("OpenCV");
  VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
  VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
#endif

  if (rb_klass)
    return;
  /* 
   * opencv = rb_define_module("OpenCV");
   * 
   * note: this comment is used by rdoc.
   */
  VALUE opencv = rb_module_opencv();
  VALUE face_recognizer = cFaceRecognizer::rb_class();
  rb_klass = rb_define_class_under(opencv, "EigenFaces", face_recognizer);
  rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
  rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
}
开发者ID:HaiTo,项目名称:ruby-opencv,代码行数:23,代码来源:eigenfaces.cpp


示例15: Init_ora_number

void Init_ora_number(void)
{
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  /* ruby 1.8 */
  rb_define_alloc_func(cOraNumber, RUBY_METHOD_FUNC(ora_number_s_allocate));
  rb_define_method(cOraNumber, "initialize", ora_number_initialize, -1);
  rb_define_method(cOraNumber, "initialize_copy", ora_number_initialize_copy, 1);
#else
  /* ruby 1.6 */
  rb_define_singleton_method(cOraNumber, "new", ora_number_s_new, -1);
  rb_define_method(cOraNumber, "initialize", ora_number_initialize, -1);
  rb_define_method(cOraNumber, "clone", ora_number_clone, 0);
  rb_define_method(cOraNumber, "dup", ora_number_clone, 0);
#endif

  rb_define_method(cOraNumber, "to_i", ora_number_to_i, 0);
  rb_define_method(cOraNumber, "to_f", ora_number_to_f, 0);
  rb_define_method(cOraNumber, "to_s", ora_number_to_s, 0);
  rb_define_method(cOraNumber, "[email protected]", ora_number_uminus, 0);

  rb_define_method(cOraNumber, "_dump", ora_number_dump, -1);
  rb_define_singleton_method(cOraNumber, "_load", ora_number_s_load, 1);
}
开发者ID:kevincolyar,项目名称:ruby_oracle_libs,代码行数:23,代码来源:oranumber.c


示例16: rxml_init_document

void rxml_init_document(void)
{
  cXMLDocument = rb_define_class_under(mXML, "Document", rb_cObject);
  rb_define_alloc_func(cXMLDocument, rxml_document_alloc);

  rb_define_method(cXMLDocument, "initialize", rxml_document_initialize, -1);
  rb_define_method(cXMLDocument, "child", rxml_document_child_get, 0);
  rb_define_method(cXMLDocument, "child?", rxml_document_child_q, 0);
  rb_define_method(cXMLDocument, "compression", rxml_document_compression_get, 0);
  rb_define_method(cXMLDocument, "compression=", rxml_document_compression_set, 1);
  rb_define_method(cXMLDocument, "compression?", rxml_document_compression_q, 0);
  rb_define_method(cXMLDocument, "debug", rxml_document_debug, 0);
  rb_define_method(cXMLDocument, "encoding", rxml_document_encoding_get, 0);
  rb_define_method(cXMLDocument, "encoding=", rxml_document_encoding_set, 1);
  rb_define_method(cXMLDocument, "last", rxml_document_last_get, 0);
  rb_define_method(cXMLDocument, "last?", rxml_document_last_q, 0);
  rb_define_method(cXMLDocument, "next", rxml_document_next_get, 0);
  rb_define_method(cXMLDocument, "next?", rxml_document_next_q, 0);
  rb_define_method(cXMLDocument, "node_type", rxml_document_node_type, 0);
  rb_define_method(cXMLDocument, "order_elements!", rxml_document_order_elements, 0);
  rb_define_method(cXMLDocument, "parent", rxml_document_parent_get, 0);
  rb_define_method(cXMLDocument, "parent?", rxml_document_parent_q, 0);
  rb_define_method(cXMLDocument, "prev", rxml_document_prev_get, 0);
  rb_define_method(cXMLDocument, "prev?", rxml_document_prev_q, 0);
  rb_define_method(cXMLDocument, "root", rxml_document_root_get, 0);
  rb_define_method(cXMLDocument, "root=", rxml_document_root_set, 1);
  rb_define_method(cXMLDocument, "save", rxml_document_save, -1);
  rb_define_method(cXMLDocument, "standalone?", rxml_document_standalone_q, 0);
  rb_define_method(cXMLDocument, "to_s", rxml_document_to_s, -1);
  rb_define_method(cXMLDocument, "url", rxml_document_url_get, 0);
  rb_define_method(cXMLDocument, "version", rxml_document_version_get, 0);
  rb_define_method(cXMLDocument, "xhtml?", rxml_document_xhtml_q, 0);
  rb_define_method(cXMLDocument, "xinclude", rxml_document_xinclude, 0);
  rb_define_method(cXMLDocument, "validate", rxml_document_validate_dtd, 1);
  rb_define_method(cXMLDocument, "validate_schema", rxml_document_validate_schema, 1);
  rb_define_method(cXMLDocument, "validate_relaxng", rxml_document_validate_relaxng, 1);
}
开发者ID:tadman,项目名称:libxml-ruby,代码行数:37,代码来源:ruby_xml_document.c


示例17: rb_grn_init_database

void
rb_grn_init_database (VALUE mGrn)
{
    rb_cGrnDatabase = rb_define_class_under(mGrn, "Database", rb_cGrnObject);
    rb_define_alloc_func(rb_cGrnDatabase, rb_grn_database_alloc);

    rb_include_module(rb_cGrnDatabase, rb_mEnumerable);
    rb_include_module(rb_cGrnDatabase, rb_mGrnEncodingSupport);
    rb_include_module(rb_cGrnDatabase, rb_mGrnFlushable);

    rb_define_singleton_method(rb_cGrnDatabase, "create",
                               rb_grn_database_s_create, -1);
    rb_define_singleton_method(rb_cGrnDatabase, "open",
                               rb_grn_database_s_open, -1);

    rb_define_method(rb_cGrnDatabase, "initialize",
                     rb_grn_database_initialize, -1);

    rb_define_method(rb_cGrnDatabase, "each",
                     rb_grn_database_each, -1);

    rb_define_method(rb_cGrnDatabase, "close",
                     rb_grn_database_close, 0);

    rb_define_method(rb_cGrnDatabase, "lock", rb_grn_database_lock, -1);
    rb_define_method(rb_cGrnDatabase, "unlock", rb_grn_database_unlock, 0);
    rb_define_method(rb_cGrnDatabase, "clear_lock",
                     rb_grn_database_clear_lock, 0);
    rb_define_method(rb_cGrnDatabase, "locked?", rb_grn_database_is_locked, 0);

    rb_define_method(rb_cGrnDatabase, "touch", rb_grn_database_touch, 0);
    rb_define_method(rb_cGrnDatabase, "defrag", rb_grn_database_defrag, -1);
    rb_define_method(rb_cGrnDatabase, "recover", rb_grn_database_recover, 0);
    rb_define_method(rb_cGrnDatabase, "unmap", rb_grn_database_unmap, 0);
    rb_define_method(rb_cGrnDatabase, "reindex", rb_grn_database_reindex, 0);
    rb_define_method(rb_cGrnDatabase, "remove_force", rb_grn_database_remove_force, 1);
}
开发者ID:kenhys,项目名称:rroonga,代码行数:37,代码来源:rb-grn-database.c


示例18: Init_Row

/**
 * This function is used to create and initialize the Row class within the
 * Ruby environment.
 *
 * @param  module  A reference to the module that the Row class will be created
 *                 under.
 *
 */
void Init_Row(VALUE module) {
  cRow = rb_define_class_under(module, "Row", rb_cObject);
  rb_define_alloc_func(cRow, allocateRow);
  rb_include_module(cRow, rb_mEnumerable);
  rb_define_method(cRow, "initialize", initializeRow, 3);
  rb_define_method(cRow, "number", getRowNumber, 0);
  rb_define_method(cRow, "column_count", columnsInRow, 0);
  rb_define_method(cRow, "column_name", getColumnName, 1);
  rb_define_method(cRow, "column_alias", getColumnAlias, 1);
  rb_define_method(cRow, "column_scale", getColumnScale, 1);
  rb_define_method(cRow, "each", eachColumn, 0);
  rb_define_method(cRow, "each_key", eachColumnKey, 0);
  rb_define_method(cRow, "each_value", eachColumnValue, 0);
  rb_define_method(cRow, "[]", getColumnValue, 1);
  rb_define_method(cRow, "fetch", fetchRowValue, -1);
  rb_define_method(cRow, "has_key?", hasColumnKey, 1);
  rb_define_method(cRow, "has_column?", hasColumnName, 1);
  rb_define_method(cRow, "has_alias?", hasColumnAlias, 1);
  rb_define_method(cRow, "has_value?", hasColumnValue, 1);
  rb_define_method(cRow, "keys", getColumnKeys, 0);
  rb_define_method(cRow, "names", getColumnNames, 0);
  rb_define_method(cRow, "aliases", getColumnAliases, 0);
  rb_define_method(cRow, "values", getColumnValues, 0);
  rb_define_method(cRow, "get_base_type", getColumnBaseType, 1);
  rb_define_method(cRow, "select", selectRowEntries, 0);
  rb_define_method(cRow, "to_a", rowToArray, 0);
  rb_define_method(cRow, "to_hash", rowToHash, 0);
  rb_define_method(cRow, "values_at", rowValuesAt, -1);;

  rb_define_alias(cRow, "each_pair", "each");
  rb_define_alias(cRow, "include?", "has_key?");
  rb_define_alias(cRow, "key?", "has_key?");
  rb_define_alias(cRow, "member?", "has_key?");
  rb_define_alias(cRow, "value?", "has_value?");
  rb_define_alias(cRow, "length", "column_count");
  rb_define_alias(cRow, "size", "column_count");
}
开发者ID:pilcrow,项目名称:rubyfb,代码行数:45,代码来源:Row.c


示例19: Init_leds

void Init_leds( )
{
  sym_dma        = ID2SYM(rb_intern( "dma" ));
  sym_frequency  = ID2SYM(rb_intern( "frequency" ));
  sym_invert     = ID2SYM(rb_intern( "invert" ));
  sym_brightness = ID2SYM(rb_intern( "brightness" ));

  mPixelPi = rb_define_module( "PixelPi" );

  cLeds = rb_define_class_under( mPixelPi, "Leds", rb_cObject );
  rb_define_alloc_func( cLeds, pp_leds_allocate );
  rb_define_method( cLeds, "initialize", pp_leds_initialize, -1 );

  rb_define_method( cLeds, "length",      pp_leds_length_get,        0 );
  rb_define_method( cLeds, "gpio",        pp_leds_gpio_get,          0 );
  rb_define_method( cLeds, "dma",         pp_leds_dma_get,           0 );
  rb_define_method( cLeds, "frequency",   pp_leds_frequency_get,     0 );
  rb_define_method( cLeds, "invert",      pp_leds_invert_get,        0 );
  rb_define_method( cLeds, "brightness",  pp_leds_brightness_get,    0 );
  rb_define_method( cLeds, "brightness=", pp_leds_brightness_set,    1 );
  rb_define_method( cLeds, "show",        pp_leds_show,              0 );
  rb_define_method( cLeds, "clear",       pp_leds_clear,             0 );
  rb_define_method( cLeds, "close",       pp_leds_close,             0 );
  rb_define_method( cLeds, "[]",          pp_leds_get_pixel_color,   1 );
  rb_define_method( cLeds, "[]=",         pp_leds_set_pixel_color,   2 );
  rb_define_method( cLeds, "set_pixel",   pp_leds_set_pixel_color2, -1 );
  rb_define_method( cLeds, "to_a",        pp_leds_to_a,              0 );
  rb_define_method( cLeds, "replace",     pp_leds_replace,           1 );
  rb_define_method( cLeds, "reverse",     pp_leds_reverse_m,         0 );
  rb_define_method( cLeds, "rotate",      pp_leds_rotate,           -1 );
  rb_define_method( cLeds, "fill",        pp_leds_fill,             -1 );

  rb_define_module_function( mPixelPi, "Color", pp_color, 3 );

  /* Define the PixelPi::Error class */
  ePixelPiError = rb_define_class_under( mPixelPi, "Error", rb_eStandardError );
}
开发者ID:TwP,项目名称:pixel_pi,代码行数:37,代码来源:leds.c


示例20: strb_InitializeGame

VALUE
strb_InitializeGame(VALUE _rb_mStarRuby)
{
  rb_mStarRuby = _rb_mStarRuby;

  rb_cGame = rb_define_class_under(rb_mStarRuby, "Game", rb_cObject);
  rb_define_singleton_method(rb_cGame, "current",   Game_s_current,   0);
  rb_define_singleton_method(rb_cGame, "run",       Game_s_run,       -1);
  rb_define_singleton_method(rb_cGame, "ticks",     Game_s_ticks,     0);
  rb_define_alloc_func(rb_cGame, Game_alloc);
  rb_define_private_method(rb_cGame, "initialize", Game_initialize, -1);
  rb_define_method(rb_cGame, "dispose",         Game_dispose,         0);
  rb_define_method(rb_cGame, "disposed?",       Game_disposed,        0);
  rb_define_method(rb_cGame, "fps",             Game_fps,             0);
  rb_define_method(rb_cGame, "fps=",            Game_fps_eq,          1);
  rb_define_method(rb_cGame, "fullscreen?",     Game_fullscreen,      0);
  rb_define_method(rb_cGame, "fullscreen=",     Game_fullscreen_eq,   1);
  rb_define_method(rb_cGame, "real_fps",        Game_real_fps,        0);
  rb_define_method(rb_cGame, "screen",          Game_screen,          0);
  rb_define_method(rb_cGame, "title",           Game_title,           0);
  rb_define_method(rb_cGame, "title=",          Game_title_eq,        1);
  rb_define_method(rb_cGame, "update_screen",   Game_update_screen,   0);
  rb_define_method(rb_cGame, "update_state",    Game_update_state,    0);
  rb_define_method(rb_cGame, "wait",            Game_wait,            0);
  rb_define_method(rb_cGame, "window_closing?", Game_window_closing,  0);
  rb_define_method(rb_cGame, "window_scale",    Game_window_scale,    0);
  rb_define_method(rb_cGame, "window_scale=",   Game_window_scale_eq, 1);

  symbol_cursor       = ID2SYM(rb_intern("cursor"));
  symbol_fps          = ID2SYM(rb_intern("fps"));
  symbol_fullscreen   = ID2SYM(rb_intern("fullscreen"));
  symbol_title        = ID2SYM(rb_intern("title"));
  symbol_vsync        = ID2SYM(rb_intern("vsync"));
  symbol_window_scale = ID2SYM(rb_intern("window_scale"));

  return rb_cGame;
}
开发者ID:CaptainJet,项目名称:RM-StarRuby,代码行数:37,代码来源:game.c



注:本文中的rb_define_alloc_func函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rb_define_class函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_default_internal_encoding函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap