Lines Matching refs:c
196 static string GetFlagFor(const CodeGeneratorContext& c) { in GetFlagFor() argument
197 if (c.is_return_value) { in GetFlagFor()
204 bool WriteToParcelFor(const CodeGeneratorContext& c) { in WriteToParcelFor() argument
207 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
208 c.writer << c.parcel << ".writeInt(((" << c.var << ")?(1):(0)));\n"; in WriteToParcelFor()
211 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
212 c.writer << c.parcel << ".writeBooleanArray(" << c.var << ");\n"; in WriteToParcelFor()
215 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
216 c.writer << c.parcel << ".writeByte(" << c.var << ");\n"; in WriteToParcelFor()
219 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
220 c.writer << c.parcel << ".writeByteArray(" << c.var << ");\n"; in WriteToParcelFor()
223 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
224 c.writer << c.parcel << ".writeInt(((int)" << c.var << "));\n"; in WriteToParcelFor()
227 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
228 c.writer << c.parcel << ".writeCharArray(" << c.var << ");\n"; in WriteToParcelFor()
231 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
232 c.writer << c.parcel << ".writeInt(" << c.var << ");\n"; in WriteToParcelFor()
235 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
236 c.writer << c.parcel << ".writeIntArray(" << c.var << ");\n"; in WriteToParcelFor()
239 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
240 c.writer << c.parcel << ".writeLong(" << c.var << ");\n"; in WriteToParcelFor()
243 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
244 c.writer << c.parcel << ".writeLongArray(" << c.var << ");\n"; in WriteToParcelFor()
247 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
248 c.writer << c.parcel << ".writeFloat(" << c.var << ");\n"; in WriteToParcelFor()
251 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
252 c.writer << c.parcel << ".writeFloatArray(" << c.var << ");\n"; in WriteToParcelFor()
255 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
256 c.writer << c.parcel << ".writeDouble(" << c.var << ");\n"; in WriteToParcelFor()
259 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
260 c.writer << c.parcel << ".writeDoubleArray(" << c.var << ");\n"; in WriteToParcelFor()
263 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
264 c.writer << c.parcel << ".writeString(" << c.var << ");\n"; in WriteToParcelFor()
267 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
268 c.writer << c.parcel << ".writeStringArray(" << c.var << ");\n"; in WriteToParcelFor()
271 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
272 if (c.type.IsGeneric()) { in WriteToParcelFor()
273 const string& contained_type = c.type.GetTypeParameters().at(0)->GetName(); in WriteToParcelFor()
275 c.writer << c.parcel << ".writeStringList(" << c.var << ");\n"; in WriteToParcelFor()
277 c.writer << c.parcel << ".writeBinderList(" << c.var << ");\n"; in WriteToParcelFor()
278 } else if (c.typenames.IsParcelable(contained_type)) { in WriteToParcelFor()
279 c.writer << c.parcel << ".writeTypedList(" << c.var << ");\n"; in WriteToParcelFor()
281 AIDL_FATAL(c.type) << "write: NOT IMPLEMENTED for " << contained_type; in WriteToParcelFor()
284 c.writer << c.parcel << ".writeList(" << c.var << ");\n"; in WriteToParcelFor()
288 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
289 if (c.type.IsGeneric()) { in WriteToParcelFor()
290 c.writer << "if (" << c.var << " == null) {\n"; in WriteToParcelFor()
291 c.writer.Indent(); in WriteToParcelFor()
292 c.writer << c.parcel << ".writeInt(-1);\n"; in WriteToParcelFor()
293 c.writer.Dedent(); in WriteToParcelFor()
294 c.writer << "} else {\n"; in WriteToParcelFor()
295 c.writer.Indent(); in WriteToParcelFor()
296 c.writer << c.parcel << ".writeInt(" << c.var << ".size());\n"; in WriteToParcelFor()
297 c.writer << c.var << ".forEach((k, v) -> {\n"; in WriteToParcelFor()
298 c.writer.Indent(); in WriteToParcelFor()
299 c.writer << c.parcel << ".writeString(k);\n"; in WriteToParcelFor()
302 c.writer, in WriteToParcelFor()
303 c.typenames, in WriteToParcelFor()
304 *c.type.GetTypeParameters()[1].get(), in WriteToParcelFor()
305 c.parcel, in WriteToParcelFor()
307 c.is_return_value, in WriteToParcelFor()
308 c.is_classloader_created, in WriteToParcelFor()
309 c.filename, in WriteToParcelFor()
312 c.writer.Dedent(); in WriteToParcelFor()
313 c.writer << "});\n"; in WriteToParcelFor()
315 c.writer.Dedent(); in WriteToParcelFor()
316 c.writer << "}\n"; in WriteToParcelFor()
318 c.writer << c.parcel << ".writeMap(" << c.var << ");\n"; in WriteToParcelFor()
322 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
323 c.writer << c.parcel << ".writeStrongBinder(" << c.var << ");\n"; in WriteToParcelFor()
326 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
327 c.writer << c.parcel << ".writeBinderArray(" << c.var << ");\n"; in WriteToParcelFor()
330 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
331 c.writer << c.parcel << ".writeRawFileDescriptor(" << c.var << ");\n"; in WriteToParcelFor()
334 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
335 c.writer << c.parcel << ".writeRawFileDescriptorArray(" << c.var << ");\n"; in WriteToParcelFor()
338 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
341 c.writer << "if ((" << c.var << "!=null)) {\n"; in WriteToParcelFor()
342 c.writer.Indent(); in WriteToParcelFor()
343 c.writer << c.parcel << ".writeInt(1);\n"; in WriteToParcelFor()
344 c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n"; in WriteToParcelFor()
345 c.writer.Dedent(); in WriteToParcelFor()
346 c.writer << "}\n"; in WriteToParcelFor()
347 c.writer << "else {\n"; in WriteToParcelFor()
348 c.writer.Indent(); in WriteToParcelFor()
349 c.writer << c.parcel << ".writeInt(0);\n"; in WriteToParcelFor()
350 c.writer.Dedent(); in WriteToParcelFor()
351 c.writer << "}\n"; in WriteToParcelFor()
354 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
355 c.writer << c.parcel << ".writeTypedArray(" << c.var << ", " << GetFlagFor(c) << ");\n"; in WriteToParcelFor()
358 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
361 c.writer << "if (" << c.var << "!=null) {\n"; in WriteToParcelFor()
362 c.writer.Indent(); in WriteToParcelFor()
363 c.writer << c.parcel << ".writeInt(1);\n"; in WriteToParcelFor()
364 c.writer << "android.text.TextUtils.writeToParcel(" << c.var << ", " << c.parcel << ", " in WriteToParcelFor()
365 << GetFlagFor(c) << ");\n"; in WriteToParcelFor()
366 c.writer.Dedent(); in WriteToParcelFor()
367 c.writer << "}\n"; in WriteToParcelFor()
368 c.writer << "else {\n"; in WriteToParcelFor()
369 c.writer.Indent(); in WriteToParcelFor()
370 c.writer << c.parcel << ".writeInt(0);\n"; in WriteToParcelFor()
371 c.writer.Dedent(); in WriteToParcelFor()
372 c.writer << "}\n"; in WriteToParcelFor()
375 [](const CodeGeneratorContext& c) { in WriteToParcelFor() argument
376 c.writer << c.parcel << ".writeTypedObject(" << c.var << ", 0);\n"; in WriteToParcelFor()
379 const string type_name = AidlBackingTypeName(c.type, c.typenames); in WriteToParcelFor()
382 found->second(c); in WriteToParcelFor()
384 const AidlDefinedType* t = c.typenames.TryGetDefinedType(c.type.GetName()); in WriteToParcelFor()
385 AIDL_FATAL_IF(t == nullptr, c.type) << "Unknown type: " << c.type.GetName(); in WriteToParcelFor()
387 if (!c.type.IsArray()) { in WriteToParcelFor()
390 c.writer << c.parcel << ".writeStrongBinder((((" << c.var << "!=null))?" in WriteToParcelFor()
391 << "(" << c.var << ".asBinder()):(null)));\n"; in WriteToParcelFor()
394 if (c.type.IsArray()) { in WriteToParcelFor()
395 c.writer << c.parcel << ".writeTypedArray(" << c.var << ", " << GetFlagFor(c) << ");\n"; in WriteToParcelFor()
399 c.writer << "if ((" << c.var << "!=null)) {\n"; in WriteToParcelFor()
400 c.writer.Indent(); in WriteToParcelFor()
401 c.writer << c.parcel << ".writeInt(1);\n"; in WriteToParcelFor()
402 c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n"; in WriteToParcelFor()
403 c.writer.Dedent(); in WriteToParcelFor()
404 c.writer << "}\n"; in WriteToParcelFor()
405 c.writer << "else {\n"; in WriteToParcelFor()
406 c.writer.Indent(); in WriteToParcelFor()
407 c.writer << c.parcel << ".writeInt(0);\n"; in WriteToParcelFor()
408 c.writer.Dedent(); in WriteToParcelFor()
409 c.writer << "}\n"; in WriteToParcelFor()
418 static string EnsureAndGetClassloader(CodeGeneratorContext& c) { in EnsureAndGetClassloader() argument
419 AIDL_FATAL_IF(c.is_classloader_created == nullptr, AIDL_LOCATION_HERE); in EnsureAndGetClassloader()
420 if (!*(c.is_classloader_created)) { in EnsureAndGetClassloader()
421 c.writer << "java.lang.ClassLoader cl = " in EnsureAndGetClassloader()
423 *(c.is_classloader_created) = true; in EnsureAndGetClassloader()
428 bool CreateFromParcelFor(const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
431 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
432 c.writer << c.var << " = (0!=" << c.parcel << ".readInt());\n"; in CreateFromParcelFor()
435 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
436 c.writer << c.var << " = " << c.parcel << ".createBooleanArray();\n"; in CreateFromParcelFor()
439 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
440 c.writer << c.var << " = " << c.parcel << ".readByte();\n"; in CreateFromParcelFor()
443 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
444 c.writer << c.var << " = " << c.parcel << ".createByteArray();\n"; in CreateFromParcelFor()
447 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
448 c.writer << c.var << " = (char)" << c.parcel << ".readInt();\n"; in CreateFromParcelFor()
451 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
452 c.writer << c.var << " = " << c.parcel << ".createCharArray();\n"; in CreateFromParcelFor()
455 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
456 c.writer << c.var << " = " << c.parcel << ".readInt();\n"; in CreateFromParcelFor()
459 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
460 c.writer << c.var << " = " << c.parcel << ".createIntArray();\n"; in CreateFromParcelFor()
463 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
464 c.writer << c.var << " = " << c.parcel << ".readLong();\n"; in CreateFromParcelFor()
467 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
468 c.writer << c.var << " = " << c.parcel << ".createLongArray();\n"; in CreateFromParcelFor()
471 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
472 c.writer << c.var << " = " << c.parcel << ".readFloat();\n"; in CreateFromParcelFor()
475 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
476 c.writer << c.var << " = " << c.parcel << ".createFloatArray();\n"; in CreateFromParcelFor()
479 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
480 c.writer << c.var << " = " << c.parcel << ".readDouble();\n"; in CreateFromParcelFor()
483 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
484 c.writer << c.var << " = " << c.parcel << ".createDoubleArray();\n"; in CreateFromParcelFor()
487 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
488 c.writer << c.var << " = " << c.parcel << ".readString();\n"; in CreateFromParcelFor()
491 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
492 c.writer << c.var << " = " << c.parcel << ".createStringArray();\n"; in CreateFromParcelFor()
495 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
496 if (c.type.IsGeneric()) { in CreateFromParcelFor()
497 const string& contained_type = c.type.GetTypeParameters().at(0)->GetName(); in CreateFromParcelFor()
499 c.writer << c.var << " = " << c.parcel << ".createStringArrayList();\n"; in CreateFromParcelFor()
501 c.writer << c.var << " = " << c.parcel << ".createBinderArrayList();\n"; in CreateFromParcelFor()
502 } else if (c.typenames.IsParcelable(contained_type)) { in CreateFromParcelFor()
503 c.writer << c.var << " = " << c.parcel << ".createTypedArrayList(" in CreateFromParcelFor()
504 << JavaNameOf(*(c.type.GetTypeParameters().at(0)), c.typenames) in CreateFromParcelFor()
507 AIDL_FATAL(c.type) << "create: NOT IMPLEMENTED for " << contained_type; in CreateFromParcelFor()
510 const string classloader = EnsureAndGetClassloader(const_cast<CodeGeneratorContext&>(c)); in CreateFromParcelFor()
511 c.writer << c.var << " = " << c.parcel << ".readArrayList(" << classloader << ");\n"; in CreateFromParcelFor()
515 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
516 if (c.type.IsGeneric()) { in CreateFromParcelFor()
517 c.writer << "{\n"; in CreateFromParcelFor()
518 c.writer.Indent(); in CreateFromParcelFor()
519 c.writer << "int N = " << c.parcel << ".readInt();\n"; in CreateFromParcelFor()
520 c.writer << c.var << " = N < 0 ? null : new java.util.HashMap<>();\n"; in CreateFromParcelFor()
522 auto creator = JavaNameOf(*(c.type.GetTypeParameters().at(1)), c.typenames) + ".CREATOR"; in CreateFromParcelFor()
523 c.writer << "java.util.stream.IntStream.range(0, N).forEach(i -> {\n"; in CreateFromParcelFor()
524 c.writer.Indent(); in CreateFromParcelFor()
525 c.writer << "String k = " << c.parcel << ".readString();\n"; in CreateFromParcelFor()
526 c.writer << JavaSignatureOf(*(c.type.GetTypeParameters().at(1)), c.typenames) << " v;\n"; in CreateFromParcelFor()
528 c.writer, in CreateFromParcelFor()
529 c.typenames, in CreateFromParcelFor()
530 *c.type.GetTypeParameters()[1].get(), in CreateFromParcelFor()
531 c.parcel, in CreateFromParcelFor()
533 c.is_return_value, in CreateFromParcelFor()
534 c.is_classloader_created, in CreateFromParcelFor()
535 c.filename, in CreateFromParcelFor()
538 c.writer << c.var << ".put(k, v);\n"; in CreateFromParcelFor()
540 c.writer.Dedent(); in CreateFromParcelFor()
541 c.writer << "});\n"; in CreateFromParcelFor()
543 c.writer.Dedent(); in CreateFromParcelFor()
544 c.writer << "}\n"; in CreateFromParcelFor()
546 const string classloader = EnsureAndGetClassloader(const_cast<CodeGeneratorContext&>(c)); in CreateFromParcelFor()
547 c.writer << c.var << " = " << c.parcel << ".readHashMap(" << classloader << ");\n"; in CreateFromParcelFor()
551 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
552 c.writer << c.var << " = " << c.parcel << ".readStrongBinder();\n"; in CreateFromParcelFor()
555 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
556 c.writer << c.var << " = " << c.parcel << ".createBinderArray();\n"; in CreateFromParcelFor()
559 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
560 c.writer << c.var << " = " << c.parcel << ".readRawFileDescriptor();\n"; in CreateFromParcelFor()
563 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
564 c.writer << c.var << " = " << c.parcel << ".createRawFileDescriptorArray();\n"; in CreateFromParcelFor()
567 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
570 c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n"; in CreateFromParcelFor()
571 c.writer.Indent(); in CreateFromParcelFor()
572 …c.writer << c.var << " = " << "android.os.ParcelFileDescriptor.CREATOR.createFromParcel(" << c.par… in CreateFromParcelFor()
574 c.writer.Dedent(); in CreateFromParcelFor()
575 c.writer << "}\n"; in CreateFromParcelFor()
576 c.writer << "else {\n"; in CreateFromParcelFor()
577 c.writer.Indent(); in CreateFromParcelFor()
578 c.writer << c.var << " = null;\n"; in CreateFromParcelFor()
579 c.writer.Dedent(); in CreateFromParcelFor()
580 c.writer << "}\n"; in CreateFromParcelFor()
583 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
584 c.writer << c.var << " = " << c.parcel in CreateFromParcelFor()
588 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
590 c.writer << "if (0!=" << c.parcel << ".readInt()) {\n"; in CreateFromParcelFor()
591 c.writer.Indent(); in CreateFromParcelFor()
592 c.writer << c.var << " = android.text.TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(" in CreateFromParcelFor()
593 << c.parcel << ");\n"; in CreateFromParcelFor()
594 c.writer.Dedent(); in CreateFromParcelFor()
595 c.writer << "}\n"; in CreateFromParcelFor()
596 c.writer << "else {\n"; in CreateFromParcelFor()
597 c.writer.Indent(); in CreateFromParcelFor()
598 c.writer << c.var << " = null;\n"; in CreateFromParcelFor()
599 c.writer.Dedent(); in CreateFromParcelFor()
600 c.writer << "}\n"; in CreateFromParcelFor()
603 [](const CodeGeneratorContext& c) { in CreateFromParcelFor() argument
604 c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n"; in CreateFromParcelFor()
605 c.writer.Indent(); in CreateFromParcelFor()
606 c.writer << c.var << ".readFromParcel(" << c.parcel << ");\n"; in CreateFromParcelFor()
607 c.writer.Dedent(); in CreateFromParcelFor()
608 c.writer << "}\n"; in CreateFromParcelFor()
611 const auto found = method_map.find(AidlBackingTypeName(c.type, c.typenames)); in CreateFromParcelFor()
613 found->second(c); in CreateFromParcelFor()
615 const AidlDefinedType* t = c.typenames.TryGetDefinedType(c.type.GetName()); in CreateFromParcelFor()
616 AIDL_FATAL_IF(t == nullptr, c.type) << "Unknown type: " << c.type.GetName(); in CreateFromParcelFor()
618 if (!c.type.IsArray()) { in CreateFromParcelFor()
619 c.writer << c.var << " = " << c.type.GetName() << ".Stub.asInterface(" << c.parcel in CreateFromParcelFor()
623 if (c.type.IsArray()) { in CreateFromParcelFor()
624 c.writer << c.var << " = " << c.parcel << ".createTypedArray(" in CreateFromParcelFor()
625 << JavaNameOf(c.type, c.typenames) << ".CREATOR);\n"; in CreateFromParcelFor()
629 c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n"; in CreateFromParcelFor()
630 c.writer.Indent(); in CreateFromParcelFor()
631 c.writer << c.var << " = " << c.type.GetName() << ".CREATOR.createFromParcel(" << c.parcel in CreateFromParcelFor()
633 c.writer.Dedent(); in CreateFromParcelFor()
634 c.writer << "}\n"; in CreateFromParcelFor()
635 c.writer << "else {\n"; in CreateFromParcelFor()
636 c.writer.Indent(); in CreateFromParcelFor()
637 c.writer << c.var << " = null;\n"; in CreateFromParcelFor()
638 c.writer.Dedent(); in CreateFromParcelFor()
639 c.writer << "}\n"; in CreateFromParcelFor()
646 bool ReadFromParcelFor(const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
649 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
650 c.writer << c.parcel << ".readBooleanArray(" << c.var << ");\n"; in ReadFromParcelFor()
653 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
654 c.writer << c.parcel << ".readByteArray(" << c.var << ");\n"; in ReadFromParcelFor()
657 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
658 c.writer << c.parcel << ".readCharArray(" << c.var << ");\n"; in ReadFromParcelFor()
661 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
662 c.writer << c.parcel << ".readIntArray(" << c.var << ");\n"; in ReadFromParcelFor()
665 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
666 c.writer << c.parcel << ".readLongArray(" << c.var << ");\n"; in ReadFromParcelFor()
669 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
670 c.writer << c.parcel << ".readFloatArray(" << c.var << ");\n"; in ReadFromParcelFor()
673 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
674 c.writer << c.parcel << ".readDoubleArray(" << c.var << ");\n"; in ReadFromParcelFor()
677 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
678 c.writer << c.parcel << ".readStringArray(" << c.var << ");\n"; in ReadFromParcelFor()
681 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
682 if (c.type.IsGeneric()) { in ReadFromParcelFor()
683 const string& contained_type = c.type.GetTypeParameters().at(0)->GetName(); in ReadFromParcelFor()
685 c.writer << c.parcel << ".readStringList(" << c.var << ");\n"; in ReadFromParcelFor()
687 c.writer << c.parcel << ".readBinderList(" << c.var << ");\n"; in ReadFromParcelFor()
688 } else if (c.typenames.IsParcelable(contained_type)) { in ReadFromParcelFor()
689 c.writer << c.parcel << ".readTypedList(" << c.var << ", " in ReadFromParcelFor()
690 << JavaNameOf(*(c.type.GetTypeParameters().at(0)), c.typenames) in ReadFromParcelFor()
693 AIDL_FATAL(c.type) << "read: NOT IMPLEMENTED for " << contained_type; in ReadFromParcelFor()
696 const string classloader = EnsureAndGetClassloader(const_cast<CodeGeneratorContext&>(c)); in ReadFromParcelFor()
697 c.writer << c.parcel << ".readList(" << c.var << ", " << classloader << ");\n"; in ReadFromParcelFor()
701 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
702 if (c.type.IsGeneric()) { in ReadFromParcelFor()
703 c.writer << "if (" << c.var << " != null) " << c.var << ".clear();\n"; in ReadFromParcelFor()
704 c.writer << "java.util.stream.IntStream.range(0, " << c.parcel in ReadFromParcelFor()
706 c.writer.Indent(); in ReadFromParcelFor()
707 c.writer << "String k = " << c.parcel << ".readString();\n"; in ReadFromParcelFor()
708 c.writer << JavaNameOf(*(c.type.GetTypeParameters().at(1)), c.typenames) << " v;\n"; in ReadFromParcelFor()
710 c.writer, in ReadFromParcelFor()
711 c.typenames, in ReadFromParcelFor()
712 *c.type.GetTypeParameters()[1].get(), in ReadFromParcelFor()
713 c.parcel, in ReadFromParcelFor()
715 c.is_return_value, in ReadFromParcelFor()
716 c.is_classloader_created, in ReadFromParcelFor()
717 c.filename, in ReadFromParcelFor()
720 c.writer << c.var << ".put(k, v);\n"; in ReadFromParcelFor()
722 c.writer.Dedent(); in ReadFromParcelFor()
723 c.writer << "});\n"; in ReadFromParcelFor()
725 c.writer.Dedent(); in ReadFromParcelFor()
726 c.writer << "}\n"; in ReadFromParcelFor()
728 const string classloader = EnsureAndGetClassloader(const_cast<CodeGeneratorContext&>(c)); in ReadFromParcelFor()
729 c.writer << c.var << " = " << c.parcel << ".readHashMap(" << classloader << ");\n"; in ReadFromParcelFor()
733 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
734 c.writer << c.parcel << ".readBinderArray(" << c.var << ");\n"; in ReadFromParcelFor()
737 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
738 c.writer << c.parcel << ".readRawFileDescriptorArray(" << c.var << ");\n"; in ReadFromParcelFor()
741 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
742 c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n"; in ReadFromParcelFor()
743 c.writer.Indent(); in ReadFromParcelFor()
744 …c.writer << c.var << " = " << "android.os.ParcelFileDescriptor.CREATOR.createFromParcel(" << c.par… in ReadFromParcelFor()
745 c.writer.Dedent(); in ReadFromParcelFor()
746 c.writer << "}\n"; in ReadFromParcelFor()
749 [](const CodeGeneratorContext& c) { in ReadFromParcelFor() argument
750 c.writer << c.parcel << ".readTypedArray(" << c.var in ReadFromParcelFor()
754 const auto& found = method_map.find(AidlBackingTypeName(c.type, c.typenames)); in ReadFromParcelFor()
756 found->second(c); in ReadFromParcelFor()
758 const AidlDefinedType* t = c.typenames.TryGetDefinedType(c.type.GetName()); in ReadFromParcelFor()
759 AIDL_FATAL_IF(t == nullptr, c.type) << "Unknown type: " << c.type.GetName(); in ReadFromParcelFor()
761 if (c.type.IsArray()) { in ReadFromParcelFor()
762 c.writer << c.parcel << ".readTypedArray(" << c.var << ", " << c.type.GetName() in ReadFromParcelFor()
765 c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n"; in ReadFromParcelFor()
766 c.writer.Indent(); in ReadFromParcelFor()
767 c.writer << c.var << ".readFromParcel(" << c.parcel << ");\n"; in ReadFromParcelFor()
768 c.writer.Dedent(); in ReadFromParcelFor()
769 c.writer << "}\n"; in ReadFromParcelFor()
776 void ToStringFor(const CodeGeneratorContext& c) { in ToStringFor() argument
777 if (c.type.IsArray()) { in ToStringFor()
778 c.writer << "java.util.Arrays.toString(" << c.var << ")"; in ToStringFor()
782 const std::string name = c.type.GetName(); in ToStringFor()
785 c.writer << c.var; in ToStringFor()
789 const AidlDefinedType* t = c.typenames.TryGetDefinedType(name); in ToStringFor()
791 c.writer << c.var; in ToStringFor()
797 c.writer << c.var << " == null ? \"null\" : "; in ToStringFor()
798 c.writer << c.var << ".getInt$()"; in ToStringFor()
804 c.writer << "java.util.Objects.toString(" << c.var << ")"; in ToStringFor()
810 AIDL_FATAL_IF(t == nullptr, c.type) << "Unknown type"; in ToStringFor()
812 c.writer << "java.util.Objects.toString(" << c.var << ")"; in ToStringFor()