本文整理汇总了C++中LLTemplateMessageReader::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ LLTemplateMessageReader::getString方法的具体用法?C++ LLTemplateMessageReader::getString怎么用?C++ LLTemplateMessageReader::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLTemplateMessageReader
的用法示例。
在下文中一共展示了LLTemplateMessageReader::getString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultTemplate
void LLTemplateMessageBuilderTestObject::test<18>()
// String
{
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_VARIABLE, 1));
std::string outValue, inValue = "testing";
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addString(_PREHASH_Test0, inValue.c_str());
LLTemplateMessageReader* reader = setReader(messageTemplate, builder);
char buffer[MAX_STRING];
reader->getString(_PREHASH_Test0, _PREHASH_Test0, MAX_STRING, buffer);
outValue = buffer;
ensure_equals("Ensure String", inValue, outValue);
delete reader;
}
示例2: LLTemplateMessageReader
void LLTemplateMessageBuilderTestObject::test<45>()
// read variable length data past end of message -> 0 length
{
// build message with single block
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE));
U32 outValue, outValue2, inValue = 0xbbbbbbbb;
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addU32(_PREHASH_Test0, inValue);
const U32 bufferSize = 1024;
U8 buffer[bufferSize];
memset(buffer, 0xaa, bufferSize);
memset(buffer, 0, LL_PACKET_ID_SIZE);
U32 builtSize = builder->buildMessage(buffer, bufferSize, 0);
delete builder;
// add variable block to reader template
messageTemplate.addBlock(createBlock(const_cast<char*>(_PREHASH_Test1), MVT_VARIABLE, 4,
MBT_SINGLE));
// read message value and default string
numberMap[1] = &messageTemplate;
LLTemplateMessageReader* reader =
new LLTemplateMessageReader(numberMap);
reader->validateMessage(buffer, builtSize, LLHost());
reader->readMessage(buffer, LLHost());
reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue);
char outBuffer[bufferSize];
memset(buffer, 0xcc, bufferSize);
reader->getString(_PREHASH_Test1, _PREHASH_Test0, bufferSize,
outBuffer);
outValue2 = reader->getNumberOfBlocks(_PREHASH_Test1);
ensure_equals("Ensure present value ", outValue, inValue);
ensure_equals("Ensure unchanged buffer ", strlen(outBuffer), 0);
delete reader;
}