本文整理汇总了C++中Nullable::SetNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Nullable::SetNull方法的具体用法?C++ Nullable::SetNull怎么用?C++ Nullable::SetNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nullable
的用法示例。
在下文中一共展示了Nullable::SetNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
KeyframeEffectReadOnly::GetTarget(
Nullable<OwningElementOrCSSPseudoElement>& aRv) const
{
if (!mTarget) {
aRv.SetNull();
return;
}
switch (mTarget->mPseudoType) {
case CSSPseudoElementType::before:
case CSSPseudoElementType::after:
aRv.SetValue().SetAsCSSPseudoElement() =
CSSPseudoElement::GetCSSPseudoElement(mTarget->mElement,
mTarget->mPseudoType);
break;
case CSSPseudoElementType::NotPseudo:
aRv.SetValue().SetAsElement() = mTarget->mElement;
break;
default:
NS_NOTREACHED("Animation of unsupported pseudo-type");
aRv.SetNull();
}
}
示例2: WebGLExtensionID
void
WebGLContext::GetSupportedExtensions(JSContext *cx, Nullable< nsTArray<nsString> > &retval)
{
retval.SetNull();
if (IsContextLost())
return;
nsTArray<nsString>& arr = retval.SetValue();
for (size_t i = 0; i < size_t(WebGLExtensionID_max); i++)
{
WebGLExtensionID extension = WebGLExtensionID(i);
if (IsExtensionSupported(cx, extension)) {
arr.AppendElement(NS_ConvertUTF8toUTF16(GetExtensionString(extension)));
}
}
/**
* We keep backward compatibility for these deprecated vendor-prefixed
* alias. Do not add new ones anymore. Hide it behind the
* webgl.enable-draft-extensions flag instead.
*/
if (IsExtensionSupported(cx, WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_atc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_pvrtc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_pvrtc"));
if (IsExtensionSupported(cx, WEBGL_depth_texture))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"));
}
示例3:
void
FileList::Item(uint32_t aIndex, Nullable<OwningFileOrDirectory>& aValue,
ErrorResult& aRv) const
{
if (aIndex >= mFilesOrDirectories.Length()) {
aValue.SetNull();
return;
}
aValue.SetValue(mFilesOrDirectories[aIndex]);
}
示例4: AssertSourceIsCorrect
void
IDBRequest::GetSource(Nullable<OwningIDBObjectStoreOrIDBIndexOrIDBCursor>& aSource) const
{
MOZ_ASSERT(NS_IsMainThread());
AssertSourceIsCorrect();
if (mSourceAsObjectStore) {
aSource.SetValue().SetAsIDBObjectStore() = mSourceAsObjectStore;
} else if (mSourceAsIndex) {
aSource.SetValue().SetAsIDBIndex() = mSourceAsIndex;
} else if (mSourceAsCursor) {
aSource.SetValue().SetAsIDBCursor() = mSourceAsCursor;
} else {
aSource.SetNull();
}
}
示例5:
void
WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributes> &retval)
{
retval.SetNull();
if (IsContextLost())
return;
dom::WebGLContextAttributes& result = retval.SetValue();
const PixelBufferFormat& format = gl->GetPixelFormat();
result.mAlpha.Construct(format.alpha > 0);
result.mDepth = format.depth > 0;
result.mStencil = format.stencil > 0;
result.mAntialias = format.samples > 1;
result.mPremultipliedAlpha = mOptions.premultipliedAlpha;
result.mPreserveDrawingBuffer = mOptions.preserveDrawingBuffer;
}
示例6: AssertIsOnOwningThread
void
IDBRequest::GetSource(
Nullable<OwningIDBObjectStoreOrIDBIndexOrIDBCursor>& aSource) const
{
AssertIsOnOwningThread();
MOZ_ASSERT_IF(mSourceAsObjectStore, !mSourceAsIndex);
MOZ_ASSERT_IF(mSourceAsIndex, !mSourceAsObjectStore);
MOZ_ASSERT_IF(mSourceAsCursor, mSourceAsObjectStore || mSourceAsIndex);
// Always check cursor first since cursor requests hold both the cursor and
// the objectStore or index the cursor came from.
if (mSourceAsCursor) {
aSource.SetValue().SetAsIDBCursor() = mSourceAsCursor;
} else if (mSourceAsObjectStore) {
aSource.SetValue().SetAsIDBObjectStore() = mSourceAsObjectStore;
} else if (mSourceAsIndex) {
aSource.SetValue().SetAsIDBIndex() = mSourceAsIndex;
} else {
aSource.SetNull();
}
}
示例7:
void
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
{
retval.SetNull();
if (!IsContextStable())
return;
if (mDisableExtensions) {
return;
}
nsTArray<nsString>& arr = retval.SetValue();
if (IsExtensionSupported(WebGL_OES_texture_float))
arr.AppendElement(NS_LITERAL_STRING("OES_texture_float"));
if (IsExtensionSupported(WebGL_OES_standard_derivatives))
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
if (IsExtensionSupported(WebGL_EXT_texture_filter_anisotropic))
arr.AppendElement(NS_LITERAL_STRING("MOZ_EXT_texture_filter_anisotropic"));
if (IsExtensionSupported(WebGL_WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
if (IsExtensionSupported(WebGL_WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
}