2011-02-24 66 views
0

我在使用Symbian描述符时遇到了一些困难。我基本上想要采取各种描述符并将它们连接在一起成为一个更大的描述符,也许将它们放入RBuf中。此外,数据片段的长度会随着程序运行的每种类型而变化,下面是一些我一直在玩弄但尚未能够构建的骨架代码。如何连接各种Symbian描述符

HBufC8 * aVar = someObj.aVarData(); 
HBufC * anotherVar = someObj.anotherVarData(); 
HBuf8 * someVar = someObj.someVarData(); 

//Perform some operation to convert the descriptors to the same type and add them to a RBuf; 

RBuf toLog; 
toLog.CreateL(_L("Info to Log")); 
toLog.Append(aVar); 
toLog.Append(anotherVar); 
toLog.Append(someVar); 

我一直无法找到如何将描述符转换并添加到缓冲区,正如您从注释中看到的那样。提前致谢。

回答

1

追加()花费TDesC的引用,作为PARAM。所以,你的代码应该是这样的:

toLog.Append(*aVar); 
toLog.Append(*anotherVar); 
toLog.Append(*someVar); 
+0

快速的问题,为什么你用* aVar而不是aVar-> Des()? – binarycreations 2011-02-26 00:37:40

+0

取消引用hbufc描述符(仅)以获取嵌入的buf比使用全功能调用aVar-> Des()更快。这是symbian中hbufc描述符的基本经验法则(我们在Symbian组织中明智地遵循它)。 – Viren 2011-03-01 23:42:13