2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef DeprecatedSVGAnimatedPropertyTraits_h
22 #define DeprecatedSVGAnimatedPropertyTraits_h
25 #include "PlatformString.h"
26 #include "SVGNumberList.h"
27 #include "SVGPreserveAspectRatio.h"
28 #include "SVGTransformList.h"
32 template<typename Type>
33 struct DeprecatedSVGAnimatedPropertyTraits : public Noncopyable { };
37 struct DeprecatedSVGAnimatedPropertyTraits<float> : public Noncopyable {
38 typedef const float& PassType;
39 typedef float ReturnType;
40 typedef float StoredType;
42 static ReturnType null() { return 0.0f; }
43 static ReturnType toReturnType(const StoredType& type) { return type; }
44 static String toString(PassType type) { return String::number(type); }
47 // SVGAnimatedNumberList
49 struct DeprecatedSVGAnimatedPropertyTraits<SVGNumberList*> : public Noncopyable {
50 typedef SVGNumberList* PassType;
51 typedef SVGNumberList* ReturnType;
52 typedef RefPtr<SVGNumberList> StoredType;
54 static ReturnType null() { return 0; }
55 static ReturnType toReturnType(const StoredType& type) { return type.get(); }
56 static String toString(PassType type) { return type ? type->valueAsString() : String(); }
59 // SVGAnimatedPreserveAspectRatio
61 struct DeprecatedSVGAnimatedPropertyTraits<SVGPreserveAspectRatio> : public Noncopyable {
62 typedef const SVGPreserveAspectRatio& PassType;
63 typedef SVGPreserveAspectRatio ReturnType;
64 typedef SVGPreserveAspectRatio StoredType;
66 static ReturnType null() { return SVGPreserveAspectRatio(); }
67 static ReturnType toReturnType(const StoredType& type) { return type; }
68 static String toString(PassType type) { return type.valueAsString(); }
73 struct DeprecatedSVGAnimatedPropertyTraits<String> : public Noncopyable {
74 typedef const String& PassType;
75 typedef String ReturnType;
76 typedef String StoredType;
78 static ReturnType null() { return String(); }
79 static ReturnType toReturnType(const StoredType& type) { return type; }
80 static String toString(PassType type) { return type; }
83 // SVGAnimatedTransformList
85 struct DeprecatedSVGAnimatedPropertyTraits<SVGTransformList*> : public Noncopyable {
86 typedef SVGTransformList* PassType;
87 typedef SVGTransformList* ReturnType;
88 typedef RefPtr<SVGTransformList> StoredType;
90 static ReturnType null() { return 0; }
91 static ReturnType toReturnType(const StoredType& type) { return type.get(); }
92 static String toString(PassType type) { return type ? type->valueAsString() : String(); }