TParseBase Class Reference

#include <f32file.h>

class TParseBase
Protected Attributes
TInt16 iMod
Public Member Functions
TParseBase()
IMPORT_C TIntAddDir(const TDesC &)
IMPORT_C TPtrCDrive()
IMPORT_C TPtrCDriveAndPath()
IMPORT_C TBoolDrivePresent()
IMPORT_C TPtrCExt()
IMPORT_C TBoolExtPresent()
IMPORT_C const TDesC &FullName()
IMPORT_C TBoolIsExtWild()
IMPORT_C TBoolIsKMatchAny()
IMPORT_C TBoolIsKMatchOne()
IMPORT_C TBoolIsNameWild()
IMPORT_C TBoolIsRoot()
IMPORT_C TBoolIsWild()
IMPORT_C TPtrCName()
IMPORT_C TPtrCNameAndExt()
IMPORT_C TBoolNameOrExtPresent()
IMPORT_C TBoolNamePresent()
IMPORT_C TPtrCPath()
IMPORT_C TBoolPathPresent()
IMPORT_C TIntPopDir()
Protected Member Functions
pure virtual TDes &NameBuf()
pure virtual const TDesC &NameBufC()
TInt Set(const TDesC *, const TDesC *, const TDesC *, TBool)

Detailed Description

Base class for file name parsing.

You first need to set up the path to be parsed using either a TParse, TParsePtr or TParsePtrC object.

The interrogation and extraction functions in this class allow you to test whether a component has been specified in the pathname, and if so, to extract it. If a component is not present in the pathname, the extraction function returns an empty string.

This class also allows directories to be added to, and popped from the path.

Notes:

1. the filename modification functions cannot be used by the TParsePtrC class.

2. navigation using .. and . is not supported.

See also: TParse TParsePtr TParsePtrC

Member Attribute Documentation

iMod

TInt16 iMod[protected]

Constructor & Destructor Documentation

TParseBase ( )

IMPORT_CTParseBase()

Default constructor.

Member Function Documentation

AddDir ( const TDesC & )

IMPORT_C TIntAddDir(const TDesC &aName)

Adds a single directory onto the end of the path in the fully parsed specification.

The directory is inserted between the final directory, and the filename, if there is one.

See also: KMaxFileName

ParameterDescription
aNameThe directory to be added. It must not start with a \ otherwise the function does not recognise it as a valid directory name and an error is returned. The directory name must not end with a \ since the function adds this automatically. It must not exceed the maximum filename length, KMaxFileName characters, otherwise an error is returned.

Returns: KErrNone if successful, otherwise another of the system-wide error codes.

Drive ( )

IMPORT_C TPtrCDrive()const

Gets the drive letter.

The drive letter is in the form:

drive-letter:

Note that the drive letter is folded.

Returns: The drive letter and colon.

DriveAndPath ( )

IMPORT_C TPtrCDriveAndPath()const

Gets the drive letter and path.

This is in the form

drive-letter:\path\

Note that the drive letter is folded

Returns: The drive and path.

DrivePresent ( )

IMPORT_C TBoolDrivePresent()const

Tests whether a drive is present.

Note that this function refers to a component in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not to the resulting fully parsed file specification.

See also: TParse RFs

Returns: True if a drive present, false if not.

Ext ( )

IMPORT_C TPtrCExt()const

Gets the extension.

This is in the form:

.extension

Returns: The extension and preceding dot.

ExtPresent ( )

IMPORT_C TBoolExtPresent()const

Tests whether an extension is present.

Note that this function refers to a component in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not to the resulting fully parsed file specification.

This function returns true even if the extension contains only wildcards. It only returns false if nothing is specified.

Returns: True if an extension present, false if not.

FullName ( )

IMPORT_C const TDesC &FullName()const

Gets the complete file specification.

This is in the form:

drive-letter: \path\filename.extension

Returns: The fully parsed file specification.

IsExtWild ( )

IMPORT_C TBoolIsExtWild()const

Tests whether the extension in the fully parsed specification contains one or more wildcard characters.

Returns: True if the extension contains wildcard characters, false if not.

IsKMatchAny ( )

IMPORT_C TBoolIsKMatchAny()const

Tests whether the name or the extension contains asterisk wildcards.

Returns: True if either the name or extension has a * wild card, false otherwise.

IsKMatchOne ( )

IMPORT_C TBoolIsKMatchOne()const

Tests whether the name or the extension contains a question mark wildcard.

Returns: True if either the name or extension has a ? wild card, false otherwise.

IsNameWild ( )

IMPORT_C TBoolIsNameWild()const

Tests whether the filename in the fully parsed specification contains one or more wildcard characters.

Returns: True if the filename contains wildcard characters, false if not.

IsRoot ( )

IMPORT_C TBoolIsRoot()const

Tests whether the path in the fully parsed specification is the root directory.

Returns: True if path is root, false if not.

IsWild ( )

IMPORT_C TBoolIsWild()const

Tests whether the filename or the extension in the fully parsed specification contains one or more wildcard characters.

Returns: True if wildcards are present, false if not.

Name ( )

IMPORT_C TPtrCName()const

Gets the filename.

This is in the form

filename

Returns: The filename.

NameAndExt ( )

IMPORT_C TPtrCNameAndExt()const

Gets the filename and extension.

This is in the form:

filename.ext

Returns: The filename and extension.

NameBuf ( )

TDes &NameBuf()[protected, pure virtual]

NameBufC ( )

const TDesC &NameBufC()const [protected, pure virtual]

NameOrExtPresent ( )

IMPORT_C TBoolNameOrExtPresent()const

Tests whether a filename or an extension are present.

Note that this function refers to a component in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not to the resulting fully parsed file specification.

This function returns true even if the filename or extension specified in aName contain only wildcards. It only returns false if nothing is specified.

Returns: True if either a name or an extension or both are present, otherwise false.

NamePresent ( )

IMPORT_C TBoolNamePresent()const

Tests whether a file name is present.

Note that this function refers to a component in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not to the resulting fully parsed file specification.

This function returns true even if the filename specified in aName contains only wildcards. It only returns false if nothing is specified.

Returns: True if a name present, false if not.

Path ( )

IMPORT_C TPtrCPath()const

Gets the path.

The path is in the form:

\path\

Returns: The path. It always begins and ends in a backslash.

PathPresent ( )

IMPORT_C TBoolPathPresent()const

Tests whether a path is present.

Note that this function refers to a component in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not to the resulting fully parsed file specification.

See also: TParse RFs

Returns: True if a path present, false if not.

PopDir ( )

IMPORT_C TIntPopDir()

Removes the last directory from the path in the fully parsed specification.

This function may be used to navigate up one level in a directory hierarchy. An error is returned if the specified directory is the root.

Returns: KErrNone if successful, otherwise one of the other system-wide error codes.

Set ( const TDesC *, const TDesC *, const TDesC *, TBool )

TInt Set(const TDesC *aName,
const TDesC *aRelated,
const TDesC *aDefault,
TBoolallowWild
)[protected]