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


C++ rb_require函数代码示例

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


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

示例1: Init_ossl_digest

/*
 * INIT
 */
void
Init_ossl_digest()
{
    rb_require("openssl");
    rb_require("digest");

#if 0 /* let rdoc know about mOSSL */
    mOSSL = rb_define_module("OpenSSL");
#endif

    cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
    eDigestError = rb_define_class_under(cDigest, "DigestError", eOSSLError);
	
    rb_define_alloc_func(cDigest, ossl_digest_alloc);

    rb_define_method(cDigest, "initialize", ossl_digest_initialize, -1);
    rb_define_copy_func(cDigest, ossl_digest_copy);
    rb_define_method(cDigest, "reset", ossl_digest_reset, 0);
    rb_define_method(cDigest, "update", ossl_digest_update, 1);
    rb_define_alias(cDigest, "<<", "update");
    rb_define_private_method(cDigest, "finish", ossl_digest_finish, -1);
    rb_define_method(cDigest, "digest_length", ossl_digest_size, 0);
    rb_define_method(cDigest, "block_length", ossl_digest_block_length, 0);

    rb_define_method(cDigest, "name", ossl_digest_name, 0);
}
开发者ID:AndreMeira,项目名称:rubinius,代码行数:29,代码来源:ossl_digest.c

示例2: Init_fastxml

void Init_fastxml()
{	
    if (xmlHasFeature(XML_WITH_TREE) == 0)
        rb_raise( rb_eRuntimeError, "libxml not built with tree support" );

    if (xmlHasFeature(XML_WITH_XPATH) == 0)
        rb_raise( rb_eRuntimeError, "libxml not built with xpath support" );

	s_readlines = rb_intern("readlines");
	s_to_s = rb_intern("to_s");

    xmlInitParser();
    xmlXPathInit();
	xsltInit();
    rb_mFastXml = rb_define_module( "FastXml" );
    rb_define_const( rb_mFastXml, "LIBXML_VERSION", rb_str_new2( LIBXML_DOTTED_VERSION ) );

    /* setting symbols */
    rb_sValidateDtd = ID2SYM( rb_intern("validate") );
    rb_sForgivingParse = ID2SYM( rb_intern("forgiving") );
    rb_sHtmlParse = ID2SYM( rb_intern("html") );
    
	Init_fastxml_doc();       /* Doc */    
	Init_fastxml_node();      /* Node */
	Init_fastxml_nodelist();  /* NodeList */
	Init_fastxml_attrlist();  /* AttrList */
	
	/* pull in the ruby side of things */
	rb_require( "fastxml/fastxml_lib" );      // ruby-side methods for the FastXml classes
	rb_require( "fastxml/fastxml_helpers" );  // FastXml and FastHtml methods
}
开发者ID:segfault,项目名称:fastxml,代码行数:31,代码来源:fastxml.c

示例3: Init_plasma_applet

Q_DECL_EXPORT void
Init_plasma_applet()
{
    rb_require("korundum4");    // need to initialize the core runtime first
    init_plasma_Smoke();
    set_qtruby_embedded(true);

    binding = QtRuby::Binding(plasma_Smoke);

    smokeList << plasma_Smoke;

    QtRubyModule module = { "Plasma", resolve_classname_plasma, 0, &binding };
    qtruby_modules[plasma_Smoke] = module;

    install_handlers(Plasma_handlers);

    plasma_module = rb_define_module("Plasma");
    plasma_internal_module = rb_define_module_under(plasma_module, "Internal");

    rb_define_singleton_method(plasma_module, "method_missing", (VALUE (*) (...)) plasma_module_method_missing, -1);
    rb_define_singleton_method(plasma_module, "const_missing", (VALUE (*) (...)) plasma_module_method_missing, -1);

    rb_define_singleton_method(plasma_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);

    rb_require("KDE/plasma.rb");
    rb_funcall(plasma_internal_module, rb_intern("init_all_classes"), 0);
}
开发者ID:0xd34df00d,项目名称:Qross,代码行数:27,代码来源:plasma.cpp

示例4: Init_clutter_gst

void
Init_clutter_gst ()
{
    rb_require ("glib2");
    rb_require ("clutter");
    rb_require ("gst");

    /* The base class init of some of the clutter-gst classes call some
       gst functions so unfortunatly defining the Ruby wrappers will
       crash if clutter_gst_init is not called first */
    rbclt_call_init_func (0, NULL, clutter_gst_init);

    rbcltgst_c_clutter_gst = rb_define_module_under (rbclt_c_clutter, "Gst");

    /* Version constants. Not defining a regular VERSION constant
       because under Ruby-GTK that constant refers to the version of the
       actual library binary, but there isn't a way to get that with
       Clutter yet. */
    rb_define_const (rbcltgst_c_clutter_gst, "BUILD_VERSION",
                     rb_ary_new3 (3, INT2FIX (CLUTTER_GST_MAJOR_VERSION),
                                  INT2FIX (CLUTTER_GST_MINOR_VERSION),
                                  INT2FIX (CLUTTER_GST_MICRO_VERSION)));

    rbcltgst_video_sink_init ();
    rbcltgst_video_texture_init ();
}
开发者ID:orospakr,项目名称:rbclutter,代码行数:26,代码来源:rbcluttergst.c

示例5: Init_do_sqlite3_ext

void Init_do_sqlite3_ext() {
  rb_require("bigdecimal");
  rb_require("date");

  // Get references classes needed for Date/Time parsing
  rb_cDate = CONST_GET(rb_mKernel, "Date");
  rb_cDateTime = CONST_GET(rb_mKernel, "DateTime");
  rb_cTime = CONST_GET(rb_mKernel, "Time");
  rb_cBigDecimal = CONST_GET(rb_mKernel, "BigDecimal");

  rb_funcall(rb_mKernel, rb_intern("require"), 1, rb_str_new2("data_objects"));

#ifdef RUBY_LESS_THAN_186
  ID_NEW_DATE = rb_intern("new0");
#else
  ID_NEW_DATE = rb_intern("new!");
#endif
  ID_RATIONAL = rb_intern("Rational");
  ID_LOGGER = rb_intern("logger");
  ID_DEBUG = rb_intern("debug");
  ID_LEVEL = rb_intern("level");

  // Get references to the DataObjects module and its classes
  mDO = CONST_GET(rb_mKernel, "DataObjects");
  cDO_Quoting = CONST_GET(mDO, "Quoting");
  cDO_Connection = CONST_GET(mDO, "Connection");
  cDO_Command = CONST_GET(mDO, "Command");
  cDO_Result = CONST_GET(mDO, "Result");
  cDO_Reader = CONST_GET(mDO, "Reader");

  // Initialize the DataObjects::Sqlite3 module, and define its classes
  mSqlite3 = rb_define_module_under(mDO, "Sqlite3");

  eSqlite3Error = rb_define_class("Sqlite3Error", rb_eStandardError);

  cConnection = SQLITE3_CLASS("Connection", cDO_Connection);
  rb_define_method(cConnection, "initialize", cConnection_initialize, 1);
  rb_define_method(cConnection, "dispose", cConnection_dispose, 0);

  cCommand = SQLITE3_CLASS("Command", cDO_Command);
  rb_include_module(cCommand, cDO_Quoting);
  rb_define_method(cCommand, "set_types", cCommand_set_types, 1);
  rb_define_method(cCommand, "execute_non_query", cCommand_execute_non_query, -1);
  rb_define_method(cCommand, "execute_reader", cCommand_execute_reader, -1);
  rb_define_method(cCommand, "quote_boolean", cCommand_quote_boolean, 1);
  rb_define_method(cCommand, "quote_string", cCommand_quote_string, 1);

  cResult = SQLITE3_CLASS("Result", cDO_Result);

  cReader = SQLITE3_CLASS("Reader", cDO_Reader);
  rb_define_method(cReader, "close", cReader_close, 0);
  rb_define_method(cReader, "next!", cReader_next, 0);
  rb_define_method(cReader, "values", cReader_values, 0);
  rb_define_method(cReader, "fields", cReader_fields, 0);
  rb_define_method(cReader, "field_count", cReader_field_count, 0);
  rb_define_method(cReader, "row_count", cReader_row_count, 0);

}
开发者ID:Bluejade,项目名称:rots_consumer,代码行数:58,代码来源:do_sqlite3_ext.c

示例6: Init_wikitext

void Init_wikitext()
{
    // Wikitext
    mWikitext = rb_define_module("Wikitext");

    // Wikitext::Parser
    cWikitextParser = rb_define_class_under(mWikitext, "Parser", rb_cObject);
    rb_define_method(cWikitextParser, "initialize", Wikitext_parser_initialize, -1);
    rb_define_method(cWikitextParser, "parse", Wikitext_parser_parse, -1);
    rb_define_method(cWikitextParser, "tokenize", Wikitext_parser_tokenize, 1);
    rb_define_method(cWikitextParser, "benchmarking_tokenize", Wikitext_parser_benchmarking_tokenize, 1);
    rb_define_method(cWikitextParser, "fulltext_tokenize", Wikitext_parser_fulltext_tokenize, -1);
    rb_define_singleton_method(cWikitextParser, "sanitize_link_target", Wikitext_parser_sanitize_link_target, 1);
    rb_define_singleton_method(cWikitextParser, "encode_link_target", Wikitext_parser_encode_link_target, 1);
    rb_define_attr(cWikitextParser, "line_ending", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "internal_link_prefix", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "img_prefix", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "external_link_class", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "external_link_rel", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "mailto_class", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "link_proc", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "autolink", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "space_to_underscore", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "minimum_fulltext_token_length", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "base_heading_level", Qtrue, Qtrue);
    rb_define_attr(cWikitextParser, "output_style", Qtrue, Qtrue);

    // Wikitext::Parser::Error
    eWikitextParserError = rb_define_class_under(cWikitextParser, "Error", rb_eException);

    // Wikitext::Parser::Token
    cWikitextParserToken = rb_define_class_under(cWikitextParser, "Token", rb_cObject);
    rb_define_singleton_method(cWikitextParserToken, "types", Wikitext_parser_token_types, 0);
    rb_define_attr(cWikitextParserToken, "start", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "stop", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "line_start", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "line_stop", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "column_start", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "column_stop", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "code_point", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "token_type", Qtrue, Qfalse);
    rb_define_attr(cWikitextParserToken, "string_value", Qtrue, Qfalse);

    // check to see if ::ActiveSupport is defined
    if (rb_funcall(rb_cObject, rb_intern("const_defined?"), 1,
        ID2SYM(rb_intern("ActiveSupport"))) == Qtrue)
    {
        // we are running under Rails
        rb_require("wikitext/nil_class");
        rb_require("wikitext/string");

        VALUE active_support = rb_const_get(rb_cObject,
            rb_intern("ActiveSupport"));
        rb_iterate(wikitext_block_forwarder, active_support,
            wikitext_on_load_block, Qnil);
    }
}
开发者ID:GremL1N,项目名称:wikitext,代码行数:57,代码来源:wikitext.c

示例7: Init_cbson

void Init_cbson() {
    VALUE bson, CBson, Digest, ext_version, digest;
    static char hostname[MAX_HOSTNAME_LENGTH];

    element_assignment_method = rb_intern("[]=");
    unpack_method = rb_intern("unpack");
    utc_method = rb_intern("utc");
    lt_operator = rb_intern("<");
    gt_operator = rb_intern(">");

    bson = rb_const_get(rb_cObject, rb_intern("BSON"));
    rb_require("bson/types/binary");
    Binary = rb_const_get(bson, rb_intern("Binary"));
    rb_require("bson/types/object_id");
    ObjectId = rb_const_get(bson, rb_intern("ObjectId"));
    rb_require("bson/types/dbref");
    DBRef = rb_const_get(bson, rb_intern("DBRef"));
    rb_require("bson/types/code");
    Code = rb_const_get(bson, rb_intern("Code"));
    rb_require("bson/types/min_max_keys");
    MinKey = rb_const_get(bson, rb_intern("MinKey"));
    MaxKey = rb_const_get(bson, rb_intern("MaxKey"));
    rb_require("bson/types/timestamp");
    Timestamp = rb_const_get(bson, rb_intern("Timestamp"));
    Regexp = rb_const_get(rb_cObject, rb_intern("Regexp"));
    rb_require("bson/exceptions");
    InvalidKeyName = rb_const_get(bson, rb_intern("InvalidKeyName"));
    InvalidStringEncoding = rb_const_get(bson, rb_intern("InvalidStringEncoding"));
    InvalidDocument = rb_const_get(bson, rb_intern("InvalidDocument"));
    rb_require("bson/ordered_hash");
    OrderedHash = rb_const_get(bson, rb_intern("OrderedHash"));
    RB_HASH = rb_const_get(bson, rb_intern("Hash"));

    CBson = rb_define_module("CBson");
    ext_version = rb_str_new2(VERSION);
    rb_define_const(CBson, "VERSION", ext_version);
    rb_define_module_function(CBson, "serialize", method_serialize, 3);
    rb_define_module_function(CBson, "deserialize", method_deserialize, 1);
    rb_define_module_function(CBson, "max_bson_size", method_max_bson_size, 0);
    rb_define_module_function(CBson, "update_max_bson_size", method_update_max_bson_size, 1);

    rb_require("digest/md5");
    Digest = rb_const_get(rb_cObject, rb_intern("Digest"));
    DigestMD5 = rb_const_get(Digest, rb_intern("MD5"));

    rb_define_method(ObjectId, "generate", objectid_generate, -1);

    if (gethostname(hostname, MAX_HOSTNAME_LENGTH) != 0) {
        rb_raise(rb_eRuntimeError, "failed to get hostname");
    }
    digest = rb_funcall(DigestMD5, rb_intern("digest"), 1,
        rb_str_new2(hostname));
    memcpy(hostname_digest, RSTRING_PTR(digest), 16);
    hostname_digest[16] = '\0';

    max_bson_size = 4 * 1024 * 1024;
}
开发者ID:ericenphase,项目名称:mongo-ruby-driver,代码行数:57,代码来源:cbson.c

示例8: Init_cbson

void Init_cbson() {
    VALUE driver, CBson;
    Time = rb_const_get(rb_cObject, rb_intern("Time"));

    driver = rb_const_get(rb_cObject,rb_intern("Mongo"));
    rb_require("mongo/types/binary");
    Binary = rb_const_get(driver, rb_intern("Binary"));
    rb_require("mongo/types/undefined");
    Undefined = rb_const_get(driver, rb_intern("Undefined"));
    rb_require("mongo/types/objectid");
    ObjectID = rb_const_get(driver, rb_intern("ObjectID"));
    rb_require("mongo/types/dbref");
    DBRef = rb_const_get(driver, rb_intern("DBRef"));
    rb_require("mongo/types/code");
    Code = rb_const_get(driver, rb_intern("Code"));
    rb_require("mongo/types/regexp_of_holding");
    RegexpOfHolding = rb_const_get(driver, rb_intern("RegexpOfHolding"));
    rb_require("mongo/errors");
    InvalidName = rb_const_get(driver, rb_intern("InvalidName"));
    rb_require("mongo/util/ordered_hash");
    OrderedHash = rb_const_get(rb_cObject, rb_intern("OrderedHash"));

    CBson = rb_define_module("CBson");
    rb_define_module_function(CBson, "serialize", method_serialize, 2);
    rb_define_module_function(CBson, "deserialize", method_deserialize, 1);
}
开发者ID:animehunter,项目名称:mongo-ruby-driver,代码行数:26,代码来源:cbson.c

示例9: Init_pg_typecast

void Init_pg_typecast() {
  rb_require("pg");
  rb_require("date");
  rb_require("stringio");
  rb_require("bigdecimal");

  fnew        = rb_intern("new");
  cStringIO   = CONST_GET(rb_mKernel, "StringIO");
  cBigDecimal = CONST_GET(rb_mKernel, "BigDecimal");

  VALUE cPGresult = rb_define_class("PGresult", rb_cObject);
  rb_include_module(cPGresult, CONST_GET(rb_mKernel, "Enumerable"));
  rb_define_method(cPGresult, "each", RUBY_METHOD_FUNC(result_each), 0);
}
开发者ID:deepfryed,项目名称:pg_typecast,代码行数:14,代码来源:pg_typecast.c

示例10: Init_rdo_mysql_tuples

/** Initializer for the TupleList class */
void Init_rdo_mysql_tuples(void) {
  rb_require("rdo/mysql");
  rb_require("set");

  VALUE mMySQL = rb_path2class("RDO::MySQL");

  rdo_mysql_cTupleList = rb_define_class_under(mMySQL,
      "TupleList", rb_cObject);

  rb_define_method(rdo_mysql_cTupleList,
      "each", rdo_mysql_tuple_list_each, 0);

  rb_include_module(rdo_mysql_cTupleList, rb_mEnumerable);
}
开发者ID:d11wtq,项目名称:rdo-mysql,代码行数:15,代码来源:tuples.c

示例11: Init_cbson

void Init_cbson() {
    VALUE mongo, CBson, Digest, ext_version;
    Time = rb_const_get(rb_cObject, rb_intern("Time"));

    mongo = rb_const_get(rb_cObject, rb_intern("Mongo"));
    rb_require("mongo/types/binary");
    Binary = rb_const_get(mongo, rb_intern("Binary"));
    rb_require("mongo/types/objectid");
    ObjectID = rb_const_get(mongo, rb_intern("ObjectID"));
    rb_require("mongo/types/dbref");
    DBRef = rb_const_get(mongo, rb_intern("DBRef"));
    rb_require("mongo/types/code");
    Code = rb_const_get(mongo, rb_intern("Code"));
    rb_require("mongo/types/regexp_of_holding");
    RegexpOfHolding = rb_const_get(mongo, rb_intern("RegexpOfHolding"));
    rb_require("mongo/errors");
    InvalidName = rb_const_get(mongo, rb_intern("InvalidName"));
    InvalidStringEncoding = rb_const_get(mongo, rb_intern("InvalidStringEncoding"));
    rb_require("mongo/util/ordered_hash");
    OrderedHash = rb_const_get(rb_cObject, rb_intern("OrderedHash"));

    CBson = rb_define_module("CBson");
    ext_version = rb_str_new2(VERSION);
    rb_define_const(CBson, "VERSION", ext_version);
    rb_define_module_function(CBson, "serialize", method_serialize, 2);
    rb_define_module_function(CBson, "deserialize", method_deserialize, 1);

    rb_require("digest/md5");
    Digest = rb_const_get(rb_cObject, rb_intern("Digest"));
    DigestMD5 = rb_const_get(Digest, rb_intern("MD5"));

    rb_define_method(ObjectID, "generate", objectid_generate, 0);

    rb_define_method(rb_cArray, "fast_pack", fast_pack, 0);
}
开发者ID:blythedunham,项目名称:mongo-ruby-driver,代码行数:35,代码来源:cbson.c

示例12: Init_bson_object_id

void Init_bson_object_id() {
    VALUE bson;

    rb_require("bson");
    bson = rb_const_get(rb_cObject, rb_intern("BSON"));
    rb_require("bson/types/object_id");
    ObjectId = rb_const_get(bson, rb_intern("ObjectId"));
    rb_require("bson/exceptions");
    InvalidObjectId = rb_const_get(bson, rb_intern("InvalidObjectId"));

    rb_define_singleton_method(ObjectId, "legal?", objectid_legal, 1);
    rb_define_singleton_method(ObjectId, "from_string", objectid_from_string, 1);

    rb_define_method(ObjectId, "to_s", objectid_to_s, 0);
}
开发者ID:getaroom,项目名称:bson_object_id_ext,代码行数:15,代码来源:bson_object_id.c

示例13: init_swift_db_postgres_typecast

void init_swift_db_postgres_typecast() {
    rb_require("bigdecimal");
    rb_require("stringio");
    rb_require("date");

    cStringIO   = CONST_GET(rb_mKernel, "StringIO");
    cBigDecimal = CONST_GET(rb_mKernel, "BigDecimal");
    cDateTime   = CONST_GET(rb_mKernel, "DateTime");
    fnew        = rb_intern("new");
    fto_date    = rb_intern("to_date");
    fstrftime   = rb_intern("strftime");
    dtformat    = rb_str_new2("%F %T.%N %z");

    rb_global_variable(&dtformat);
}
开发者ID:filterfish,项目名称:swift-db-postgres,代码行数:15,代码来源:typecast.c

示例14: Init_trema

void
Init_trema() {
  mTrema = rb_define_module( "Trema" );

  rb_require( "trema/host" );
  rb_require( "trema/path" );
  rb_require( "trema/sub-commands" );
  rb_require( "trema/switch" );

  Init_action_output();
  Init_action_set_dl_dst();
  Init_action_set_dl_src();
  Init_action_enqueue();
  Init_action_set_nw_src();
  Init_action_set_nw_dst();
  Init_action_set_tp_src();
  Init_action_set_tp_dst();
  Init_action_set_nw_tos();
  Init_action_set_vlan_vid();
  Init_action_set_vlan_pcp();
  Init_action_strip_vlan();
  Init_action_vendor();
  Init_echo_request();
  Init_error();
  Init_logger();
  Init_controller();
  Init_features_reply();
  Init_features_request();
  Init_set_config();
  Init_stats_request();
  Init_hello();
  Init_match();
  Init_packet_in();
  Init_port();
  Init_flow_removed();
  Init_port_status();
  Init_stats_reply();
  Init_openflow_error();
  Init_get_config_request();
  Init_get_config_reply();
  Init_barrier_request();
  Init_barrier_reply();
  Init_queue_get_config_request();
  Init_queue_get_config_reply();
  Init_vendor_request();
  Init_port_mod();
  rb_require( "trema/exact-match" );
}
开发者ID:nickkaranatsios,项目名称:trema,代码行数:48,代码来源:trema.c

示例15: Init_soprano

Q_DECL_EXPORT void
Init_soprano()
{
    init_soprano_Smoke();

    binding = QtRuby::Binding(soprano_Smoke);

    smokeList << soprano_Smoke;

    QtRubyModule module = { "Soprano", resolve_classname_soprano, 0, &binding };
    qtruby_modules[soprano_Smoke] = module;

    install_handlers(Soprano_handlers);

    soprano_module = rb_define_module("Soprano");
    soprano_internal_module = rb_define_module_under(soprano_module, "Internal");

    rb_define_singleton_method(soprano_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);

    (void) qRegisterMetaType<Soprano::Statement>();
    (void) qRegisterMetaType<Soprano::Node>();

    rb_require("soprano/soprano.rb");
    rb_funcall(soprano_internal_module, rb_intern("init_all_classes"), 0);
}
开发者ID:KDE,项目名称:korundum,代码行数:25,代码来源:soprano.cpp


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