The Symbian OS does not use a string of C strings (char*) or C + + that we are familiar with. Symbian's string is implemented through descriptor. Our first Symbian program, written version HelloWorld, is used in this way: _lit (Khelloworldtext, "Hello world! n "); console->printf (Khelloworldtext); _lit () is a macro that declares a descriptor:khelloworldtext with the contents" Hello world! ". The following console->printf parameter is a descriptor. Descirptor is a flexible design that takes full account of the limitations of small devices. This provides a very class, some can be modified, some cannot be modified, some on the stack, some on the heap. The NEWLC site has a descriptor chart: Http://www.newlc.com/article.php3? Id_article=12. It contains eight classes, which are not all descriptor classes, but are sufficient for the current use of our course. Where Tdesc is the most basic class. All other descriptor classes are inherited by it. Tdes is the most basic class that can be modified. All classes with the C suffix are not modifiable.
The chart below is a memory sketch of the 5 most commonly used descriptor classes.
The 5 in the tbufc<5> is its length, which represents the string "NEWLC", which is not to be changed.
Tbuf<8> 8 is its maximum length, and currently only uses 5 bytes, its contents are modifiable, but note that the content length can not be greater than his maximum length tptrc is a descriptor pointer class, it is an unmodified pointer, pointing to an immutable "NEWLC "The address.
Tptr is a modifiable descriptor pointer class that points to the address of a modifiable "NEWLC".
HBUFC's H stands for heap, which is specifically used to create strings on heap, and the strings of other descriptor classes are generally placed on stack.
In general, use heap memory as much as possible, because stack memory is more limited, if a large number of strings in the stack will easily lead to low memory.
These classes are used by many functions to modify and query their strings, and you can refer to the API Reference in the developer library. _lit () also has a simpler version, in which two lines in HelloWorld can be rewritten as: console->printf (_l ("Hello world! n "));