diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 08:40:34 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 08:40:34 +0000 |
| commit | aadfea4113abc6863d7ab03d21b973802c41c503 (patch) | |
| tree | 3f890c0c112433fd850d59558208addf1baa85da /src/conditions.cpp | |
| parent | Pot and Dutch translation update (diff) | |
| parent | A simple layout document as to what, why and how is cppification. (diff) | |
| download | inkscape-aadfea4113abc6863d7ab03d21b973802c41c503.tar.gz inkscape-aadfea4113abc6863d7ab03d21b973802c41c503.zip | |
Merge and cleanup of GSoC C++-ification project.
(bzr r9945.1.1)
Diffstat (limited to 'src/conditions.cpp')
| -rw-r--r-- | src/conditions.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/conditions.cpp b/src/conditions.cpp index 8d1770d6a..d35f18cf1 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -1,10 +1,9 @@ -#define __SP_CONDITIONS_CPP__ - /* * SVG conditional attribute evaluation * * Authors: * Andrius R. <knutux@gmail.com> + * Abhishek Sharma * * Copyright (C) 2006 authors * @@ -39,20 +38,16 @@ static Condition _condition_handlers[] = { { "requiredExtensions", evaluateRequiredExtensions }, }; -/* function which evaluates if item should be displayed */ +// function which evaluates if item should be displayed bool sp_item_evaluate(SPItem const *item) { - Inkscape::XML::Node *grepr = SP_OBJECT_REPR (item); - - for ( unsigned int i = 0 ; i < sizeof(_condition_handlers)/sizeof(_condition_handlers[0]) ; i++ ) { - gchar const *value = grepr->attribute(_condition_handlers[i].attribute); - if ( NULL == value ) - continue; - - if (!_condition_handlers[i].evaluator(item, value)) - return false; + bool needDisplay = true; + for ( unsigned int i = 0 ; needDisplay && (i < sizeof(_condition_handlers) / sizeof(_condition_handlers[0])) ; i++ ) { + gchar const *value = item->getAttribute(_condition_handlers[i].attribute); + if ( value && !_condition_handlers[i].evaluator(item, value) ) { + needDisplay = false; + } } - - return true; + return needDisplay; } #define ISALNUM(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9')) |
