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


C++ Encoding类代码示例

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


在下文中一共展示了Encoding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: UploadVideoImage

void UploadVideoImage(LPVOID lpParam)
{
	UploadVideoImageInfo* pUploadInfo = (UploadVideoImageInfo*)lpParam;

	string PackageDataSegment;
	PackageDataSegment.append("site=");
	PackageDataSegment.append(Encoding::Convert(pUploadInfo->strSite, CP_ACP));
	PackageDataSegment.append("&videoid=");
	PackageDataSegment.append(Encoding::Convert(pUploadInfo->strVideoId, CP_ACP));
	PackageDataSegment.append("&xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0D%0A%3CFile%20xmlns%3Adt%3D%22urn%3Aschemas-microsoft-com%3Adatatypes%22%3E%3CName%3E");
	PackageDataSegment.append(Encoding::Convert(pUploadInfo->GetFileName(), CP_ACP));
	PackageDataSegment.append("%3C/Name%3E%3CData%20dt%3Adt%3D%22bin.hex%22%3E");
	PackageDataSegment.append(pUploadInfo->GetFileData());
	PackageDataSegment.append("%3C/Data%3E%3C/File%3E");

	vector<BYTE> vPostData(PackageDataSegment.length());
	memcpy(&vPostData.at(0), PackageDataSegment.c_str(), PackageDataSegment.length());

	vector<BYTE> vResponseData;
	WebClient::Download(TEXT("http://wizard2.webdev.com/cgi-bin/article/uploadimages4video"), vResponseData, vPostData);
	vResponseData.push_back(0);

	Encoding encode;
	TSTLSTRING strRetValue = CW2T(encode.Convert((const char*)&vResponseData.at(0), CP_ACP).c_str());

	delete pUploadInfo;
}
开发者ID:NickeyWoo,项目名称:EditorAssistant,代码行数:27,代码来源:WizardVideoApplication.cpp

示例3: QDialog

ReloadEncodingDialog::ReloadEncodingDialog(TextEdit* textEdit,
                                           const Encoding& fromEncoding,
                                           const Encoding& toEncoding,
                                           QWidget* parent)
    : QDialog(parent),
      m_fromEncoding(fromEncoding),
      m_toEncoding(toEncoding),
      m_textEdit(textEdit) {
  QPushButton* cancelBtn = new QPushButton(tr("&Cancel"));
  QPushButton* reloadBtn = new QPushButton(tr("&Reload"));
  QPushButton* convertBtn = new QPushButton(tr("&Convert"));
  auto buttonBox = new QDialogButtonBox(this);
  // The button box takes ownership of the button
  buttonBox->addButton(reloadBtn, QDialogButtonBox::ActionRole);
  buttonBox->addButton(convertBtn, QDialogButtonBox::ActionRole);
  buttonBox->addButton(cancelBtn, QDialogButtonBox::ResetRole);
  auto label = new QLabel(
      tr("Reload: reload current file from disk in %1\nConvert: convert current text in %1")
          .arg(toEncoding.name()),
      this);
  QVBoxLayout* layout = new QVBoxLayout(this);
  layout->addWidget(label);
  layout->addWidget(buttonBox, 0, Qt::AlignRight);
  setLayout(layout);
  setWindowTitle(tr("%1: Reload or Convert to %2").arg(fromEncoding.name()).arg(toEncoding.name()));
  setFixedHeight(sizeHint().height());

  connect(cancelBtn, &QPushButton::clicked, this, &ReloadEncodingDialog::close);
  connect(reloadBtn, &QPushButton::clicked, this, &ReloadEncodingDialog::reload);
  connect(convertBtn, &QPushButton::clicked, this, &ReloadEncodingDialog::convert);
}
开发者ID:silkedit,项目名称:silkedit,代码行数:31,代码来源:ReloadEncodingDialog.cpp

示例4: 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

示例5:

  void Encoding::Info::show(STATE, Object* self, int level) {
    Encoding* enc = as<Encoding>(self);

    class_header(state, self);
    indent_attribute(++level, "name"); enc->name()->show_simple(state, level);
    indent_attribute(level, "dummy?"); enc->dummy()->show_simple(state, level);
    close_body(level);
  }
开发者ID:h4ck3rm1k3,项目名称:rubinius,代码行数:8,代码来源:encoding.cpp

示例6: create

  Encoding* Encoding::create(STATE, OnigEncodingType* enc, Object* dummy) {
    Encoding* e = state->new_object<Encoding>(G(encoding));

    e->dummy(state, dummy);
    e->encoding_ = enc;

    return e;
  }
开发者ID:meh,项目名称:rubinius,代码行数:8,代码来源:encoding.cpp

示例7: 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

示例8: 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

示例9:

 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

示例10: 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

示例11: create

  Encoding* Encoding::create(STATE, OnigEncodingType* enc, Object* dummy) {
    Encoding* e = state->new_object<Encoding>(G(encoding));

    e->dummy(state, dummy);
    e->encoding_ = enc;
    e->cache_index_ = cCachedOnigDatas - 1;
    e->managed_ = false;

    return e;
  }
开发者ID:Azzurrio,项目名称:rubinius,代码行数:10,代码来源:encoding.cpp

示例12: 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

示例13: toStdString

std::string estring::toStdString(std::string enc_name) const {
	byte_const_iterator iter = _string.cbegin();
	byte_string str;
	Encoding* enc = Encoding::byName(enc_name);
	while (iter != _string.end()) {
		char_t i = encoding->next(iter);
		enc->append(i, std::back_inserter(str));
	}
	return std::string(reinterpret_cast<char*>(&str[0]));
}
开发者ID:okknor,项目名称:edit,代码行数:10,代码来源:encoded_string.cpp

示例14: 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

示例15: rb_to_encoding

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

    int index = rb_to_encoding_index(obj);
    if(index < 0) return 0;

    Encoding* enc = try_as<Encoding>(Encoding::from_index(env->state(), index));

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


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