-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
As you can see from the code below, I use find_element to drill down to tthe desired week in the XML file:
auto pWeek = tinyxml2::find_element(doc, stdWeekPath);
if (pWeek != nullptr)
{
auto UpdateAssignForWeek = [this, listMidweekAssign, pWeek, pEntry](int iAssign, const char* strElement, MWBAuto::SetAssignNameFunc fncSetAssignName)
{
if (listMidweekAssign.at(iAssign)) // Host
{
const tinyxml2::XMLElement* pElement = pWeek->FirstChildElement(strElement);
if (pElement == nullptr)
{
AfxThrowMemoryException();
}
CString strNameToUse;
strNameToUse = CA2CT(pElement->GetText(), CP_UTF8);
(pEntry->*fncSetAssignName)(strNameToUse);
}
};
UpdateAssignForWeek(0, kVideoConferenceHost, &CChristianLifeMinistryEntry::SetVideoHost);
UpdateAssignForWeek(1, kVideoConferenceCohost, &CChristianLifeMinistryEntry::SetVideoCohost);
UpdateAssignForWeek(2, kChairman, &CChristianLifeMinistryEntry::SetChairman);
if (iDate == m_iDateIndex)
{
DisplayMeetingForDate();
}
}
But can the lambda be simplified? Where it get the text of the sub element? Do you have a helper for that? Sorry if I missed in the sample.
Thank you.
Metadata
Metadata
Assignees
Labels
No labels