本文整理汇总了C++中WebVector::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ WebVector::assign方法的具体用法?C++ WebVector::assign怎么用?C++ WebVector::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebVector
的用法示例。
在下文中一共展示了WebVector::assign方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
// Old style parser. Deprecated.
static bool parse(const Dictionary& constraintsDictionary, WebVector<WebMediaConstraint>& optional, WebVector<WebMediaConstraint>& mandatory)
{
if (constraintsDictionary.isUndefinedOrNull())
return true;
Vector<String> names;
bool ok = constraintsDictionary.getPropertyNames(names);
if (!ok)
return false;
String mandatoryName("mandatory");
String optionalName("optional");
for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) {
if (*it != mandatoryName && *it != optionalName)
return false;
}
if (names.contains(mandatoryName)) {
Dictionary mandatoryConstraintsDictionary;
bool ok = constraintsDictionary.get(mandatoryName, mandatoryConstraintsDictionary);
if (!ok || mandatoryConstraintsDictionary.isUndefinedOrNull())
return false;
ok = parseMandatoryConstraintsDictionary(mandatoryConstraintsDictionary, mandatory);
if (!ok)
return false;
}
Vector<WebMediaConstraint> optionalConstraintsVector;
if (names.contains(optionalName)) {
ArrayValue optionalConstraints;
bool ok = DictionaryHelper::get(constraintsDictionary, optionalName, optionalConstraints);
if (!ok || optionalConstraints.isUndefinedOrNull())
return false;
size_t numberOfConstraints;
ok = optionalConstraints.length(numberOfConstraints);
if (!ok)
return false;
for (size_t i = 0; i < numberOfConstraints; ++i) {
Dictionary constraint;
ok = optionalConstraints.get(i, constraint);
if (!ok || constraint.isUndefinedOrNull())
return false;
ok = parseOptionalConstraintsVectorElement(constraint, optionalConstraintsVector);
if (!ok)
return false;
}
optional.assign(optionalConstraintsVector);
}
return true;
}
示例2: getInputElements
void WebFormElement::getInputElements(WebVector<WebInputElement>& result) const
{
const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
Vector<RefPtr<HTMLInputElement> > tempVector;
for (size_t i = 0; i < form->formElements.size(); i++) {
if (form->formElements[i]->hasLocalName(HTMLNames::inputTag))
tempVector.append(static_cast<HTMLInputElement*>(
form->formElements[i]));
}
result.assign(tempVector);
}
示例3: getFormControlElements
void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& result) const
{
const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
Vector<RefPtr<HTMLFormControlElement> > formControlElements;
const Vector<FormAssociatedElement*>& associatedElements = form->associatedElements();
for (Vector<FormAssociatedElement*>::const_iterator it = associatedElements.begin(); it != associatedElements.end(); ++it) {
if ((*it)->isFormControlElement())
formControlElements.append(toHTMLFormControlElement(*it));
}
result.assign(formControlElements);
}
示例4: parseMandatoryConstraintsDictionary
static bool parseMandatoryConstraintsDictionary(const Dictionary& mandatoryConstraintsDictionary, WebVector<WebMediaConstraint>& mandatory)
{
Vector<WebMediaConstraint> mandatoryConstraintsVector;
HashMap<String, String> mandatoryConstraintsHashMap;
bool ok = mandatoryConstraintsDictionary.getOwnPropertiesAsStringHashMap(mandatoryConstraintsHashMap);
if (!ok)
return false;
for (const auto& iter : mandatoryConstraintsHashMap)
mandatoryConstraintsVector.append(WebMediaConstraint(iter.key, iter.value));
mandatory.assign(mandatoryConstraintsVector);
return true;
}
示例5: images
void WebDocument::images(WebVector<WebElement>& results)
{
RefPtr<HTMLCollection> images = unwrap<Document>()->images();
size_t sourceLength = images->length();
Vector<WebElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
Node* node = images->item(i);
if (node && node->isHTMLElement())
temp.append(WebElement(static_cast<Element*>(node)));
}
results.assign(temp);
}
示例6: images
void WebDocument::images(WebVector<WebElement>& results)
{
RefPtr<HTMLCollection> images = unwrap<Document>()->images();
size_t sourceLength = images->length();
Vector<WebElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
Element* element = images->item(i);
if (element && element->isHTMLElement())
temp.append(WebElement(element));
}
results.assign(temp);
}
示例7: getFormControlElements
void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& result) const
{
const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
Vector<RefPtr<HTMLFormControlElement> > tempVector;
// FIXME: We should move the for-loop condition into a variable instead of
// re-evaluating size each time. Also, consider refactoring this code so that
// we don't call form->associatedElements() multiple times.
for (size_t i = 0; i < form->associatedElements().size(); i++) {
if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag)
|| form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag))
tempVector.append(form->associatedElements()[i]);
}
result.assign(tempVector);
}
示例8: forms
void WebDocument::forms(WebVector<WebFormElement>& results) const
{
RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>())->forms();
size_t sourceLength = forms->length();
Vector<WebFormElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
Node* node = forms->item(i);
// Strange but true, sometimes node can be 0.
if (node && node->isHTMLElement())
temp.append(WebFormElement(static_cast<HTMLFormElement*>(node)));
}
results.assign(temp);
}
示例9: forms
void WebDocument::forms(WebVector<WebFormElement>& results) const {
HTMLCollection* forms =
const_cast<Document*>(constUnwrap<Document>())->forms();
size_t sourceLength = forms->length();
Vector<WebFormElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
Element* element = forms->item(i);
// Strange but true, sometimes node can be 0.
if (element && element->isHTMLElement())
temp.append(WebFormElement(toHTMLFormElement(element)));
}
results.assign(temp);
}
示例10: redirectChain
void WebDataSourceImpl::redirectChain(WebVector<WebURL>& result) const
{
result.assign(m_redirectChain);
}