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 khtml {
00028 class Path;
00029 }
00030
00031 namespace WebCore {
00032
00033 typedef khtml::Path Path;
00034 class SVGPointList;
00035 class SVGPathSegList;
00036
00037 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true);
00038 bool parseNumberOptionalNumber(const String& s, float& h, float& v);
00039
00040
00041
00042 inline bool isWhitespace(const UChar& c)
00043 {
00044 return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
00045 }
00046
00047 inline bool skipOptionalSpaces(const UChar*& ptr, const UChar* end)
00048 {
00049 while (ptr < end && isWhitespace(*ptr))
00050 ptr++;
00051 return ptr < end;
00052 }
00053
00054 inline bool skipOptionalSpacesOrDelimiter(const UChar*& ptr, const UChar* end, UChar delimiter = ',')
00055 {
00056 if (ptr < end && !isWhitespace(*ptr) && *ptr != delimiter)
00057 return false;
00058 if (skipOptionalSpaces(ptr, end)) {
00059 if (ptr < end && *ptr == delimiter) {
00060 ptr++;
00061 skipOptionalSpaces(ptr, end);
00062 }
00063 }
00064 return ptr < end;
00065 }
00066
00067 bool pointsListFromSVGData(SVGPointList* pointsList, const String& points);
00068 bool pathFromSVGData(Path& path, const String& d);
00069 bool pathSegListFromSVGData(SVGPathSegList* pathSegList, const String& d, bool process = false);
00070 Vector<String> parseDelimitedString(const String& input, const char separator);
00071
00072 }
00073
00074 #endif // ENABLE(SVG)
00075 #endif // SVGParserUtilities_h