SkSVGAttribute.h revision ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976e
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkSVGAttribute_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkSVGAttribute_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTypes.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct SkSVGAttribute { 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char* fName; 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t fOffset; 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SK_OFFSETOF 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1) 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) } 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS, cAttr) } 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_ATTRIBUTE(attr) { #attr } 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr } 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_ADD_ATTRIBUTE(attr) \ 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (f_##attr.size() > 0) \ 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size()) 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \ 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (f_##alias.size() > 0) \ 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size()) 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SkSVGAttribute_DEFINED 43