本文整理汇总了C++中ArgumentDecoder::decodeEnum方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgumentDecoder::decodeEnum方法的具体用法?C++ ArgumentDecoder::decodeEnum怎么用?C++ ArgumentDecoder::decodeEnum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentDecoder
的用法示例。
在下文中一共展示了ArgumentDecoder::decodeEnum方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool ArgumentCoder<TransformOperations>::decode(ArgumentDecoder& decoder, TransformOperations& transformOperations)
{
uint32_t operationsSize;
if (!decoder.decode(operationsSize))
return false;
for (size_t i = 0; i < operationsSize; ++i) {
TransformOperation::OperationType operationType;
if (!decoder.decodeEnum(operationType))
return false;
switch (operationType) {
case TransformOperation::SCALE_X:
case TransformOperation::SCALE_Y:
case TransformOperation::SCALE:
case TransformOperation::SCALE_Z:
case TransformOperation::SCALE_3D: {
double x, y, z;
if (!decoder.decode(x))
return false;
if (!decoder.decode(y))
return false;
if (!decoder.decode(z))
return false;
transformOperations.operations().append(ScaleTransformOperation::create(x, y, z, operationType));
break;
}
case TransformOperation::TRANSLATE_X:
case TransformOperation::TRANSLATE_Y:
case TransformOperation::TRANSLATE:
case TransformOperation::TRANSLATE_Z:
case TransformOperation::TRANSLATE_3D: {
Length x, y, z;
if (!ArgumentCoder<Length>::decode(decoder, x))
return false;
if (!ArgumentCoder<Length>::decode(decoder, y))
return false;
if (!ArgumentCoder<Length>::decode(decoder, z))
return false;
transformOperations.operations().append(TranslateTransformOperation::create(x, y, z, operationType));
break;
}
case TransformOperation::ROTATE:
case TransformOperation::ROTATE_X:
case TransformOperation::ROTATE_Y:
case TransformOperation::ROTATE_3D: {
double x, y, z, angle;
if (!decoder.decode(x))
return false;
if (!decoder.decode(y))
return false;
if (!decoder.decode(z))
return false;
if (!decoder.decode(angle))
return false;
transformOperations.operations().append(RotateTransformOperation::create(x, y, z, angle, operationType));
break;
}
case TransformOperation::SKEW_X:
case TransformOperation::SKEW_Y:
case TransformOperation::SKEW: {
double angleX, angleY;
if (!decoder.decode(angleX))
return false;
if (!decoder.decode(angleY))
return false;
transformOperations.operations().append(SkewTransformOperation::create(angleX, angleY, operationType));
break;
}
case TransformOperation::MATRIX: {
TransformationMatrix matrix;
if (!ArgumentCoder<TransformationMatrix>::decode(decoder, matrix))
return false;
transformOperations.operations().append(MatrixTransformOperation::create(matrix));
break;
}
case TransformOperation::MATRIX_3D: {
TransformationMatrix matrix;
if (!ArgumentCoder<TransformationMatrix>::decode(decoder, matrix))
return false;
transformOperations.operations().append(Matrix3DTransformOperation::create(matrix));
break;
}
case TransformOperation::PERSPECTIVE: {
Length perspective;
if (!ArgumentCoder<Length>::decode(decoder, perspective))
return false;
transformOperations.operations().append(PerspectiveTransformOperation::create(perspective));
break;
}
case TransformOperation::IDENTITY:
transformOperations.operations().append(IdentityTransformOperation::create());
break;
case TransformOperation::NONE:
ASSERT_NOT_REACHED();
break;
}
}
return true;
}
示例2: keyframes
bool ArgumentCoder<GraphicsLayerAnimation>::decode(ArgumentDecoder& decoder, GraphicsLayerAnimation& animation)
{
String name;
IntSize boxSize;
GraphicsLayerAnimation::AnimationState state;
double startTime;
double pauseTime;
bool listsMatch;
Animation::AnimationDirection direction;
unsigned fillMode;
double duration;
double iterationCount;
RefPtr<TimingFunction> timingFunction;
RefPtr<Animation> animationObject;
if (!decoder.decode(name))
return false;
if (!decoder.decode(boxSize))
return false;
if (!decoder.decodeEnum(state))
return false;
if (!decoder.decode(startTime))
return false;
if (!decoder.decode(pauseTime))
return false;
if (!decoder.decode(listsMatch))
return false;
if (!decoder.decodeEnum(direction))
return false;
if (!decoder.decode(fillMode))
return false;
if (!decoder.decode(duration))
return false;
if (!decoder.decode(iterationCount))
return false;
if (!decodeTimingFunction(decoder, timingFunction))
return false;
animationObject = Animation::create();
animationObject->setDirection(direction);
animationObject->setFillMode(fillMode);
animationObject->setDuration(duration);
animationObject->setIterationCount(iterationCount);
if (timingFunction)
animationObject->setTimingFunction(timingFunction);
AnimatedPropertyID property;
if (!decoder.decodeEnum(property))
return false;
KeyframeValueList keyframes(property);
unsigned keyframesSize;
if (!decoder.decode(keyframesSize))
return false;
for (unsigned i = 0; i < keyframesSize; ++i) {
double keyTime;
RefPtr<TimingFunction> timingFunction;
if (!decoder.decode(keyTime))
return false;
if (!decodeTimingFunction(decoder, timingFunction))
return false;
switch (property) {
case AnimatedPropertyOpacity: {
float value;
if (!decoder.decode(value))
return false;
keyframes.insert(FloatAnimationValue::create(keyTime, value, timingFunction.get()));
break;
}
case AnimatedPropertyWebkitTransform: {
TransformOperations transform;
if (!decoder.decode(transform))
return false;
keyframes.insert(TransformAnimationValue::create(keyTime, transform, timingFunction.get()));
break;
}
case AnimatedPropertyWebkitFilter: {
FilterOperations filter;
if (!decoder.decode(filter))
return false;
keyframes.insert(FilterAnimationValue::create(keyTime, filter, timingFunction.get()));
break;
}
default:
break;
}
}
animation = GraphicsLayerAnimation(name, keyframes, boxSize, animationObject.get(), startTime, listsMatch);
animation.setState(state, pauseTime);
return true;
}
示例3:
bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder& decoder, ResourceRequest& resourceRequest)
{
String url;
if (!decoder.decode(url))
return false;
resourceRequest.setURL(URL(URL(), url));
String httpMethod;
if (!decoder.decode(httpMethod))
return false;
resourceRequest.setHTTPMethod(httpMethod);
HTTPHeaderMap headers;
if (!decoder.decode(headers))
return false;
resourceRequest.setHTTPHeaderFields(WTF::move(headers));
double timeoutInterval;
if (!decoder.decode(timeoutInterval))
return false;
resourceRequest.setTimeoutInterval(timeoutInterval);
bool hasHTTPBody;
if (!decoder.decode(hasHTTPBody))
return false;
if (hasHTTPBody) {
String httpBody;
if (!decoder.decode(httpBody))
return false;
resourceRequest.setHTTPBody(FormData::create(httpBody.utf8()));
}
String firstPartyForCookies;
if (!decoder.decode(firstPartyForCookies))
return false;
resourceRequest.setFirstPartyForCookies(URL(URL(), firstPartyForCookies));
bool allowCookies;
if (!decoder.decode(allowCookies))
return false;
resourceRequest.setAllowCookies(allowCookies);
ResourceLoadPriority priority;
if (!decoder.decodeEnum(priority))
return false;
resourceRequest.setPriority(priority);
ResourceRequestCachePolicy cachePolicy;
if (!decoder.decodeEnum(cachePolicy))
return false;
resourceRequest.setCachePolicy(cachePolicy);
ResourceRequest::Requester requester;
if (!decoder.decodeEnum(requester))
return false;
resourceRequest.setRequester(requester);
uint32_t soupMessageFlags;
if (!decoder.decode(soupMessageFlags))
return false;
resourceRequest.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags));
uint64_t initiatingPageID;
if (!decoder.decode(initiatingPageID))
return false;
resourceRequest.setInitiatingPageID(initiatingPageID);
return true;
}
示例4: parameters
bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder& decoder, WebCore::FilterOperations& filters)
{
uint32_t size;
if (!decoder.decode(size))
return false;
Vector<RefPtr<FilterOperation> >& operations = filters.operations();
for (size_t i = 0; i < size; ++i) {
FilterOperation::OperationType type;
RefPtr<FilterOperation> filter;
if (!decoder.decodeEnum(type))
return false;
switch (type) {
case FilterOperation::GRAYSCALE:
case FilterOperation::SEPIA:
case FilterOperation::SATURATE:
case FilterOperation::HUE_ROTATE: {
double value;
if (!decoder.decode(value))
return false;
filter = BasicColorMatrixFilterOperation::create(value, type);
break;
}
case FilterOperation::INVERT:
case FilterOperation::BRIGHTNESS:
case FilterOperation::CONTRAST:
case FilterOperation::OPACITY: {
double value;
if (!decoder.decode(value))
return false;
filter = BasicComponentTransferFilterOperation::create(value, type);
break;
}
case FilterOperation::BLUR: {
Length length;
if (!ArgumentCoder<Length>::decode(decoder, length))
return false;
filter = BlurFilterOperation::create(length, type);
break;
}
case FilterOperation::DROP_SHADOW: {
IntPoint location;
int32_t stdDeviation;
Color color;
if (!ArgumentCoder<IntPoint>::decode(decoder, location))
return false;
if (!decoder.decode(stdDeviation))
return false;
if (!ArgumentCoder<Color>::decode(decoder, color))
return false;
filter = DropShadowFilterOperation::create(location, stdDeviation, color, type);
break;
}
#if ENABLE(CSS_SHADERS)
case FilterOperation::CUSTOM:
// Custom Filters are converted to VALIDATED_CUSTOM before reaching this point.
ASSERT_NOT_REACHED();
break;
case FilterOperation::VALIDATED_CUSTOM: {
// FIXME: CustomFilterOperation should not need the meshType.
// https://bugs.webkit.org/show_bug.cgi?id=102529
CustomFilterMeshType meshType;
if (!decoder.decodeEnum(meshType))
return false;
int programID = 0;
if (!decoder.decode(programID))
return false;
uint32_t parametersSize;
if (!decoder.decode(parametersSize))
return false;
CustomFilterParameterList parameters(parametersSize);
for (size_t i = 0; i < parametersSize; ++i) {
String name;
CustomFilterParameter::ParameterType parameterType;
if (!decoder.decode(name))
return false;
if (!decoder.decodeEnum(parameterType))
return false;
switch (parameterType) {
case CustomFilterParameter::ARRAY: {
RefPtr<CustomFilterArrayParameter> arrayParameter = CustomFilterArrayParameter::create(name);
uint32_t arrayParameterSize;
if (!decoder.decode(arrayParameterSize))
return false;
double arrayParameterValue;
for (size_t j = 0; j < arrayParameterSize; ++j) {
if (!decoder.decode(arrayParameterValue))
return false;
arrayParameter->addValue(arrayParameterValue);
}
parameters[i] = arrayParameter.release();
break;
}
case CustomFilterParameter::NUMBER: {
RefPtr<CustomFilterNumberParameter> numberParameter = CustomFilterNumberParameter::create(name);
//.........这里部分代码省略.........
示例5: decode
bool decode(ArgumentDecoder& decoder, RetainPtr<CFTypeRef>& result)
{
CFType type;
if (!decoder.decodeEnum(type))
return false;
switch (type) {
case CFArray: {
RetainPtr<CFArrayRef> array;
if (!decode(decoder, array))
return false;
result = adoptCF(array.leakRef());
return true;
}
case CFBoolean: {
RetainPtr<CFBooleanRef> boolean;
if (!decode(decoder, boolean))
return false;
result = adoptCF(boolean.leakRef());
return true;
}
case CFData: {
RetainPtr<CFDataRef> data;
if (!decode(decoder, data))
return false;
result = adoptCF(data.leakRef());
return true;
}
case CFDate: {
RetainPtr<CFDateRef> date;
if (!decode(decoder, date))
return false;
result = adoptCF(date.leakRef());
return true;
}
case CFDictionary: {
RetainPtr<CFDictionaryRef> dictionary;
if (!decode(decoder, dictionary))
return false;
result = adoptCF(dictionary.leakRef());
return true;
}
case CFNull:
result = adoptCF(kCFNull);
return true;
case CFNumber: {
RetainPtr<CFNumberRef> number;
if (!decode(decoder, number))
return false;
result = adoptCF(number.leakRef());
return true;
}
case CFString: {
RetainPtr<CFStringRef> string;
if (!decode(decoder, string))
return false;
result = adoptCF(string.leakRef());
return true;
}
case CFURL: {
RetainPtr<CFURLRef> url;
if (!decode(decoder, url))
return false;
result = adoptCF(url.leakRef());
return true;
}
case SecCertificate: {
RetainPtr<SecCertificateRef> certificate;
if (!decode(decoder, certificate))
return false;
result = adoptCF(certificate.leakRef());
return true;
}
#if PLATFORM(IOS)
case SecIdentity: {
RetainPtr<SecIdentityRef> identity;
if (!decode(decoder, identity))
return false;
result = adoptCF(identity.leakRef());
return true;
}
#endif
#if HAVE(SEC_KEYCHAIN)
case SecKeychainItem: {
RetainPtr<SecKeychainItemRef> keychainItem;
if (!decode(decoder, keychainItem))
return false;
result = adoptCF(keychainItem.leakRef());
return true;
}
#endif
#if HAVE(SEC_ACCESS_CONTROL)
case SecAccessControl: {
RetainPtr<SecAccessControlRef> accessControl;
if (!decode(decoder, accessControl))
return false;
result = adoptCF(accessControl.leakRef());
return true;
}
#endif
//.........这里部分代码省略.........