本文整理汇总了C++中aurora::LocString::writeLocString方法的典型用法代码示例。如果您正苦于以下问题:C++ LocString::writeLocString方法的具体用法?C++ LocString::writeLocString怎么用?C++ LocString::writeLocString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::LocString
的用法示例。
在下文中一共展示了LocString::writeLocString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readStream
GTEST_TEST_F(LocString, write) {
Aurora::LocString locString;
locString.setString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderMale, "String to test");
locString.setString(Aurora::kLanguageFrench, Aurora::kLanguageGenderMale, "String pour tester");
Common::MemoryWriteStreamDynamic *writeStream = new Common::MemoryWriteStreamDynamic(true);
locString.writeLocString(*writeStream);
Aurora::LocString locString2;
Common::MemoryReadStream readStream(writeStream->getData(), writeStream->size());
EXPECT_EQ(readStream.readUint32LE(), 0);
EXPECT_EQ(readStream.readUint32LE(), 14);
Common::UString englishString = Common::readStringFixed(readStream, Common::kEncodingASCII, 14);
EXPECT_STREQ(englishString.c_str(), "String to test");
EXPECT_EQ(readStream.readUint32LE(), 2);
EXPECT_EQ(readStream.readUint32LE(), 18);
Common::UString frenchString = Common::readStringFixed(readStream, Common::kEncodingASCII, 18);
EXPECT_STREQ(frenchString.c_str(), "String pour tester");
delete writeStream;
}