本文整理汇总了C++中MojRefCountedPtr::WriteEmail方法的典型用法代码示例。如果您正苦于以下问题:C++ MojRefCountedPtr::WriteEmail方法的具体用法?C++ MojRefCountedPtr::WriteEmail怎么用?C++ MojRefCountedPtr::WriteEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojRefCountedPtr
的用法示例。
在下文中一共展示了MojRefCountedPtr::WriteEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteEmail
void WriteEmail(MojRefCountedPtr<AsyncEmailWriter> writer, std::string& output)
{
// Write to a counter output stream
MojRefCountedPtr<CounterOutputStream> counter( new CounterOutputStream() );
writer->SetOutputStream(counter);
MojRefCountedPtr<AsyncEmailWriterResult> writeResult(new AsyncEmailWriterResult());
writer->WriteEmail(writeResult->GetSlot());
// Make sure it's done writing
ASSERT_TRUE( writeResult->Done() );
// Check if any exceptions were reported
ASSERT_TRUE( !writeResult->GetException() );
// Now write it again to a buffer
writeResult.reset(new AsyncEmailWriterResult());
MojRefCountedPtr<ByteBufferOutputStream> bbos( new ByteBufferOutputStream() );
writer->SetOutputStream(bbos);
writer->WriteEmail(writeResult->GetSlot());
// Make sure it's done writing
ASSERT_TRUE( writeResult->Done() );
// Check if any exceptions were reported
ASSERT_TRUE( !writeResult->GetException() );
// Read generated email into output string
ReadBuffer(output, bbos.get());
// Make sure the count matches the actual bytes written
ASSERT_EQ(counter->GetBytesWritten(), output.size());
}