std::unique_ptr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList) { FormKeyGenerator keyGenerator; auto stateMap = std::make_unique<SavedFormStateMap>(); for (auto& control : controlList) { if (!control->shouldSaveAndRestoreFormControlState()) continue; auto& formState = stateMap->add(keyGenerator.formKey(*control).impl(), nullptr).iterator->value; if (!formState) formState = std::make_unique<SavedFormState>(); formState->appendControlState(control->name(), control->type(), control->saveFormControlState()); } return stateMap; }
std::unique_ptr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList) { FormKeyGenerator keyGenerator; auto stateMap = std::make_unique<SavedFormStateMap>(); for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) { HTMLFormControlElementWithState* control = it->get(); if (!control->shouldSaveAndRestoreFormControlState()) continue; auto& formState = stateMap->add(keyGenerator.formKey(*control).impl(), nullptr).iterator->value; if (!formState) formState = std::make_unique<SavedFormState>(); formState->appendControlState(control->name(), control->type(), control->saveFormControlState()); } return stateMap; }