How to use descriptor TPtr/TDes as class member
| Thu, 2005-04-07 14:23 | |
|
Hi all,
I have a problem. I want to declare a TPtr/TDes variable in a class as a data member. Can it be possible. I have written the following code, but its giving error as "no appropriate default constructor available" The code is as follows: Code: Code: #include "e32base.h"
#include "e32def.h" #include "e32std.h" class CMyTestParm: public CBase { private: TInt a; TPtr d; public: void ConstructL(); ~CMyTestParm(); static CMyTestParm* NewL(); static CMyTestParm* NewLC(); CMyTestParm(); }; CMyTestParm* CMyTestParm::NewL() { CMyTestParm* self = CMyTestParm::NewLC(); CleanupStack::Pop(self); return self; } CMyTestParm* CMyTestParm::NewLC() { CMyTestParm* self = new (ELeave) CMyTestParm; CleanupStack::PushL(self); self->ConstructL(); return self; } CMyTestParm::CMyTestParm() { } void CMyTestParm::ConstructL() { // No implementation required } CMyTestParm::~CMyTestParm() { // delete d; // d = NULL; } |
|






Forum posts: 205
TPtr * d;
Best regards,
Michal Laskowski
Forum posts: 176
TPtr's constructors
IMPORT_C TPtr16(TUint16 *aBuf,TInt aLength,TInt aMaxLength);
Example:
CMyTestParm::CMyTestParm() : d(NULL,0)
{
}
Remember, TPtr does not actually own data, it points to data. So if you create a TPtr, you don't delete it.
Darin Dishneau
www.dishneau.com/symbian
Forum posts: 2
Thank you very much for this information. It helped so lot.
But I have another problem. Can you please solve it?
How can i assign value to the member variable iPtr (Tptr iPtr) and how to retrive it again. Its highly essential for my project.
regards
Balaraju
TPtr's constructors
IMPORT_C TPtr16(TUint16 *aBuf,TInt aLength,TInt aMaxLength);
Example:
CMyTestParm::CMyTestParm() : d(NULL,0)
{
}
Remember, TPtr does not actually own data, it points to data. So if you create a TPtr, you don't delete it.