当前位置: 首页>>代码示例>>C++>>正文


C++ rb_define_module_under函数代码示例

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


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

示例1: init_xml_syntax_error

void init_xml_syntax_error()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");

  /*
   * The XML::SyntaxError is raised on parse errors
   */
  VALUE syntax_error_mommy = rb_define_class_under(nokogiri, "SyntaxError", rb_eStandardError);
  VALUE klass = rb_define_class_under(xml, "SyntaxError", syntax_error_mommy);
  cNokogiriXmlSyntaxError = klass;

}
开发者ID:2potatocakes,项目名称:nokogiri,代码行数:13,代码来源:xml_syntax_error.c

示例2: init_drizzle_result

void init_drizzle_result()
{
  DrizzleResult = rb_define_module_under(DownpourModule, "Result");
  rb_define_method(DrizzleResult, "buffered?", is_buffered, 0);
  define_attr(column_count);
  define_attr(insert_id);
  define_attr(error_code);
  define_attr(affected_rows);
  define_attr(warning_count);
  define_attr(sqlstate);
  define_attr(info);
  define_attr(error);
}
开发者ID:c42,项目名称:downpour,代码行数:13,代码来源:result.c

示例3: rbffi_Platform_Init

void
rbffi_Platform_Init(VALUE moduleFFI)
{
    PlatformModule = rb_define_module_under(moduleFFI, "Platform");
    rb_define_const(PlatformModule, "BYTE_ORDER", INT2FIX(BYTE_ORDER));
    rb_define_const(PlatformModule, "LITTLE_ENDIAN", INT2FIX(LITTLE_ENDIAN));
    rb_define_const(PlatformModule, "BIG_ENDIAN", INT2FIX(BIG_ENDIAN));
    rb_define_const(PlatformModule, "CPU", rb_str_new2(CPU));
#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
    rb_define_const(PlatformModule, "GNU_LIBC", rb_str_new2(LIBC_SO));
#endif
    export_primitive_types(PlatformModule);
}
开发者ID:AHOUSAIN,项目名称:sample_app,代码行数:13,代码来源:Platform.c

示例4: Init_do_mysql

void Init_do_mysql() {
  data_objects_common_init();

  // Top Level Module that all the classes live under
  mMysql    = rb_define_module_under(mDO, "Mysql");
  mEncoding = rb_define_module_under(mMysql, "Encoding");

  cMysqlConnection = rb_define_class_under(mMysql, "Connection", cDO_Connection);
  rb_define_method(cMysqlConnection, "initialize", do_mysql_cConnection_initialize, 1);
  rb_define_method(cMysqlConnection, "using_socket?", data_objects_cConnection_is_using_socket, 0);
  rb_define_method(cMysqlConnection, "ssl_cipher", data_objects_cConnection_ssl_cipher, 0);
  rb_define_method(cMysqlConnection, "character_set", data_objects_cConnection_character_set , 0);
  rb_define_method(cMysqlConnection, "dispose", do_mysql_cConnection_dispose, 0);
  rb_define_method(cMysqlConnection, "quote_string", do_mysql_cConnection_quote_string, 1);
  rb_define_method(cMysqlConnection, "quote_date", data_objects_cConnection_quote_date, 1);
  rb_define_method(cMysqlConnection, "quote_time", data_objects_cConnection_quote_time, 1);
  rb_define_method(cMysqlConnection, "quote_datetime", data_objects_cConnection_quote_date_time, 1);

  cMysqlCommand = rb_define_class_under(mMysql, "Command", cDO_Command);
  rb_define_method(cMysqlCommand, "set_types", data_objects_cCommand_set_types, -1);
  rb_define_method(cMysqlCommand, "execute_non_query", do_mysql_cCommand_execute_non_query, -1);
  rb_define_method(cMysqlCommand, "execute_reader", do_mysql_cCommand_execute_reader, -1);

  // Non-Query result
  cMysqlResult = rb_define_class_under(mMysql, "Result", cDO_Result);

  // Query result
  cMysqlReader = rb_define_class_under(mMysql, "Reader", cDO_Reader);
  rb_define_method(cMysqlReader, "close", do_mysql_cReader_close, 0);
  rb_define_method(cMysqlReader, "next!", do_mysql_cReader_next, 0);
  rb_define_method(cMysqlReader, "values", data_objects_cReader_values, 0);
  rb_define_method(cMysqlReader, "fields", data_objects_cReader_fields, 0);
  rb_define_method(cMysqlReader, "field_count", data_objects_cReader_field_count, 0);

  rb_global_variable(&cMysqlResult);
  rb_global_variable(&cMysqlReader);

  data_objects_define_errors(mMysql, do_mysql_errors);
}
开发者ID:dariocravero,项目名称:do,代码行数:39,代码来源:do_mysql.c

示例5: Init_gtk_gdk_input

void
Init_gtk_gdk_input(VALUE mGdk)
{
    VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Input");

    RG_DEF_MODFUNC(add, 2);
    RG_DEF_MODFUNC(remove, 1);

    /* GdkInputCondition */
    G_DEF_CLASS(GDK_TYPE_INPUT_CONDITION, "Condition", RG_TARGET_NAMESPACE);
    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_CONDITION, "GDK_INPUT_");

}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgdkinput.c

示例6: Init_fresnel

void Init_fresnel(VALUE module)
{
  VALUE mfresnel;
  mfresnel = rb_define_module_under(module, "Fresnel");
  rb_define_module_function(module, "fresnel_c", rb_fresnel_c, 1);
  rb_define_module_function(module, "fresnel_s", rb_fresnel_s, 1);
  rb_define_module_function(module, "fresnel_c1", rb_fresnel_c1, 1);
  rb_define_module_function(module, "fresnel_s1", rb_fresnel_s1, 1);
  rb_define_module_function(mfresnel, "c", rb_fresnel_c, 1);
  rb_define_module_function(mfresnel, "s", rb_fresnel_s, 1);
  rb_define_module_function(mfresnel, "c1", rb_fresnel_c1, 1);
  rb_define_module_function(mfresnel, "s1", rb_fresnel_s1, 1);
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:13,代码来源:fresnel.c

示例7: Init_grpc_error_codes

static void Init_grpc_error_codes() {
  /* Constants representing the error codes of grpc_call_error in grpc.h */
  VALUE grpc_rb_mRpcErrors =
      rb_define_module_under(grpc_rb_mGrpcCore, "RpcErrors");
  rb_define_const(grpc_rb_mRpcErrors, "OK", UINT2NUM(GRPC_CALL_OK));
  rb_define_const(grpc_rb_mRpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_SERVER",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_CLIENT",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_ON_CLIENT));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_ACCEPTED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_ACCEPTED));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_INVOKED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_INVOKED));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_INVOKED",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_INVOKED));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_FINISHED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_FINISHED));
  rb_define_const(grpc_rb_mRpcErrors, "TOO_MANY_OPERATIONS",
                  UINT2NUM(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS));
  rb_define_const(grpc_rb_mRpcErrors, "INVALID_FLAGS",
                  UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS));

  /* Add the detail strings to a Hash */
  rb_error_code_details = rb_hash_new();
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_OK),
               rb_str_new2("ok"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR),
               rb_str_new2("unknown error"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER),
               rb_str_new2("not available on a server"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_ON_CLIENT),
               rb_str_new2("not available on a client"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_ALREADY_ACCEPTED),
               rb_str_new2("call is already accepted"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_ALREADY_INVOKED),
               rb_str_new2("call is already invoked"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_INVOKED),
               rb_str_new2("call is not yet invoked"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_ALREADY_FINISHED),
               rb_str_new2("call is already finished"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS),
               rb_str_new2("outstanding read or write present"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS),
               rb_str_new2("a bad flag was given"));
  rb_define_const(grpc_rb_mRpcErrors, "ErrorMessages", rb_error_code_details);
  rb_obj_freeze(rb_error_code_details);
}
开发者ID:rootusr,项目名称:grpc,代码行数:51,代码来源:rb_call.c

示例8: MessagePack_Unpacker_module_init

void MessagePack_Unpacker_module_init(VALUE mMessagePack)
{
    msgpack_unpacker_static_init();
    msgpack_unpacker_ext_registry_static_init();

    mTypeError = rb_define_module_under(mMessagePack, "TypeError");

    cMessagePack_Unpacker = rb_define_class_under(mMessagePack, "Unpacker", rb_cObject);

    eUnpackError = rb_define_class_under(mMessagePack, "UnpackError", rb_eStandardError);

    eMalformedFormatError = rb_define_class_under(mMessagePack, "MalformedFormatError", eUnpackError);

    eStackError = rb_define_class_under(mMessagePack, "StackError", eUnpackError);

    eUnexpectedTypeError = rb_define_class_under(mMessagePack, "UnexpectedTypeError", eUnpackError);
    rb_include_module(eUnexpectedTypeError, mTypeError);

    eUnknownExtTypeError = rb_define_class_under(mMessagePack, "UnknownExtTypeError", eUnpackError);

    rb_define_alloc_func(cMessagePack_Unpacker, MessagePack_Unpacker_alloc);

    rb_define_method(cMessagePack_Unpacker, "initialize", MessagePack_Unpacker_initialize, -1);
    rb_define_method(cMessagePack_Unpacker, "symbolize_keys?", Unpacker_symbolized_keys_p, 0);
    rb_define_method(cMessagePack_Unpacker, "allow_unknown_ext?", Unpacker_allow_unknown_ext_p, 0);
    rb_define_method(cMessagePack_Unpacker, "buffer", Unpacker_buffer, 0);
    rb_define_method(cMessagePack_Unpacker, "read", Unpacker_read, 0);
    rb_define_alias(cMessagePack_Unpacker, "unpack", "read");
    rb_define_method(cMessagePack_Unpacker, "skip", Unpacker_skip, 0);
    rb_define_method(cMessagePack_Unpacker, "skip_nil", Unpacker_skip_nil, 0);
    rb_define_method(cMessagePack_Unpacker, "read_array_header", Unpacker_read_array_header, 0);
    rb_define_method(cMessagePack_Unpacker, "read_map_header", Unpacker_read_map_header, 0);
    //rb_define_method(cMessagePack_Unpacker, "peek_next_type", Unpacker_peek_next_type, 0);  // TODO
    rb_define_method(cMessagePack_Unpacker, "feed", Unpacker_feed, 1);
    rb_define_method(cMessagePack_Unpacker, "each", Unpacker_each, 0);
    rb_define_method(cMessagePack_Unpacker, "feed_each", Unpacker_feed_each, 1);
    rb_define_method(cMessagePack_Unpacker, "reset", Unpacker_reset, 0);

    rb_define_private_method(cMessagePack_Unpacker, "registered_types_internal", Unpacker_registered_types_internal, 0);
    rb_define_method(cMessagePack_Unpacker, "register_type", Unpacker_register_type, -1);

    //s_unpacker_value = MessagePack_Unpacker_alloc(cMessagePack_Unpacker);
    //rb_gc_register_address(&s_unpacker_value);
    //Data_Get_Struct(s_unpacker_value, msgpack_unpacker_t, s_unpacker);
    /* prefer reference than copying */
    //msgpack_buffer_set_write_reference_threshold(UNPACKER_BUFFER_(s_unpacker), 0);

    /* MessagePack.unpack(x) */
    rb_define_module_function(mMessagePack, "load", MessagePack_load_module_method, -1);
    rb_define_module_function(mMessagePack, "unpack", MessagePack_unpack_module_method, -1);
}
开发者ID:blazux,项目名称:Live,代码行数:51,代码来源:unpacker_class.c

示例9: Init_glib_shell

void
Init_glib_shell()
{
    VALUE mShell = rb_define_module_under(mGLib, "Shell");
    VALUE cShellError = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", mGLib, rb_eRuntimeError);

    rb_define_module_function(mShell, "parse", shell_parse, 1);
    rb_define_module_function(mShell, "quote", shell_quote, 1);
    rb_define_module_function(mShell, "unquote", shell_unquote, 1);

    rb_define_const(cShellError, "BAD_QUOTING", INT2FIX(G_SHELL_ERROR_BAD_QUOTING));
    rb_define_const(cShellError, "EMPTY_STRING", INT2FIX(G_SHELL_ERROR_EMPTY_STRING));
    rb_define_const(cShellError, "FAILED", INT2FIX(G_SHELL_ERROR_FAILED));
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:14,代码来源:rbglib_shell.c

示例10: init_kgio_autopush

void init_kgio_autopush(void)
{
	VALUE mKgio = rb_define_module("Kgio");
	VALUE tmp;

	rb_define_singleton_method(mKgio, "autopush?", s_get_autopush, 0);
	rb_define_singleton_method(mKgio, "autopush=", s_set_autopush, 1);

	tmp = rb_define_module_under(mKgio, "SocketMethods");
	rb_define_method(tmp, "kgio_autopush=", autopush_set, 1);
	rb_define_method(tmp, "kgio_autopush?", autopush_get, 0);

	id_autopush_state = rb_intern("@kgio_autopush_state");
}
开发者ID:AdamDotCom,项目名称:my-rvm,代码行数:14,代码来源:autopush.c

示例11: Init_krypt_hex

void
Init_krypt_hex(void)
{
#if 0
    mKrypt = rb_define_module("Krypt"); /* Let RDoc know */
#endif

    mKryptHex = rb_define_module_under(mKrypt, "Hex");

    eKryptHexError = rb_define_class_under(mKryptHex, "HexError", eKryptError);

    rb_define_module_function(mKryptHex, "decode", krypt_hex_module_decode, 1);
    rb_define_module_function(mKryptHex, "encode", krypt_hex_module_encode, 1);
}
开发者ID:LarsWestergren,项目名称:krypt-core-c,代码行数:14,代码来源:krypt_hex.c

示例12: Init_gobject_typeinterface

void
Init_gobject_typeinterface()
{
    mMetaInterface = rb_define_module_under(mGLib, "MetaInterface");
    rb_define_method(mMetaInterface, "gtype", generic_s_gtype, 0);
    rb_define_method(mMetaInterface, "append_features", interface_s_append_features, 1);
#if GLIB_CHECK_VERSION(2,4,0)
    rb_define_method(mMetaInterface, "install_property", interface_s_install_property, 1);
    rb_define_method(mMetaInterface, "property", interface_s_property, 1);
    rb_define_method(mMetaInterface, "properties", interface_s_properties, -1);
#endif

    rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib);
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:14,代码来源:rbgobj_typeinterface.c

示例13: define_ruby_module

void
define_ruby_module()
{
  if(rb_module)
    return;
  /* 
   * opencv = rb_define_module("OpenCV");      
   *
   * note: this comment is used by rdoc.
   */
  VALUE opencv = rb_module_opencv();
  rb_module = rb_define_module_under(opencv, "GUI");
  rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
}
开发者ID:thenoseman,项目名称:ruby-opencv,代码行数:14,代码来源:gui.cpp

示例14: Init_gsl_deriv

void Init_gsl_deriv(VALUE module)
{
  VALUE mgsl_deriv;

  mgsl_deriv = rb_define_module_under(module, "Deriv");

  rb_define_method(cgsl_function, "deriv_central", rb_gsl_deriv_central, -1);
  rb_define_method(cgsl_function, "deriv_forward", rb_gsl_deriv_forward, -1);
  rb_define_method(cgsl_function, "deriv_backward", rb_gsl_deriv_backward, -1);

  rb_define_singleton_method(mgsl_deriv, "central", rb_gsl_deriv_central, -1);
  rb_define_singleton_method(mgsl_deriv, "forward", rb_gsl_deriv_forward, -1);
  rb_define_singleton_method(mgsl_deriv, "backward", rb_gsl_deriv_backward, -1);
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:14,代码来源:deriv.c

示例15: init_xml_schema

void init_xml_schema()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");
  VALUE klass = rb_define_class_under(xml, "Schema", rb_cObject);

  cNokogiriXmlSchema = klass;

  rb_define_singleton_method(klass, "read_memory", read_memory, 1);
  rb_define_singleton_method(klass, "from_document", from_document, 1);

  rb_define_private_method(klass, "validate_document", validate_document, 1);
  rb_define_private_method(klass, "validate_file",     validate_file, 1);
}
开发者ID:AndreasKrueger,项目名称:nokogiri,代码行数:14,代码来源:xml_schema.c


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