home *** CD-ROM | disk | FTP | other *** search
- /* PedFile.cc */
-
- #include <Files.h>
- #include <Resources.h>
-
- #include "DGDebugging.h"
-
- #include "PedFSRef.hh"
- #include "PedFile.hh"
-
- PedFile::PedFile()
- : mRef(NULL)/*, mType('????'), mCreator('????')*/
- {
- }
-
- PedFile::PedFile(PedFSRef &inFSRef)
- : mRef(&inFSRef)/*, mType('????'), mCreator('????')*/
- {
- }
-
- PedFile::~PedFile()
- {
- }
-
- void
- PedFile::SetFSRef(PedFSRef &inRef)
- {
- if (mRef) {
- mRef->release();
- }
- mRef = &inRef;
- inRef.retain();
- }
-
- AccessPath
- PedFile::OpenData(SInt8 inPerm) const
- {
- OSErr err;
- AccessPath refNum;
- FSSpec spec;
-
- ThrowIfNULL_(mRef);
- spec = mRef->FSS();
-
- err = ::FSpOpenDF(&spec, inPerm, &refNum);
- ThrowIfOSErr_(err);
- return refNum;
- }
-
- AccessPath
- PedFile::OpenResFile(SInt8 inPerm) const
- {
- OSErr err;
- AccessPath refNum;
- FSSpec spec;
-
- ThrowIfNULL_(mRef);
- spec = mRef->FSS();
-
- refNum = ::FSpOpenResFile(&spec, inPerm);
- err = ::ResError();
- ThrowIfOSErr_(err);
- return refNum;
- }
-