Component masking

TParse
can be
used to select components from different file and path specifications. The
Set()
function
takes three arguments. They are each parsed into four components: drive, path,
filename and extension.

The example below sets up the
TParse
object
so that it can be used to yield useful information.

The resulting
fp.fullname
will be
A:\path1\file1.xxx.
All
the components that are specified in the file specification (drive and filename)
are put into the result; any missing components (path and extension) are taken
from the related file specification which has next order of precedence; nothing
is specified in the default.

The second example shows how wildcards
are allowed in the filename and extension.

TParse
operations
occur without reference to the file server. Two
RFs::Parse()
functions
perform a
TParse::Set()
using the session path as the
aDefault
argument :
one of these variants specifies an
aRelated
, the other does
not. Use these
RFs::Parse()
functions to parse filenames
with reference to the session path.

Wildcard characters

The
?
and
*
wildcard
characters are supported to indicate a single character, and any sequence
of characters. Both wildcard characters can be used any number of times in
any part of any component of the file specification, except the drive. Although
there is no intention that these will ever change, they are defined as the
constants
KMatchOne
and
KMatchAny
.

Illegal paths

The following restrictions apply
to path components. If any are violated,
TParse
will return
KErrBadName
:

a path component which
is followed by a trailing backslash must also be preceded by a backslash.
For example, the following code will return an error because
DIR\
is
neither a directory nor a file.

_LIT(KText,"DIR\\");
...
TInt r=parse.Set(KText,NULL,NULL);

the length of any component
(and the total path length) must not exceed 256 characters

spaces between the drive
and the first directory in the path are illegal, although there may be spaces
between other path components, for instance between the path or drive and
filename, or within path components. The following code will return an error:

_LIT(KBadText,"C: \\DIR\\");
...
r=parse.Set(KBadText,NULL,NULL);

when using
TParse::SetNoWild()
no
wildcard character may be present in the filename or extension.