template <typename TypeInfoT>

class TypedReffable

Defined at line 34 of file ../../src/ui/lib/escher/base/typed_reffable.h

TypedReffable is a subclass of Reffable that supports dynamic type-checking.

To make a new subclass of TypedReffable, you must follow some simple steps:

1) add a new entry to the enum of types in the hierarchy, creating a new enum

if this is the first type (see type_info.h for details).

2) in your new class, add a const static member to represent the type.

3) also in your new class, override type_info(), defining it to return a

reference to the static member.

Following the example in type_info.h, assume that we are adding a new class

named Foo. We would first add this line to "enum class ExampleTypes":

kFoo = 1

<

<

4

Then, we would define our class:

class Foo : public TypedReffable

<ExampleTypeInfo

> {

public:

static const TypeInfo kTypeInfo; // TypeInfo is typedeffed in superclass

const TypeInfo

&

type_info() const override { return kTypeInfo; }

};

For a working example, see typed_reffable_unittest.cc.

Public Methods

bool IsKindOf (const TypeInfo & base_type)

Return true if the specified type is identical or a base type of this

TypedReffable; return false otherwise.

Defined at line 46 of file ../../src/ui/lib/escher/base/typed_reffable.h

template <typename TypedReffableT>
bool IsKindOf ()

Return true if the specified type is identical or a base type of this

TypedReffable; return false otherwise.

Defined at line 51 of file ../../src/ui/lib/escher/base/typed_reffable.h

const TypeInfo & type_info ()

Concrete subclasses must override this to return a type-specific TypeInfo.

For each subclass, the TypeInfo's:

- type flags MUST match the inheritance chain of that subclass.

- name MUST match the name of that subclass.

const char * type_name ()

Return the name of the TypedReffable subclass that this object is an

instance of.

Defined at line 57 of file ../../src/ui/lib/escher/base/typed_reffable.h