diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_filenames_8cpp-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_filenames_8cpp-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ - -
-00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // -00015 -00016 -00017 #include <f32file.h> -00018 #include "CommonFramework.h" -00019 -00020 static RFs fsSession; -00021 -00022 // example functions -00023 void CreatePathsL(); // sets up the paths to parse -00024 void ParseNamesL(const TDesC& aFullName); // does the parsing -00025 -00026 void WaitForKey() -00027 { -00028 _LIT(KMessage,"Press any key to continue\n\n"); -00029 console->Printf(KMessage); -00030 console->Getch(); -00031 } -00032 -00033 static void doExampleL() -00034 { -00035 // Connect to file server -00036 User::LeaveIfError(fsSession.Connect()); // Start session -00037 CreatePathsL(); -00038 fsSession.Close(); // close session -00039 } -00040 -00041 void CreatePathsL() -00042 { -00043 // Define descriptor constants using the _LIT macro -00044 _LIT(KFuncName,"\nDoParsing()\n"); -00045 _LIT(KParse1,"d:\\path\\fn.ext"); -00046 _LIT(KParse2,"autoexec.bat"); -00047 _LIT(KParse3,"\\readme"); -00048 _LIT(KParse4,"\\include\\stdio.h"); -00049 _LIT(KParse5,".profile"); -00050 _LIT(KParse6,"autoexec.*"); -00051 console->Printf(KFuncName); -00052 // Parse a full path, then paths with various components missing -00053 // to show the results of using a default path and related path -00054 // to fill in missing path components. -00055 ParseNamesL(KParse1); -00056 WaitForKey(); -00057 ParseNamesL(KParse2); -00058 WaitForKey(); -00059 ParseNamesL(KParse3); -00060 WaitForKey(); -00061 ParseNamesL(KParse4); -00062 WaitForKey(); -00063 ParseNamesL(KParse5); -00064 WaitForKey(); -00065 ParseNamesL(KParse6); -00066 WaitForKey(); -00067 } -00068 -00069 void ParseNamesL(const TDesC& aFullName) -00070 { -00071 _LIT(KFullName,"Full name=%S\n"); -00072 _LIT(KPathComponents,"Drive=%S path=%S name=%S ext=%S\n"); -00073 _LIT(KFullNameText,"Full name against session path=%S\n"); -00074 _LIT(KExtension,".txt"); -00075 _LIT(KParsedPath,"Full name against session path and default extension=%S\n"); -00076 -00077 // Set up parse using TParse::Set(). Print whole path, then each path -00078 // component in turn. -00079 // Parse path using the default session path, using RFs::Parse -00080 // then additionally with a related path. -00081 TParse p; -00082 // do isolated parse -00083 User::LeaveIfError(p.Set(aFullName,NULL,NULL)); -00084 console->Printf(KFullName, &p.FullName()); -00085 TFileName drivename(p.Drive()); -00086 TFileName pathname(p.Path()); -00087 TFileName filename(p.Name()); -00088 TFileName extension(p.Ext()); -00089 console->Printf(KPathComponents,&drivename,&pathname,&filename,&extension); -00090 // do parse including session path -00091 User::LeaveIfError(fsSession.Parse(aFullName,p)); -00092 console->Printf(KFullNameText,&(p.FullName())); -00093 // add default extension -00094 User::LeaveIfError(fsSession.Parse(aFullName,KExtension,p)); -00095 console->Printf(KParsedPath,&(p.FullName())); -00096 } -00097 -00098 -00099 -00100 -