Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: f32file.h
Link against: efsrv.lib

Class TParseBase

class TParseBase;

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.

Members

Defined in TParseBase:
AddDir(), Drive(), DriveAndPath(), DrivePresent(), Ext(), ExtPresent(), FullName(), IsExtWild(), IsKMatchAny(), IsKMatchOne(), IsNameWild(), IsRoot(), IsWild(), Name(), NameAndExt(), NameBuf(), NameBufC(), NameOrExtPresent(), NamePresent(), Path(), PathPresent(), PopDir(), TParseBase(), iMod

See also:


Construction and destruction


TParseBase()

IMPORT_C TParseBase();

Description

Default constructor.

[Top]


Member functions


PopDir()

IMPORT_C TInt PopDir();

Description

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.

Return value

TInt

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


AddDir()

IMPORT_C TInt AddDir(const TDesC &aName);

Description

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.

Parameters

const TDesC &aName

The 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.

Return value

TInt

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

See also:


FullName()

IMPORT_C const TDesC &FullName() const;

Description

Gets the complete file specification.

This is in the form:

drive-letter: \path\filename.extension

Return value

const TDesC &

The fully parsed file specification.


Drive()

IMPORT_C TPtrC Drive() const;

Description

Gets the drive letter.

The drive letter is in the form:

drive-letter:

Note that the drive letter is folded.

Return value

TPtrC

The drive letter and colon.


Path()

IMPORT_C TPtrC Path() const;

Description

Gets the path.

The path is in the form:

\path\

Return value

TPtrC

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


DriveAndPath()

IMPORT_C TPtrC DriveAndPath() const;

Description

Gets the drive letter and path.

This is in the form

drive-letter:\path\

Note that the drive letter is folded

Return value

TPtrC

The drive and path.


Name()

IMPORT_C TPtrC Name() const;

Description

Gets the filename.

This is in the form

filename

Return value

TPtrC

The filename.


Ext()

IMPORT_C TPtrC Ext() const;

Description

Gets the extension.

This is in the form:

.extension

Return value

TPtrC

The extension and preceding dot.


NameAndExt()

IMPORT_C TPtrC NameAndExt() const;

Description

Gets the filename and extension.

This is in the form:

filename.ext

Return value

TPtrC

The filename and extension.


DrivePresent()

IMPORT_C TBool DrivePresent() const;

Description

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.

Return value

TBool

True if a drive present, false if not.

See also:


PathPresent()

IMPORT_C TBool PathPresent() const;

Description

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.

Return value

TBool

True if a path present, false if not.

See also:


NamePresent()

IMPORT_C TBool NamePresent() const;

Description

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.

Return value

TBool

True if a name present, false if not.


ExtPresent()

IMPORT_C TBool ExtPresent() const;

Description

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.

Return value

TBool

True if an extension present, false if not.


NameOrExtPresent()

IMPORT_C TBool NameOrExtPresent() const;

Description

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.

Return value

TBool

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


IsRoot()

IMPORT_C TBool IsRoot() const;

Description

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

Return value

TBool

True if path is root, false if not.


IsWild()

IMPORT_C TBool IsWild() const;

Description

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

Return value

TBool

True if wildcards are present, false if not.


IsKMatchOne()

IMPORT_C TBool IsKMatchOne() const;

Description

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

Return value

TBool

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


IsKMatchAny()

IMPORT_C TBool IsKMatchAny() const;

Description

Tests whether the name or the extension contains asterisk wildcards.

Return value

TBool

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


IsNameWild()

IMPORT_C TBool IsNameWild() const;

Description

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

Return value

TBool

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


IsExtWild()

IMPORT_C TBool IsExtWild() const;

Description

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

Return value

TBool

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


NameBuf()

protected: virtual TDes &NameBuf()=0;

Description

Return value

TDes &


NameBufC()

protected: virtual const TDesC &NameBufC() const=0;

Description

Return value

const TDesC &

[Top]


Member data


iMod

protected: TInt16 iMod;

Description