• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ encoding函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: QgsDebugMsg

QStringList QgsOpenVectorLayerDialog::openFile()
{

    QStringList selectedFiles;
    QgsDebugMsg( "Vector file filters: " + mVectorFileFilter );
    QString enc = encoding();
    QString title = tr( "Open an OGR Supported Vector Layer" );
    QgisGui::openFilesRememberingFilter( "lastVectorFileFilter", mVectorFileFilter, selectedFiles, enc,
                                         title );

    return selectedFiles;
}
开发者ID:mola,项目名称:qgis,代码行数:12,代码来源:qgsopenvectorlayerdialog.cpp


示例2: Encoding

void Encoding ( hit *i )
   {
      Z32 j;

      for ( j = 0; j < FIELDS; j++ )
	 {
	    word_length = lens[j]; 
	    word_code = i->i[j] + negs[j];
	    
	    encoding();
	 }
   }
开发者ID:ffzg,项目名称:PhiloLogic3,代码行数:12,代码来源:p-t1.c


示例3: encoding

TextDecoder* TextDecoder::create(const String& label, const TextDecoderOptions& options, ExceptionState& exceptionState)
{
    WTF::TextEncoding encoding(label);
    // The replacement encoding is not valid, but the Encoding API also
    // rejects aliases of the replacement encoding.
    if (!encoding.isValid() || !strcasecmp(encoding.name(), "replacement")) {
        exceptionState.throwRangeError("The encoding label provided ('" + label + "') is invalid.");
        return 0;
    }

    return new TextDecoder(encoding, options.fatal(), options.ignoreBOM());
}
开发者ID:kjthegod,项目名称:WebKit,代码行数:12,代码来源:TextDecoder.cpp


示例4: is_valid

const char* PredicateRegisterImpl::name() const {
  const char* names[number_of_registers] = {
      "pr0",   "pr1",   "pr2",   "pr3",   "pr4",   "pr5",   "pr6",   "pr7",
      "pr8",   "pr9",   "pr10",  "pr11",  "pr12", "pr13",   "pr14",  "pr15",
      "pr16",  "pr17",  "pr18",  "pr19",  "pr20",  "pr21",  "pr22",  "pr23",
      "pr24",  "pr25",  "pr26",  "pr27",  "pr28",  "pr29",  "pr30",  "pr31",
      "pr32",  "pr33",  "pr34",  "pr35",  "pr36",  "pr37",  "pr38",  "pr39",
      "pr40",  "pr41",  "pr42",  "pr43",  "pr44",  "pr45",  "pr46",  "pr47",
      "pr48",  "pr49",  "pr50",  "pr51",  "pr52",  "pr53",  "pr54",  "pr55",
      "pr56",  "pr57",  "pr58",  "pr59",  "pr60",  "pr61",  "pr62",  "pr63"
  };
  return is_valid() ? names[encoding()] : "noreg";
}
开发者ID:MuniyappanV,项目名称:jdk-source-code,代码行数:13,代码来源:register_ia64.cpp


示例5: encoding

HRESULT CPersistMemoryHelper2::Load(BLOB* pblob)
// Load from the indicated blob
	{
	OSSBUF encoding(World(), OSSBUF::keep);
	encoding.length = pblob->cbSize;
	encoding.value  = pblob->pBlobData;

	HRESULT hr = Load(encoding);
	if (hr == S_OK)
		m_isDirty = FALSE;

	return hr;
	}
开发者ID:mingpen,项目名称:OpenNT,代码行数:13,代码来源:pkcs10.cpp


示例6: inf_text_buffer_insert_text

void TextBuffer::insertText( unsigned int pos,
    const QByteArray &data,
    unsigned int length,
    User *user )
{
    inf_text_buffer_insert_text( INF_TEXT_BUFFER(gobject()),
        pos, data.data(), data.length(), length,
        INF_USER(user->gobject()) );
    // TODO test me, I don't think this is used anywhere in kobby
    QInfinity::TextChunk chunk( encoding() );
    chunk.insertText( 0, data, data.length(), user->id() );
    inf_text_buffer_text_inserted( INF_TEXT_BUFFER(gobject()),
        pos, chunk.infChunk(), INF_USER(user->gobject()) );
}
开发者ID:KDE,项目名称:libqinfinity,代码行数:14,代码来源:textbuffer.cpp


示例7: encoding

 void encoding(T state, Encoding* obj) {
   if(obj->nil_p() || (!CBOOL(ascii_only()) && obj->ascii_compatible())) {
     ascii_only(cNil);
     num_chars(nil<Fixnum>());
     valid_encoding(cNil);
   }
   if(byte_size() == 0 && !obj->nil_p() && obj->ascii_compatible()) {
     ascii_only(cTrue);
     num_chars(Fixnum::from(0));
     valid_encoding(cTrue);
   }
   encoding(obj);
   state->memory()->write_barrier(this, obj);
 }
开发者ID:JesseChavez,项目名称:rubinius,代码行数:14,代码来源:string.hpp


示例8: encoding

void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
                                    FXTEXT_CHARPOS* charPos,
                                    CFX_Font* cFont,
                                    FX_FLOAT geWidth,
                                    int32_t fontSize,
                                    FX_FLOAT& charsLen) {
  std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
      FX_CreateFontEncodingEx(cFont));

  int32_t length = text.GetLength();
  uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
  FX_FLOAT charWidth = 0;
  for (int32_t j = 0; j < text.GetLength(); j++) {
    pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
    int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
    int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
    FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0);
    charWidth += temp;
  }
  charsLen = charWidth;
  FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f;
  if (leftPositon < 0 && geWidth == 0) {
    leftPositon = 0;
  }
  FX_FLOAT penX = 0.0;
  FX_FLOAT penY =
      (FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f;
  FX_FLOAT left = leftPositon;
  FX_FLOAT top = 0.0;
  charPos[0].m_OriginX = penX + left;
  charPos[0].m_OriginY = penY + top;
  charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]);
  charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
  charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
  penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
  for (int32_t i = 1; i < length; i++) {
    charPos[i].m_OriginX = penX + left;
    charPos[i].m_OriginY = penY + top;
    charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
    charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
    charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
#endif
    penX +=
        (FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
  }
  FX_Free(pCharCode);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:50,代码来源:BC_OneDimWriter.cpp


示例9: String

String InspectorResource::sourceString() const
{
    if (!m_xmlHttpResponseText.isNull())
        return String(m_xmlHttpResponseText);

    String textEncodingName;
    RefPtr<SharedBuffer> buffer = resourceData(&textEncodingName);
    if (!buffer)
        return String();

    TextEncoding encoding(textEncodingName);
    if (!encoding.isValid())
        encoding = WindowsLatin1Encoding();
    return encoding.decode(buffer->data(), buffer->size());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:15,代码来源:InspectorResource.cpp


示例10: guard

  Object* Dir::read(STATE) {
    guard(state);

    struct dirent ent;
    struct dirent* entp = &ent;
    if(int erno = readdir_r(os(), entp, &entp)) {
      Exception::raise_errno_error(state, "readdir_r(3) failed", erno);
    }

    if(!entp) return cNil;

    String* str = String::create(state, ent.d_name);
    str->encoding(state, encoding());
    return str;
  }
开发者ID:Omosofe,项目名称:rubinius,代码行数:15,代码来源:dir.cpp


示例11: encoding

document gz_corpus::next()
{
    class_label label{"[none]"};

    if (class_stream_)
        std::getline(class_stream_, static_cast<std::string&>(label));

    std::string line;
    std::getline(corpus_stream_, line);

    document doc{cur_id_++, label};
    doc.content(line, encoding());
    doc.mdata(next_metadata());

    return doc;
}
开发者ID:domarps,项目名称:meta,代码行数:16,代码来源:gz_corpus.cpp


示例12: ExpatParser_initialize

/**
 * Creates a new Expat parser. Called from the Java ExpatParser constructor.
 *
 * @param object the Java ExpatParser instance
 * @param javaEncoding the character encoding name
 * @param processNamespaces true if the parser should handle namespaces
 * @returns the pointer to the C Expat parser
 */
static jlong ExpatParser_initialize(JNIEnv* env, jobject object, jstring javaEncoding,
        jboolean processNamespaces) {
    // Allocate parsing context.
    UniquePtr<ParsingContext> context(new ParsingContext(object));
    if (context.get() == NULL) {
        jniThrowOutOfMemoryError(env, NULL);
        return 0;
    }

    context->processNamespaces = processNamespaces;

    // Create a parser.
    XML_Parser parser;
    ScopedUtfChars encoding(env, javaEncoding);
    if (encoding.c_str() == NULL) {
        return 0;
    }
    if (processNamespaces) {
        // Use '|' to separate URIs from local names.
        parser = XML_ParserCreateNS(encoding.c_str(), '|');
    } else {
        parser = XML_ParserCreate(encoding.c_str());
    }

    if (parser != NULL) {
        if (processNamespaces) {
            XML_SetNamespaceDeclHandler(parser, startNamespace, endNamespace);
            XML_SetReturnNSTriplet(parser, 1);
        }

        XML_SetCdataSectionHandler(parser, startCdata, endCdata);
        XML_SetCharacterDataHandler(parser, text);
        XML_SetCommentHandler(parser, comment);
        XML_SetDoctypeDeclHandler(parser, startDtd, endDtd);
        XML_SetElementHandler(parser, startElement, endElement);
        XML_SetExternalEntityRefHandler(parser, handleExternalEntity);
        XML_SetNotationDeclHandler(parser, notationDecl);
        XML_SetProcessingInstructionHandler(parser, processingInstruction);
        XML_SetUnparsedEntityDeclHandler(parser, unparsedEntityDecl);
        XML_SetUserData(parser, context.release());
    } else {
        jniThrowOutOfMemoryError(env, NULL);
        return 0;
    }

    return fromXMLParser(parser);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_libcore,代码行数:55,代码来源:org_apache_harmony_xml_ExpatParser.cpp


示例13: cs

bool
KSpellConfig::writeGlobalSettings ()
{
  TDEConfigGroupSaver cs( kc,"KSpell" );

  kc->writeEntry ("KSpell_NoRootAffix",(int) noRootAffix(), true, true);
  kc->writeEntry ("KSpell_RunTogether", (int) runTogether(), true, true);
  kc->writeEntry ("KSpell_Dictionary", dictionary(), true, true);
  kc->writeEntry ("KSpell_DictFromList",(int) dictFromList(), true, true);
  kc->writeEntry ("KSpell_Encoding", (int) encoding(),
		  true, true);
  kc->writeEntry ("KSpell_Client", client(),
		  true, true);
  kc->sync();

  return true;
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:17,代码来源:ksconfig.cpp


示例14: Buffer

TextBuffer::TextBuffer( InfTextBuffer *infBuffer,
    QObject *parent,
    bool own_gobject )
    : Buffer( INF_BUFFER(infBuffer), parent, own_gobject )
    , m_codec( 0 )
    , m_encoder( 0 )
{
    m_codec = QTextCodec::codecForName( encoding().toAscii() );
    if( m_codec )
        m_encoder = m_codec->makeEncoder();
    erase_text_handler = g_signal_connect_after( gobject(),
        "text-erased", G_CALLBACK(TextBuffer::text_erased_cb),
        this );
    insert_text_handler = g_signal_connect_after( gobject(),
        "text-inserted", G_CALLBACK(TextBuffer::text_inserted_cb),
        this );
}
开发者ID:KDE,项目名称:libqinfinity,代码行数:17,代码来源:textbuffer.cpp


示例15: encoding

TextDecoder* TextDecoder::create(const String& label, const Dictionary& options, ExceptionState& exceptionState)
{
    WTF::TextEncoding encoding(label);
    // The replacement encoding is not valid, but the Encoding API also
    // rejects aliases of the replacement encoding.
    if (!encoding.isValid() || !strcasecmp(encoding.name(), "replacement")) {
        exceptionState.throwTypeError("The encoding label provided ('" + label + "') is invalid.");
        return 0;
    }

    bool fatal = false;
    options.get("fatal", fatal);

    bool ignoreBOM = false;
    options.get("ignoreBOM", ignoreBOM);

    return new TextDecoder(encoding, fatal, ignoreBOM);
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:18,代码来源:TextDecoder.cpp


示例16: localChangedText

void KDocumentTextBuffer::localTextInserted( KTextEditor::Document *document,
    const KTextEditor::Range &range )
{
    if ( m_aboutToClose ) return;

    emit localChangedText(range, user(), false);
    Q_UNUSED(document)

    textOpPerformed();
    if( m_user.isNull() ) {
        kDebug() << "Could not insert text: No local user set.";
        return;
    }
    unsigned int offset = cursorToOffset_kte(range.start());
    kDebug() << "local text inserted" << kDocument() << "( range" << range << ")" << m_user << "offset:" << offset;
    QInfinity::TextChunk chunk(encoding());
    QString text = kDocument()->text(range);
#ifdef ENABLE_TAB_HACK
    if ( text.contains('\t') ) {
        text = text.replace('\t', "    ");
        kDocument()->blockSignals(true);
        kDocument()->replaceText(range, text);
        kDocument()->blockSignals(false);
    }
#endif
    Q_ASSERT(encoder());
    if ( text.isEmpty() ) {
        kDebug() << "Skipping empty insert.";
        return;
    }
    QByteArray encodedText = codec()->fromUnicode( text );
    if ( encodedText.size() == 0 ) {
        kDebug() << "Got empty encoded text from non empty string "
                    "Skipping insertion";
    }
    else {
        chunk.insertText( 0, encodedText, countUnicodeCharacters(text), m_user->id() );
        blockRemoteInsert = true;
        kDebug() << "inserting chunk of size" << chunk.length() << "into local buffer" << kDocument()->url();
        insertChunk( offset, chunk, m_user );
        kDebug() << "done inserting chunk";
        checkConsistency();
    }
}
开发者ID:KDE,项目名称:kte-collaborative,代码行数:44,代码来源:document.cpp


示例17: encoding

void InspectorResourceAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result)
{
    if (!frame) {
        *errorString = "No frame to get resource content for";
        return;
    }

    String textEncodingName;
    RefPtr<SharedBuffer> buffer = InspectorResourceAgent::resourceData(frame, url, &textEncodingName);

    if (buffer) {
        TextEncoding encoding(textEncodingName);
        if (!encoding.isValid())
            encoding = WindowsLatin1Encoding();
        *result = encoding.decode(buffer->data(), buffer->size());
        return;
    }
    *errorString = "No resource with given URL found"; 
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:19,代码来源:InspectorResourceAgent.cpp


示例18: title

bool StandardFeed::addItself(RootItem* parent) {
  // Now, add feed to persistent storage.
  QSqlDatabase database = qApp->database()->connection(metaObject()->className());
  bool ok;
  int new_id = DatabaseQueries::addFeed(database, parent->id(), parent->getParentServiceRoot()->accountId(), title(),
                                        description(), creationDate(), icon(), encoding(), url(), passwordProtected(),
                                        username(), password(), autoUpdateType(), autoUpdateInitialInterval(), type(), &ok);

  if (!ok) {
    // Query failed.
    return false;
  }
  else {
    // New feed was added, fetch is primary id from the database.
    setId(new_id);
    setCustomId(QString::number(new_id));
    return true;
  }
}
开发者ID:martinrotter,项目名称:rssguard,代码行数:19,代码来源:standardfeed.cpp


示例19: coding_test

void coding_test() {
    char* encode;
    int encode_len;
    char* decode;
    int decode_len;

    if (encoding("abcd", 4, &encode, &encode_len) < 0) {
        return ;
    }

    printf("%.*s\n", encode_len - 4, encode + 4);

    if (decoding(encode + 4, encode_len - 4, &decode, &decode_len) < 0) {
        return ;
    }

    printf("%.*s\n", decode_len, decode);

}
开发者ID:cumirror,项目名称:epoll_example,代码行数:19,代码来源:coding.c


示例20: encoding

document gz_corpus::next()
{
    class_label label{"[none]"};

    if (class_stream_)
        std::getline(class_stream_, static_cast<std::string&>(label));

    std::string line;
    std::getline(corpus_stream_, line);

    document doc{cur_id_++, label};
    doc.content(line, encoding());

    auto mdata = next_metadata();
    if (store_full_text())
        mdata.insert(mdata.begin(), metadata::field{doc.content()});
    doc.mdata(std::move(mdata));

    return doc;
}
开发者ID:MGKhKhD,项目名称:meta,代码行数:20,代码来源:gz_corpus.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ encrypt函数代码示例发布时间:2022-05-30
下一篇:
C++ encoder函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap