Symbian3/SDK/Source/GUID-2CE8544C-470C-5693-8ED6-27B01DD9548B.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     6
<!-- Initial Contributors:
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     7
    Nokia Corporation - initial contribution.
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     8
Contributors: 
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     9
-->
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    10
<!DOCTYPE concept
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    12
<concept xml:lang="en" id="GUID-2CE8544C-470C-5693-8ED6-27B01DD9548B"><title>How to parse a pathname</title><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Retrieving individual components</title> <p>The following code fragment shows how the individual components are extracted using the <codeph>TParseBase</codeph> functions:</p> <codeblock id="GUID-B1605907-E17B-57F6-B9BB-8D977E02376A" xml:space="preserve">_LIT(KPath,"c:\\wrd\\meeting.wrd");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    13
...
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    14
TParse p;
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    15
p.Set(KPath,NULL,NULL);
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    16
p.Name();       // gives "meeting"
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    17
p.NameAndExt(); // gives "meeting.wrd"
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    18
...</codeblock> </section> <section><title>Component masking</title> <p><codeph>TParse</codeph> can be used to select components from different file and path specifications. The <codeph>Set()</codeph> function takes three arguments. They are each parsed into four components: drive, path, filename and extension.</p> <p>The example below sets up the <codeph>TParse</codeph> object so that it can be used to yield useful information.</p> <codeblock id="GUID-14D77BE2-C607-5018-A9B5-E7E4A54FB0F1" xml:space="preserve">_LIT(KSpec,"A:file1");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    19
_LIT(KRelated,"C:\\path1\\related.xxx");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    20
TParse fp;
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    21
fp.Set(KSpec,&amp;KRelated,NULL);</codeblock> <table id="GUID-31958460-AEB8-5876-806B-08982A62FE97"><tgroup cols="5"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/><colspec colname="col3"/><colspec colname="col4"/><tbody><row><entry/><entry><p>drive</p> </entry> <entry><p>path</p> </entry> <entry><p>filename</p> </entry> <entry><p>extension</p> </entry> </row> <row><entry><p>file specification</p> </entry> <entry><p><filepath>A:</filepath> </p> </entry> <entry/><entry><p><filepath>file1</filepath> </p> </entry> <entry/></row> <row><entry><p>related name</p> </entry> <entry><p><filepath>C:</filepath> </p> </entry> <entry><p><filepath>\path1\</filepath> </p> </entry> <entry><p><filepath>related</filepath> </p> </entry> <entry><p><filepath>.xxx</filepath> </p> </entry> </row> <row><entry><p>default name</p> </entry> <entry/><entry/><entry/><entry/></row> <row><entry><p>result</p> </entry> <entry><p><filepath>A:</filepath> </p> </entry> <entry><p><filepath>\path1\</filepath> </p> </entry> <entry><p><filepath>file1</filepath> </p> </entry> <entry><p><filepath>.xxx</filepath> </p> </entry> </row> </tbody> </tgroup> </table> <p>The resulting <codeph>fp.fullname</codeph> will be <codeph>A:\path1\file1.xxx.</codeph> 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.</p> <p>The second example shows how wildcards are allowed in the filename and extension.</p> <codeblock id="GUID-17D1D396-FC67-5097-9165-B159F549BFC1" xml:space="preserve">    TParse fp;
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    22
    _LIT(KSpec,"A:file1");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    23
    _LIT(KDefault,"C:\\path1\\*.*");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    24
    fp.Set(KSpec,NULL,&amp;KDefault);</codeblock> <table id="GUID-9CEADC99-16FE-50FD-B401-AB595B91D48C"><tgroup cols="5"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/><colspec colname="col3"/><colspec colname="col4"/><tbody><row><entry><p>  </p> </entry> <entry><p>drive</p> </entry> <entry><p>path</p> </entry> <entry><p>filename</p> </entry> <entry><p>extension</p> </entry> </row> <row><entry><p>file specification</p> </entry> <entry><p><filepath>A:</filepath> </p> </entry> <entry/><entry><p><filepath>file1</filepath> </p> </entry> <entry/></row> <row><entry><p>related filename</p> </entry> <entry/><entry/><entry/><entry/></row> <row><entry><p>default filename</p> </entry> <entry><p><filepath>C:</filepath> </p> </entry> <entry><p><filepath>\path1\</filepath> </p> </entry> <entry><p><filepath>*</filepath> </p> </entry> <entry><p><filepath>.*</filepath> </p> </entry> </row> <row><entry><p>result</p> </entry> <entry><p><filepath>A:</filepath> </p> </entry> <entry><p><filepath>\path1\</filepath> </p> </entry> <entry><p><filepath>file1</filepath> </p> </entry> <entry><p><filepath>.*</filepath> </p> </entry> </row> </tbody> </tgroup> </table> <p>The resulting <codeph>fp.fullname</codeph> will be <codeph>A:\path1\file1.*</codeph> </p> <p><b>Parsing with reference to the session default directory</b> </p> <p><codeph>TParse</codeph> operations occur without reference to the file server. Two <codeph>RFs::Parse()</codeph> functions perform a <codeph>TParse::Set()</codeph> using the session path as the <codeph>aDefault</codeph> argument : one of these variants specifies an <codeph>aRelated</codeph>, the other does not. Use these <codeph>RFs::Parse()</codeph> functions to parse filenames with reference to the session path.</p> </section> <section><title>Wildcard characters</title> <p>The <codeph>?</codeph> and <codeph>*</codeph> 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 <codeph>KMatchOne</codeph> and <codeph>KMatchAny</codeph>.</p> </section> <section><title>Illegal paths</title> <p>The following restrictions apply to path components. If any are violated, <codeph>TParse</codeph> will return <codeph>KErrBadName</codeph>: </p> <ul><li id="GUID-A1BF9F97-F77C-54D1-AF22-EDB4E06699B6"><p>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 <filepath>DIR\</filepath> is neither a directory nor a file.</p> </li> </ul> <codeblock id="GUID-C7988B04-ECA0-5BED-B90E-2415C66F141B" xml:space="preserve">_LIT(KText,"DIR\\");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    25
...
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    26
TInt r=parse.Set(KText,NULL,NULL);</codeblock> <ul><li id="GUID-8B2C6A24-A7AD-5210-8B33-F4E4C328BA57"><p>the length of any component (and the total path length) must not exceed 256 characters</p> </li> <li id="GUID-A10B9251-BF06-5FB3-A74F-E2E9F2B9A0EE"><p>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:</p> </li> </ul> <codeblock id="GUID-7036B814-8A5F-549F-B580-13383E424B20" xml:space="preserve">_LIT(KBadText,"C: \\DIR\\");
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    27
...
89d6a7a84779 Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    28
r=parse.Set(KBadText,NULL,NULL);</codeblock> <ul><li id="GUID-83462E03-77BF-5692-90AF-729ACE4B7C8E"><p>when using <codeph>TParse::SetNoWild()</codeph> no wildcard character may be present in the filename or extension.</p> </li> </ul> </section> </conbody></concept>