本文整理汇总了C++中android::sp::countEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::countEntries方法的具体用法?C++ sp::countEntries怎么用?C++ sp::countEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android::sp
的用法示例。
在下文中一共展示了sp::countEntries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertMessageToMap
ECode Media_Utils::ConvertMessageToMap(
/* [in] */ android::sp<android::AMessage>& msg,
/* [out] */ IObjectStringMap** mymap)
{
VALIDATE_NOT_NULL(mymap);
*mymap = NULL;
AutoPtr<IObjectStringMap> returnMap;
CObjectStringMap::New( (IObjectStringMap**)&returnMap);
for (Int32 i = 0; i < msg->countEntries(); i++) {
android::AMessage::Type valueType;
const char *key = msg->getEntryNameAt(i,&valueType);
AutoPtr<IInterface> valueObj;
switch (valueType){
case android::AMessage::kTypeInt32: {
Int32 val;
msg->findInt32(key, &val);
AutoPtr<IInteger32> value;
CInteger32::New(val, (IInteger32**)&value);
valueObj = value->Probe(EIID_IInterface);
break;
}
case android::AMessage::kTypeInt64: {
Int64 val;
msg->findInt64(key, &val);
AutoPtr<IInteger64> value;
CInteger64::New(val, (IInteger64**)&value);
valueObj = value->Probe(EIID_IInterface);
break;
}
case android::AMessage::kTypeFloat: {
Float val;
msg->findFloat(key, &val);
AutoPtr<IFloat> value;
CFloat::New(val, (IFloat**)&value);
valueObj = value->Probe(EIID_IInterface);
break;
}
case android::AMessage::kTypeString: {
android::AString val;
msg->findString(key, &val);
AutoPtr<ICharSequence> value;
CString::New(String(val.c_str()), (ICharSequence**)&value);
valueObj = value->Probe(EIID_IInterface);
break;
}
case android::AMessage::kTypeBuffer: {
android::sp<android::ABuffer> val;
msg->findBuffer(key, &val);
Int32 size = val->size();
ArrayOf<Byte> bytes((Byte*)val->data(), size);
AutoPtr<IByteBufferHelper> helper;
CByteBufferHelper::AcquireSingleton((IByteBufferHelper**)&helper);
AutoPtr<IByteBuffer> buffer;
helper->Allocate(size, (IByteBuffer**)&buffer);
buffer->PutBytes(bytes);
valueObj = buffer->Probe(EIID_IInterface);
break;
}
case android::AMessage::kTypeRect: {
Int32 left, top, right, bottom;
msg->findRect(key, &left, &top, &right, &bottom);
AutoPtr<IInteger32> tmpInt;
String strLeft;
strLeft.AppendFormat("%s-left", key);
CInteger32::New(left, (IInteger32**)&tmpInt);
returnMap->Put(strLeft ,tmpInt->Probe(EIID_IInterface));
String strTop;
strLeft.AppendFormat("%s-top", key);
tmpInt = NULL;
CInteger32::New(top, (IInteger32**)&tmpInt);
returnMap->Put(strTop ,tmpInt->Probe(EIID_IInterface));
String strRight;
strLeft.AppendFormat("%s-right", key);
tmpInt = NULL;
CInteger32::New(right, (IInteger32**)&tmpInt);
returnMap->Put(strRight ,tmpInt->Probe(EIID_IInterface));
String strBottom;
strLeft.AppendFormat("%s-bottom", key);
tmpInt = NULL;
CInteger32::New(bottom, (IInteger32**)&tmpInt);
returnMap->Put(strBottom ,tmpInt->Probe(EIID_IInterface));
break;
}
default:
break;
}//end switch
if (valueObj != NULL) {
String keyObj(key);
returnMap->Put(keyObj ,valueObj);
//.........这里部分代码省略.........