#ifndef V8_OBJECTS_OPTION_UTILS_H_
#define V8_OBJECTS_OPTION_UTILS_H_
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/objects/js-objects.h"
#include "src/objects/string.h"
namespace v8 {
namespace internal {
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> GetOptionsObject(
Isolate* isolate, Handle<Object> options, const char* method_name);
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject(
Isolate* isolate, Handle<Object> options, const char* method_name);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property,
const std::vector<const char*>& values, const char* method_name,
std::unique_ptr<char[]>* result);
template <typename T>
V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* name,
const char* method_name, const std::vector<const char*>& str_values,
const std::vector<T>& enum_values, T default_value) { … }
template <typename T>
V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOrBooleanOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property,
const char* method, const std::vector<const char*>& str_values,
const std::vector<T>& enum_values, T true_value, T false_value,
T fallback_value) { … }
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property,
const char* method_name, bool* result);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<int> GetNumberOption(
Isolate* isolate, Handle<JSReceiver> options, Handle<String> property,
int min, int max, int fallback);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<double> GetNumberOptionAsDouble(
Isolate* isolate, Handle<JSReceiver> options, Handle<String> property,
double default_value);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<int> DefaultNumberOption(
Isolate* isolate, Handle<Object> value, int min, int max, int fallback,
Handle<String> property);
}
}
#endif