# ClassDescC

# Class hierarchy

ClassDescC

# Overview

Class descriptors provide the system information about the plugin classes in the DLL. Developer creates a class descriptor by deriving a class from ClassDescC and implementing the methods.

This class is implemented by the system.

Header: | ClassDescC.h
Library: | core.lib

# Class members

`virtual void* create();`

#### Return value

Pointer to the created object.

#### Remarks

Demopaja calls this method when it needs new instance of the plugin class. The plugin is responds by allocating a new insance of its plugin class. The instace should be derived from DataBlockI interface, which has the release method for deleting the instance.

#### Example Implementation

`void*
TGAImportDescC::create()
{
return (void*)TGAImportC::create_new();
}
`

`virtual int32 get_classtype() const;`

#### Return value

The type of the plugin class.

#### Remarks

The return can be either CLASS_TYPE_EFFECT or CLASS_TYPE_FILEIMPORT depending on the plugin class' type. Both values are defined in the ClassDescC.h.

`virtual ClassIdC get_classid() const;`

#### Return value

Unique Class ID of the plugin class.

#### Remarks

Each plugin class must have unique class ID. The Demopaja system will identify the plugin classes (Importers and Effects) by its class ID. If two classes conflict the system will use the first class it finds. Use the random class ID generator provided with the SDK to generate new class IDs to avoid conflicts. This ID is for per class, you don't have to create new ID for every instance.

`virtual SuperClassIdC get_super_classid() const;`

#### Return value

Super Class ID of the plugin class.

#### Remarks

This method returns system defined constant which describes the class this plugin class is derived from. For example all effects returns SUPERCLASS_EFFECT (defined in EffectI.h).

`virtual const char* get_name() const;`

#### Return value

Returns the name of the plugin class as NULL terminated string.

#### Remarks

The name of the plugin class should be as descriptive as possible. This name is used all over the user interface so make it short. Say, everything below 15 characters is good.

#### Example Implementation

`const char*
TGAImportDescC::get_name() const
{
return "Targa Image";
}
`

`virtual const char* get_desc() const;`

#### Return value

Returns description of the plugin class as NULL terminated string.

#### Example Implementation

`const char*
TGAImportDescC::get_desc() const
{
return "Importer for Targa (.TGA) images";
}
`

`virtual const char* get_author_name() const;`

#### Return value

Returns the short description of the developer of the plugin class as NULL terminated string.

#### Example Implementation

`const char*
TGAImportDescC::get_author_name() const
{
return "Mikko \"memon\" Mononen";
}
`

`virtual const char* get_copyright_message() const;`

#### Return value

Returns copyright message of the plugin class as NULL terminated string.

#### Example Implementation

`const char*
TGAImportDescC::get_copyright_message() const
{
return "Copyright (c) 2000 Moppi Productions";
}
`

`virtual const char* get_url() const;`

#### Return value

The URL of the developers homepage (or e-mail address) as NULL terminated string.

#### Remarks

This information will be used in the About Plugins dialog to forward user to the homepage of the plugin.

#### Example Implementation

`const char*
TGAImportDescC::get_url() const
{
return "http://moppi.inside.org/demopaja/";
}
`

`virtual uint32 get_ext_count() const;`

#### Return value

Number of file extensions used by the plugin class.

#### Remarks

This information is only used with the importer and exporter plugins. Effect plugin class descriptors may return zero.

#### Example Implementation

`uint32
TGAImportDescC::get_ext_count() const
{
return 4;
}
`

`virtual const char* get_ext( uint32 ui32Index ) const;`

#### Parameters

ui32Index
  A zero based index of the extension string get get.

#### Return value

The extension of specified index as a NULL terminated string.

#### Remarks

The extension can be any length, but it should not include the leading ".".

#### Example Implementation

`const char*
TGAImportDescC::get_ext( uint32 ui32Index ) const
{
if( ui32Index == 0 )
return "tga";
else if( ui32Index == 1 )
return "vda";
else if( ui32Index == 2 )
return "icb";
else if( ui32Index == 3 )
return "vst";
return 0;
}
`

`virtual bool check_device_support( DeviceContextC* pContext );`

#### Parameters

pContext
  Pointer to the device context containing all the supported interfaces.

#### Return value

True if device context holds a device interface the plugin class supports.

#### Remarks

This function is called by the system at load time to check if this plugin class can be used with the current devices, such as OpenGL or software rendering. To check if the interface the plugin class uses is available, the method should query it. If query_interface methods returns an interface then it exists. Otherwise the interface is not supported.

#### Example Implementation

`bool
TGAImportDescC::check_device_support( DeviceContextC* pContext )
{
if( pContext->query_interface( INTERFACE_OPENGL ) )
return true;
return false;
}
`

Copyright © 2000 Moppi Productions