PbkEngUtils Struct Reference

struct PbkEngUtils
Public Member Functions
IMPORT_C HBufC *AllocL(HBufC *, TInt)
IMPORT_C TIntAppendAndReplaceChars(TDes &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C voidAppendGraphicCharacters(TDes &, const TDesC &, TText)
IMPORT_C MDesCArray *BreakInWordsLC(const TDesC &, TIsWordSeparator)
IMPORT_C TBoolContainSameDigits(const TDesC &, const TDesC &, TInt)
IMPORT_C TIntCopyDigitsFromEnd(const TDesC &, TInt, TDes &)
IMPORT_C HBufC *CopyL(HBufC *, const TDesC &, TInt)
IMPORT_C TIntCountSpaces(const TDesC &)
IMPORT_C voidFindAndOpenDefaultResourceFileLC(RFs &, RResourceFile &)
IMPORT_C voidFindAndOpenResourceFileLC(RFs &, const TDesC &, const TDesC &, const TDesC &, RResourceFile &)
TBool IsEmptyOrAllSpaces(const TDesC &)
IMPORT_C voidReplaceNonGraphicCharacters(TDes &, TText)
IMPORT_C TIntTrimAllAppend(const TDesC &, TDes &)
IMPORT_C TIntTrimAllLength(const TDesC &)
IMPORT_C TIntTrimRightAppend(const TDesC &, TDes &)
IMPORT_C TIntTrimRightLength(const TDesC &)
Private Member Functions
PbkEngUtils()
Public Member Type Definitions
typedef TBool(* TIsWordSeparator

Constructor & Destructor Documentation

PbkEngUtils()

PbkEngUtils()[private]

Hidden, unimplemented constructor.

Member Functions Documentation

AllocL(HBufC *, TInt)

IMPORT_C HBufC *AllocL(HBufC *aBuffer,
TIntaMaxLength
)[static]

Allocates or reallocates aBuffer to be able to hold at least aMaxLength characters.

Parameters

HBufC * aBufferbuffer to (re)allocate. Can be NULL.
TInt aMaxLengthsize for the buffer in characters

AppendAndReplaceChars(TDes &, const TDesC &, const TDesC &, const TDesC &)

IMPORT_C TIntAppendAndReplaceChars(TDes &aDest,
const TDesC &aSrc,
const TDesC &aCharsToReplace,
const TDesC &aReplaceChars
)[static]

Appends a descriptor to another and replaces characters while appending.

Parameters

TDes & aDestdestination descriptor.
const TDesC & aSrcsource descriptor.
const TDesC & aCharsToReplacecharacters to replace from aSrc.
const TDesC & aReplaceCharscharacters to replace to from the same position in aCharsToReplace.

AppendGraphicCharacters(TDes &, const TDesC &, TText)

IMPORT_C voidAppendGraphicCharacters(TDes &aDest,
const TDesC &aSrc,
TTextaChar
)[static]

Appends all graphic characters (TChar::IsGraph()) in a string to another string. Non-graphic characters are replaced with a specified character.

Parameters

TDes & aDestthe string where to append graphic characters.
const TDesC & aSrcthe string where from chracters are appended to aDest.
TText aCharthe character used to replace non-graphic characters in aSrc.

BreakInWordsLC(const TDesC &, TIsWordSeparator)

IMPORT_C MDesCArray *BreakInWordsLC(const TDesC &aText,
TIsWordSeparatoraWordSeparatorFunc = NULL
)[static]

Breaks text into words array.

Parameters

const TDesC & aTexttext to break into words.
TIsWordSeparator aWordSeparatorFunc = NULLfunction for detecting word separator characters. Default implementation uses TChar::IsSpace().

ContainSameDigits(const TDesC &, const TDesC &, TInt)

IMPORT_C TBoolContainSameDigits(const TDesC &aNumText1,
const TDesC &aNumText2,
TIntaNumberOfDigits = 0
)[static]

Returns true if two descriptors contain the same digits in the same order. Skips all non-digit characters when doing the comparison.

Boundary conditions:
  • if both descriptors are empty the result is true

  • if both descriptors contain no digits the result is true

  • if both descriptors contain digits, but the other less than aNumberOfDigits the result is false

  • if both descriptors contain digits, but the other less than aNumberOfDigits the result is false

  • if both descriptors contain the same digits in the same order the result is always true regardless of the value of aNumberOfDigits

Parameters

const TDesC & aNumText1first descriptor to compare.
const TDesC & aNumText2second descriptor to compare.
TInt aNumberOfDigits = 0number of digits to compare from the end of the descriptors, if 0 all digits in both descriptors are compared.

CopyDigitsFromEnd(const TDesC &, TInt, TDes &)

IMPORT_C TIntCopyDigitsFromEnd(const TDesC &aNumText,
TIntaNumberOfDigits,
TDes &aDigitsText
)[static]

Copies specified number of digit characters (c is a digit if TChar(c).IsDigit() is true) from the end of a descriptor to another descriptor. Used in phone number matching.

Parameters

const TDesC & aNumTextthe text containing digits to copy, (i.e. a phone number).
TInt aNumberOfDigitsmaximum number of digits to copy.
TDes & aDigitsTextdescriptor where digits are copied.

CopyL(HBufC *, const TDesC &, TInt)

IMPORT_C HBufC *CopyL(HBufC *aBuffer,
const TDesC &aText,
TIntaMinBufLength = 0
)[static]

Copies aText into aBuffer. The buffer is reallocated if necessary.

Parameters

HBufC * aBufferthe buffer where to copy aText. Can be NULL.
const TDesC & aTexttext to be copied into aBuffer.
TInt aMinBufLength = 0minimum length to allocate for aBuffer.

CountSpaces(const TDesC &)

IMPORT_C TIntCountSpaces(const TDesC &aText)[static]

Returns the number of white space characters in aText.

Parameters

const TDesC & aText

FindAndOpenDefaultResourceFileLC(RFs &, RResourceFile &)

IMPORT_C voidFindAndOpenDefaultResourceFileLC(RFs &aFs,
RResourceFile &aResFile
)[static]

Searches and opens the DLL default resource file. Calls FindAndOpenResourceFileLC.

PbkEngUtils::FindAndOpenResourceFileLC

Parameters

RFs & aFsopen file server handle.
RResourceFile & aResFileresource file to open. If open is succesful, resource file close operation is pushed on to the cleanup stack.

FindAndOpenResourceFileLC(RFs &, const TDesC &, const TDesC &, const TDesC &, RResourceFile &)

IMPORT_C voidFindAndOpenResourceFileLC(RFs &aFs,
const TDesC &aResFileName,
const TDesC &aResFilePath,
const TDesC &aResFileDrive,
RResourceFile &aResFile
)[static]

Searches and opens a resource file.

Exceptions
KErrNoMemory

if out of memory.

KErrNotFound

if the resource file is not found.

KErrBadName

if an empty file name (with path) was supplied

other

error searching or opening the resource file.

Parameters

RFs & aFsopen file server handle.
const TDesC & aResFileNameresource file name.
const TDesC & aResFilePathpath to search the resource file from.
const TDesC & aResFileDriveDrive the resource file is on.
RResourceFile & aResFileresource file to open. If open is succesful, resource file close operation is pushed on to the cleanup stack.

IsEmptyOrAllSpaces(const TDesC &)

TBool IsEmptyOrAllSpaces(const TDesC &aText)[static, inline]

Returns ETrue if aText is either empty or consists of only white space characters.

Parameters

const TDesC & aText

ReplaceNonGraphicCharacters(TDes &, TText)

IMPORT_C voidReplaceNonGraphicCharacters(TDes &aText,
TTextaChar
)[static]

Replaces all non-graphic characters (!TCharIsGraph()) in a string with the specified character.

Parameters

TDes & aTextthe string where to replace non-graphics characters.
TText aCharthe character used to replace non-graphic characters in aText.

TrimAllAppend(const TDesC &, TDes &)

IMPORT_C TIntTrimAllAppend(const TDesC &aText,
TDes &aDest
)[static]

Appends aText to aDest. Ignores all leading and trailing spaces in aText and converts consencutive space characters to a single space character.

Parameters

const TDesC & aTexttext to append as a trimmed version to aDest.
TDes & aDestbuffer where trimmed aText is appended. aDest must have enough room for the copied text.

TrimAllLength(const TDesC &)

IMPORT_C TIntTrimAllLength(const TDesC &aText)[static]

Calculates and returns the trimmed length of aText. Ignores all leading and trailing spaces in aText and calculates consencutive space characters as a single character.

Parameters

const TDesC & aTextthe text whose trimmed length is to be calculated.

TrimRightAppend(const TDesC &, TDes &)

IMPORT_C TIntTrimRightAppend(const TDesC &aText,
TDes &aDest
)[static]

Appends aText to aDest. Ignores all trailing spaces in aText and converts consencutive space characters to a single space character. Leading spaces remain unaffected.

Parameters

const TDesC & aTexttext to append as a trimmed version to aDest.
TDes & aDestbuffer where trimmed aText is appended. aDest must have enough room for the copied text.

TrimRightLength(const TDesC &)

IMPORT_C TIntTrimRightLength(const TDesC &aText)[static]

Calculates and returns the trimmed length of aText. Ignores all trailing spaces in aText and calculates consencutive space characters as a single character. Leading spaces remain unaffected.

Parameters

const TDesC & aTextthe text whose trimmed length is to be calculated.

Member Type Definitions Documentation

Typedef TIsWordSeparator

typedef TBool(*TIsWordSeparator

Definition for a function that returns true if aChar is a word separator character. BreakInWordsL