First public contribution.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfsrv\cl_drive.cpp
23 EXPORT_C TDriveUnit::TDriveUnit(TInt aDrive)
25 Constructor taking a drive number.
27 @param aDrive The drive number.
29 @panic FSCLIENT 0 if aDrive is greater than or equal to KMaxDrives or less than 0.
34 __ASSERT_ALWAYS((aDrive>=0 && aDrive<KMaxDrives),Panic(EDriveUnitBadDrive));
41 EXPORT_C TDriveUnit::TDriveUnit(const TDesC& aDriveText)
43 Constructor taking a drive letter.
45 @param aDriveText A descriptor containing text whose first character is
46 the drive letter. Can be upper or lower case. Trailing text
49 @panic FSCLIENT 1 if the drive letter is invalid, i.e. does not correspond
55 __ASSERT_ALWAYS(RFs::CharToDrive(aDriveText[0],iDrive)==0,Panic(EDriveUnitBadDriveText));
61 EXPORT_C TDriveUnit& TDriveUnit::operator=(TInt aDrive)
63 Assigns the drive number to the drive unit
65 @param aDrive The new drive number.
67 @return A reference to this drive unit.
69 @panic FSCLIENT 0 if aDrive is greater than or equal to KMaxDrives.
74 __ASSERT_ALWAYS(aDrive<KMaxDrives,Panic(EDriveUnitBadDrive));
82 EXPORT_C TDriveUnit& TDriveUnit::operator=(const TDesC& aDriveText)
84 Assigns a drive letter to the drive unit.
86 The letter must be between A and Z or a panic is raised. Any trailing
87 text within the descriptor is ignored.
89 @param aDriveText Descriptor containing text whose first character is
90 the drive letter. It can be upper or lower case.
92 @return A reference to this drive unit.
94 @panic FSCLIENT 1 if the drive letter is invalid, i.e. does not correspond
100 __ASSERT_ALWAYS(RFs::CharToDrive(aDriveText[0],iDrive)==0,Panic(EDriveUnitBadDriveText));
107 EXPORT_C TDriveName TDriveUnit::Name() const
109 Gets the drive unit as text.
111 The drive letter is returned with a trailing colon.
113 @return The drive letter and a trailing colon.
115 @panic FSCLIENT 0 if RFs::DriveToChar() returned an error.
119 TInt r = RFs::DriveToChar(iDrive,driveLetter);
120 __ASSERT_ALWAYS(r == KErrNone, Panic(EDriveUnitBadDrive));
121 TDriveName driveName;
122 driveName.SetLength(2);
123 driveName[0]=(TText)driveLetter;
124 driveName[1]=KDriveDelimiter;