180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkMemberInfo_DEFINED
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkMemberInfo_DEFINED
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined SK_BUILD_CONDENSED
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define SK_USE_CONDENSED_INFO 0
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkDisplayType.h"
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkScript.h"
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkString.h"
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkIntArray.h"
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkAnimateMaker;
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkDisplayable;
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkScriptEngine;
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// temporary hacks until name change is more complete
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkFloat SkScalar
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkInt SkS32
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustruct SkMemberInfo {
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    //!!! alternative:
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // if fCount == 0, record is member property
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // then fType can be type, so caller doesn't have to check
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_USE_CONDENSED_INFO == 0
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const char* fName;  // may be NULL for anonymous functions
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    size_t fOffset; // if negative, is index into member pointer table (for properties and functions)
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes fType;
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int fCount;         // for properties, actual type (count is always assumed to be 1)
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    unsigned char fName;
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    signed char fOffset;
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    unsigned char fType;
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    signed char fCount;
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes arrayType() const {
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType == SkType_Array);
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return (SkDisplayTypes) fCount;  // hack, but worth it?
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int functionIndex() const {
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType == SkType_MemberFunction);
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return (signed) fOffset > 0 ? -1 + (int) fOffset : -1 - (int) fOffset;
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool getArrayValue(const SkDisplayable* displayable, int index, SkOperand* value) const;
5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int getCount() const {
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return fType == SkType_MemberProperty || fType == SkType_Array ||
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fType == SkType_MemberFunction ? 1 : fCount;
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const SkMemberInfo* getInherited() const;
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    size_t getSize(const SkDisplayable* ) const;
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void getString(const SkDisplayable* , SkString** string) const;
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes getType() const {
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return fType == SkType_MemberProperty || fType == SkType_Array ||
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fType == SkType_MemberFunction ? (SkDisplayTypes) fCount : (SkDisplayTypes) fType;
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void getValue(const SkDisplayable* , SkOperand values[], int count) const;
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool isEnum() const;
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const char* mapEnums(const char* match, int* value) const;
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void* memberData(const SkDisplayable* displayable) const {
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType != SkType_MemberProperty &&  fType != SkType_MemberFunction);
7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return (void*) ((const char*) displayable + fOffset);
7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int propertyIndex() const {
7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType == SkType_MemberProperty);
7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return (signed) fOffset > 0 ? -1 + (int) fOffset : -1 - (int) fOffset;
7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes propertyType() const {
7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType == SkType_MemberProperty || fType == SkType_Array);
7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return (SkDisplayTypes) fCount;  // hack, but worth it?
7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setMemberData(SkDisplayable* displayable, const void* child, size_t size) const {
8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(fType != SkType_MemberProperty &&  fType != SkType_MemberFunction);
8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        memcpy((char*) displayable + fOffset, child, size);
8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setString(SkDisplayable* , SkString* ) const;
8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setValue(SkDisplayable* , const SkOperand values[], int count) const;
8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int storageOffset, int maxStorage, SkDisplayable* ,
8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkDisplayTypes outType, const char value[], size_t len) const;
8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int storageOffset, int maxStorage, SkDisplayable* ,
9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkDisplayTypes outType, SkString& str) const;
9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  void setValue(SkDisplayable* , const char value[], const char name[]) const;
9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkScriptValue& scriptValue) const;
9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_USE_CONDENSED_INFO == 0
9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo* Find(const SkMemberInfo [], int count, int* index);
9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo* Find(const SkMemberInfo [], int count, const char** name);
9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo* Find(SkDisplayTypes type, int* index);
10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo* Find(SkDisplayTypes type, const char** name);
10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static size_t GetSize(SkDisplayTypes type); // size of simple types only
10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  static bool SetValue(void* value, const char* name, SkDisplayTypes , int count);
10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER(_member, _type) \
10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_##_type, \
10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    sizeof(((BASE_CLASS*) 1)->_member) / sizeof(SkScalar) }
11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_ALIAS(_member, _alias, _type) \
11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    { #_member, SK_OFFSETOF(BASE_CLASS, _alias), SkType_##_type, \
11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    sizeof(((BASE_CLASS*) 1)->_alias) / sizeof(SkScalar) }
11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_ARRAY(_member, _type) \
11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_Array, \
11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    (int) SkType_##_type }
11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_INHERITED \
12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    { (const char*) INHERITED::fInfo, 0, SkType_BaseClassInfo, INHERITED::fInfoCount }
12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// #define SK_MEMBER_KEY_TYPE(_member, _type)
12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//  {#_member, (size_t) -1, SkType_##_type, 0}
12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_FUNCTION(_member) \
12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    k_##_member##Function
12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_PROPERTY(_member) \
12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    k_##_member##Property
13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_DYNAMIC_FUNCTION(_member, _type) \
13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    {#_member, (size_t) (+1 + SK_FUNCTION(_member)), SkType_MemberFunction, \
13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    (int) SkType_##_type }
13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_DYNAMIC_PROPERTY(_member, _type) \
13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    {#_member, (size_t) (1 + SK_PROPERTY(_member)), SkType_MemberProperty, \
13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    (int) SkType_##_type }
13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_FUNCTION(_member, _type) \
14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    {#_member, (size_t) (-1 - SK_FUNCTION(_member)), SkType_MemberFunction, \
14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    (int) SkType_##_type }
14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SK_MEMBER_PROPERTY(_member, _type) \
14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    {#_member, (size_t) (-1 - SK_PROPERTY(_member)), SkType_MemberProperty, \
14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    (int) SkType_##_type }
14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_USE_CONDENSED_INFO == 0
14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_PRIVATE_MEMBER_INFO(_type) \
15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index); \
15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]); \
15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_MEMBER_INFO(_type) \
15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index); \
16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]); \
16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_DRAW_MEMBER_INFO(_type) \
16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index); \
17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]); \
17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDraw##_type BASE_CLASS
17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_DISPLAY_MEMBER_INFO(_type) \
17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index); \
18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]); \
18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDisplay##_type BASE_CLASS
18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_EMPTY_MEMBER_INFO(_type) \
18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; }
18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_EXTRAS_MEMBER_INFO(_type) \
18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index); \
19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]); \
19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes fType; \
19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return fType; } \
19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef _type BASE_CLASS
19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_NO_VIRTUALS_MEMBER_INFO(_type) \
19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const SkMemberInfo fInfo[]; \
20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static const int fInfoCount; \
20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DEFINE_GET_MEMBER(_class) \
20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const SkMemberInfo* _class::getMember(int index) { \
20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkMemberInfo* result = SkMemberInfo::Find(fInfo, SK_ARRAY_COUNT(fInfo), &index); \
20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return result; \
20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    } \
20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const SkMemberInfo* _class::getMember(const char name[]) { \
21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkMemberInfo* result = SkMemberInfo::Find(fInfo, SK_ARRAY_COUNT(fInfo), &name); \
21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return result; \
21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    } \
21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const int _class::fInfoCount = SK_ARRAY_COUNT(fInfo)
21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DEFINE_NO_VIRTUALS_GET_MEMBER(_class) \
21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    const int _class::fInfoCount = SK_ARRAY_COUNT(fInfo)
21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_PRIVATE_MEMBER_INFO(_type) \
22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_MEMBER_INFO(_type) \
22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index) { \
22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]) { \
22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
23180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
23280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
23380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_DRAW_MEMBER_INFO(_type) \
23480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
23580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index) { \
23680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
23780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]) { \
23880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
23980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
24080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDraw##_type BASE_CLASS
24180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
24280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_DISPLAY_MEMBER_INFO(_type) \
24380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
24480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index) { \
24580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
24680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]) { \
24780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &name); } \
24880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return SkType_##_type; } \
24980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDisplay##_type BASE_CLASS
25080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
25180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_EXTRAS_MEMBER_INFO(_type) \
25280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
25380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(int index) { \
25480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, SkType_##_type, &index); } \
25580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const SkMemberInfo* getMember(const char name[]) { \
25680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return SkDisplayType::GetMember(NULL, fType, &name); } \
25780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkDisplayTypes fType; \
25880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual SkDisplayTypes getType() const { return fType; } \
25980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef _type BASE_CLASS
26080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
26180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DECLARE_NO_VIRTUALS_MEMBER_INFO(_type) \
26280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: \
26380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef Sk##_type BASE_CLASS
26480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
26580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DEFINE_GET_MEMBER(_class)
26680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define DEFINE_NO_VIRTUALS_GET_MEMBER(_class)
26780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
26880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
26980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
27080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkMemberInfo_DEFINED
271