userlibandfileserver/fileserver/sfsrv/cl_drive.cpp
author Tom Cosgrove <tom.cosgrove@nokia.com>
Fri, 28 May 2010 16:29:07 +0100
changeset 30 8aab599e3476
parent 0 a41df078684a
permissions -rw-r--r--
Fix for bug 2283 (RVCT 4.0 support is missing from PDK 3.0.h) Have multiple extension sections in the bld.inf, one for each version of the compiler. The RVCT version building the tools will build the runtime libraries for its version, but make sure we extract all the other versions from zip archives. Also add the archive for RVCT4.

// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// f32\sfsrv\cl_drive.cpp
// 
//

#include "cl_std.h"




EXPORT_C TDriveUnit::TDriveUnit(TInt aDrive)
/**
Constructor taking a drive number.

@param aDrive The drive number.

@panic FSCLIENT 0 if aDrive is greater than or equal to KMaxDrives or less than 0.

@see KMaxDrives
*/
	{
	__ASSERT_ALWAYS((aDrive>=0 && aDrive<KMaxDrives),Panic(EDriveUnitBadDrive));
	iDrive=aDrive;
	}




EXPORT_C TDriveUnit::TDriveUnit(const TDesC& aDriveText)
/**
Constructor taking a drive letter.

@param aDriveText A descriptor containing text whose first character is
                  the drive letter. Can be upper or lower case. Trailing text
                  is ignored.
                  
@panic FSCLIENT 1 if the drive letter is invalid, i.e. does not correspond
       to a drive number.
       
@see RFs::CharToDrive
*/
	{
	__ASSERT_ALWAYS(RFs::CharToDrive(aDriveText[0],iDrive)==0,Panic(EDriveUnitBadDriveText));
	}




EXPORT_C TDriveUnit& TDriveUnit::operator=(TInt aDrive)
/**
Assigns the drive number to the drive unit

@param aDrive The new drive number.

@return A reference to this drive unit. 

@panic FSCLIENT 0 if aDrive is greater than or equal to KMaxDrives.

@see KMaxDrives
*/
	{
	__ASSERT_ALWAYS(aDrive<KMaxDrives,Panic(EDriveUnitBadDrive));
	iDrive=aDrive;
	return *this;
	}




EXPORT_C TDriveUnit& TDriveUnit::operator=(const TDesC& aDriveText)
/**
Assigns a drive letter to the drive unit.

The letter must be between A and Z or a panic is raised. Any trailing
text within the descriptor is ignored.

@param aDriveText Descriptor containing text whose first character is
                  the drive letter. It can be upper or lower case.
                  
@return A reference to this drive unit. 

@panic FSCLIENT 1 if the drive letter is invalid, i.e. does not correspond
       to a drive number.
       
@see RFs::CharToDrive                  
*/
	{
	__ASSERT_ALWAYS(RFs::CharToDrive(aDriveText[0],iDrive)==0,Panic(EDriveUnitBadDriveText));
	return *this;
	}




EXPORT_C TDriveName TDriveUnit::Name() const
/**
Gets the drive unit as text.

The drive letter is returned with a trailing colon.

@return The drive letter and a trailing colon.

@panic FSCLIENT 0 if RFs::DriveToChar() returned an error.
*/
	{
	TChar driveLetter;
	TInt r = RFs::DriveToChar(iDrive,driveLetter);
	__ASSERT_ALWAYS(r == KErrNone, Panic(EDriveUnitBadDrive));
	TDriveName driveName;
	driveName.SetLength(2);
	driveName[0]=(TText)driveLetter;
	driveName[1]=KDriveDelimiter;
	return driveName;
	}