MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / getArrayInitialization

Method getArrayInitialization

erpcgen/src/JavaGenerator.cpp:478–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478string JavaGenerator::getArrayInitialization(ArrayType *t)
479{
480 string result = "";
481
482 DataType *current = dynamic_cast<DataType *>(t);
483 while (current->isArray())
484 {
485 ArrayType *arrayType = dynamic_cast<ArrayType *>(current);
486 result += format_string("[%d]", arrayType->getElementCount());
487 current = arrayType->getElementType();
488 }
489
490 if (current->getDataType() == DataType::data_type_t::kListType)
491 {
492 result = "List" + result; // Java does not support typed arrays e.g. List<int[]>. Use untyped List[].
493 }
494 else
495 {
496 result = getTypenameName(t->getTrueContainerDataType(), false, false) + result;
497 }
498
499 result = "new " + result;
500
501 return result;
502}
503
504void JavaGenerator::makeConstTemplateData()
505{

Callers

nothing calls this directly

Calls 5

format_stringFunction · 0.85
isArrayMethod · 0.80
getElementTypeMethod · 0.45
getDataTypeMethod · 0.45

Tested by

no test coverage detected