Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / testing / TypeConversions.h
1 /*
2  * Copyright (C) 2013 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef TypeConversions_h
27 #define TypeConversions_h
28
29 #include "bindings/core/v8/ScriptWrappable.h"
30 #include "wtf/FastMalloc.h"
31 #include "wtf/PassRefPtr.h"
32 #include "wtf/RefCounted.h"
33
34 namespace blink {
35
36 class TypeConversions : public RefCountedWillBeGarbageCollectedFinalized<TypeConversions>, public ScriptWrappable {
37 public:
38     static PassRefPtrWillBeRawPtr<TypeConversions> create()
39     {
40         return adoptRefWillBeNoop(new TypeConversions());
41     }
42
43     long testLong() { return m_long; }
44     void setTestLong(long value) { m_long = value; }
45     unsigned long testUnsignedLong() { return m_unsignedLong; }
46     void setTestUnsignedLong(unsigned long value) { m_unsignedLong = value; }
47
48     long long testLongLong() { return m_longLong; }
49     void setTestLongLong(long long value) { m_longLong = value; }
50     unsigned long long testUnsignedLongLong() { return m_unsignedLongLong; }
51     void setTestUnsignedLongLong(unsigned long long value) { m_unsignedLongLong = value; }
52
53     int8_t testByte() { return m_byte; }
54     void setTestByte(int8_t value) { m_byte = value; }
55     uint8_t testOctet() { return m_octet; }
56     void setTestOctet(uint8_t value) { m_octet = value; }
57
58     int16_t testShort() { return m_short; }
59     void setTestShort(int16_t value) { m_short = value; }
60     uint16_t testUnsignedShort() { return m_unsignedShort; }
61     void setTestUnsignedShort(uint16_t value) { m_unsignedShort = value; }
62
63     const String& testByteString() const { return m_byteString; }
64     void setTestByteString(const String& value) { m_byteString = value; }
65
66     const String& testScalarValueString() const { return m_scalarValueString; }
67     void setTestScalarValueString(const String& value) { m_scalarValueString = value; }
68
69     void trace(Visitor*) { }
70
71 private:
72     TypeConversions()
73     {
74         ScriptWrappable::init(this);
75     }
76
77     long m_long;
78     unsigned long m_unsignedLong;
79     long long m_longLong;
80     unsigned long long m_unsignedLongLong;
81     int8_t m_byte;
82     uint8_t m_octet;
83     int16_t m_short;
84     uint16_t m_unsignedShort;
85     String m_byteString;
86     String m_scalarValueString;
87 };
88
89 } // namespace blink
90
91 #endif