KHTML
SVGParserUtilities.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SVGParserUtilities_h
00022 #define SVGParserUtilities_h
00023 #if ENABLE(SVG)
00024
00025 #include "ParserUtilities.h"
00026
00027 namespace WebCore {
00028
00029 class Path;
00030 class SVGPointList;
00031 class SVGPathSegList;
00032
00033 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true);
00034 bool parseNumberOptionalNumber(const String& s, float& h, float& v);
00035
00036
00037
00038 inline bool isWhitespace(const UChar& c)
00039 {
00040 return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
00041 }
00042
00043 inline bool skipOptionalSpaces(const UChar*& ptr, const UChar* end)
00044 {
00045 while (ptr < end && isWhitespace(*ptr))
00046 ptr++;
00047 return ptr < end;
00048 }
00049
00050 inline bool skipOptionalSpacesOrDelimiter(const UChar*& ptr, const UChar* end, UChar delimiter = ',')
00051 {
00052 if (ptr < end && !isWhitespace(*ptr) && *ptr != delimiter)
00053 return false;
00054 if (skipOptionalSpaces(ptr, end)) {
00055 if (ptr < end && *ptr == delimiter) {
00056 ptr++;
00057 skipOptionalSpaces(ptr, end);
00058 }
00059 }
00060 return ptr < end;
00061 }
00062
00063 bool pointsListFromSVGData(SVGPointList* pointsList, const String& points);
00064 bool pathFromSVGData(Path& path, const String& d);
00065 bool pathSegListFromSVGData(SVGPathSegList* pathSegList, const String& d, bool process = false);
00066 Vector<String> parseDelimitedString(const String& input, const char seperator);
00067
00068 }
00069
00070 #endif // ENABLE(SVG)
00071 #endif // SVGParserUtilities_h