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


C++ rb_path2class函数代码示例

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


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

示例1: ray_drawable_init_copy

static
VALUE ray_drawable_init_copy(VALUE self, VALUE orig) {
  if (rb_obj_is_kind_of(self, rb_path2class("Ray::Text"))   ||
      rb_obj_is_kind_of(self, rb_path2class("Ray::Sprite")) ||
      rb_obj_is_kind_of(self, rb_path2class("Ray::Polygon"))) {
    rb_raise(rb_eTypeError, "can't get drawable pointer from %s",
             RAY_OBJ_CLASSNAME(self));
  }

  ray_drawable *obj = NULL;
  Data_Get_Struct(self, ray_drawable, obj);

  ray_drawable *other = ray_rb2full_drawable(orig);

  size_t vid = say_drawable_get_vertex_type(other->drawable);
  obj->drawable = say_drawable_create(vid);
  say_drawable_set_custom_data(obj->drawable, obj);
  say_drawable_set_other_data(obj->drawable, (void*)self);
  say_drawable_copy(obj->drawable, other->drawable);
  say_drawable_set_changed(obj->drawable);

  rb_iv_set(self, "@vertex_type_class", rb_iv_get(orig, "@vertex_type_class"));
  obj->vsize = other->vsize;

  ray_drawable_copy_attr(self, orig);

  return self;
}
开发者ID:Mon-Ouie,项目名称:ray,代码行数:28,代码来源:drawable.c

示例2: Init_wongi_turtle

void Init_wongi_turtle() {

	define_prelude();

	define_parser();

	cURI = rb_path2class("URI");

	symResource = rb_intern( "resource" );
	symDocument = rb_intern( "document" );
	symRegister = rb_intern( "register" );
	symBaseEQ = rb_intern( "base=" );
	symLSHIFT = rb_intern( "<<" );
	symCommonEXCL = rb_intern( "common!" );
	symSplit = rb_intern( "split" );
	symLookup = rb_intern( "lookup" );
	symFragment = rb_intern( "fragment" );
	symPLUS = rb_intern( "+" );
	symEscape = rb_intern( "escape" );
	symImportBlank = rb_intern( "import_blank" );
	symBlank = rb_intern( "blank" );
	symParse = rb_intern( "parse" );
	symAbsoluteQ = rb_intern( "absolute?" );
	symBase = rb_intern( "base" );

	cCollector = rb_path2class("Wongi::RDF::Collector");
	cStatement = rb_path2class( "Wongi::RDF::Statement" );

}
开发者ID:ulfurinn,项目名称:wongi-rdf,代码行数:29,代码来源:wongi_turtle.c

示例3: Init_sha2

/*
 * Classes for calculating message digests using the SHA-256/384/512
 * Secure Hash Algorithm(s) by NIST (the US' National Institute of
 * Standards and Technology), described in FIPS PUB 180-2.
 */
void
Init_sha2()
{
    VALUE mDigest, cDigest_Base;
    ID id_metadata;

#define DECLARE_ALGO_CLASS(bitlen) \
    VALUE cDigest_SHA##bitlen;

    FOREACH_BITLEN(DECLARE_ALGO_CLASS)


    id_metadata = rb_intern("metadata");

    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

#define DEFINE_ALGO_CLASS(bitlen) \
    cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
\
    rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
      Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&sha##bitlen));

    FOREACH_BITLEN(DEFINE_ALGO_CLASS)
}
开发者ID:ArekX,项目名称:RAGE,代码行数:30,代码来源:sha2init.c

示例4: initialize

/*
  @overload initialize(vertex_class = Ray::Vertex)
    @param [Class] vertex_class Class of the vertices.
*/
static
VALUE ray_drawable_init(int argc, VALUE *argv, VALUE self) {
  if (rb_obj_is_kind_of(self, rb_path2class("Ray::Text"))   ||
      rb_obj_is_kind_of(self, rb_path2class("Ray::Sprite")) ||
      rb_obj_is_kind_of(self, rb_path2class("Ray::Polygon"))) {
    rb_raise(rb_eTypeError, "can't get drawable pointer from %s",
             RAY_OBJ_CLASSNAME(self));
  }

  ray_drawable *obj = NULL;
  Data_Get_Struct(self, ray_drawable, obj);

  VALUE arg = Qnil;
  rb_scan_args(argc, argv, "01", &arg);

  size_t id = NIL_P(arg) ? 0 : ray_get_vtype(arg);

  obj->drawable = say_drawable_create(id);
  say_drawable_set_custom_data(obj->drawable, obj);
  say_drawable_set_other_data(obj->drawable, (void*)self);
  say_drawable_set_fill_proc(obj->drawable, ray_drawable_fill_proc);
  say_drawable_set_shader_proc(obj->drawable, ray_drawable_shader_proc);
  say_drawable_set_render_proc(obj->drawable, ray_drawable_render_proc);
  say_drawable_set_index_fill_proc(obj->drawable,
                                   ray_drawable_indices_fill_proc);
  say_drawable_set_changed(obj->drawable);

  rb_iv_set(self, "@vertex_type_class", NIL_P(arg) ?
            rb_path2class("Ray::Vertex") : arg);

  obj->vsize = say_vertex_type_get_size(say_get_vertex_type(id));

  return self;
}
开发者ID:Mon-Ouie,项目名称:ray,代码行数:38,代码来源:drawable.c

示例5: Init_sha2

/*
 * Classes for calculating message digests using the SHA-256/384/512
 * Secure Hash Algorithm(s) by NIST (the US' National Institute of
 * Standards and Technology), described in FIPS PUB 180-2.
 */
void
Init_sha2(void)
{
    VALUE mDigest, cDigest_Base;
    ID id_metadata;

#define DECLARE_ALGO_CLASS(bitlen) \
    VALUE cDigest_SHA##bitlen;

    FOREACH_BITLEN(DECLARE_ALGO_CLASS)

    rb_require("digest");

    id_metadata = rb_intern("metadata");

    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

#define DEFINE_ALGO_CLASS(bitlen) \
    cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
\
    rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
		Data_Wrap_Struct(0, 0, 0, (void *)&sha##bitlen));

#undef RUBY_UNTYPED_DATA_WARNING
#define RUBY_UNTYPED_DATA_WARNING 0
    FOREACH_BITLEN(DEFINE_ALGO_CLASS)
}
开发者ID:gentle6318,项目名称:gentle6318.github.com,代码行数:33,代码来源:sha2init.c

示例6: if

octave_value OR_Variable::to_octave()
{
  if (ruby_val == Qtrue) {
    return true;
  } else if (ruby_val == Qfalse) {
    return false;
  } else if (ruby_val == Qnil) {
    return octave_NaN;
  } else if (rb_type(ruby_val) == T_FLOAT) {
    return RFLOAT_VALUE(ruby_val);
  } else if (rb_type(ruby_val) == T_FIXNUM) {
    return FIX2LONG(ruby_val);
  } else if (rb_obj_is_kind_of(ruby_val, rb_path2class("Array")) == Qtrue) {
    return OR_Array(ruby_val).to_octave();
  } else if (rb_obj_is_kind_of(ruby_val, rb_path2class("Hash")) == Qtrue) {
    return OR_Hash(ruby_val).to_octave();
  } else if (rb_obj_is_kind_of(ruby_val, rb_path2class("Octave::StructMatrix")) == Qtrue) {
    return OR_StructMatrix(ruby_val).to_octave();
  } else if (rb_obj_is_kind_of(ruby_val, rb_path2class("Octave::CellMatrix")) == Qtrue) {
    return OR_CellMatrix(ruby_val).to_octave();
  } else if (rb_obj_is_kind_of(ruby_val, rb_path2class("Octave::Matrix")) == Qtrue) {
    return OR_Matrix(ruby_val).to_octave();
  } else {
    return OR_String(ruby_val).to_octave();
  }
}
开发者ID:IlyaAndr,项目名称:octave-ruby,代码行数:26,代码来源:or-variable.cpp

示例7: ray_rb2polygon

say_drawable *ray_rb2drawable(VALUE obj) {
  if (RAY_IS_A(obj, rb_path2class("Ray::Polygon")))
    return ray_rb2polygon(obj)->drawable;
  else if (RAY_IS_A(obj, rb_path2class("Ray::Sprite")))
    return ray_rb2sprite(obj)->drawable;
  else if (RAY_IS_A(obj, rb_path2class("Ray::Text")))
    return ray_rb2text(obj)->drawable;
  else {
    return ray_rb2full_drawable(obj)->drawable;
  }
}
开发者ID:Mon-Ouie,项目名称:ray,代码行数:11,代码来源:drawable.c

示例8: ray_rb2sound

say_audio_source *ray_rb2audio_source(VALUE obj) {
  if (RAY_IS_A(obj, rb_path2class("Ray::Sound")))
    return ray_rb2sound(obj)->src;
  if (RAY_IS_A(obj, rb_path2class("Ray::Music")))
    return ray_rb2music(obj)->src;
  else {
    rb_raise(rb_eTypeError, "can't get audio source pointer from %s",
             RAY_OBJ_CLASSNAME(obj));
  }

  return NULL;
}
开发者ID:Mon-Ouie,项目名称:ray,代码行数:12,代码来源:audio_source.c

示例9: Init_rmd160

/*
 * A class for calculating message digests using RIPEMD-160
 * cryptographic hash function, designed by Hans Dobbertin, Antoon
 * Bosselaers, and Bart Preneel.
 */
void
Init_rmd160()
{
    VALUE mDigest, cDigest_Base, cDigest_RMD160;

    rb_require("digest");

    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

    cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);

    rb_ivar_set(cDigest_RMD160, rb_intern("metadata"),
      Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&rmd160));
}
开发者ID:2220142,项目名称:ruby,代码行数:20,代码来源:rmd160init.c

示例10: Init_tiger

void
Init_tiger()
{
    VALUE mDigest, cDigest_Base, cDigest_Tiger;

    rb_require("digest");

    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

    cDigest_Tiger = rb_define_class_under(mDigest, "Tiger", cDigest_Base);

    rb_ivar_set(cDigest_Tiger, rb_intern("metadata"),
                Data_Wrap_Struct(rb_cObject, 0, 0, &tiger));
}
开发者ID:ROFISH,项目名称:ruby-digest-extra,代码行数:15,代码来源:tiger_init.c

示例11: Init_sha1

/*
 * A class for calculating message digests using the SHA-1 Secure Hash
 * Algorithm by NIST (the US' National Institute of Standards and
 * Technology), described in FIPS PUB 180-1.
 */
void
Init_sha1()
{
    VALUE mDigest, cDigest_Base, cDigest_SHA1;
 
    rb_require("digest");
 
    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

    cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);

    rb_ivar_set(cDigest_SHA1, rb_intern("metadata"),
      Data_Wrap_Struct(rb_cObject, 0, 0, &sha1));
}
开发者ID:BCafairley,项目名称:rubyenterpriseedition187-248,代码行数:20,代码来源:sha1init.c

示例12: Init_md5

/*
 * A class for calculating message digests using the MD5
 * Message-Digest Algorithm by RSA Data Security, Inc., described in
 * RFC1321.
 */
void
Init_md5()
{
    VALUE mDigest, cDigest_Base, cDigest_MD5;

    rb_require("digest");

    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");

    cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);

    rb_ivar_set(cDigest_MD5, rb_intern("metadata"),
      Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&md5));
}
开发者ID:qnighy,项目名称:ruby-1.9.2p0,代码行数:20,代码来源:md5init.c

示例13: Init_ossl_digest

/*
 * INIT
 */
void
Init_ossl_digest()
{
    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_objc_define_method(*(VALUE *)cDigest, "alloc", ossl_digest_alloc, 0);

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

    rb_objc_define_method(cDigest, "name", ossl_digest_name, 0);
}
开发者ID:1nueve,项目名称:MacRuby,代码行数:28,代码来源:ossl_digest.c

示例14: odp_raise

static void odp_raise(VALUE self, const char * msg) {
  OdpMysql * conn;

  Data_Get_Struct(self, OdpMysql, conn);
  rb_raise(rb_path2class("Oedipus::ConnectionError"),
           "%s. Error %u: %s", msg, mysql_errno(conn->ptr), mysql_error(conn->ptr));
}
开发者ID:bustlelabs,项目名称:oedipus,代码行数:7,代码来源:oedipus.c

示例15: class2path

static VALUE
class2path(VALUE klass)
{
    VALUE path;
    if (klass == rb_cNSObject) {
	path = rb_str_new2("Object");
    }
    else if (klass == rb_cNSMutableString) {
	path = rb_str_new2("String");
    }
    else {
	path = rb_class_path(klass);
    }
    const char *n = RSTRING_PTR(path);

    if (n[0] == '#') {
	rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
		 (TYPE(klass) == T_CLASS ? "class" : "module"),
		 n);
    }
    if (rb_path2class(n) != rb_class_real(klass, true)) {
	rb_raise(rb_eTypeError, "%s can't be referred", n);
    }
    return path;
}
开发者ID:DocPsy,项目名称:MacRuby,代码行数:25,代码来源:marshal.c


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