StartupNotifications is a dynamic array. Delphi's 'for..in' syntax has built-in support for iterating arrays:
Iteration Over Containers Using For StatementsIn C++, you can loop through the array normally using indexes:
- Code: Select all
void __fastcall TFormMain::FormActivate(TObject *Sender)
{
DynamicArray<TPushServiceNotification*> StartupNotifications = fPushService->StartupNotifications;
for (int i = StartupNotifications.Low; i <= StartupNotifications.High; ++i)
{
TPushServiceNotification *CurNotification = StartupNotifications[i];
if (CurNotification)
Memo->Lines->Text = CurNotification->Json->ToJSON();
}
}
Or, if you are using a CLang-based compiler, you might try using a C++11 for-range loop:
C++11 Features Supported by RAD Studio Clang-enhanced C++ Compilers | Range-based for- Code: Select all
void __fastcall TFormMain::FormActivate(TObject *Sender)
{
for (auto CurNotification : fPushService->StartupNotifications)
{
if (CurNotification)
Memo->Lines->Text = CurNotification->Json->ToJSON();
}
}