Symbian use the following naming convention to indicate the basic property of a class:
| T | Simple class (like a typedef). T classes have no constructor and no destructor. They can be allocated on the stack |
| C | C classes have a constructor and a destructor and all derivate from CBase. Instances are always allocated on the heap |
| R | R Classes are proxies for object owned elsewhere (typically a server running in another thread). R classes objects generally have an initialization and a termination function |
| M | A Mixin class. This is pure interface class. In other words an abstract class with only pure virtual methods (no implementation) [1] |
Some older version of Symbian OS also use the S prefix for structure definition. This prefix is now obsolete and shall be replaced by T.
The E prefix is also used for enum values (ETrue, EFalse) and K for constants (KErrNone).
T-Classes
T classes are generally used for integers, Booleans and simple other structure types:
TInt i; // a counter
TBool res=ETrue;// a boolean value
TPoint origin; // a point object having two coordinates TInt X and TInt Y |
C-Classes
C classes derivate from Cbase. A C object is allocated on the heap through the use of the new operator. This operator is overloaded by Symbian new(Eleave) to allow a memory protection mechanism called two phase construction :
Class CMyClass : public CBase
{
}
CMyClass *myObject = new(ELeave) CMyClass ;
delete myObject; |
R-Classes
R Classes are proxies for object owned elsewhere (typically a server running in another thread). R classes objects have an initialization (generally called Create, Open, ...) and a termination function (Delete, Close,...) :
RTimer myTimer;
myTimer.CreateLocal();
myTimer.Delete(); |
[1] Thanks to Tero for the definition ;-)
|