2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@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.
24 #include "SVGLengthList.h"
26 #include "SVGParserUtilities.h"
27 #include <wtf/text/StringBuilder.h>
31 void SVGLengthList::parse(const String& value, SVGLengthMode mode)
36 const UChar* ptr = value.characters();
37 const UChar* end = ptr + value.length();
39 const UChar* start = ptr;
40 while (ptr < end && *ptr != ',' && !isSVGSpace(*ptr))
45 SVGLength length(mode);
46 String valueString(start, ptr - start);
47 if (valueString.isEmpty())
49 length.setValueAsString(valueString, ec);
53 skipOptionalSVGSpacesOrDelimiter(ptr, end);
57 String SVGLengthList::valueAsString() const
59 StringBuilder builder;
61 unsigned size = this->size();
62 for (unsigned i = 0; i < size; ++i) {
66 builder.append(at(i).valueAsString());
69 return builder.toString();