本文整理汇总了C++中Nullable::hasValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Nullable::hasValue方法的具体用法?C++ Nullable::hasValue怎么用?C++ Nullable::hasValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nullable
的用法示例。
在下文中一共展示了Nullable::hasValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool CSSIDSelector::match(Element& e, ViewCSSImp* view, bool dynamic)
{
Nullable<std::u16string> id = e.getAttribute(u"id");
if (!id.hasValue())
return false;
return id.value() == name;
}
示例2: eval
void HTMLElementImp::eval()
{
DocumentWindowPtr window = getOwnerDocumentImp()->activate();
Nullable<std::u16string> attr = getAttribute(u"style");
if (attr.hasValue()) {
CSSParser parser;
style = parser.parseDeclarations(attr.value());
parser.getStyleDeclaration()->setOwner(this);
}
attr = getAttribute(u"onclick");
if (attr.hasValue())
setOnclick(window->getContext()->compileFunction(attr.value()));
attr = getAttribute(u"onload");
if (attr.hasValue())
setOnload(window->getContext()->compileFunction(attr.value()));
}
示例3: evalValign
bool HTMLElementImp::evalValign(HTMLElementImp* element)
{
Nullable<std::u16string> value = element->getAttribute(u"valign");
if (value.hasValue()) {
element->getStyle().setProperty(u"vertical-align", value.value(), u"non-css");
return true;
}
return false;
}
示例4: evalNoWrap
bool HTMLElementImp::evalNoWrap(HTMLElementImp* element)
{
Nullable<std::u16string> value = element->getAttribute(u"nowrap");
if (value.hasValue()) {
element->getStyle().setProperty(u"white-space", u"nowrap", u"non-css");
return true;
}
return false;
}
示例5: evalColor
bool HTMLElementImp::evalColor(HTMLElementImp* element, const std::u16string& attr, const std::u16string& prop)
{
Nullable<std::u16string> value = element->getAttribute(attr);
if (value.hasValue()) {
css::CSSStyleDeclaration style = element->getStyle();
style.setProperty(prop, value.value(), u"non-css");
return true;
}
return false;
}
示例6: evalBackground
bool HTMLElementImp::evalBackground(HTMLElementImp* element)
{
Nullable<std::u16string> attr = element->getAttribute(u"background");
if (attr.hasValue()) {
css::CSSStyleDeclaration style = element->getStyle();
style.setProperty(u"background-image", u"url(" + attr.value() + u")", u"non-css");
return true;
}
return false;
}
示例7: length
HTMLFormControlsCollectionImp::HTMLFormControlsCollectionImp(const HTMLFormElementPtr& form) :
length(0)
{
ElementPtr i = form;
while (i = i->getNextElement(form)) {
if (isListedElement(i)) {
std::u16string name;
Nullable<std::u16string> a = i->getAttribute(u"name");
if (a.hasValue())
name = a.value();
if (name.empty()) {
a = i->getAttribute(u"id");
if (a.hasValue())
name = a.value();
}
Object found = namedItem(name);
if (!found) {
map.insert(std::pair<const std::u16string, Object>(name, i));
++length;
continue;
}
if (html::RadioNodeList::hasInstance(found)) {
html::RadioNodeList r = interface_cast<html::RadioNodeList>(found);
if (auto list = std::dynamic_pointer_cast<RadioNodeListImp>(r.self())) {
list->addItem(i);
++length;
}
continue;
}
auto list = std::make_shared<RadioNodeListImp>();
if (list) {
list->addItem(interface_cast<Element>(found));
list->addItem(i);
++length;
map.erase(name);
map.insert(std::pair<const std::u16string, Object>(name, list));
}
}
}
}
示例8: evalPxOrPercentage
bool HTMLElementImp::evalPxOrPercentage(HTMLElementImp* element, const std::u16string& attr, const std::u16string& prop)
{
Nullable<std::u16string> value = element->getAttribute(attr);
if (value.hasValue()) {
std::u16string length = value.value();
if (toPxOrPercentage(length)) {
css::CSSStyleDeclaration style = element->getStyle();
style.setProperty(prop, length, u"non-css");
return true;
}
}
return false;
}
示例9: evalVspace
bool HTMLElementImp::evalVspace(HTMLElementImp* element, const std::u16string& prop)
{
Nullable<std::u16string> value = element->getAttribute(prop);
if (value.hasValue()) {
std::u16string px = value.value();
if (toPx(px)) {
css::CSSStyleDeclaration style = element->getStyle();
style.setProperty(u"margin-top", px, u"non-css");
style.setProperty(u"margin-bottom", px, u"non-css");
return true;
}
}
return false;
}
示例10: evalBorder
bool HTMLElementImp::evalBorder(HTMLElementImp* element)
{
Nullable<std::u16string> value = element->getAttribute(u"border");
if (value.hasValue()) {
std::u16string px = value.value();
if (toPx(px)) {
css::CSSStyleDeclaration style = element->getStyle();
style.setProperty(u"border-width", px, u"non-css");
style.setProperty(u"border-style", u"solid", u"non-css");
return true;
}
}
return false;
}