本文整理汇总了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(), "");
}
示例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");
}
示例3: testInt
void testInt()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.serialize(-4711, "value").finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "{\"value\":-4711}");
}
示例4: testPlainInt
void testPlainInt()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.serialize(-4711).finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "-4711");
}
示例5: serializer
void
AudioSenderPlayerv1::sendOKClang()
{
serializer().serializeOKClang( transport(),
listener().clangMinVer(),
listener().clangMaxVer() );
transport() << std::ends << std::flush;
}
示例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);
}
示例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();
}
示例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());
}
示例9: serializer
void JsonChannelGroupList::finish()
{
cxxtools::JsonSerializer serializer(*s->getBasicStream());
serializer.serialize(groups, "groups");
serializer.serialize(Count(), "count");
serializer.serialize(total, "total");
serializer.finish();
}
示例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;
}
示例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));
}
}
}
示例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);
}
示例13: serializer
void
FullStateSenderPlayerV8::sendBall()
{
serializer().serializeFSBall( transport(),
stadium().ball().pos().x,
stadium().ball().pos().y,
stadium().ball().vel().x,
stadium().ball().vel().y );
}
示例14: serializer
void LocalSettings::load()
{
DataSerializer serializer( m_path );
if ( !serializer.openForReading() )
return;
serializer.stream() >> m_data;
}
示例15: testEmptyObject
void testEmptyObject()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.setObject();
serializer.finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "{}");
}