Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using TPckgBuf<class T>

This is a code fragment which shows an object of class TExample packaged into a packaged modifiable buffer descriptor. The package is passed to a function which takes the appropriate argument type.

{
TExample myExample; // The object to be passed.
...
typedef TPckgBuf<TExample> TExampleBuf; // Useful typedef.
...
TExampleBuf buffer(myExample); // Package the object.

Foo(buffer); // Pass it into some function.
}

void Foo(TExampleBuf aBuf) // Cannot pass a descriptor containing
 { // an object of any other type.
 aBuf().SomeFunction(); // The operator() returns a reference to
                        // the packaged object and is used to
                        // access a member function of that
                        // packaged object
 ...
 }