Creating TBuf<> equivalent...

Login to reply to this topic.
Thu, 2007-03-08 09:52
Joined: 2004-09-06
Forum posts: 235
I am referring to this link...

http://msdn2.microsoft.com/en-us/library/aa454903.aspx

It gives a possible replacement for TBuf<>: std:wstring
So, my implementation looks something like this (it supports both Symbian and Windows)

class VString
{
   VString();
   int Length(){
#ifdef SYMBIAN
    return str.Length();
#else
    return str.length();

private:

#ifdef SYMBIAN
     TBuf<128> str;
#else
    std::wstring str;
#endif
};

Can I replace this hardcoded 128 so that it can accept a value at runtime. I mean any work around here? or do I have to use dynamic buffer.

Also, is STL supported in Symbian, in case I haveto use std::vector<void*> instead of RPointerArray in symbian itself?

Thu, 2007-03-08 18:35
Joined: 2004-07-10
Forum posts: 364
Re: Creating TBuf<> equivalent...
You can't define the size of a TBuf at run time.
So if you change your class to use an RBuf or HBufC* you're then going to have to start worring about things such as cleanup. The more you start to try and create a dual purpose class the more and more problems you will inevitably run into.
  • Login to reply to this topic.