blob: 940ca5a951431169634a853e568f6907a519b5d4 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkSVGAttribute_DEFINED
11#define SkSVGAttribute_DEFINED
12
13#include "SkTypes.h"
14
15struct SkSVGAttribute {
16 const char* fName;
17#ifdef SK_DEBUG
18 size_t fOffset;
19#endif
20};
21
22#ifndef SK_OFFSETOF
23#define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1)
24#endif
25
26#ifdef SK_DEBUG
27#define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) }
28#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS, cAttr) }
29#else
30#define SVG_ATTRIBUTE(attr) { #attr }
31#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr }
32#endif
33
34#define SVG_ADD_ATTRIBUTE(attr) \
35 if (f_##attr.size() > 0) \
36 parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size())
37
38#define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \
39 if (f_##alias.size() > 0) \
40 parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size())
41
42#endif // SkSVGAttribute_DEFINED