Lines Matching refs:item

91     for (Item &item : mItems) {  in clear()
92 delete[] item.mName; in clear()
93 item.mName = NULL; in clear()
94 freeItemValue(&item); in clear()
99 void AMessage::freeItemValue(Item *item) { in freeItemValue() argument
100 switch (item->mType) { in freeItemValue()
103 delete item->u.stringValue; in freeItemValue()
111 if (item->u.refValue != NULL) { in freeItemValue()
112 item->u.refValue->decStrong(this); in freeItemValue()
120 item->mType = kTypeInt32; // clear type in freeItemValue()
198 Item *item; in allocateItem() local
201 item = &mItems[i]; in allocateItem()
202 freeItemValue(item); in allocateItem()
208 item = &mItems[i]; in allocateItem()
211 return item; in allocateItem()
218 const Item *item = &mItems[i]; in findItem() local
219 return item->mType == type ? item : NULL; in findItem()
228 const Item *item = &mItems[i]; in findAsFloat() local
229 switch (item->mType) { in findAsFloat()
231 *value = item->u.floatValue; in findAsFloat()
234 *value = (float)item->u.doubleValue; in findAsFloat()
237 *value = (float)item->u.int64Value; in findAsFloat()
240 *value = (float)item->u.int32Value; in findAsFloat()
243 *value = (float)item->u.sizeValue; in findAsFloat()
255 const Item *item = &mItems[i]; in findAsInt64() local
256 switch (item->mType) { in findAsInt64()
258 *value = item->u.int64Value; in findAsInt64()
261 *value = item->u.int32Value; in findAsInt64()
277 Item *item = allocateItem(name); \
278 if (item) { \
279 item->mType = kType##NAME; \
280 item->u.FIELDNAME = value; \
286 const Item *item = findItem(name, kType##NAME); \
287 if (item) { \
288 *value = item->u.FIELDNAME; \
305 Item *item = allocateItem(name); in BASIC_TYPE() local
306 if (item) { in BASIC_TYPE()
307 item->mType = kTypeString; in BASIC_TYPE()
308 item->u.stringValue = new AString(s, len < 0 ? strlen(s) : len); in BASIC_TYPE()
319 Item *item = allocateItem(name); in setObjectInternal() local
320 if (item) { in setObjectInternal()
321 item->mType = type; in setObjectInternal()
324 item->u.refValue = obj.get(); in setObjectInternal()
337 Item *item = allocateItem(name); in setMessage() local
338 if (item) { in setMessage()
339 item->mType = kTypeMessage; in setMessage()
342 item->u.refValue = obj.get(); in setMessage()
349 Item *item = allocateItem(name); in setRect() local
350 if (item) { in setRect()
351 item->mType = kTypeRect; in setRect()
353 item->u.rectValue.mLeft = left; in setRect()
354 item->u.rectValue.mTop = top; in setRect()
355 item->u.rectValue.mRight = right; in setRect()
356 item->u.rectValue.mBottom = bottom; in setRect()
361 const Item *item = findItem(name, kTypeString); in findString() local
362 if (item) { in findString()
363 *value = *item->u.stringValue; in findString()
370 const Item *item = findItem(name, kTypeObject); in findObject() local
371 if (item) { in findObject()
372 *obj = item->u.refValue; in findObject()
379 const Item *item = findItem(name, kTypeBuffer); in findBuffer() local
380 if (item) { in findBuffer()
381 *buf = (ABuffer *)(item->u.refValue); in findBuffer()
388 const Item *item = findItem(name, kTypeMessage); in findMessage() local
389 if (item) { in findMessage()
390 *obj = static_cast<AMessage *>(item->u.refValue); in findMessage()
399 const Item *item = findItem(name, kTypeRect); in findRect() local
400 if (item == NULL) { in findRect()
404 *left = item->u.rectValue.mLeft; in findRect()
405 *top = item->u.rectValue.mTop; in findRect()
406 *right = item->u.rectValue.mRight; in findRect()
407 *bottom = item->u.rectValue.mBottom; in findRect()
588 const Item &item = mItems[i]; in debugString() local
590 switch (item.mType) { in debugString()
593 "int32_t %s = %d", item.mName, item.u.int32Value); in debugString()
597 "int64_t %s = %lld", item.mName, item.u.int64Value); in debugString()
601 "size_t %s = %d", item.mName, item.u.sizeValue); in debugString()
605 "float %s = %f", item.mName, item.u.floatValue); in debugString()
609 "double %s = %f", item.mName, item.u.doubleValue); in debugString()
613 "void *%s = %p", item.mName, item.u.ptrValue); in debugString()
618 item.mName, in debugString()
619 item.u.stringValue->c_str()); in debugString()
623 "RefBase *%s = %p", item.mName, item.u.refValue); in debugString()
627 sp<ABuffer> buffer = static_cast<ABuffer *>(item.u.refValue); in debugString()
630 tmp = AStringPrintf("Buffer %s = {\n", item.mName); in debugString()
636 "Buffer *%s = %p", item.mName, buffer.get()); in debugString()
643 item.mName, in debugString()
645 item.u.refValue)->debugString( in debugString()
646 indent + strlen(item.mName) + 14).c_str()); in debugString()
651 item.mName, in debugString()
652 item.u.rectValue.mLeft, in debugString()
653 item.u.rectValue.mTop, in debugString()
654 item.u.rectValue.mRight, in debugString()
655 item.u.rectValue.mBottom); in debugString()
688 Item *item = &msg->mItems[i]; in FromParcel() local
697 item->mType = static_cast<Type>(parcel.readInt32()); in FromParcel()
700 switch (item->mType) { in FromParcel()
703 item->u.int32Value = parcel.readInt32(); in FromParcel()
709 item->u.int64Value = parcel.readInt64(); in FromParcel()
715 item->u.sizeValue = static_cast<size_t>(parcel.readInt32()); in FromParcel()
721 item->u.floatValue = parcel.readFloat(); in FromParcel()
727 item->u.doubleValue = parcel.readDouble(); in FromParcel()
741 item->u.stringValue = new AString(stringValue); in FromParcel()
763 item->u.refValue = subMsg.get(); in FromParcel()
774 item->setName(name, strlen(name)); in FromParcel()
784 for (const Item &item : mItems) { in writeToParcel() local
785 parcel->writeCString(item.mName); in writeToParcel()
786 parcel->writeInt32(static_cast<int32_t>(item.mType)); in writeToParcel()
788 switch (item.mType) { in writeToParcel()
791 parcel->writeInt32(item.u.int32Value); in writeToParcel()
797 parcel->writeInt64(item.u.int64Value); in writeToParcel()
803 parcel->writeInt32(static_cast<int32_t>(item.u.sizeValue)); in writeToParcel()
809 parcel->writeFloat(item.u.floatValue); in writeToParcel()
815 parcel->writeDouble(item.u.doubleValue); in writeToParcel()
821 parcel->writeCString(item.u.stringValue->c_str()); in writeToParcel()
827 static_cast<AMessage *>(item.u.refValue)->writeToParcel(parcel); in writeToParcel()
854 for (const Item &item : mItems) { in changesFrom() local
855 const Item *oitem = other->findItem(item.mName, item.mType); in changesFrom()
856 switch (item.mType) { in changesFrom()
858 if (oitem == NULL || item.u.int32Value != oitem->u.int32Value) { in changesFrom()
859 diff->setInt32(item.mName, item.u.int32Value); in changesFrom()
864 if (oitem == NULL || item.u.int64Value != oitem->u.int64Value) { in changesFrom()
865 diff->setInt64(item.mName, item.u.int64Value); in changesFrom()
870 if (oitem == NULL || item.u.sizeValue != oitem->u.sizeValue) { in changesFrom()
871 diff->setSize(item.mName, item.u.sizeValue); in changesFrom()
876 if (oitem == NULL || item.u.floatValue != oitem->u.floatValue) { in changesFrom()
877 diff->setFloat(item.mName, item.u.sizeValue); in changesFrom()
882 if (oitem == NULL || item.u.doubleValue != oitem->u.doubleValue) { in changesFrom()
883 diff->setDouble(item.mName, item.u.sizeValue); in changesFrom()
888 if (oitem == NULL || *item.u.stringValue != *oitem->u.stringValue) { in changesFrom()
889 diff->setString(item.mName, *item.u.stringValue); in changesFrom()
894 if (oitem == NULL || memcmp(&item.u.rectValue, &oitem->u.rectValue, sizeof(Rect))) { in changesFrom()
896 item.mName, item.u.rectValue.mLeft, item.u.rectValue.mTop, in changesFrom()
897 item.u.rectValue.mRight, item.u.rectValue.mBottom); in changesFrom()
902 if (oitem == NULL || item.u.ptrValue != oitem->u.ptrValue) { in changesFrom()
903 diff->setPointer(item.mName, item.u.ptrValue); in changesFrom()
909 sp<ABuffer> myBuf = static_cast<ABuffer *>(item.u.refValue); in changesFrom()
912 diff->setBuffer(item.mName, NULL); in changesFrom()
921 diff->setBuffer(item.mName, myBuf); in changesFrom()
928 sp<AMessage> myMsg = static_cast<AMessage *>(item.u.refValue); in changesFrom()
931 diff->setMessage(item.mName, NULL); in changesFrom()
939 diff->setMessage(item.mName, deep ? changes : myMsg); in changesFrom()
945 if (oitem == NULL || item.u.refValue != oitem->u.refValue) { in changesFrom()
946 diff->setObject(item.mName, item.u.refValue); in changesFrom()
952 ALOGE("Unknown type %d", item.mType); in changesFrom()
1035 status_t AMessage::setEntryAt(size_t index, const ItemData &item) { in setEntryAt() argument
1044 if (!item.used()) { in setEntryAt()
1051 if (item.find(&dst->u.int32Value)) { in setEntryAt()
1053 } else if (item.find(&dst->u.int64Value)) { in setEntryAt()
1055 } else if (item.find(&dst->u.sizeValue)) { in setEntryAt()
1057 } else if (item.find(&dst->u.floatValue)) { in setEntryAt()
1059 } else if (item.find(&dst->u.doubleValue)) { in setEntryAt()
1061 } else if (item.find(&dst->u.ptrValue)) { in setEntryAt()
1063 } else if (item.find(&dst->u.rectValue)) { in setEntryAt()
1065 } else if (item.find(&stringValue)) { in setEntryAt()
1068 } else if (item.find(&refValue)) { in setEntryAt()
1072 } else if (item.find(&msgValue)) { in setEntryAt()
1076 } else if (item.find(&bufValue)) { in setEntryAt()
1120 void AMessage::setItem(const char *name, const ItemData &item) { in setItem() argument
1121 if (item.used()) { in setItem()
1124 setEntryAt(it - &mItems[0], item); in setItem()