DateTimeChooserParameters.h [plain text]
#pragma once
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
#include "IntRect.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
struct DateTimeChooserParameters {
AtomString type;
IntRect anchorRectInRootView;
AtomString locale;
String currentValue;
Vector<String> suggestionValues;
Vector<String> localizedSuggestionValues;
Vector<String> suggestionLabels;
double minimum { 0 };
double maximum { 0 };
double step { 0 };
double stepBase { 0 };
bool required { false };
bool isAnchorElementRTL { false };
bool useDarkAppearance { false };
bool hasSecondField { false };
bool hasMillisecondField { false };
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static Optional<DateTimeChooserParameters> decode(Decoder&);
};
template<class Encoder>
void DateTimeChooserParameters::encode(Encoder& encoder) const
{
encoder << type;
encoder << anchorRectInRootView;
encoder << locale;
encoder << currentValue;
encoder << suggestionValues;
encoder << localizedSuggestionValues;
encoder << suggestionLabels;
encoder << minimum;
encoder << maximum;
encoder << step;
encoder << stepBase;
encoder << required;
encoder << isAnchorElementRTL;
encoder << useDarkAppearance;
encoder << hasSecondField;
encoder << hasMillisecondField;
}
template<class Decoder>
Optional<DateTimeChooserParameters> DateTimeChooserParameters::decode(Decoder& decoder)
{
AtomString type;
if (!decoder.decode(type))
return WTF::nullopt;
IntRect anchorRectInRootView;
if (!decoder.decode(anchorRectInRootView))
return WTF::nullopt;
AtomString locale;
if (!decoder.decode(locale))
return WTF::nullopt;
String currentValue;
if (!decoder.decode(currentValue))
return WTF::nullopt;
Vector<String> suggestionValues;
if (!decoder.decode(suggestionValues))
return WTF::nullopt;
Vector<String> localizedSuggestionValues;
if (!decoder.decode(localizedSuggestionValues))
return WTF::nullopt;
Vector<String> suggestionLabels;
if (!decoder.decode(suggestionLabels))
return WTF::nullopt;
double minimum;
if (!decoder.decode(minimum))
return WTF::nullopt;
double maximum;
if (!decoder.decode(maximum))
return WTF::nullopt;
double step;
if (!decoder.decode(step))
return WTF::nullopt;
double stepBase;
if (!decoder.decode(stepBase))
return WTF::nullopt;
bool required;
if (!decoder.decode(required))
return WTF::nullopt;
bool isAnchorElementRTL;
if (!decoder.decode(isAnchorElementRTL))
return WTF::nullopt;
bool useDarkAppearance;
if (!decoder.decode(useDarkAppearance))
return WTF::nullopt;
bool hasSecondField;
if (!decoder.decode(hasSecondField))
return WTF::nullopt;
bool hasMillisecondField;
if (!decoder.decode(hasMillisecondField))
return WTF::nullopt;
return {{ WTFMove(type), anchorRectInRootView, WTFMove(locale), WTFMove(currentValue), WTFMove(suggestionValues), WTFMove(localizedSuggestionValues), WTFMove(suggestionLabels), minimum, maximum, step, stepBase, required, isAnchorElementRTL, useDarkAppearance, hasSecondField, hasMillisecondField }};
}
}
#endif