OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! | 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
6 | 6 |
7 #ifndef {{macro_guard}} | 7 #ifndef {{macro_guard}} |
8 #define {{macro_guard}} | 8 #define {{macro_guard}} |
9 | 9 |
| 10 {% for filename in header_includes %} |
| 11 #include "{{filename}}" |
| 12 {% endfor %} |
| 13 |
10 namespace blink { | 14 namespace blink { |
11 | 15 |
| 16 {% for decl in header_forward_decls %} |
| 17 class {{decl}}; |
| 18 {% endfor %} |
| 19 |
12 {% for container in containers %} | 20 {% for container in containers %} |
13 class {{container.cpp_class}} final { | 21 class {{container.cpp_class}} final { |
14 // FIXME: Implement | 22 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 23 public: |
| 24 {{container.cpp_class}}(); |
| 25 bool isNull() const { return m_type == SpecificTypeNone; } |
| 26 |
| 27 {% for member in container.members %} |
| 28 bool is{{member.type_name}}() const { return m_type == {{member.specific_typ
e_enum}}; } |
| 29 {{member.rvalue_cpp_type}} getAs{{member.type_name}}(); |
| 30 void set{{member.type_name}}({{member.rvalue_cpp_type}}); |
| 31 |
| 32 {% endfor %} |
| 33 private: |
| 34 enum SpecificTypes { |
| 35 SpecificTypeNone, |
| 36 {% for member in container.members %} |
| 37 {{member.specific_type_enum}}, |
| 38 {% endfor %} |
| 39 }; |
| 40 SpecificTypes m_type; |
| 41 |
| 42 {% for member in container.members %} |
| 43 {{member.cpp_type}} m_{{member.cpp_name}}; |
| 44 {% endfor %} |
15 }; | 45 }; |
16 | 46 |
| 47 class V8{{container.cpp_class}} final { |
| 48 public: |
| 49 static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, {{container.cpp_clas
s}}&, ExceptionState&); |
| 50 }; |
| 51 |
| 52 v8::Handle<v8::Value> toV8({{container.cpp_class}}&, v8::Handle<v8::Object>, v8:
:Isolate*); |
| 53 |
| 54 template <class CallbackInfo> |
| 55 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c
lass}}& impl) |
| 56 { |
| 57 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 58 } |
| 59 |
17 {% endfor %} | 60 {% endfor %} |
18 } // namespace blink | 61 } // namespace blink |
19 | 62 |
20 #endif // {{macro_guard}} | 63 #endif // {{macro_guard}} |
OLD | NEW |