当前位置: 首页>>代码示例>>C++>>正文


C++ sp::findInt64方法代码示例

本文整理汇总了C++中android::sp::findInt64方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::findInt64方法的具体用法?C++ sp::findInt64怎么用?C++ sp::findInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android::sp的用法示例。


在下文中一共展示了sp::findInt64方法的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);
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:101,代码来源:Media_Utils.cpp


注:本文中的android::sp::findInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。