71
71
int DynamicLengthArrayDataInformation::calculateLength()
73
if (!mParent || mParent->isTopLevel())
75
75
kWarning() << "dynamic length array without parent ->"
76
76
" length will always be 0";
79
QList<const DataInformation*> refs = findChildrenWithName(mLengthString, this);
80
if (refs.length() == 0)
83
<< "referenced size field not found";
86
for (int i = 0; i < refs.length(); ++i)
88
const DataInformation* data = refs.at(i);
89
const PrimitiveDataInformation* prim =
90
dynamic_cast<const PrimitiveDataInformation*> (data);
93
if (!prim->wasAbleToRead())
96
<< "primitive type is not valid";
101
return prim->value().ulongValue;
79
QPair<DataInformation*, QString> val =
80
static_cast<DataInformation*>(mParent)->findChildForDynamicArrayLength(mLengthString, row());
81
const DataInformation* data = val.first;
82
const QString path = QLatin1String("this.parent.") + val.second; //this is so I can finally remove this class soon
83
const PrimitiveDataInformation* prim = dynamic_cast<const PrimitiveDataInformation*>(data);
86
kDebug() << "referenced value (" << mLengthString << ") was not a primitive value";
88
else if (!prim->wasAbleToRead())
90
kDebug() << "was not able to read new array length for " << name()
91
<< "referenced value (" << mLengthString << ") was not valid";
95
return prim->value().ulongValue;