本文整理汇总了C++中WMLPageState::storeVariable方法的典型用法代码示例。如果您正苦于以下问题:C++ WMLPageState::storeVariable方法的具体用法?C++ WMLPageState::storeVariable怎么用?C++ WMLPageState::storeVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMLPageState
的用法示例。
在下文中一共展示了WMLPageState::storeVariable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void WMLInputElement::initialize()
{
String nameVariable = formControlName();
String variableValue;
WMLPageState* pageSate = wmlPageStateForDocument(document());
ASSERT(pageSate);
if (!nameVariable.isEmpty())
variableValue = pageSate->getVariable(nameVariable);
if (variableValue.isEmpty() || !isConformedToInputMask(variableValue)) {
String val = value();
if (isConformedToInputMask(val))
variableValue = val;
else
variableValue = "";
pageSate->storeVariable(nameVariable, variableValue);
}
setValue(variableValue);
if (!hasAttribute(WMLNames::emptyokAttr)) {
if (m_formatMask.isEmpty() ||
// check if the format codes is just "*f"
(m_formatMask.length() == 2 && m_formatMask[0] == '*' && formatCodes().find(m_formatMask[1]) != notFound))
m_isEmptyOk = true;
}
}
示例2: timerFired
void WMLTimerElement::timerFired(Timer<WMLTimerElement>*)
{
if (!m_card)
return;
WMLPageState* pageState = wmlPageStateForDocument(document());
if (!pageState)
return;
String value = this->value();
// When the timer expires, set the name varialbe of timer to '0'
if (!m_name.isEmpty()) {
value = "0";
pageState->storeVariable(m_name, value);
}
WMLIntrinsicEventType eventType = WMLIntrinsicEventOnTimer;
WMLIntrinsicEventHandler* eventHandler = m_card->eventHandler();
bool hasIntrinsicEvent = false;
if (eventHandler && eventHandler->hasIntrinsicEvent(eventType))
hasIntrinsicEvent = true;
else if (m_card->templateElement()) {
eventHandler = m_card->templateElement()->eventHandler();
if (eventHandler && eventHandler->hasIntrinsicEvent(eventType))
hasIntrinsicEvent = true;
}
if (hasIntrinsicEvent)
eventHandler->triggerIntrinsicEvent(eventType);
}
示例3: updateVariables
void WMLSelectElement::updateVariables()
{
WMLPageState* pageState = wmlPageStateForDocument(document());
if (!pageState)
return;
String name = this->name();
String iname = this->iname();
if (iname.isEmpty() && name.isEmpty())
return;
String nameString;
String inameString;
unsigned optionIndex = 0;
const Vector<Element*>& items = m_data.listItems(this);
for (unsigned i = 0; i < items.size(); ++i) {
OptionElement* optionElement = toOptionElement(items[i]);
if (!optionElement)
continue;
++optionIndex;
if (!optionElement->selected())
continue;
if (!nameString.isEmpty())
nameString += ";";
if (!inameString.isEmpty())
inameString += ";";
nameString += optionElement->value();
inameString += String::number(optionIndex);
}
if (!name.isEmpty())
pageState->storeVariable(name, nameString);
if (!iname.isEmpty())
pageState->storeVariable(iname, inameString);
}
示例4: initializeVariables
void WMLSelectElement::initializeVariables()
{
ASSERT(!m_defaultOptionIndices.isEmpty());
WMLPageState* pageState = wmlPageStateForDocument(document());
if (!pageState)
return;
const Vector<Element*>& items = m_data.listItems(this);
if (items.isEmpty())
return;
// Spec: If the 'iname' attribute is specified, then the named variable is set with the default option index.
String iname = this->iname();
if (!iname.isEmpty())
pageState->storeVariable(iname, optionIndicesToString());
String name = this->name();
if (name.isEmpty())
return;
if (m_data.multiple()) {
// Spec: If the 'name' attribute is specified and the select is a multiple-choice element,
// then for each index greater than zero, the value of the 'value' attribute on the option
// element at the index is added to the name variable.
pageState->storeVariable(name, optionIndicesToValueString());
return;
}
// Spec: If the 'name' attribute is specified and the select is a single-choice element,
// then the named variable is set with the value of the 'value' attribute on the option
// element at the default option index.
unsigned optionIndex = m_defaultOptionIndices.first();
ASSERT(optionIndex >= 1);
int listIndex = optionToListIndex(optionIndex - 1);
ASSERT(listIndex >= 0);
ASSERT(listIndex < (int) items.size());
if (OptionElement* optionElement = toOptionElement(items[listIndex]))
pageState->storeVariable(name, optionElement->value());
}