michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef SkSVGAttribute_DEFINED michael@0: #define SkSVGAttribute_DEFINED michael@0: michael@0: #include "SkTypes.h" michael@0: michael@0: struct SkSVGAttribute { michael@0: const char* fName; michael@0: #ifdef SK_DEBUG michael@0: size_t fOffset; michael@0: #endif michael@0: }; michael@0: michael@0: #ifndef SK_OFFSETOF michael@0: #define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1) michael@0: #endif michael@0: michael@0: #ifdef SK_DEBUG michael@0: #define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) } michael@0: #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS, cAttr) } michael@0: #else michael@0: #define SVG_ATTRIBUTE(attr) { #attr } michael@0: #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr } michael@0: #endif michael@0: michael@0: #define SVG_ADD_ATTRIBUTE(attr) \ michael@0: if (f_##attr.size() > 0) \ michael@0: parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size()) michael@0: michael@0: #define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \ michael@0: if (f_##alias.size() > 0) \ michael@0: parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size()) michael@0: michael@0: #endif // SkSVGAttribute_DEFINED