| Index: Source/wtf/UnionType.h
|
| diff --git a/Source/wtf/text/StringStatics.h b/Source/wtf/UnionType.h
|
| similarity index 64%
|
| copy from Source/wtf/text/StringStatics.h
|
| copy to Source/wtf/UnionType.h
|
| index 73097bc5cdbaf2e17318bd93cdcb1c445f676b27..23597ca6e3149486641e9332921304c8eeb90269 100644
|
| --- a/Source/wtf/text/StringStatics.h
|
| +++ b/Source/wtf/UnionType.h
|
| @@ -28,19 +28,50 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef StringStatics_h
|
| -#define StringStatics_h
|
| +#ifndef UnionType_h
|
| +#define UnionType_h
|
|
|
| namespace WTF {
|
|
|
| -class StringStatics {
|
| +// UnionTypeN holds multiple types of objects.
|
| +//
|
| +// WebIDL(UnionType):
|
| +// http://www.w3.org/TR/WebIDL/#prod-UnionType
|
| +//
|
| +// Example IDL:
|
| +// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection
|
| +template<typename Type1, typename Type2>
|
| +class UnionType2 {
|
| public:
|
| - static void init();
|
| -
|
| + UnionType2()
|
| + {
|
| + }
|
| + explicit UnionType2(PassRefPtr<Type1> value)
|
| + {
|
| + m_value1 = value;
|
| + }
|
| + explicit UnionType2(PassRefPtr<Type2> value)
|
| + {
|
| + m_value2 = value;
|
| + }
|
| + bool isNull() const
|
| + {
|
| + return !m_value1 && !m_value2;
|
| + }
|
| + PassRefPtr<Type1> member1() const
|
| + {
|
| + return m_value1;
|
| + }
|
| + PassRefPtr<Type2> member2() const
|
| + {
|
| + return m_value2;
|
| + }
|
| private:
|
| - StringStatics();
|
| + RefPtr<Type1> m_value1;
|
| + RefPtr<Type2> m_value2;
|
| };
|
|
|
| -}
|
|
|
| -#endif
|
| +} // namespace WTF
|
| +
|
| +#endif // UnionType_h
|
|
|