Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Headers/Volume.h
/* |
File: Volume.h |
Contains: TVolume is a simple volume based utility class (provides information about volumes) |
TVolume.h contains the TVolume class definitions. |
Written by: Kent Sandvik |
Copyright: Copyright © 1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
8/18/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 |
*/ |
// Declare label for this header file |
#ifndef _VOLUME_ |
#define _VOLUME_ |
#ifndef _DTSCPLUSLIBRARY_ |
#include "DTSCPlusLibrary.h" |
#endif |
// TOOLBOX HEADER FILES |
#ifndef __FILES__ |
#include <Files.h> |
#endif |
#ifndef __TYPES__ |
#include <Types.h> |
#endif |
#ifndef __FOLDERS__ |
#include <Folders.h> |
#endif |
#ifndef __ERRORS__ |
#include <Errors.h> |
#endif |
// _________________________________________________________________________________________________________ // |
// TVolume Class Interface. |
class TVolume |
// TVolume will provide volume level information about mounted volumes. |
{ |
public: |
// CONSTRUCTORS AND DESTRUCTORS |
TVolume(); // default constructor |
TVolume(short refNum); // constructor that accepts a volume refnum |
virtual~ TVolume(); // default destructor |
// MAIN INTERFACE |
virtual short GetBootVRefNum(); // find out the VRefNum of the boot volume |
virtual long GetKFreeSpace(); // get amount of free space (Kb) on volume |
virtual long GetFileCount(); // return amount of files on volume |
virtual long GetDirCount(); // return amount of folders on volume |
virtual long GetCreationDate(); // return creation date of volume |
virtual short GetDriverNumber(); // get actual driver number |
virtual Boolean GetName(Str255& name); // get driver FSSpec |
virtual short GetNumVolumes(); // get # of mounted volumes |
// ITERATORS |
virtual void Reset(); // get back to boot volume |
virtual Boolean Last(); // last volume? |
virtual void Next(); // iterate to next volume |
// INTERNAL FUNCTIONS |
virtual Boolean GetHParamBlock(); // generate a lookup in a pre-defined param block |
// GET/SET FUNCTIONS |
virtual void SetVRefNum(const short refNum);// set used VRefNum |
virtual short GetVRefNum() const; // get currently used VRefNum |
// FIELDS |
protected: |
short fVRefNum; // the volume VRefNum |
HParamBlockRec fPB; // paramBlock rec used everywhere |
OSErr fError; // latest error |
short fIndex; // volume index |
Boolean fLast; // indicator if we have the last volume |
}; |
#endif |
// _________________________________________________________________________________________________________ // |
/* Change History (most recent last): |
No Init. Date Comment |
1 khs 1/5/93 New file |
2 khs 1/7/93 Cleanup |
*/ |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14