本文整理汇总了C++中rocket::core::Dictionary::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::Get方法的具体用法?C++ Dictionary::Get怎么用?C++ Dictionary::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocket::core::Dictionary
的用法示例。
在下文中一共展示了Dictionary::Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Submit
// Submits the form.
void ElementForm::Submit(const Rocket::Core::String& name, const Rocket::Core::String& submit_value)
{
Rocket::Core::Dictionary values;
if (name.Empty())
values.Set("submit", submit_value);
else
values.Set(name, submit_value);
Core::ElementList form_controls;
Core::ElementUtilities::GetElementsByTagName(form_controls, this, "input");
Core::ElementUtilities::GetElementsByTagName(form_controls, this, "textarea");
Core::ElementUtilities::GetElementsByTagName(form_controls, this, "select");
Core::ElementUtilities::GetElementsByTagName(form_controls, this, "dataselect");
for (size_t i = 0; i < form_controls.size(); i++)
{
ElementFormControl* control = rocket_dynamic_cast< ElementFormControl* >(form_controls[i]);
if (!control)
continue;
// Skip disabled controls.
if (control->IsDisabled())
continue;
// Only process controls that should be submitted.
if (!control->IsSubmitted())
continue;
Rocket::Core::String control_name = control->GetName();
Rocket::Core::String control_value = control->GetValue();
// Skip over unnamed form controls.
if (control_name.Empty())
continue;
// If the item already exists, append to it.
Rocket::Core::Variant* value = values.Get(control_name);
if (value != NULL)
value->Set(value->Get< Rocket::Core::String >() + ", " + control_value);
else
values.Set< Rocket::Core::String >(control_name, control_value);
}
DispatchEvent("submit", values);
}