OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 |
| 7 #ifndef StringOrStringSequence_h |
| 8 #define StringOrStringSequence_h |
| 9 |
| 10 #include "bindings/core/v8/Dictionary.h" |
| 11 #include "bindings/core/v8/ExceptionState.h" |
| 12 #include "bindings/core/v8/V8Binding.h" |
| 13 #include "platform/heap/Handle.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class StringOrStringSequence final { |
| 18 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 19 public: |
| 20 StringOrStringSequence(); |
| 21 bool isNull() const { return m_type == SpecificTypeNone; } |
| 22 |
| 23 bool isString() const { return m_type == SpecificTypeString; } |
| 24 String getAsString() const; |
| 25 void setString(String); |
| 26 static StringOrStringSequence fromString(String); |
| 27 |
| 28 bool isStringSequence() const { return m_type == SpecificTypeStringSequence;
} |
| 29 const Vector<String>& getAsStringSequence() const; |
| 30 void setStringSequence(const Vector<String>&); |
| 31 static StringOrStringSequence fromStringSequence(const Vector<String>&); |
| 32 |
| 33 private: |
| 34 enum SpecificTypes { |
| 35 SpecificTypeNone, |
| 36 SpecificTypeString, |
| 37 SpecificTypeStringSequence, |
| 38 }; |
| 39 SpecificTypes m_type; |
| 40 |
| 41 String m_string; |
| 42 Vector<String> m_stringSequence; |
| 43 |
| 44 friend v8::Local<v8::Value> toV8(const StringOrStringSequence&, v8::Local<v8
::Object>, v8::Isolate*); |
| 45 }; |
| 46 |
| 47 class V8StringOrStringSequence final { |
| 48 public: |
| 49 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrStringSequenc
e&, ExceptionState&); |
| 50 }; |
| 51 |
| 52 v8::Local<v8::Value> toV8(const StringOrStringSequence&, v8::Local<v8::Object>,
v8::Isolate*); |
| 53 |
| 54 template <class CallbackInfo> |
| 55 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrStringSeq
uence& impl) |
| 56 { |
| 57 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 58 } |
| 59 |
| 60 template <> |
| 61 struct NativeValueTraits<StringOrStringSequence> { |
| 62 static StringOrStringSequence nativeValue(const v8::Local<v8::Value>&, v8::I
solate*, ExceptionState&); |
| 63 }; |
| 64 |
| 65 } // namespace blink |
| 66 |
| 67 #endif // StringOrStringSequence_h |
OLD | NEW |