首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> base >> 正文
T, C, R, M classes
作者:佚名    文章来源:不详    更新时间:2006-5-7 11:00:31

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 ;-)

相关文章:
Hashtable implementation for Symbian
Using Extended Notifiers
Using inline assembler within Symbian C++
Using Sound with Symbian
Multichannel Sound using CMdaAudioOutputStream (v1.1)
Playing a WAV file
Image loading and color reduction
String and Descriptors
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号