void ValueImpl::initList(const List& fl) { for (List::const_iterator iter = fl.begin(); iter != fl.end(); iter++) { const FieldValue& fvalue(*iter->get()); uint8_t amqType = fvalue.getType(); if (amqType == 0x32) { Value* subval(new Value(TYPE_UINT64)); subval->setUint64(fvalue.get<int64_t>()); appendToList(subval); } else if ((amqType & 0xCF) == 0x02) { Value* subval(new Value(TYPE_UINT32)); switch (amqType) { case 0x02 : subval->setUint(fvalue.get<int>()); break; // uint8 case 0x12 : subval->setUint(fvalue.get<int>()); break; // uint16 case 0x22 : subval->setUint(fvalue.get<int>()); break; // uint32 } appendToList(subval); } else if (amqType == 0x31) { // int64 Value* subval(new Value(TYPE_INT64)); subval->setInt64(fvalue.get<int64_t>()); appendToList(subval); } else if ((amqType & 0xCF) == 0x01) { // 0x01:int8, 0x11:int16, 0x21:int32 Value* subval(new Value(TYPE_INT32)); subval->setInt((int32_t)fvalue.get<int>()); appendToList(subval); } else if (amqType == 0x85 || amqType == 0x95) { Value* subval(new Value(TYPE_LSTR)); subval->setString(fvalue.get<string>().c_str()); appendToList(subval); } else if (amqType == 0x23 || amqType == 0x33) { Value* subval(new Value(TYPE_DOUBLE)); subval->setDouble(fvalue.get<double>()); appendToList(subval); } else if (amqType == 0xa8) { FieldTable subFt; bool valid = qpid::framing::getEncodedValue<FieldTable>(*iter, subFt); if (valid) { Value* subval(new Value(TYPE_MAP)); subval->impl->initMap(subFt); appendToList(subval); } } else if (amqType == 0xa9) { List subList; bool valid = qpid::framing::getEncodedValue<List>(*iter, subList); if (valid) { Value *subVal(new Value(TYPE_LIST)); subVal->impl->initList(subList); appendToList(subVal); } } else if (amqType == 0x08) { Value* subval(new Value(TYPE_BOOL)); subval->setBool(fvalue.get<int>() ? true : false); appendToList(subval); } else { QPID_LOG(error, "Unable to decode unsupported AMQP typecode =" << amqType); } } }
Factory* find (std::string const& name) const { for (List::const_iterator iter (m_list.begin ()); iter != m_list.end (); ++iter) if ((*iter)->getName().compareIgnoreCase (name) == 0) return iter->get(); return nullptr; }