Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: f32file.h
Link against: efsrv.lib

Class TParseBase

TParseBase

Support

Supported from 5.0

Description

Base class for file name parsing.

After the path to be parsed has been set up using the TParse class, the TParsePtr class or the TParsePtrC class, the path name interrogation and extraction functions provided by this class can be used.

These functions allow programs 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 provides functions which allow directories to be added to and popped from the path.

Note:

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


Construction


TParseBase()

TParseBase();

Description

Default C++ constructor. Constructs and initialises a TParseBase object.

[Top]


Component extraction


FullName()

const TDesC& FullName() const;

Description

Gets the complete file specification. This is in the form:

drive-letter: \path\filename.extension

Return value

TDesC&

The fully parsed file specification.


Drive()

TPtrC Drive() const;

Description

Gets the drive letter. The drive letter is in the form:

drive-letter:

Note:

Return value

TPtrC

The drive letter and colon


Path()

TPtrC Path() const;

Description

Gets the path. The path is in the form:

\path\

Return value

TPtrC

The path. Always begins and ends in a backslash.


DriveAndPath()

TPtrC DriveAndPath() const;

Description

Gets the drive letter and path. This is in the form

drive-letter:\path\

Note:

Return value

TPtrC

The drive and path


Name()

TPtrC Name() const;

Description

Gets the filename. This is in the form

filename

Return value

TPtrC

The filename


Ext()

TPtrC Ext() const;

Description

Gets the extension. This is in the form:

-extension

Return value

TPtrC

The extension and preceding dot.


NameAndExt()

TPtrC NameAndExt() const;

Description

Gets the filename and extension. This is in the form:

filename - ext

Return value

TPtrC

The filename and extension

[Top]


Interrogation for presence of components


DrivePresent()

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 toTParse::Set(), TParse::SetNoWild() orRFs::Parse() — not to the resulting fully parsed file specification.

Return value

TBool

True if drive present, false if not.


PathPresent()

TBool PathPresent() const;

Description

Gets whether a path is present. Note that this function refers to a component in the aName argument specified in calls toTParse::Set(), TParse::SetNoWild() orRFs::Parse() — not to the resulting fully parsed file specification.

Return value

TBool

True if path present, false if not.


NamePresent()

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 toTParse::Set(), TParse::SetNoWild() orRFs::Parse() — not to the resulting fully parsed file specification.

This function returns true even if the filename specified inaName contains only wildcards. It only returns FALSEif nothing is specified.

Return value

TBool

True if name present, false if not.


ExtPresent()

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 toTParse::Set(), TParse::SetNoWild() orRFs::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 extension present, false if not.


NameOrExtPresent()

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() orRFs::Parse() — not to the resulting fully parsed file specification.

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

Return value

TBool

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

[Top]


Miscellaneous enquiry functions


IsRoot()

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()

TBool IsWild() const;

Description

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

Return value

TBool

True if wildcards present, false if not.


IsNameWild()

TBool IsNameWild() const;

Description

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

Return value

TBool

True if filename contains wildcards, false if not.


IsExtWild()

TBool IsExtWild() const;

Description

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

Return value

TBool

True if extension contains wildcards, false if not.


IsKMatchAny()

TBool IsKMatchAny() const;

Description

Tests whether either the name or extension contains asterisk wildcards.

Return value

TBool

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


IsKMatchOne()

TBool IsKMatchOne() const;

Description

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

Return value

TBool

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

[Top]


Directory navigation


PopDir()

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 another of the system-wide error codes.


AddDir()

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 add. 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. Must not exceed the maximum filename length (KMaxFileName=256 characters) or an error is returned.

Return value

TInt

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