changeset 1011:05e4782142f1

move CssPropertyInfo definition to cssparser.cc
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sun, 15 Mar 2009 22:18:20 +0100
parents 4653ee2e7657
children 306ce2f3228f
files src/css.cc src/cssparser.cc src/cssparser.hh
diffstat 3 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Sun Mar 15 22:12:11 2009 +0100
+++ b/src/css.cc	Sun Mar 15 22:18:20 2009 +0100
@@ -20,7 +20,8 @@
 using namespace dw::core::style;
 
 void CssProperty::print () {
-   fprintf (stderr, "%s - %d\n", Css_property_info[name].symbol, value.intVal);
+   fprintf (stderr, "%s - %d\n",
+            CssParser::propertyNameString((CssPropertyName) name), value.intVal);
 }
 
 CssPropertyList::~CssPropertyList () {
--- a/src/cssparser.cc	Sun Mar 15 22:12:11 2009 +0100
+++ b/src/cssparser.cc	Sun Mar 15 22:18:20 2009 +0100
@@ -42,6 +42,12 @@
    (CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES)
 
 
+typedef struct {
+   const char *symbol;
+   const CssValueType type[3];
+   const char *const *enum_symbols;
+} CssPropertyInfo;
+
 static const char *const Css_border_style_enum_vals[] = {
    "none", "hidden", "dotted", "dashed", "solid", "double", "groove",
    "ridge", "inset", "outset", NULL
@@ -1191,6 +1197,11 @@
       nextToken();
 }
 
+const char * CssParser::propertyNameString(CssPropertyName name)
+{
+   return Css_property_info[name].symbol;
+}
+
 void CssParser::parse(CssContext * context,
                       const char *buf,
                       int buflen, CssOrigin origin)
--- a/src/cssparser.hh	Sun Mar 15 22:12:11 2009 +0100
+++ b/src/cssparser.hh	Sun Mar 15 22:18:20 2009 +0100
@@ -3,14 +3,6 @@
 
 #include "css.hh"
 
-typedef struct {
-   const char *symbol;
-   const CssValueType type[3];
-   const char *const *enum_symbols;
-} CssPropertyInfo;
-
-extern const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST];
-
 class CssParser {
    private:
       typedef enum {
@@ -49,6 +41,7 @@
       static CssPropertyList *parseDeclarationBlock(const char *buf, int buflen);
       static void parse(CssContext *context, const char *buf, int buflen,
                         CssOrigin origin);
+      static const char *propertyNameString(CssPropertyName name);
 };
 
 #endif