blob: a2f4533a74efd53422b642e7db182c89d477020c [file] [log] [blame]
$$ This is a pump file for generating file templates. Pump is a python
$$ script that is part of the Google Test suite of utilities. Description
$$ can be found here:
$$
$$ http://code.google.com/p/googletest/wiki/PumpManual
$$
$$ Maximum number of different member types in a union.
$var MAX_MEMBERS = 5
// Copyright 2016 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef COBALT_SCRIPT_MOZJS_45_UNION_TYPE_CONVERSION_FORWARD_H_
#define COBALT_SCRIPT_MOZJS_45_UNION_TYPE_CONVERSION_FORWARD_H_
#include "cobalt/script/mozjs-45/mozjs_exception_state.h"
#include "cobalt/script/mozjs-45/mozjs_user_object_holder.h"
#include "cobalt/script/mozjs-45/mozjs_value_handle.h"
#include "cobalt/script/mozjs-45/type_traits.h"
#include "cobalt/script/union_type.h"
// Forward declaration for ToJSValue and FromJSValue for IDL union types.
namespace cobalt {
namespace script {
namespace mozjs {
$range NUM_MEMBERS 2..MAX_MEMBERS
$for NUM_MEMBERS [[
$range TYPE 1..NUM_MEMBERS
template <$for TYPE , [[typename T$(TYPE)]]>
void ToJSValue(JSContext* context, const script::UnionType$(NUM_MEMBERS)<$for TYPE , [[T$(TYPE)]]>& in_union, JS::MutableHandleValue out_value);
template <$for TYPE , [[typename T$(TYPE)]]>
void FromJSValue(JSContext* context, JS::HandleValue value,
int conversion_flags, ExceptionState* exception_state,
script::UnionType$(NUM_MEMBERS)<$for TYPE , [[T$(TYPE)]]>* out_union);
]] $$ for NUM_MEMBERS
} // namespace mozjs
} // namespace script
} // namespace cobalt
#endif // COBALT_SCRIPT_MOZJS_45_UNION_TYPE_CONVERSION_FORWARD_H_