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


C++ Encoding::nil_p方法代码示例

本文整理汇总了C++中Encoding::nil_p方法的典型用法代码示例。如果您正苦于以下问题:C++ Encoding::nil_p方法的具体用法?C++ Encoding::nil_p怎么用?C++ Encoding::nil_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Encoding的用法示例。


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

示例1: rb_enc_from_index

  rb_encoding* rb_enc_from_index(int index) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Encoding* enc = Encoding::from_index(env->state(), index);
    if(enc->nil_p()) return 0;
    return enc->get_encoding();
  }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:7,代码来源:encoding.cpp

示例2: rb_enc_find

  rb_encoding* rb_enc_find(const char* name) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Encoding* enc = Encoding::find(env->state(), name);
    if(enc->nil_p()) return 0;
    return enc->get_encoding();
  }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:7,代码来源:encoding.cpp

示例3: locale_string

 String* Time::locale_string(STATE, const char* data) {
   String* str = String::create(state, data);
   Encoding* locale = Encoding::find(state, "locale");
   if(!locale->nil_p()) {
     str->encoding(state, locale);
   }
   return str;
 }
开发者ID:Locke23rus,项目名称:rubinius,代码行数:8,代码来源:time.cpp

示例4:

 rb_encoding *rb_default_internal_encoding(void) {
   NativeMethodEnvironment* env = NativeMethodEnvironment::get();
   Encoding* enc = Encoding::find(env->state(), "internal");
   if(enc->nil_p()) {
     return 0;
   } else {
     return enc->get_encoding();
   }
 }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:9,代码来源:encoding.cpp

示例5: rb_filesystem_encoding

 rb_encoding* rb_filesystem_encoding(void) {
   NativeMethodEnvironment* env = NativeMethodEnvironment::get();
   Encoding* enc = Encoding::find(env->state(), "filesystem");
   if(enc->nil_p()) {
     return rb_ascii8bit_encoding();
   } else {
     return enc->get_encoding();
   }
 }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:9,代码来源:encoding.cpp

示例6: rb_locale_encoding

 rb_encoding* rb_locale_encoding(void) {
   NativeMethodEnvironment* env = NativeMethodEnvironment::get();
   Encoding* enc = Encoding::find(env->state(), "locale");
   if(enc->nil_p()) {
     return rb_usascii_encoding();
   } else {
     return enc->get_encoding();
   }
 }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:9,代码来源:encoding.cpp

示例7: rb_enc_get_index

  int rb_enc_get_index(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    Encoding* enc = Encoding::get_object_encoding(env->state(), val);

    if(enc->nil_p()) return 0;

    return Encoding::find_index(env->state(), enc->get_encoding()->name);
  }
开发者ID:fakeleft,项目名称:rubinius,代码行数:10,代码来源:encoding.cpp

示例8: rb_enc_get

  rb_encoding* rb_enc_get(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    if(!val->reference_p() && !val->symbol_p()) return 0;
    Encoding* enc = Encoding::get_object_encoding(env->state(), val);

    if(enc->nil_p()) return 0;
    return enc->get_encoding();
  }
开发者ID:Emily,项目名称:rubinius,代码行数:10,代码来源:encoding.cpp

示例9: rb_enc_get_index

  int rb_enc_get_index(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    if(!val->reference_p() && !val->symbol_p()) return -1;

    Encoding* enc = Encoding::get_object_encoding(env->state(), val);

    if(enc->nil_p()) return 0;

    return Encoding::find_index(env->state(), enc->name()->c_str(env->state()));
  }
开发者ID:Emily,项目名称:rubinius,代码行数:12,代码来源:encoding.cpp

示例10: rb_enc_get_index

  int rb_enc_get_index(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    Object* val = env->get_object(obj);
    Encoding* enc;

    if(String* str = try_as<String>(val)) {
      enc = str->encoding(env->state());
    } else if(Regexp* reg = try_as<Regexp>(val)) {
      enc = reg->encoding(env->state());
    } else if(Symbol* sym = try_as<Symbol>(val)) {
      enc = sym->encoding(env->state());
    } else {
      rb_raise(rb_eArgError, "object does not have an associated Encoding");
    }

    if(enc->nil_p()) return -1;

    return Encoding::find_index(env->state(), enc->get_encoding()->name);
  }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:20,代码来源:encoding.cpp

示例11: rb_to_encoding_index

  int rb_to_encoding_index(VALUE obj) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();
    Encoding* enc = nil<Encoding>();

    switch(TYPE(obj)) {
    case T_ENCODING:
      enc = c_as<Encoding>(env->get_object(obj));
      break;
    case T_STRING:
      enc = Encoding::find(env->state(), RSTRING_PTR(obj));
      break;
    default:
      obj = rb_funcall(obj, rb_intern("to_str"), 0);
      enc = Encoding::find(env->state(), RSTRING_PTR(obj));
    }

    if(enc->nil_p()) return -1;

    return Encoding::find_index(env->state(), enc->get_encoding()->name);
  }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:20,代码来源:encoding.cpp

示例12: replicate

  Encoding* Encoding::replicate(STATE, const char* name, const char* original) {
    Encoding* enc = find(state, original);
    if(enc->nil_p()) return nil<Encoding>();

    return replicate(state, name, enc);
  }
开发者ID:h4ck3rm1k3,项目名称:rubinius,代码行数:6,代码来源:encoding.cpp


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