aboutsummaryrefslogtreecommitdiff
path: root/src/cssparser.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-15 20:48:44 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-15 20:48:44 +0100
commit39803b40143e5bc3e4d842def88f54e255a5290d (patch)
tree93134f783696d89b127c58e49118887cdf2db865 /src/cssparser.cc
parentb03767b12d881be24220bdb3f18370d0d7535bb7 (diff)
add CssParser constructor
Diffstat (limited to 'src/cssparser.cc')
-rw-r--r--src/cssparser.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/cssparser.cc b/src/cssparser.cc
index f94a255f..f2bde324 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -372,6 +372,8 @@ class CssParser {
bool within_block;
bool space_separated; /* used when parsing CSS selectors */
+ CssParser(CssContext *context, CssOrigin origin,
+ const char *buf, int buflen);
int getc();
void ungetc();
void nextToken();
@@ -386,6 +388,19 @@ class CssParser {
void parseRuleset();
};
+CssParser::CssParser(CssContext *context, CssOrigin origin,
+ const char *buf, int buflen)
+{
+ this->context = context;
+ this->origin = origin;
+ this->buf = buf;
+ this->buflen = buflen;
+ this->bufptr = 0;
+ this->space_separated = false;
+
+ nextToken ();
+}
+
/*
* Gets the next character from the buffer, or EOF.
*/
@@ -1216,17 +1231,10 @@ void a_Css_parse(CssContext * context,
const char *buf,
int buflen, CssOrigin origin)
{
- CssParser parser;
+ CssParser parser (context, origin, buf, buflen);
- parser.context = context;
- parser.buf = buf;
- parser.buflen = buflen;
- parser.bufptr = 0;
- parser.origin = origin;
parser.within_block = false;
- parser.space_separated = false;
- parser.nextToken();
while (parser.ttype != CSS_TK_END)
parser.parseRuleset();
}
@@ -1234,17 +1242,10 @@ void a_Css_parse(CssContext * context,
CssPropertyList *a_Css_parse_declaration(const char *buf, int buflen)
{
CssPropertyList *props = new CssPropertyList (true);
- CssParser parser;
+ CssParser parser (NULL, CSS_ORIGIN_AUTHOR, buf, buflen);
- parser.context = NULL;
- parser.buf = buf;
- parser.buflen = buflen;
- parser.bufptr = 0;
- parser.origin = CSS_ORIGIN_AUTHOR;
parser.within_block = true;
- parser.space_separated = false;
- parser.nextToken();
do
parser.parseDeclaration(props, NULL);
while (!(parser.ttype == CSS_TK_END ||