Enabling the Extension Mechanism

This tutorial describes how to enable the MUF extension mechanism.

Purpose

The purpose of this tutorial is to show you how to access custom parser plug-in interfaces using the MUF extension mechanism

Required Background

The Metadata Utility Library Overview introduces the metadata client utility.

Introduction

The basic functionality of parser plug-ins can be extended by using custom interfaces (extensions). MUF provides an extension mechanism to enable clients to access custom interfaces.

MUF recognizes the required custom interface by its extension ID. The extension ID is passed as a parameter in the GetExtension() method.

Using the Extension Mechanism

The following tasks will be covered in this tutorial:

  • Enable the extension mechanism

Basic Procedure

The high level steps to enable the extension mechanism are shown here:

  1. Create a new metadata utility object.

  2. Initialise a parser plug-in with an input source.

  3. Call GetExtension() and set the following parameters:

    Parameter Description

    aExtensionId

    The extension ID.

    aCMInterPtr

    Pointer to get the extension.

    aCMIntPtr

    Not used.

    IMPORT_C virtual TInt GetExtension(TUint aExtensionId, TAny*& aCMInterPtr, TAny* aCMIntPtr);

    GetExtension() is called directly on the current parser.

Example

//Create a new utility object (utility)
//Initialise the parser plug-in

utility->GetExtension(pluginUid,(TAny*&)ptr1, ptr2); 
//Get the extension where extension ID=pluginUid