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

C++ encoder函数代码示例

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

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



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

示例1: write_argument_value

	void write_argument_value(tstring const& data)
	{
		// http://www.w3.org/TR/REC-xml/#NT-AttValue
		// says that in att value, we escape " ' < and &
		static const tstring patterns = "\"'<&";
		static const tstring replacements[] = {
			"&quot;", "&apos;", "&lt;", "&amp;"
		};
		xml_content_encoder encoder(data, patterns, replacements);
		while( encoder.has_next() ) {
			tinfra::tstring chunk = encoder.next();
			out_->write(chunk.data(), chunk.size());
		}
	}
开发者ID:icasimpan,项目名称:tinfra,代码行数:14,代码来源:xml_writer.cpp


示例2: createHeader

    const std::string createHeader()
    {
        // TODO: Some sane code to represent JSON objects
        std::string header = "{\"alg\":\""+_alg+"\",\"typ\":\""+_typ+"\"}";

        Log::info("JWT Header: " + header);
        std::ostringstream ostr;
        Poco::OutputLineEndingConverter lineEndingConv(ostr, "");
        Poco::Base64Encoder encoder(lineEndingConv);
        encoder << header;
        encoder.close();

        return ostr.str();
    }
开发者ID:konlytest,项目名称:online,代码行数:14,代码来源:Auth.hpp


示例3: encoder

void ArchExecutor::EncodeFiles(Options* options)
{
	int filesCount = options->Files->GetCount();
	if (options->Stdin || filesCount == 0)
	{
		LzwEncoder encoder(stdin, stdout);
		encoder.Encode("");
		return;
	}

	for(int i = 0; i < filesCount; i++)
	{
		char* path = options->Files->GetElement(i);

		FILE* inputFile = fopen(path, "rb");
		if (IsCompressedFile(inputFile))
		{
			fclose(inputFile);
			continue;
		}

		char* compressedPath = new char[PATH_MAX];
		int pathLength = sprintf (compressedPath, "%s.ar", path);
		if (pathLength >= PATH_MAX) 
		{
			printf ("Path length has got too long.\n");
			continue;
		}

		FILE* outputFile = fopen(compressedPath, "wb");

		LzwEncoder encoder(inputFile, outputFile);
		encoder.Encode(GetName(path));
		fclose(inputFile);
		remove(path);
	}
}
开发者ID:Breaktheline,项目名称:Arch,代码行数:37,代码来源:ArchExecutor.cpp


示例4: newChunk

void VlrCompressor::done()
{
    // Close and clear the point encoder.
    m_encoder->done();
    m_encoder.reset();

    newChunk();

    // Save our current position.  Go to the location where we need
    // to write the chunk table offset at the beginning of the point data.

    uint64_t chunkTablePos = htole64((uint64_t) m_stream.m_buf.size());
    // We need to add the offset given a construction time since
    // we did not use a stream to write the header and vlrs
    uint64_t trueChunkTablePos = htole64((uint64_t) m_stream.m_buf.size() +  m_offsetToData);

    // Equivalent of stream.seekp(m_chunkInfoPos); stream << chunkTablePos
    memcpy(&m_stream.m_buf[m_chunkInfoPos], (char*) &trueChunkTablePos, sizeof(uint64_t));

    // Move to the start of the chunk table.
    // Which in our case is the end of the m_stream vector

    // Write the chunk table header in two steps
    // 1. Push bytes into the stream
    // 2. memcpy the data into the pushed bytes
    unsigned char skip[2 * sizeof(uint32_t)] = {0};
    m_stream.putBytes(skip, sizeof(skip));
    uint32_t version = htole32(0);
    uint32_t chunkTableSize = htole32((uint32_t) m_chunkTable.size());

    memcpy(&m_stream.m_buf[chunkTablePos], &version, sizeof(uint32_t));
    memcpy(&m_stream.m_buf[chunkTablePos + sizeof(uint32_t)], &chunkTableSize, sizeof(uint32_t));

    // Encode and write the chunk table.
    // OutputStream outputStream(m_stream);
    TypedLazPerfBuf<uint8_t> outputStream(m_stream);
    Encoder encoder(outputStream);
    laszip::compressors::integer compressor(32, 2);
    compressor.init();

    uint32_t predictor = 0;
    for (uint32_t chunkSize : m_chunkTable)
    {
        chunkSize = htole32(chunkSize);
        compressor.compress(encoder, predictor, chunkSize, 1);
        predictor = chunkSize;
    }
    encoder.done();
}
开发者ID:abellgithub,项目名称:laz-perf,代码行数:49,代码来源:PyVlrCompressor.cpp


示例5: _WIMTRACE2

// -----------------------------------------------------------------------------
// CWimCertHandler::ParseCertPublicKeyL
// Parse public key from certificate.
// -----------------------------------------------------------------------------
//
void CWimCertHandler::ParseCertPublicKeyL(
    const TDesC8& aCertData,
    TDes8& aPublicKey,
    const TUint8 aCertType ) const
    {
    _WIMTRACE2(_L("WIM | WIMServer | CWimPublicKeyHandler::ParseCertPublicKeyL | Begin, type %d"), aCertType);
    CCertificate* certificate = NULL;
    CRSAPublicKey* publicKey = NULL;

    switch ( aCertType )
        {
        case WIMI_CT_WTLS:
            {
            certificate = CWTLSCertificate::NewLC( aCertData );
            publicKey = CWTLSRSAPublicKey::NewLC( certificate->PublicKey().KeyData() );
            break;
            }

        case WIMI_CT_X509:
            {
            certificate = CX509Certificate::NewLC( aCertData );
            publicKey = CX509RSAPublicKey::NewLC( certificate->PublicKey().KeyData() );
            break;
            }
        default:
            {
            _WIMTRACE2(_L("WIM|WIMServer|CWimCertHandler::ParseCertPublicKeyL, type %d not supported"), aCertType);
            User::Leave( KErrNotSupported );
            break;
            }
        }

    TX509RSAKeyEncoder encoder( *publicKey, ESHA1 );
    CASN1EncBase* encoded = encoder.EncodeKeyLC();

    TUint pos = 0;
    aPublicKey.SetLength( KPublicKeyLength );
    // Check that Max. length is not exceeded
    if ( encoded->LengthDER() > static_cast< TUint >( KPublicKeyLength ) )
        {
        _WIMTRACE(_L("WIM|WIMServer|CWimCertHandler::ParseCertPublicKeyL, too long public key"));
        User::Leave( KErrBadDescriptor );
        }
    // Write encoded key to prealloced buffer
    encoded->WriteDERL( aPublicKey, pos );

    CleanupStack::PopAndDestroy( 3, certificate );  // encoded, publicKey, certificate
    _WIMTRACE(_L("WIM | WIMServer | CWimPublicKeyHandler::ParseCertPublicKeyL | End"));
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:54,代码来源:WimCertHandler.cpp


示例6: run_codec_test

/*
encoder - decoder
cbr or cq
ppinloop
rebuild.yuv size.txt ssim.txt
*/
void run_codec_test(char argc, char** argv)
{
	CX264Encoder e;

	set_default_cmd();    
	parse_cmd_enc( argc, argv);
	if(1==verfy_cmd())
	{
		cmd_help();
	}

	init_encoder( &e );

    encoder( &e, &gCmd);
}
开发者ID:yujun1703,项目名称:video_enc,代码行数:21,代码来源:main.cpp


示例7: lzwTest

	std::string lzwTest(const std::string& str) {
		std::ostringstream oss;
		LzwEncoder encoder(std::make_shared<Writer>(&oss));
		for (auto c : str) {
			encoder.encode(c);
		}
		encoder.flush();

		std::istringstream iss(oss.str());
		LzwDecoder decoder(std::make_shared<Reader>(&iss));
		std::ostringstream result;
		decoder.decode(result);

		return result.str();
	}
开发者ID:WingOfRay,项目名称:lzw,代码行数:15,代码来源:TestLzw.cpp


示例8: encoder

void URLEncoderTest::DecodeTest()
{
	URLEncoder encoder("encoder");
	String Request = "Dies%20ist%0A%20%22%25%26%3F%2F%5C%23%7B%7DeinTestString";
	String Answer, expected;
	encoder.DoDecode(Answer, Request);
	expected = "Dies ist\n ";
	expected.Append('"').Append("%&?/\\#{}einTestString");
	assertEqual( expected, Answer );
	Request = "Dies+ist%0A+%22%25%26%3F%2F%5C%23%7B%7Dein+Test+String";
	encoder.DoDecode(Answer, Request);
	expected = "Dies ist\n ";
	expected.Append('"').Append("%&?/\\#{}ein Test String");
	assertEqual( expected, Answer );
}
开发者ID:chenbk85,项目名称:CuteTestForCoastTest,代码行数:15,代码来源:URLEncoderTest.cpp


示例9: write_content_bytes

	void write_content_bytes(tstring const& data)
	{
		// http://www.w3.org/TR/REC-xml/#dt-chardata
		// says that only < and & are escaped 
		// in normal text
		static const tstring patterns = "<&";
		static const tstring replacements[] = {
			"&lt;", "&amp;"
		};
		xml_content_encoder encoder(data, patterns, replacements); 
		while( encoder.has_next() ) {
			tinfra::tstring chunk = encoder.next();
			out_->write(chunk.data(), chunk.size());
		}
	}
开发者ID:icasimpan,项目名称:tinfra,代码行数:15,代码来源:xml_writer.cpp


示例10: switch

void MailMessage::writeEncoded(std::istream& istr, std::ostream& ostr, ContentTransferEncoding encoding) const
{
	switch (encoding)
	{
	case ENCODING_7BIT:
	case ENCODING_8BIT:
		StreamCopier::copyStream(istr, ostr);
		break;
	case ENCODING_QUOTED_PRINTABLE:
		{
			QuotedPrintableEncoder encoder(ostr);
			StreamCopier::copyStream(istr, encoder);
			encoder.close();
		}
		break;
	case ENCODING_BASE64:
		{
			Base64Encoder encoder(ostr);
			StreamCopier::copyStream(istr, encoder);
			encoder.close();
		}
		break;
	}
}
开发者ID:1514louluo,项目名称:poco,代码行数:24,代码来源:MailMessage.cpp


示例11: compressAdaptive

void compressAdaptive(std::istream& in, std::ostream& out) {
	const char* header = "AC\x00";
	out.write(header, 3);

	ArithmeticEncoder encoder(std::make_shared<BitStreamWriter>(&out));
	AdaptiveDataModel dataModel(NUM_SYMBOLS);
	for (;;) {
		int c = in.get();
		if (c == std::char_traits<char>::eof()) {
			encoder.encode(NUM_SYMBOLS - 1, &dataModel);
			break;
		}

		encoder.encode(c, &dataModel);
	}
}
开发者ID:WingOfRay,项目名称:lzw,代码行数:16,代码来源:main.cpp


示例12: makeBlock

  static Block
  makeBlock(uint32_t type, Iterator first, Iterator last)
  {
    EncodingEstimator estimator;
    size_t valueLength = last - first;
    size_t totalLength = valueLength;
    totalLength += estimator.prependVarNumber(valueLength);
    totalLength += estimator.prependVarNumber(type);

    EncodingBuffer encoder(totalLength, 0);
    encoder.prependRange(first, last);
    encoder.prependVarNumber(valueLength);
    encoder.prependVarNumber(type);

    return encoder.block();
  }
开发者ID:AaronTien,项目名称:ndn-cxx,代码行数:16,代码来源:block-helpers.hpp


示例13: main

void main(int argc, char *argv[])
{
    void encoder();
    static void usage(char*);
    
    if (argc != 3)
	usage(argv[0]);
#ifdef __ADSP21000__
    initx();
#else
    ifile_name = argv[1];
    xfile_name = argv[2];
#endif
    ffase = -4;
    encoder();
}
开发者ID:szhuangzan,项目名称:2011Corel,代码行数:16,代码来源:cmain.c


示例14: saveImage

void		saveImage (const unsigned char* pixels,const unsigned char* palette,size_t width,size_t height,size_t channels,const std::string& strFile)
{
    std::auto_ptr<ImageEncoder> encoder ( getImageEncoder (strFile) );
    if (!encoder.get())
            throw std::runtime_error("Unsupported file format "+strFile);

    encoder->setWidth (width);
    encoder->setHeight (height);
    encoder->setChannels (channels);
    encoder->setPalette (palette);

    encoder->write_open(strFile);
    encoder->write_header();
    encoder->write_data (pixels,palette);
    encoder->write_close ();
}
开发者ID:jfellus,项目名称:agsvm,代码行数:16,代码来源:ImageCodec.cpp


示例15: createPayload

    const std::string createPayload()
    {
        std::time_t curtime = Poco::Timestamp().epochTime();
        std::string exptime = std::to_string(curtime + 3600);

        // TODO: Some sane code to represent JSON objects
        std::string payload = "{\"iss\":\""+_iss+"\",\"sub\":\""+_sub+"\",\"aud\":\""+_aud+"\",\"nme\":\""+_name+"\",\"exp\":\""+exptime+"\"}";

        Log::info("JWT Payload: " + payload);
        std::ostringstream ostr;
        Poco::OutputLineEndingConverter lineEndingConv(ostr, "");
        Poco::Base64Encoder encoder(lineEndingConv);
        encoder << payload;
        encoder.close();

        return ostr.str();
    }
开发者ID:konlytest,项目名称:online,代码行数:17,代码来源:Auth.hpp


示例16: main

int main(void)
{
  int i, sic, eic;
  U16BIT I;

  reset_encoder();
  reset_decoder();

  sic = __time / 2;
  for (i = 0; i < sizeof(Input) / sizeof(U16BIT); i++)
    decoder(encoder(Input[i]));
  eic = __time / 2;
  printf("\nInstruction cycles for transcoding a sample: %d\n",
	 (eic - sic) / (sizeof(Input) / sizeof(U16BIT)));

  return (0);
}
开发者ID:b14ckkn19ht,项目名称:Shang,代码行数:17,代码来源:board_test.c


示例17: filter

//获取文件的MD5码
CString CProcessMgr::GetFileMD5(CString sFilePath)
{
	std::string strFilePath = (LPCTSTR)sFilePath;
	CryptoPP::Weak::MD5 md5;
	CryptoPP::HashFilter filter(md5);

	std::auto_ptr<CryptoPP::ChannelSwitch> channelSwitch(new CryptoPP::ChannelSwitch);
	channelSwitch->AddDefaultRoute(filter);
	std::wstring wstr = s2ws_1(strFilePath);
	CryptoPP::FileSource(wstr.c_str(), true, channelSwitch.release());

	std::stringstream result;
	CryptoPP::HexEncoder encoder(new CryptoPP::FileSink(result), false);
	filter.TransferTo(encoder);
	std::string strResult = result.str();
	CString sResult = strResult.c_str();
	return sResult;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:19,代码来源:ProcessMgr.cpp


示例18: Q_D

QList<MovieFormat> MovieCapture::availableFormats()
{
    Q_D(MovieCapture);
    static QList<MovieFormat> availableFormats;
    if ( availableFormats.isEmpty() && checkToolsAvailability() ) {
        QProcess encoder(this);
        foreach ( MovieFormat format, m_supportedFormats ) {
            QString type = format.type();
            QStringList args;
            args << "-h" << "muxer=" + type;
            encoder.start( d->encoderExec, args );
            encoder.waitForFinished();
            QString output = encoder.readAll();
            bool isFormatAvailable = !output.contains( "Unknown format" );
            if( isFormatAvailable ) {
                availableFormats << format;
            }
        }
开发者ID:calincru,项目名称:marble,代码行数:18,代码来源:MovieCapture.cpp


示例19: TEST

TEST(invalidEncoder, CodecLibrary)
{
    HBitmapEncoder encoder(new WindowsBitmapEncoder);

    bool isInvalidEncoder = false;

    try
    {
        std::ostringstream os(std::ios::binary);
        encoder->encodeToStream(os);
    }
    catch (const InvalidEncoder&)
    {
        isInvalidEncoder = true;
    }

    CHECK(isInvalidEncoder);
}
开发者ID:mcmellawatt,项目名称:VectorGraphicsFramework,代码行数:18,代码来源:CodecLibraryTest.cpp


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ encoding函数代码示例发布时间:2022-05-30
下一篇:
C++ encode_string函数代码示例发布时间: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