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


C++ serializer函数代码示例

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


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

示例1: testPlainEmpty

        void testPlainEmpty()
        {
            std::ostringstream out;
            cxxtools::JsonSerializer serializer(out);
            serializer.finish();

            CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "");
        }
开发者ID:acklinr,项目名称:cxxtools,代码行数:8,代码来源:jsonserializer-test.cpp

示例2: stdStream

void WalletLegacySerializer::deserialize(std::istream& stream, const std::string& password, std::string& cache) {
  StdInputStream stdStream(stream);
  CryptoNote::BinaryInputStreamSerializer serializerEncrypted(stdStream);

  serializerEncrypted.beginObject("wallet");

  uint32_t version;
  serializerEncrypted(version, "version");
  // set serialization version global variable
  CryptoNote::WALLET_LEGACY_SERIALIZATION_VERSION = version;

  Crypto::chacha8_iv iv;
  serializerEncrypted(iv, "iv");

  std::string cipher;
  serializerEncrypted(cipher, "data");

  serializerEncrypted.endObject();

  std::string plain;
  decrypt(cipher, plain, iv, password);

  MemoryInputStream decryptedStream(plain.data(), plain.size()); 
  CryptoNote::BinaryInputStreamSerializer serializer(decryptedStream);

  loadKeys(serializer);
  throwIfKeysMissmatch(account.getAccountKeys().viewSecretKey, account.getAccountKeys().address.viewPublicKey);

  if (account.getAccountKeys().spendSecretKey != NULL_SECRET_KEY) {
    throwIfKeysMissmatch(account.getAccountKeys().spendSecretKey, account.getAccountKeys().address.spendPublicKey);
  } else {
    if (!Crypto::check_key(account.getAccountKeys().address.spendPublicKey)) {
      throw std::system_error(make_error_code(CryptoNote::error::WRONG_PASSWORD));
    }
  }

  bool detailsSaved;

  serializer(detailsSaved, "has_details");

  if (detailsSaved) {
    serializer(transactionsCache, "details");
  }

  serializer.binary(cache, "cache");
}
开发者ID:seredat,项目名称:karbowanec,代码行数:46,代码来源:WalletLegacySerializer.cpp

示例3: testInt

        void testInt()
        {
            std::ostringstream out;
            cxxtools::JsonSerializer serializer(out);
            serializer.serialize(-4711, "value").finish();

            CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "{\"value\":-4711}");
        }
开发者ID:acklinr,项目名称:cxxtools,代码行数:8,代码来源:jsonserializer-test.cpp

示例4: testPlainInt

        void testPlainInt()
        {
            std::ostringstream out;
            cxxtools::JsonSerializer serializer(out);
            serializer.serialize(-4711).finish();

            CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "-4711");
        }
开发者ID:acklinr,项目名称:cxxtools,代码行数:8,代码来源:jsonserializer-test.cpp

示例5: serializer

void
AudioSenderPlayerv1::sendOKClang()
{
    serializer().serializeOKClang( transport(),
                                   listener().clangMinVer(),
                                   listener().clangMaxVer() );
    transport() << std::ends << std::flush;
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:8,代码来源:audio.cpp

示例6: file

void SkDebuggerGUI::saveToFile(const SkString& filename) {
    SkFILEWStream file(filename.c_str());
    SkAutoTUnref<SkPicture> copy(fDebugger.copyPicture());

    SkAutoTUnref<SkPixelSerializer> serializer(
            SkImageEncoder::CreatePixelSerializer());
    copy->serialize(&file, serializer);
}
开发者ID:afedorychak,项目名称:skia,代码行数:8,代码来源:SkDebuggerGUI.cpp

示例7: serializer

void JsonRecordingList::finish()
{
  cxxtools::JsonSerializer serializer(*s->getBasicStream());
  serializer.serialize(serRecordings, "recordings");
  serializer.serialize(serRecordings.size(), "count");
  serializer.serialize(total, "total");
  serializer.finish();
}
开发者ID:sja,项目名称:vdr-plugin-restfulapi,代码行数:8,代码来源:recordings.cpp

示例8: serializePageToMHTML

static PassRefPtr<SharedBuffer> serializePageToMHTML(Page* page, MHTMLArchive::EncodingPolicy encodingPolicy)
{
    Vector<SerializedResource> resources;
    PageSerializer serializer(&resources);
    serializer.serialize(page);
    Document* document = page->deprecatedLocalMainFrame()->document();
    return MHTMLArchive::generateMHTMLData(resources, encodingPolicy, document->title(), document->suggestedMIMEType());
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:8,代码来源:WebPageSerializer.cpp

示例9: serializer

void JsonChannelGroupList::finish()
{  
  cxxtools::JsonSerializer serializer(*s->getBasicStream());
  serializer.serialize(groups, "groups");
  serializer.serialize(Count(), "count");
  serializer.serialize(total, "total");
  serializer.finish();
}
开发者ID:sja,项目名称:vdr-plugin-restfulapi,代码行数:8,代码来源:channels.cpp

示例10: SerializeJsval

ALWAYS_INLINE bool SerializeJsval( JSContext *cx, SerializedData *ser, jsval *val ) {

	jl::Serializer serializer(cx);
	JL_CHK( serializer.Write(cx, *val) );
	JL_CHK( serializer.GetBufferOwnership(&ser->data, &ser->length) );
	return true;
	JL_BAD;
}
开发者ID:BenitoJedai,项目名称:jslibs,代码行数:8,代码来源:task.cpp

示例11: serializer

void
ReliableSession::nak_received(ACE_Message_Block* control)
{
  if (! this->active_) return; // sub send naks, then doesn't receive them.

  const TransportHeader& header =
    this->link_->receive_strategy()->received_header();

  Serializer serializer(
    control, header.swap_bytes());

  MulticastPeer local_peer;
  CORBA::ULong size = 0;
  serializer >> local_peer; // sent as remote_peer
  serializer >> size;

  std::vector<SequenceRange> ranges;

  for (CORBA::ULong i = 0; i < size; ++i) {
    SequenceNumber::Value low;
    serializer >> low;

    SequenceNumber::Value high;
    serializer >> high;

    ranges.push_back (SequenceRange (low, high));
  }

  // Track peer repair requests for later suppression:
  if (local_peer == this->remote_peer_) {
    for (CORBA::ULong i = 0; i < size; ++i) {
      this->nak_peers_.insert(ranges[i]);
    }
    return;
  }

  // Ignore sample if not destined for us:
  if ((local_peer != this->link_->local_peer())        // Not to us.
    || (this->remote_peer_ != header.source_)) return; // Not from the remote peer for this session.

  TransportSendBuffer* send_buffer = this->link_->send_buffer();
  // Broadcast a MULTICAST_NAKACK control sample before resending to suppress
  // repair requests for unrecoverable samples by providing a
  // new low-water mark for affected peers:
  if (!send_buffer->empty() && send_buffer->low() > ranges.begin()->first) {
    send_nakack(send_buffer->low());
  }

  for (CORBA::ULong i = 0; i < size; ++i) {
    bool ret = send_buffer->resend(ranges[i]);
    if (OpenDDS::DCPS::DCPS_debug_level > 0) {
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ReliableSession::nak_received")
                            ACE_TEXT (" %d <- %d %d - %d resend result %d\n"),
                            this->link_->local_peer(), this->remote_peer_,
                            ranges[i].first.getValue(), ranges[i].second.getValue(), ret));
    }
  }
}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:58,代码来源:ReliableSession.cpp

示例12: test_write_workbook_

 void test_write_workbook_()
 {
     xlnt::workbook wb;
     xlnt::workbook_serializer serializer(wb);
     auto observed = serializer.write_workbook();
     auto filename = PathHelper::GetDataDirectory("/workbook.xml");
     auto diff = Helper::compare_xml(PathHelper::read_file(filename), observed);
     TS_ASSERT(!diff);
 }
开发者ID:fhaoquan,项目名称:xlnt,代码行数:9,代码来源:test_write_workbook.hpp

示例13: serializer

void
FullStateSenderPlayerV8::sendBall()
{
    serializer().serializeFSBall( transport(),
                                  stadium().ball().pos().x,
                                  stadium().ball().pos().y,
                                  stadium().ball().vel().x,
                                  stadium().ball().vel().y );
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:9,代码来源:fullstatesender.cpp

示例14: serializer

void LocalSettings::load()
{
    DataSerializer serializer( m_path );

    if ( !serializer.openForReading() )
        return;

    serializer.stream() >> m_data;
}
开发者ID:Herysutrisno,项目名称:webIssue,代码行数:9,代码来源:localsettings.cpp

示例15: testEmptyObject

        void testEmptyObject()
        {
            std::ostringstream out;
            cxxtools::JsonSerializer serializer(out);
            serializer.setObject();
            serializer.finish();

            CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "{}");
        }
开发者ID:gema-arta,项目名称:zim-vendor,代码行数:9,代码来源:jsonserializer-test.cpp


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