Main Page

String Pool Documentation

Owner: | Application Frameworks & Protocols
Author: | Leon Clarke
Last Revised: | 20 March 2002.
Revision: | 3.0
Status: | Released
Reviewers: |
Approval: | (PM) Urmi Shah, (ESM) Akin Oyesola, (Architect) Andrew Baldwin

History

Date | Version | Status | Description
21-05-2001 | 1.0 | Issued | Issued
05-07-2001 | 1.1 | Added more detail, in particular about static tables. | Issued
05-07-2001 | 1.2 | Minor editorial changes following T3 review comments. | Issued
23-07-2001 | 1.3 | Added reference to example code. | Issued
09-11-2001 | 2.0 | Added mutiple table support and case-sensitive strings | Issued
20-03-2002 | 3.0 | Incorporated changes following defect fixing | Released

The string pool is a way of storing strings that makes comparison almost instantaneous at the expense of string creation. It is particularly efficient at handling string constants that are known at compile time. It currently only supports 8 bit strings. The basic algorithm is to ensure that the pool only contains one string of any particular value, using reference counts to keep track of it. Subsequent strings with the same value will actualy refer to the same copy.

To use the string pool, you need an RStringPool object. Strings from different string pools can't be compared, so there should only be 1 string pool open per thread (unless one is in a component that doesn't export its use of the string pool). Of course, you can have multiple RStringPool objects, as long as they are all handles to the same string pool.

Within this object, there are 2 distinct pools of strings, one comprising strings that are 'case-sensitive' (represented using the RString class) and another representing strings that are 'case-insensitive' (RStringF). Case-sensitive strings behave in a straightforward way. Case-insensitive strings should be used in a situation where case doesn't matter at all; if you create a new RStringF that differs from an existing RStringF only in terms of case, when you read back the value of the 'new' string, it will have the same value as the 'existing' one. This can be very useful in situations where strings are considered case-insensitive, but there is a 'traditional case' that is normaly used. As long as the first value to be added is in the 'traditional case', all subsequent additions will be corrected to match this first entry.

Case-insensitivity assumes a character set of us-ascii (i.e.it only considers A-Z to be equivalent to a-z)

If a string has a more complex or different case-sensitivity requirement that this model doesn't match, then it may be necessary to compare strings outside the pool, which may make the string pool inapplicable.

Corresponding to RString and RStringF are the classes RStringToken and RStringTokenF. These are smaller (4 bytes long rather than 8) but need to be turned into String or StringF classes before you can do anything useful with them. In particular, you can't directly find the contents of a string token. They should be used when space is absoluteley at a premium, for instance storing a lot of strings in an array, or similar applications.

Tables

A very important aspect of the string pool is the concept of static string table. This is best thought of as an array of common strings. Integers can be transformed into the strings corresponding to that index position in the array via the String and StringF functions. In addition, a string can be cast back to an integer, allowing a switch statement on strings (it returns -1 if the string isn't one from any static table of the pool). Another advantage to using the static table is that the function to create the string can't leave, and the string doesn't need to be closed (although closing it is harmless)

Multiple case-insensitive and case-sensitive string tables are supported.

A static table is written as a .st file, and is processed by stringtable.pl early in the build process to generate the actual cpp and header files at compile time. The format of the .st file is basicaly as follows. The first noncomment line consists of fstringtable <TableName> for a case-insensitive table and stringtable <TableName> for a case-sensitive table. Each subsequent non-comment line consists of the name of an enum followed by the value of the string. Comment lines start with # and can be added anywhere. You can also have lines starting in !, which will be output into the header file if you want additional comments in the header. e.g.

   # Example String Table
   fstringtable ExampleStringTable
   !// Some types of fruit
   # This comment won't appear in the .h file, but the one above is.
   EApple apple
   EOrange orange
   EBanana banana
   # Some animals
   ECat cat
   EDog dog

The string table name must be a valid C++ class name, and the generated code includes a class that contains within it an enum corresponding to the elements in the array, so entries in the above example could be referred to as MyStringTable::ECat and so on.

The stringpool.pl script takes a .st file and creates .cpp and .h files of the same name in the same directory. The easiest way to use this is to export the .st file to /epoc32/generated/, create an extension makefile that runs the script during the makefile phase and then copies the generated .h file to epoc32, and then compile the .cpp file as normal from an mmp files. Look at the example code in //EPOC/main/generic/bafl/docs/stringtableexample/... for a simple example of how to do this.

To be notified when the String Pool is closing you can derive from the mix-in class MStringPoolCloseCallBack and implement the StringPoolClosing() function. The OpenL(const TStringTable& aTable, MStringPoolCloseCallBack& aCallBack) overridden function must be used to register the callback with the String Pool. Where aCallback is the pointer to the callback. The StringPoolClosing() function will then get called when the String Pool is closing.

Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


File Index

String Pool File List

Here is a list of all documented files with brief descriptions:
  • StringPool.dox [code]
  • stringpool.h [code]
  • stringpool.inl [code]
  • StringPoolAPI.cpp [code]
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Annotated Index

String Pool Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
  • RString (A case-sensitiveString that is actualy stored in a string pool)
  • RStringBase (A String that is actualy stored in a string pool)
  • RStringF (A case-insensitive String that is actualy stored in a string pool)
  • RStringPool (The string pool handle object)
  • MStringPoolCloseCallBack (Interface for the callback function)
  • TStringTable (A pointer to a string table)
  • RStringToken (A compact (4 byte) representation of a case-sensitive string in the string pool)
  • RStringTokenBase (A compact (4 byte) representation of a string in the string pool)
  • RStringTokenF (A compact (4 byte) representation of a case-insensitive string in the string pool)
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


RString Class Reference

A case-sensitiveString that is actualy stored in a string pool. More...

#include <stringpool.h>

Inheritance diagram for RString

[legend]
Collaboration diagram for RString:

[legend]
List of all members.

Public Methods

RString | Copy ()
Copies a string. More...

operator RStringToken ()const
Returns a compact string equivalent to the string (for case-sensitive strings). More...

TBool | operator== (const RString &aVal)const
Comparison operator for case-sensitive strings. More...

TBool | operator!= (const RString &aVal)const
Comparison operator for case-sensitive strings. More...

Detailed Description

A case-sensitiveString that is actualy stored in a string pool.

To initialise values of this class, you need to use the operator() functions on the RStringPool. This class performs comparisons in a non-folded (case-sensitive) manner.

See also:
RStringPool

Definition at line 167 of file stringpool.h.

Member Function Documentation

RString RString::Copy ( ) [inline]

Copies a string.

Both the original and the copy must be separately closed

Reimplemented from RStringBase.

Definition at line 88 of file stringpool.inl.

RString::operator RStringToken ( ) const [inline]

Returns a compact string equivalent to the string (for case-sensitive strings).

Definition at line 95 of file stringpool.inl.

TBool RString::operator!= ( const RString & aVal ) const [inline]

Comparison operator for case-sensitive strings.

Parameters:
aVal The string to compare.

Definition at line 151 of file stringpool.inl.

TBool RString::operator== ( const RString & aVal ) const [inline]

Comparison operator for case-sensitive strings.

Parameters:
aVal The string to compare.

Definition at line 143 of file stringpool.inl.

Friends And Related Function Documentation

class RStringPool [friend]

Reimplemented from RStringBase.

Definition at line 178 of file stringpool.h.

class RStringToken [friend]

Definition at line 179 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl
Generated at Wed Mar 20 17:37:39 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


RStringBase Class Reference

A String that is actualy stored in a string pool. More...

#include <stringpool.h>

Inheritance diagram for RStringBase

[legend]
Collaboration diagram for RStringBase:

[legend]
List of all members.

Public Methods

RStringBase ()
Default (non-initialised) Constructor. More...

IMPORT_C void | Close ()
Closes a string. More...

IMPORT_C RStringBase | Copy ()
Copies a string. More...

IMPORT_C const TDesC8& | DesC ()const
Returns the content of the string. More...

operator RStringTokenBase ()const
Returns a compact string equivalent to the string. More...

IMPORT_C TInt | Index (const TStringTable &aTable)const
Returns the enum corresponding to this string, or -1 if it is not enumerated in the table supplied as argument. More...

IMPORT_C const TStringTable* | OriginalTableRef ()const
In case of table string this function returns a reference to the first loaded table which contains the string(there could be manytables that contain the same string) This function returns NULL if the string has been created dinamically. More...

RStringPool | Pool ()const
Returns the string pool. More...

Detailed Description

A String that is actualy stored in a string pool.

This is the base class; there are subclasses for folded and non-folded versions. Use this class when you want to receive a string but have no intention of comparing it with anything.

See also:
RStringPool

Definition at line 134 of file stringpool.h.

Constructor & Destructor Documentation

RStringBase::RStringBase ( ) [inline]

Default (non-initialised) Constructor.

Definition at line 72 of file stringpool.inl.

Member Function Documentation

EXPORT_C void RStringBase::Close ( )

Closes a string.

You must close every string you open. In other words, every call to RStringBase::Copy, RStringPool::OpenStringL and RStringPool::OpenFStringL must be matched by a close. Strings created via RStringPool::String or RStringPool::StringF with an integer argument need not be closed (but closing is harmless). RStringPool::String or RStrginPool::StringF with a StringToken or StringTokenF argument must not be closed, as they're just changing the external representation.

Definition at line 17 of file StringPoolAPI.cpp.

EXPORT_C RStringBase RStringBase::Copy ( )

Copies a string.

Both the original and the copy must be separately closed

Reimplemented in RString, and RStringF.

Definition at line 30 of file StringPoolAPI.cpp.

Referenced by RStringF::Copy(), and RString::Copy().

EXPORT_C const TDesC8 & RStringBase::DesC ( ) const

Returns the content of the string.

Definition at line 40 of file StringPoolAPI.cpp.

EXPORT_C TInt RStringBase::Index ( const TStringTable & aTable ) const

Returns the enum corresponding to this string, or -1 if it is not enumerated in the table supplied as argument.

Parameters:
aTable is the string table from which this function tries to get the string's index

Definition at line 60 of file StringPoolAPI.cpp.

EXPORT_C const TStringTable * RStringBase::OriginalTableRef ( ) const

In case of table string this function returns a reference to the first loaded table which contains the string(there could be manytables that contain the same string) This function returns NULL if the string has been created dinamically.

Definition at line 81 of file StringPoolAPI.cpp.

RStringPool RStringBase::Pool ( ) const [inline]

Returns the string pool.

Definition at line 136 of file stringpool.inl.

RStringBase::operator RStringTokenBase ( ) const [inline]

Returns a compact string equivalent to the string.

Definition at line 78 of file stringpool.inl.

Friends And Related Function Documentation

class RStringPool [friend]

Definition at line 154 of file stringpool.h.

class RStringTokenBase [friend]

Definition at line 155 of file stringpool.h.

Member Data Documentation

RStringPool RStringBase::iPool [protected]

Definition at line 157 of file stringpool.h.

TUint32 RStringBase::iVal [protected]

Definition at line 158 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl
  • StringPoolAPI.cpp


RStringF Class Reference

A case-insensitive String that is actualy stored in a string pool. More...

#include <stringpool.h>

Inheritance diagram for RStringF

[legend]
Collaboration diagram for RStringF:

[legend]
List of all members.

Public Methods

RStringF | Copy ()
Copies a string. More...

operator RStringTokenF ()const
Returns a compact string equivalent to the string(for case-insensitive strings). More...

TBool | operator== (const RStringF &aVal)const
Comparison operator for case-insensitive strings. More...

TBool | operator!= (const RStringF &aVal)const
Comparison operator for case-insensitive strings. More...

Detailed Description

A case-insensitive String that is actualy stored in a string pool.

To initialise values of this class, you need to use the operator() functions on the RStringPool. Comparisons with this class use folded (case-insensitive) comparisons.

See also:
RStringPool

Definition at line 188 of file stringpool.h.

Member Function Documentation

RStringF RStringF::Copy ( ) [inline]

Copies a string.

Both the original and the copy must be separately closed

Reimplemented from RStringBase.

Definition at line 105 of file stringpool.inl.

RStringF::operator RStringTokenF ( ) const [inline]

Returns a compact string equivalent to the string(for case-insensitive strings).

Definition at line 128 of file stringpool.inl.

TBool RStringF::operator!= ( const RStringF & aVal ) const [inline]

Comparison operator for case-insensitive strings.

Parameters:
aVal The string to compare.

Definition at line 121 of file stringpool.inl.

TBool RStringF::operator== ( const RStringF & aVal ) const [inline]

Comparison operator for case-insensitive strings.

Parameters:
aVal The string to compare.

Definition at line 113 of file stringpool.inl.

Friends And Related Function Documentation

class RStringPool [friend]

Reimplemented from RStringBase.

Definition at line 199 of file stringpool.h.

class RStringTokenF [friend]

Definition at line 200 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl


RStringPool Class Reference

The string pool handle object. More...

#include <stringpool.h>

List of all members.

Public Methods

RStringPool ()
Default constructor. More...

IMPORT_C void | OpenL ()
Creates an initialised string pool with no pre-loaded string tables. More...

IMPORT_C void | OpenL (const TStringTable &aTable)
Creates an initialised string pool with a pre-loaded string table. More...

IMPORT_C void | OpenL (const TStringTable &aTable,MStringPoolCloseCallBack &aCallBack)
Creates an initialised string pool with a pre-loaded string table. More...

IMPORT_C void | Close ()
Closes the string pool and all the tables in it . More...

IMPORT_C RStringF | OpenFStringL (const TDesC8 &aString)const
Creates a new RStringF. More...

IMPORT_C RString | OpenStringL (const TDesC8 &aString)const
Creates a new RString. More...

IMPORT_C RString | String (RStringToken aString)const
Converts the supplied RStringToken to a RString. More...

IMPORT_C RString | String (TInt aIndex,const TStringTable &aTable)const
Gets a case-sensitive string from aTable whose ordinal is aIndex. More...

IMPORT_C RStringF | StringF (RStringTokenF aString)const
Converts the supplied RStringToken to a RString. More...

IMPORT_C RStringF | StringF (TInt aIndex,const TStringTable &aTable)const
Gets a case-insensitive string from aTable whose ordinal is aIndex. More...

Detailed Description

The string pool handle object.

A string pool can have several distinct handles associated with it, each associated with a different pre-loaded table. The difference between them is that creating a string from an enum will interpret the enum as an offset into the relevant pre-loaded table

Definition at line 30 of file stringpool.h.

Constructor & Destructor Documentation

RStringPool::RStringPool ( ) [inline]

Default constructor.

Definition at line 158 of file stringpool.inl.

Member Function Documentation

EXPORT_C void RStringPool::Close ( )

Closes the string pool and all the tables in it .

This invalidates all other handles to the string pool.

Definition at line 145 of file StringPoolAPI.cpp.

EXPORT_C RStringF RStringPool::OpenFStringL ( const TDesC8 & aString ) const

Creates a new RStringF.

The string is opened case-insensitive

Parameters:
aString The value of the string
Exceptions:
KErrNoMemory There was not enough memory.

Definition at line 157 of file StringPoolAPI.cpp.

EXPORT_C void RStringPool::OpenL ( | const TStringTable & aTable,
 | MStringPoolCloseCallBack & aCallBack )

Creates an initialised string pool with a pre-loaded string table.

Parameters:
aTable | is the string table to load
aCallBack | is the callback function called when String Pool is closed
Exceptions:
KErrNoMemory There was not enough memory to open the pool

Definition at line 105 of file StringPoolAPI.cpp.

EXPORT_C void RStringPool::OpenL ( const TStringTable & aTable )

Creates an initialised string pool with a pre-loaded string table.

Parameters:
aTable is the string table to open
Exceptions:
KErrNoMemory There was not enough memory to open the pool

Definition at line 127 of file StringPoolAPI.cpp.

EXPORT_C void RStringPool::OpenL ( )

Creates an initialised string pool with no pre-loaded string tables.

Exceptions:
KErrNoMemory There was not enough memory to open the pool

Definition at line 94 of file StringPoolAPI.cpp.

EXPORT_C RString RStringPool::OpenStringL ( const TDesC8 & aString ) const

Creates a new RString.

The string is opened case-sensitive.

Parameters:
aString The value of the string
Exceptions:
KErrNoMemory There was not enough memory.

Definition at line 172 of file StringPoolAPI.cpp.

EXPORT_C RString RStringPool::String ( | TInt aIndex,
 | const TStringTable & aTable ) const

Gets a case-sensitive string from aTable whose ordinal is aIndex.

N.B.: the case of the string returned and the the case of the table need to match

Parameters:
aIndex | is the string's index in its table
aTable | is a case-sensitive table from which to get the string

Definition at line 199 of file StringPoolAPI.cpp.

EXPORT_C RString RStringPool::String ( RStringToken aString ) const

Converts the supplied RStringToken to a RString.

The function cannot leave.

Parameters:
aString The value of the string

Definition at line 186 of file StringPoolAPI.cpp.

EXPORT_C RStringF RStringPool::StringF ( | TInt aIndex,
 | const TStringTable & aTable ) const

Gets a case-insensitive string from aTable whose ordinal is aIndex.

N.B.: the case of the string returned and the the case of the table need to match

Parameters:
aIndex | is the string's index in its table
aTable | is a case-insensitive table from which to get the string

Definition at line 235 of file StringPoolAPI.cpp.

EXPORT_C RStringF RStringPool::StringF ( RStringTokenF aString ) const

Converts the supplied RStringToken to a RString.

The function cannot leave.

Parameters:
aString The value of the string

Definition at line 222 of file StringPoolAPI.cpp.

Friends And Related Function Documentation

class CStringPoolImplementation [friend]

Definition at line 59 of file stringpool.h.

class RString [friend]

Definition at line 57 of file stringpool.h.

class RStringBase [friend]

Definition at line 56 of file stringpool.h.

class RStringF [friend]

Definition at line 58 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl
  • StringPoolAPI.cpp


MStringPoolCloseCallBack Class Reference

Interface for the callback function. More...

#include <stringpool.h>

List of all members.

Public Methods

virtual void StringPoolClosing ()=0
Implement this function to perform some operation when the string pool is being closed. More...

Detailed Description

Interface for the callback function.

Derive from this class to be notified of the string pool closure

Definition at line 18 of file stringpool.h.

Member Function Documentation

void MStringPoolCloseCallBack::StringPoolClosing ( ) [pure virtual]

Implement this function to perform some operation when the string pool is being closed.

The documentation for this class was generated from the following file:
  • stringpool.h


TStringTable Struct Reference

A pointer to a string table. More...

#include <stringpool.h>

List of all members.

Public Attributes

TUint | iCount
The number of elements in the table. More...

const void* const* | iTable
A pointer to an array of pointers to the strings. More...

TBool | iCaseSensitive
ETrue if the table should be considered case-sensitive. More...

Detailed Description

A pointer to a string table.

Definition at line 206 of file stringpool.h.

Member Data Documentation

TBool TStringTable::iCaseSensitive

ETrue if the table should be considered case-sensitive.

Definition at line 214 of file stringpool.h.

TUint TStringTable::iCount

The number of elements in the table.

Definition at line 209 of file stringpool.h.

const void *const * TStringTable::iTable

A pointer to an array of pointers to the strings.

Definition at line 211 of file stringpool.h.

The documentation for this struct was generated from the following file:
  • stringpool.h


RStringToken Class Reference

A compact (4 byte) representation of a case-sensitive string in the string pool. More...

#include <stringpool.h>

Inheritance diagram for RStringToken

[legend]
Collaboration diagram for RStringToken:

[legend]
List of all members.

Public Methods

TBool | operator== (RStringToken aVal)const
Comparison operator. More...

TBool | operator!= (RStringToken aVal)const
Comparison operator. More...

RStringToken | operator= (RString aVal)
Assignment operator with unfolded (case-sensitive) rules; makes a string token from a string. More...

Detailed Description

A compact (4 byte) representation of a case-sensitive string in the string pool.

This class must be turned into a RString before you can do anything useful with it. It is only intended to be used when storing strings in situations where space matters; normaly use RString.

See also:
RString

Definition at line 94 of file stringpool.h.

Member Function Documentation

TBool RStringToken::operator!= ( RStringToken aVal ) const [inline]

Comparison operator.

Parameters:
aVal The string to compare in its compact format.

Definition at line 36 of file stringpool.inl.

RStringToken RStringToken::operator= ( RString aVal ) [inline]

Assignment operator with unfolded (case-sensitive) rules; makes a string token from a string.

Parameters:
aVal The string to copy

Reimplemented from RStringTokenBase.

Definition at line 43 of file stringpool.inl.

TBool RStringToken::operator== ( RStringToken aVal ) const [inline]

Comparison operator.

Parameters:
aVal The string to compare in its compact format

Definition at line 29 of file stringpool.inl.

Friends And Related Function Documentation

class CStringPoolImplementation [friend]

Reimplemented from RStringTokenBase.

Definition at line 105 of file stringpool.h.

class RString [friend]

Definition at line 104 of file stringpool.h.

class RStringPool [friend]

Reimplemented from RStringTokenBase.

Definition at line 103 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl


RStringTokenBase Class Reference

A compact (4 byte) representation of a string in the string pool. More...

#include <stringpool.h>

Inheritance diagram for RStringTokenBase

[legend]
List of all members.

Public Methods

RStringTokenBase ()
Default (uninitialised) constructor. More...

RStringTokenBase | operator= (RStringBase aVal)
Assignment operator; makes a string token from a string. More...

TBool | IsNull ()const
Returns true if the string is null. More...

Detailed Description

A compact (4 byte) representation of a string in the string pool.

This class must be turned into a RStringBase (or one of its derived classes) before you can do anything useful with it. It is only intended to be used when storing strings in situations where space matters; normaly use RStringBase.

See also:
RStringBase

Definition at line 70 of file stringpool.h.

Constructor & Destructor Documentation

RStringTokenBase::RStringTokenBase ( ) [inline]

Default (uninitialised) constructor.

Definition at line 8 of file stringpool.inl.

Member Function Documentation

TBool RStringTokenBase::IsNull ( ) const [inline]

Returns true if the string is null.

Definition at line 22 of file stringpool.inl.

RStringTokenBase RStringTokenBase::operator= ( RStringBase aVal ) [inline]

Assignment operator; makes a string token from a string.

Parameters:
aVal The string to copy in its compact format

Reimplemented in RStringToken.

Definition at line 15 of file stringpool.inl.

Friends And Related Function Documentation

class CStringPoolImplementation [friend]

Definition at line 83 of file stringpool.h.

class RStringBase [friend]

Definition at line 81 of file stringpool.h.

class RStringPool [friend]

Definition at line 80 of file stringpool.h.

class RStringTokenEither [friend]

Definition at line 82 of file stringpool.h.

Member Data Documentation

TUint32 RStringTokenBase::iVal [protected]

Definition at line 85 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl
Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


RStringTokenF Class Reference

A compact (4 byte) representation of a case-insensitive string in the string pool. More...

#include <stringpool.h>

Inheritance diagram for RStringTokenF

[legend]
Collaboration diagram for RStringTokenF:

[legend]
List of all members.

Public Methods

TBool | operator== (RStringTokenF aVal)const
Comparison operator. More...

TBool | operator!= (RStringTokenF aVal)const
Comparison operator. More...

RStringTokenF | operator= (RStringF aVal)
Assignment operator with folded (case-insensitive) rules; makes a string token from a string . More...

Detailed Description

A compact (4 byte) representation of a case-insensitive string in the string pool.

This class must be turned into a RStringF before you can do anything useful with it. It is only intended to be used when storing strings in situations where space matters; normaly use RStringF.

See also:
RStringF

Definition at line 114 of file stringpool.h.

Member Function Documentation

TBool RStringTokenF::operator!= ( RStringTokenF aVal ) const [inline]

Comparison operator.

Parameters:
aVal The string to compare.in its compact format

Definition at line 58 of file stringpool.inl.

RStringTokenF RStringTokenF::operator= ( RStringF aVal ) [inline]

Assignment operator with folded (case-insensitive) rules; makes a string token from a string .

Parameters:
aVal The string to copy

Definition at line 65 of file stringpool.inl.

TBool RStringTokenF::operator== ( RStringTokenF aVal ) const [inline]

Comparison operator.

Parameters:
aVal The string to compare.its compact format

Definition at line 51 of file stringpool.inl.

Friends And Related Function Documentation

class CStringPoolImplementation [friend]

Reimplemented from RStringTokenBase.

Definition at line 125 of file stringpool.h.

class RStringF [friend]

Definition at line 124 of file stringpool.h.

class RStringPool [friend]

Reimplemented from RStringTokenBase.

Definition at line 123 of file stringpool.h.

The documentation for this class was generated from the following files:
  • stringpool.h
  • stringpool.inl
Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Hierarchical Index

String Pool Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:

  • RStringBase
    • RString
    • RStringF
  • RStringPool
  • MStringPoolCloseCallBack
  • TStringTable
  • RStringTokenBase
    • RStringToken
    • RStringTokenF


Graphical Class Hierarchy

String Pool Graphical Class Hierarchy

Go to the textual class hierarchy

Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Member List

MStringPoolCloseCallBack Member List

This is the complete list of members for MStringPoolCloseCallBack, including all inherited members.
  • StringPoolClosing()=0 [pure virtual]


Member List

RString Member List

This is the complete list of members for RString, including all inherited members.
  • Close()
  • Copy() [inline]
  • RStringBase() [inline]
  • Pool()const [inline]
  • OriginalTableRef()const
  • operator RStringToken()const [inline]
  • operator==(const RString &aVal)const [inline]
  • operator!=(const RString &aVal)const [inline]
  • operator RStringTokenBase()const [inline]
  • Index(const TStringTable &aTable)const
  • DesC()const


Member List

RStringBase Member List

This is the complete list of members for RStringBase, including all inherited members.
  • Close()
  • RStringBase() [inline]
  • Pool()const [inline]
  • OriginalTableRef()const
  • operator RStringTokenBase()const [inline]
  • Index(const TStringTable &aTable)const
  • DesC()const
  • Copy()


Member List

RStringF Member List

This is the complete list of members for RStringF, including all inherited members.
  • Close()
  • Copy() [inline]
  • RStringBase() [inline]
  • Pool()const [inline]
  • OriginalTableRef()const
  • operator RStringTokenF()const [inline]
  • operator==(const RStringF &aVal)const [inline]
  • operator!=(const RStringF &aVal)const [inline]
  • operator RStringTokenBase()const [inline]
  • Index(const TStringTable &aTable)const
  • DesC()const


Member List

RStringPool Member List

This is the complete list of members for RStringPool, including all inherited members.
  • Close()
  • StringF(RStringTokenF aString)const
  • StringF(TInt aIndex,const TStringTable &aTable)const
  • String(RStringToken aString)const
  • String(TInt aIndex,const TStringTable &aTable)const
  • RStringPool() [inline]
  • OpenStringL(const TDesC8 &aString)const
  • OpenL()
  • OpenL(const TStringTable &aTable)
  • OpenL(const TStringTable &aTable,MStringPoolCloseCallBack &aCallBack)
  • OpenFStringL(const TDesC8 &aString)const


Member List

RStringToken Member List

This is the complete list of members for RStringToken, including all inherited members.
  • IsNull()const [inline]
  • RStringTokenBase() [inline]
  • operator==(RStringToken aVal)const [inline]
  • operator!=(RStringToken aVal)const [inline]
  • operator=(RString aVal) [inline]


Member List

RStringTokenBase Member List

This is the complete list of members for RStringTokenBase, including all inherited members.
  • RStringTokenBase() [inline]
  • operator=(RStringBase aVal) [inline]
  • IsNull()const [inline]
Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Member List

RStringTokenF Member List

This is the complete list of members for RStringTokenF, including all inherited members.
  • IsNull()const [inline]
  • RStringTokenBase() [inline]
  • operator==(RStringTokenF aVal)const [inline]
  • operator!=(RStringTokenF aVal)const [inline]
  • operator=(RStringF aVal) [inline]
  • RStringTokenBase::operator=(RStringBase aVal) [inline]
Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Alphabetical index

String Pool Compound Index

S | RStringBase | RStringPool | TStringTable | RStringTokenBase
RString | RStringF | MStringPoolCloseCallBack | RStringToken | RStringTokenF


Compound Member Index

String Pool Compound Members

Here is a list of all documented class members with links to the classes they belong to:
  • Close() : RStringBase, RStringPool
  • Copy() : RStringF, RString, RStringBase
  • Pool() : RStringBase
  • StringPoolClosing() : MStringPoolCloseCallBack
  • OriginalTableRef() : RStringBase
  • iTable : TStringTable
  • operator RStringTokenBase() : RStringBase
  • operator!=() : RStringF, RString, RStringTokenF, RStringToken
  • RStringPool() : RStringPool
  • StringF() : RStringPool
  • String() : RStringPool
  • OpenFStringL() : RStringPool
  • RStringTokenBase() : RStringTokenBase
  • operator RStringTokenF() : RStringF
  • operator RStringToken() : RString
  • Index() : RStringBase
  • iCount : TStringTable
  • IsNull() : RStringTokenBase
  • operator==() : RStringF, RString, RStringTokenF, RStringToken
  • operator=() : RStringTokenF, RStringToken, RStringTokenBase
  • OpenStringL() : RStringPool
  • OpenL() : RStringPool
  • RStringBase() : RStringBase
  • iCaseSensitive : TStringTable
  • DesC() : RStringBase


Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented
{
  private:
    Used *m_usedClass;
};
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 200 this will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled black box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class for which not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
The arrows have the following meaning:
  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
Generated at Wed Mar 20 17:37:40 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


StringPool.dox Source File

StringPool.dox

00001
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


stringpool.h Source File

stringpool.h

00001 //
00002 // Copyright (C) 2001 Symbian Ltd
00003
00004 #ifndef __STRINGPOOL_H__
00005 #define __STRINGPOOL_H__
00006
00007 #include <e32base.h>
00008 #include <StringTableSupport.h>
00009 #include "StringPoolErr.h"
00010
00011 class RStringF;
00012 class RString;
00013 class RStringToken;
00014 class RStringTokenF;
00015 class MStringPoolCloseCallBack;
00016
00018 class MStringPoolCloseCallBack
00019     {
00021     public:
00022         virtual void StringPoolClosing()=0;
00023     };
00024
00030 class RStringPool
00031     {
00032  public:
00033     inline RStringPool();
00034
00035     IMPORT_C void OpenL();
00036
00037     IMPORT_C void OpenL(const TStringTable& aTable);
00038
00039     IMPORT_C void OpenL(const TStringTable& aTable,MStringPoolCloseCallBack& aCallBack);
00040
00041     IMPORT_C void Close();
00042
00043     IMPORT_C RStringF OpenFStringL(const TDesC8& aString) const;
00044
00045     IMPORT_C RString OpenStringL(const TDesC8& aString) const;
00046
00047     IMPORT_C RString String(RStringToken aString) const;
00048
00049     IMPORT_C RString String(TInt aIndex,const TStringTable& aTable) const;
00050
00051     IMPORT_C RStringF StringF(RStringTokenF aString) const;
00052
00053     IMPORT_C RStringF StringF(TInt aIndex,const TStringTable& aTable) const;
00054
00055  private:
00056     friend class RStringBase;
00057     friend class RString;
00058     friend class RStringF;
00059     friend class CStringPoolImplementation;
00060
00061     CStringPoolImplementation* iImplementation;
00062     };
00063
00070 class RStringTokenBase
00071     {
00072  public:
00073     inline RStringTokenBase();
00074
00075     inline RStringTokenBase operator=(RStringBase aVal);
00076
00077     inline TBool IsNull() const;
00078
00079  protected:
00080     friend class RStringPool;
00081     friend class RStringBase;
00082     friend class RStringTokenEither;
00083     friend class CStringPoolImplementation;
00084
00085     TUint32 iVal;
00086     };
00087
00094 class RStringToken : public RStringTokenBase
00095     {
00096  public:
00097     inline TBool operator==(RStringToken aVal) const;
00098
00099     inline TBool operator!=(RStringToken aVal) const;
00100
00101     inline RStringToken operator=(RString aVal);
00102
00103     friend class RStringPool;
00104     friend class RString;
00105     friend class CStringPoolImplementation;
00106     };
00107
00114 class RStringTokenF  : public RStringTokenBase
00115     {
00116  public:
00117     inline TBool operator==(RStringTokenF aVal) const;
00118
00119     inline TBool operator!=(RStringTokenF aVal) const;
00120
00121     inline RStringTokenF operator=(RStringF aVal);
00122
00123     friend class RStringPool;
00124     friend class RStringF;
00125     friend class CStringPoolImplementation;
00126     };
00127
00134 class RStringBase
00135     {
00136  public:
00137     inline RStringBase();
00138
00139     IMPORT_C void Close();
00140
00141     IMPORT_C RStringBase Copy();
00142
00143     IMPORT_C const TDesC8& DesC() const;
00144
00145     inline operator RStringTokenBase() const;
00146
00147     IMPORT_C TInt Index(const TStringTable& aTable) const;
00148
00149     IMPORT_C const TStringTable*  OriginalTableRef() const;
00150
00151     inline RStringPool Pool() const;
00152
00153  protected:
00154     friend class RStringPool;
00155     friend class RStringTokenBase;
00156
00157     RStringPool iPool;
00158     TUint32 iVal;
00159     };
00160
00167 class RString : public RStringBase
00168     {
00169  public:
00170     inline RString Copy();
00171
00172     inline operator RStringToken() const;
00173
00174     inline TBool operator==(const RString& aVal) const;
00175
00176     inline TBool operator!=(const RString& aVal) const;
00177
00178     friend class RStringPool;
00179     friend class RStringToken;
00180     };
00181
00188 class RStringF : public RStringBase
00189     {
00190  public:
00191     inline RStringF Copy();
00192
00193     inline operator RStringTokenF() const;
00194
00195     inline TBool operator==(const RStringF& aVal) const;
00196
00197     inline TBool operator!=(const RStringF& aVal) const;
00198
00199     friend class RStringPool;
00200     friend class RStringTokenF;
00201     };
00202
00203
00206 struct TStringTable
00207     {
00209     TUint iCount;
00211     const void* const * iTable;
00212
00214     TBool iCaseSensitive;
00215     };
00216
00217 // Include the inline functions
00218 #include <stringpool.inl>
00219
00220 #endif // __STRINGPOOL_H__
00221
00222
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


stringpool.inl Source File

stringpool.inl

00001 // Copyright (c) Symbian Ltd. 2001
00002
00003 #ifndef __STRINGPOOL_INL__
00004 #define __STRINGPOOL_INL__
00005
00006
00008 inline RStringTokenBase::RStringTokenBase()
00009         : iVal(0)
00010     {
00011     }
00012
00015 inline RStringTokenBase RStringTokenBase::operator=(RStringBase aVal)
00016     {
00017     iVal = aVal.iVal;
00018     return *this;
00019     }
00020
00022 inline TBool RStringTokenBase::IsNull() const
00023     {
00024     return (iVal == 0);
00025     }
00026
00029 inline TBool RStringToken::operator==(RStringToken aVal) const
00030     {
00031     return iVal == aVal.iVal;
00032     }
00033
00036 inline TBool RStringToken::operator!=(RStringToken aVal) const
00037     {
00038     return iVal != aVal.iVal;
00039     }
00040
00043 inline RStringToken RStringToken::operator=(RString aVal)
00044     {
00045     iVal = aVal.iVal;
00046     return *this;
00047     }
00048
00051 inline TBool RStringTokenF::operator==(RStringTokenF aVal) const
00052     {
00053     return iVal == aVal.iVal;
00054     }
00055
00058 inline TBool RStringTokenF::operator!=(RStringTokenF aVal) const
00059     {
00060     return iVal != aVal.iVal;
00061     }
00062
00065 inline RStringTokenF RStringTokenF::operator=(RStringF aVal)
00066     {
00067     iVal = aVal.iVal;
00068     return *this;
00069     }
00070
00072 inline RStringBase::RStringBase()
00073         : iVal(0)
00074     {
00075     }
00076
00078 inline RStringBase::operator RStringTokenBase() const
00079     {
00080     RStringTokenBase s;
00081     s.iVal = iVal;
00082     return s;
00083     }
00084
00088 inline RString RString::Copy()
00089     {
00090     RStringBase::Copy();
00091     return *this;
00092     }
00093
00095 inline RString::operator RStringToken() const
00096     {
00097     RStringToken s;
00098     s.iVal = iVal;
00099     return s;
00100     }
00101
00105 inline RStringF RStringF::Copy()
00106     {
00107     RStringBase::Copy();
00108     return *this;
00109     }
00110
00113 inline TBool RStringF::operator==(const RStringF& aVal) const
00114     {
00115     __ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
00116     return (iVal == aVal.iVal);
00117     }
00118
00121 inline TBool RStringF::operator!=(const RStringF& aVal) const
00122     {
00123     __ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
00124     return (iVal != aVal.iVal);
00125     }
00126
00128 inline RStringF::operator RStringTokenF() const
00129     {
00130     RStringTokenF s;
00131     s.iVal = iVal;
00132     return s;
00133     }
00134
00136 inline RStringPool RStringBase::Pool() const
00137     {
00138     return iPool;
00139     }
00140
00143 inline TBool RString::operator==(const RString& aVal) const
00144     {
00145     __ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
00146     return (iVal == aVal.iVal);
00147     }
00148
00151 inline TBool RString::operator!=(const RString& aVal) const
00152     {
00153     __ASSERT_DEBUG(iPool.iImplementation==aVal.iPool.iImplementation || aVal.iVal==0 || iVal==0, StringPoolPanic::Panic(StringPoolPanic::EComparisonBetweenTwoStringPoolsNotAllowed));
00154     return (iVal != aVal.iVal);
00155     }
00156
00158 inline RStringPool::RStringPool()
00159         : iImplementation(0)
00160     {
00161     }
00162
00163
00164 #endif // __STRINGPOOL_INL__
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


StringPoolAPI.cpp Source File

StringPoolAPI.cpp

00001 // Copyright (c) Symbian 2001
00002
00003 #include "e32std.h"
00004 #include "StringPoolImplementation.h"
00005
00006
00007 const TInt KPanicUsingNullString=1;
00008
00017 EXPORT_C void RStringBase::Close()
00018     {
00019     if (iVal)
00020         //harmless for empty strings
00021         iPool.iImplementation->Close(RStringTokenEither(iVal));
00022     // invalidate the string if it's a dinamic one  otherwise do nothing
00023     if(!StringUtils::IsTableEntry(this->iVal))
00024         iVal=NULL;
00025     }
00026
00030 EXPORT_C RStringBase RStringBase::Copy()
00031     {
00032     if (iVal)
00033         iPool.iImplementation->IncrementCount(RStringTokenEither(iVal));
00034     return *this;
00035     }
00036
00037
00040 EXPORT_C const TDesC8& RStringBase::DesC() const
00041     {
00042     // check for empty string
00043     if (iVal == 0)
00044         return KNullDesC8();
00045     if (StringUtils::IsTableEntry(iVal))
00046         {
00047         TInt index = StringUtils::TableIndex(iVal);
00048         TInt tableUid= StringUtils::TableUid(iVal);
00049         return iPool.iImplementation->TableLookup(index, tableUid);
00050         }
00051     else
00052         return *StringUtils::NodePtr(iVal)->iDes;
00053     }
00054
00055
00060 EXPORT_C TInt RStringBase::Index(const TStringTable& aTable) const
00061     {
00062     //return an error for empty strings(i.e. with iVal=0 )
00063     if(!this->iVal)
00064        return KErrNotFound;
00065     TInt tableId=iPool.iImplementation->TableUid(aTable);
00066     // First check the iVal is part of the same table
00067     if (StringUtils::IsTableEntry(iVal))
00068        {
00069        if (tableId==StringUtils::TableUid(iVal))
00070            return StringUtils::TableIndex(iVal);
00071        }
00072     // Then check if the iVal is in the reverse duplicate list
00073     TInt index=iPool.iImplementation->FindTableIndexFromFirstVal(iVal, tableId);
00074     return index;
00075     }
00076
00077
00081 EXPORT_C const TStringTable* RStringBase::OriginalTableRef() const
00082     {
00083     if(StringUtils::IsTableEntry(iVal))
00084         return &iPool.iImplementation->TableRef(iVal);
00085     else
00086         return NULL;
00087     }
00088
00090
00094 EXPORT_C void RStringPool::OpenL()
00095     {
00096     iImplementation = new (ELeave) CStringPoolImplementation;
00097     }
00098
00105 EXPORT_C void RStringPool::OpenL(const TStringTable& aTable,MStringPoolCloseCallBack& aCallBack)
00106     {
00107     if (!iImplementation)
00108         {
00109         iImplementation = new (ELeave) CStringPoolImplementation;
00110         CleanupClosePushL(*this);
00111         iImplementation->AddTableL(aTable);
00112         iImplementation->AddCallBackL(aCallBack);
00113         CleanupStack::Pop(); //this
00114         }
00115     else
00116         {
00117         iImplementation->AddTableL(aTable);
00118         iImplementation->AddCallBackL(aCallBack);
00119         }
00120     }
00121
00127 EXPORT_C void RStringPool::OpenL(const TStringTable& aTable)
00128     {
00129     if (!iImplementation)
00130         {
00131         iImplementation = new (ELeave) CStringPoolImplementation;
00132         CleanupClosePushL(*this);
00133         iImplementation->AddTableL(aTable);
00134         CleanupStack::Pop(); //this
00135         }
00136     else
00137         {
00138         iImplementation->AddTableL(aTable);
00139         }
00140     }
00141
00142
00145 EXPORT_C void RStringPool::Close()
00146     {
00147     delete iImplementation;
00148     iImplementation = NULL;
00149     }
00150
00156 EXPORT_C
00157 RStringF RStringPool::OpenFStringL(const TDesC8& aString) const
00158     {
00159     RStringTokenEither newString = iImplementation->OpenL(aString, ETrue);
00160     RStringF r;
00161     r.iPool = *this;
00162     r.iVal = newString.iVal;
00163     return r;
00164     }
00165
00171 EXPORT_C
00172 RString RStringPool::OpenStringL(const TDesC8& aString) const
00173     {
00174     RStringTokenEither newString = iImplementation->OpenL(aString, EFalse);
00175     RString r;
00176     r.iPool = *this;
00177     r.iVal = newString.iVal;
00178     return r;
00179     }
00180
00185 EXPORT_C
00186 RString RStringPool::String(RStringToken aString) const
00187     {
00188     RString r;
00189     r.iPool = *this;
00190     r.iVal = aString.iVal;
00191     return r;
00192     }
00193
00198 EXPORT_C
00199 RString RStringPool::String(TInt aIndex,const TStringTable& aTable) const
00200     {
00201     __ASSERT_DEBUG(aTable.iCaseSensitive==1,StringPoolPanic::Panic(StringPoolPanic::ECreatingStringWithWrongCase));
00202     if(aIndex <(TInt)aTable.iCount)
00203         {//the index is in valid range the index
00204         RString r;
00205         r.iPool = *this;
00206         r.iVal = StringUtils::ValFromIndex(aIndex, iImplementation->TableUid(aTable));
00207         TInt originalVal;
00208         if (KErrNotFound!=(originalVal=iImplementation->FindFirstValFromDuplicate(r.iVal)))
00209             {
00210             r.iVal=originalVal;
00211             }
00212         return r;
00213         }
00214     else // the index is out of range
00215     return RString();
00216     }
00217
00221 EXPORT_C
00222 RStringF RStringPool::StringF(RStringTokenF aString) const
00223     {
00224     RStringF r;
00225     r.iPool = *this;
00226     r.iVal = aString.iVal;
00227     return r;
00228     }
00229
00234 EXPORT_C
00235 RStringF RStringPool::StringF(TInt aIndex,const TStringTable& aTable) const
00236     {
00237     __ASSERT_DEBUG(aTable.iCaseSensitive==0,StringPoolPanic::Panic(StringPoolPanic::ECreatingStringWithWrongCase));
00238     if(aIndex <(TInt)aTable.iCount)
00239         {//the index is in valid range the index
00240         RStringF r;
00241         r.iPool = *this;
00242         r.iVal = StringUtils::ValFromIndexF(aIndex, iImplementation->TableUid(aTable));
00243         TInt originalVal;
00244         if (KErrNotFound!=(originalVal=iImplementation->FindFirstValFromDuplicate(r.iVal)))
00245             {
00246             r.iVal=originalVal;
00247             }
00248         return r;
00249         }
00250     else // the index is out of range so return an empty string
00251     return RStringF();
00252     }
Generated at Wed Mar 20 17:37:38 2002 for String Pool by doxygen 1.2.4 written by Dimitri van Heesch, © 1997-2000


Member List

TStringTable Member List

This is the complete list of members for TStringTable, including all inherited members.
  • iCaseSensitive
  • iTable
  • iCount